コード例 #1
0
        /// <summary>
        /// Populates this <see cref="AllergicEpisode"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the allergic episode data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an allergic-episode node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            _name.Clear();
            XPathNavigator allergyNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("allergic-episode");

            Validator.ThrowInvalidIfNull(allergyNav, Resources.AllergicEpisodeUnexpectedNode);

            _when = new HealthServiceDateTime();
            _when.ParseXml(allergyNav.SelectSingleNode("when"));
            _name.ParseXml(allergyNav.SelectSingleNode("name"));

            XPathNavigator reactionNav =
                allergyNav.SelectSingleNode("reaction");

            if (reactionNav != null)
            {
                _reaction = new CodableValue();
                _reaction.ParseXml(reactionNav);
            }

            XPathNavigator treatmentNav =
                allergyNav.SelectSingleNode("treatment");

            if (treatmentNav != null)
            {
                _treatment = new CodableValue();
                _treatment.ParseXml(treatmentNav);
            }
        }
コード例 #2
0
        /// <summary>
        /// Populates this <see cref="BodyComposition"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the body composition data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a "body-composition" node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("body-composition");

            Validator.ThrowInvalidIfNull(itemNav, Resources.BodyCompositionUnexpectedNode);

            // when (approxi-date-time, mandatory)
            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // measurement-name (codable-value, mandatory)
            _measurementName = new CodableValue();
            _measurementName.ParseXml(itemNav.SelectSingleNode("measurement-name"));

            // value (BodyCompositionValue, mandatory)
            _value = new BodyCompositionValue();
            _value.ParseXml(itemNav.SelectSingleNode("value"));

            // measurement-method (codable value )
            _measurementMethod =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "measurement-method");

            // site
            _site =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "site");
        }
コード例 #3
0
        /// <summary>
        /// Populates this <see cref="LabTestResultValue"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the lab test result value type data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If the first node in <paramref name="navigator"/> is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // measurement
            _measurement = new GeneralMeasurement();
            _measurement.ParseXml(navigator.SelectSingleNode("measurement"));

            // ranges
            XPathNodeIterator rangesIterator = navigator.Select("ranges");

            _ranges = new Collection <TestResultRange>();
            foreach (XPathNavigator rangeNav in rangesIterator)
            {
                TestResultRange range = new TestResultRange();
                range.ParseXml(rangeNav);
                _ranges.Add(range);
            }

            // flag
            XPathNodeIterator flagsIterator = navigator.Select("flag");

            _flag = new Collection <CodableValue>();
            foreach (XPathNavigator flagNav in flagsIterator)
            {
                CodableValue singleflag = new CodableValue();
                singleflag.ParseXml(flagNav);
                _flag.Add(singleflag);
            }
        }
        /// <summary>
        /// Populates the data for the date and time from the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML node representing the date and time.
        /// </param>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _date = new HealthServiceDate();
            _date.ParseXml(navigator.SelectSingleNode("date"));

            XPathNavigator timeNav = navigator.SelectSingleNode("time");

            if (timeNav != null)
            {
                _time = new ApproximateTime();
                _time.ParseXml(timeNav);
            }
            else
            {
                _time = null;
            }

            XPathNavigator tzNav =
                navigator.SelectSingleNode("tz");

            if (tzNav != null)
            {
                _timeZone = new CodableValue();
                _timeZone.ParseXml(tzNav);
            }
        }
コード例 #5
0
        /// <summary>
        /// Populates this <see cref="Condition"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the condition data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> is <b> null </b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // name
            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));

            // onset-date
            _onsetDate =
                XPathHelper.GetOptNavValue <ApproximateDate>(navigator, "onset-date");

            // resolution-date
            _resolutionDate =
                XPathHelper.GetOptNavValue <ApproximateDate>(navigator, "resolution-date");

            // resolution
            if (navigator.SelectSingleNode("resolution") != null)
            {
                _resolution = navigator.SelectSingleNode("resolution").Value;
            }

            // occurrence
            _occurrence =
                XPathHelper.GetOptNavValue <CodableValue>(navigator, "occurrence");

            // severity
            _severity =
                XPathHelper.GetOptNavValue <CodableValue>(navigator, "severity");
        }
        /// <summary>
        /// Populates this <see cref="InsulinInjectionUse"/> instance from the
        /// data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the insulin injection use data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an insulin-injection-use node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "diabetes-insulin-injection-use");

            Validator.ThrowInvalidIfNull(itemNav, Resources.InsulinInjectionUseUnexpectedNode);

            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            _insulinType = new CodableValue();
            _insulinType.ParseXml(itemNav.SelectSingleNode("type"));

            _amount = new InsulinInjectionMeasurement();
            _amount.ParseXml(itemNav.SelectSingleNode("amount"));

            XPathNavigator deviceIdNav =
                itemNav.SelectSingleNode("device-id");

            if (deviceIdNav != null)
            {
                _deviceId = deviceIdNav.Value;
            }
        }
コード例 #7
0
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML containing the delivery.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _location       = XPathHelper.GetOptNavValue <Organization>(navigator, "location");
            _timeOfDelivery = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "time-of-delivery");
            _laborDuration  = XPathHelper.GetOptNavValueAsDouble(navigator, "labor-duration");

            _complications.Clear();
            foreach (XPathNavigator complicationNav in navigator.Select("complications"))
            {
                CodableValue complication = new CodableValue();
                complication.ParseXml(complicationNav);
                _complications.Add(complication);
            }

            _anesthesia.Clear();
            foreach (XPathNavigator anesthesiaNav in navigator.Select("anesthesia"))
            {
                CodableValue anesthesia = new CodableValue();
                anesthesia.ParseXml(anesthesiaNav);
                _anesthesia.Add(anesthesia);
            }

            _deliveryMethod = XPathHelper.GetOptNavValue <CodableValue>(navigator, "delivery-method");
            _outcome        = XPathHelper.GetOptNavValue <CodableValue>(navigator, "outcome");
            _baby           = XPathHelper.GetOptNavValue <Baby>(navigator, "baby");
            _note           = XPathHelper.GetOptNavValue(navigator, "note");
        }
コード例 #8
0
        /// <summary>
        /// Populates this health assessment instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the health assessment data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a health-assessment node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("health-assessment");

            Validator.ThrowInvalidIfNull(itemNav, Resources.HealthAssessmentUnexpectedNode);

            // <when>
            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // <name>
            _name = itemNav.SelectSingleNode("name").Value;

            // <category>
            _category = new CodableValue();
            _category.ParseXml(itemNav.SelectSingleNode("category"));

            // <result>
            _result.Clear();
            XPathNodeIterator resultIterator = itemNav.Select("result");

            foreach (XPathNavigator resultNav in resultIterator)
            {
                Assessment result = new Assessment();
                result.ParseXml(resultNav);
                _result.Add(result);
            }
        }
コード例 #9
0
        /// <summary>
        /// Populates this <see cref="DietaryIntake"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the DietaryIntake data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a MealDefinition node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            if (typeSpecificXml == null)
            {
                throw new ArgumentNullException(
                          "typeSpecificXml",
                          Resources.ParseXmlNavNull);
            }

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("meal-definition");

            if (itemNav == null)
            {
                throw new InvalidOperationException(
                          Resources.MealDefinitionUnexpectedNode);
            }

            _name = new CodableValue();
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            _mealType = new CodableValue();
            _mealType = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "meal-type");

            XPathNavigator descriptionValueNav = itemNav.SelectSingleNode("description");

            if (descriptionValueNav != null)
            {
                _description = descriptionValueNav.Value;
            }

            _dietaryIntakeItems = XPathHelper.ParseXmlCollection <DietaryIntakeItem>(itemNav, "dietary-items/dietary-item");
        }
コード例 #10
0
        /// <summary>
        /// Populates the data for the lab test type from the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML node representing the lab test type.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _when = new HealthServiceDateTime();
            _when.ParseXml(navigator.SelectSingleNode("when"));

            _name      = XPathHelper.GetOptNavValue(navigator, "name");
            _substance = XPathHelper.GetOptNavValue <CodableValue>(navigator, "substance");

            _collectionMethod =
                XPathHelper.GetOptNavValue <CodableValue>(
                    navigator,
                    "collection-method");

            _abbreviation = XPathHelper.GetOptNavValue(navigator, "abbreviation");
            _description  = XPathHelper.GetOptNavValue(navigator, "description");

            _code.Clear();
            XPathNodeIterator codeIterator = navigator.Select("code");

            foreach (XPathNavigator codeNav in codeIterator)
            {
                CodableValue codeValue = new CodableValue();
                codeValue.ParseXml(codeNav);
                _code.Add(codeValue);
            }

            _result = XPathHelper.GetOptNavValue <LabResultType>(navigator, "result");
            _status = XPathHelper.GetOptNavValue <CodableValue>(navigator, "status");
        }
コード例 #11
0
        /// <summary>
        /// Populates this medication fill instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the medication fill data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a medication-fill node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("medication-fill");

            Validator.ThrowInvalidIfNull(itemNav, Resources.MedicationFillUnexpectedNode);

            _name = new CodableValue();
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            _dateFilled =
                XPathHelper.GetOptNavValue <ApproximateDateTime>(itemNav, "date-filled");

            _daysSupply =
                XPathHelper.GetOptNavValueAsInt(itemNav, "days-supply");

            _nextRefillDate =
                XPathHelper.GetOptNavValue <HealthServiceDate>(itemNav, "next-refill-date");

            _refillsLeft =
                XPathHelper.GetOptNavValueAsInt(itemNav, "refills-left");

            _pharmacy =
                XPathHelper.GetOptNavValue <Organization>(itemNav, "pharmacy");

            _prescriptionNumber =
                XPathHelper.GetOptNavValue(itemNav, "prescription-number");

            _lotNumber =
                XPathHelper.GetOptNavValue(itemNav, "lot-number");
        }
        /// <summary>
        /// Populates this <see cref="DailyMedicationUsage"/> instance from the
        /// data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the medication usage data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a <see cref="DailyMedicationUsage"/> node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "daily-medication-usage");

            Validator.ThrowInvalidIfNull(itemNav, Resources.DailyMedicationUsageUnexpectedNode);

            _when = new HealthServiceDate();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            _drugName = new CodableValue();
            _drugName.ParseXml(itemNav.SelectSingleNode("drug-name"));

            _dosesConsumed =
                itemNav.SelectSingleNode("number-doses-consumed-in-day").ValueAsInt;

            _purposeOfUse =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "purpose-of-use");

            _intendedDoses =
                XPathHelper.GetOptNavValueAsInt(itemNav, "number-doses-intended-in-day");

            _usageSchedule =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "medication-usage-schedule");

            _drugForm =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "drug-form");

            _prescriptionType =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "prescription-type");

            _singleDoseDescription =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "single-dose-description");
        }
        /// <summary>
        /// Populates this <see cref="StructuredMeasurement"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the structured measurement data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The first node in <paramref name="navigator"/> is not
        /// a structured measurement node.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _value = navigator.SelectSingleNode("value").ValueAsDouble;

            _units = new CodableValue();
            _units.ParseXml(navigator.SelectSingleNode("units"));
        }
コード例 #14
0
        /// <summary>
        /// Populates this <see cref="CarePlanGoalGroup"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the CarePlanGoalGroup data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));
            _description = XPathHelper.GetOptNavValue(navigator, "description");
            _goals       = XPathHelper.ParseXmlCollection <CarePlanGoal>(navigator, "goals/goal");
        }
        /// <summary>
        /// Populates this <see cref="DefibrillatorEpisodeField"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the DefibrillatorEpisodeField data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("field-name"));

            _value = new CodableValue();
            _value.ParseXml(navigator.SelectSingleNode("field-value"));
        }
コード例 #16
0
        /// <summary>
        /// Populates this Person instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML containing the goal information.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="navigator"/> is not
        /// a person node.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // <name>
            _name = new Name();
            _name.ParseXml(navigator.SelectSingleNode("name"));

            // <organization>
            XPathNavigator orgNav =
                navigator.SelectSingleNode("organization");

            if (orgNav != null)
            {
                _organization = orgNav.Value;
            }

            // <professional-training>
            XPathNavigator professionalTrainingNav =
                navigator.SelectSingleNode("professional-training");

            if (professionalTrainingNav != null)
            {
                _professionalTraining = professionalTrainingNav.Value;
            }

            // <id>
            XPathNavigator idNav =
                navigator.SelectSingleNode("id");

            if (idNav != null)
            {
                _id = idNav.Value;
            }

            // <contact>
            XPathNavigator contactNav =
                navigator.SelectSingleNode("contact");

            if (contactNav != null)
            {
                _contactInfo = new ContactInfo();
                _contactInfo.ParseXml(contactNav);
            }

            // <type>
            XPathNavigator typeNav =
                navigator.SelectSingleNode("type");

            if (typeNav != null)
            {
                _personType = new CodableValue();
                _personType.ParseXml(navigator.SelectSingleNode("type"));
            }
        }
コード例 #17
0
        /// <summary>
        /// Populates this <see cref="DietaryIntakeItem"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the DietaryIntake data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the node identified by the <paramref name="navigator"/> is not a DietaryIntake node.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _foodItem = new CodableValue();
            _foodItem.ParseXml(navigator.SelectSingleNode("food-item"));
            _servingSize        = XPathHelper.GetOptNavValue <CodableValue>(navigator, "serving-size");
            _servingsConsumed   = XPathHelper.GetOptNavValueAsDouble(navigator, "servings-consumed");
            _meal               = XPathHelper.GetOptNavValue <CodableValue>(navigator, "meal");
            _when               = XPathHelper.GetOptNavValue <HealthServiceDateTime>(navigator, "when");
            _energy             = XPathHelper.GetOptNavValue <FoodEnergyValue>(navigator, "energy");
            _energyFromFat      = XPathHelper.GetOptNavValue <FoodEnergyValue>(navigator, "energy-from-fat");
            _totalFat           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "total-fat");
            _saturatedFat       = XPathHelper.GetOptNavValue <WeightValue>(navigator, "saturated-fat");
            _transFat           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "trans-fat");
            _monounsaturatedFat = XPathHelper.GetOptNavValue <WeightValue>(navigator, "monounsaturated-fat");
            _polyunsaturatedFat = XPathHelper.GetOptNavValue <WeightValue>(navigator, "polyunsaturated-fat");
            _protein            = XPathHelper.GetOptNavValue <WeightValue>(navigator, "protein");
            _carbohydrates      = XPathHelper.GetOptNavValue <WeightValue>(navigator, "carbohydrates");
            _dietaryFiber       = XPathHelper.GetOptNavValue <WeightValue>(navigator, "dietary-fiber");
            _sugars             = XPathHelper.GetOptNavValue <WeightValue>(navigator, "sugars");
            _sodium             = XPathHelper.GetOptNavValue <WeightValue>(navigator, "sodium");
            _cholesterol        = XPathHelper.GetOptNavValue <WeightValue>(navigator, "cholesterol");
            _calcium            = XPathHelper.GetOptNavValue <WeightValue>(navigator, "calcium");
            _iron               = XPathHelper.GetOptNavValue <WeightValue>(navigator, "iron");
            _magnesium          = XPathHelper.GetOptNavValue <WeightValue>(navigator, "magnesium");
            _phosphorus         = XPathHelper.GetOptNavValue <WeightValue>(navigator, "phosphorus");
            _potassium          = XPathHelper.GetOptNavValue <WeightValue>(navigator, "potassium");
            _zinc               = XPathHelper.GetOptNavValue <WeightValue>(navigator, "zinc");
            _vitaminARAE        = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-A-RAE");
            _vitaminE           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-E");
            _vitaminD           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-D");
            _vitaminC           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-C");
            _thiamin            = XPathHelper.GetOptNavValue <WeightValue>(navigator, "thiamin");
            _riboflavin         = XPathHelper.GetOptNavValue <WeightValue>(navigator, "riboflavin");
            _niacin             = XPathHelper.GetOptNavValue <WeightValue>(navigator, "niacin");
            _vitaminB6          = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-B-6");
            _folateDFE          = XPathHelper.GetOptNavValue <WeightValue>(navigator, "folate-DFE");
            _vitaminB12         = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-B-12");
            _vitaminK           = XPathHelper.GetOptNavValue <WeightValue>(navigator, "vitamin-K");

            _additionalNutritionFacts.Clear();
            XPathNavigator additionalFactsNav = navigator.SelectSingleNode("additional-nutrition-facts");

            if (additionalFactsNav != null)
            {
                foreach (XPathNavigator nav in additionalFactsNav.Select("nutrition-fact"))
                {
                    NutritionFact nutritionFact = new NutritionFact();
                    nutritionFact.ParseXml(nav);
                    _additionalNutritionFacts.Add(nutritionFact);
                }
            }
        }
コード例 #18
0
        /// <summary>
        /// Populates this <see cref="NutritionFact"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the NutritionFact data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException(
                          "navigator",
                          Resources.ParseXmlNavNull);
            }

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));
            _fact = XPathHelper.GetOptNavValue <GeneralMeasurement>(navigator, "fact");
        }
コード例 #19
0
        /// <summary>
        /// Populates this <see cref="Status"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the status data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a status node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("status");

            Validator.ThrowInvalidIfNull(itemNav, Resources.StatusUnexpectedNode);

            _statusType = new CodableValue();
            _statusType.ParseXml(itemNav.SelectSingleNode("status-type"));

            _text =
                XPathHelper.GetOptNavValue(itemNav, "text");
        }
コード例 #20
0
        /// <summary>
        /// Populates this BloodGlucose instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the blood glucose data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a blood-glucose node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator bgNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "blood-glucose");

            Validator.ThrowInvalidIfNull(bgNav, Resources.BGUnexpectedNode);

            _when = new HealthServiceDateTime();
            _when.ParseXml(bgNav.SelectSingleNode("when"));

            _value = new BloodGlucoseMeasurement();
            _value.ParseXml(bgNav.SelectSingleNode("value"));

            _glucoseMeasurementType = new CodableValue();
            _glucoseMeasurementType.ParseXml(
                bgNav.SelectSingleNode("glucose-measurement-type"));

            _outsideOperatingTemp =
                XPathHelper.GetOptNavValueAsBool(
                    bgNav,
                    "outside-operating-temp");

            _isControlTest =
                XPathHelper.GetOptNavValueAsBool(
                    bgNav,
                    "is-control-test");

            XPathNavigator normalcyNav =
                bgNav.SelectSingleNode("normalcy");

            if (normalcyNav != null)
            {
                _normalcyValue = normalcyNav.ValueAsInt;
                if (_normalcyValue < (int)Normalcy.WellBelowNormal ||
                    _normalcyValue > (int)Normalcy.WellAboveNormal)
                {
                    _normalcy = Normalcy.Unknown;
                }
                else
                {
                    _normalcy = (Normalcy)_normalcyValue;
                }
            }

            _measurementContext =
                XPathHelper.GetOptNavValue <CodableValue>(
                    bgNav,
                    "measurement-context");
        }
コード例 #21
0
        /// <summary>
        /// Populates this <see cref="Assessment"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the assessment data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> is <b> null </b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // <name>
            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));

            // <value>
            _value = new CodableValue();
            _value.ParseXml(navigator.SelectSingleNode("value"));

            // <group>
            _group = XPathHelper.GetOptNavValue <CodableValue>(navigator, "group");
        }
コード例 #22
0
        /// <summary>
        /// Populates this <see cref="GoalRange"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the GoalRange data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException(
                          nameof(navigator),
                          Resources.ParseXmlNavNull);
            }

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));
            _description = XPathHelper.GetOptNavValue(navigator, "description");
            _minimum     = XPathHelper.GetOptNavValue <GeneralMeasurement>(navigator, "minimum");
            _maximum     = XPathHelper.GetOptNavValue <GeneralMeasurement>(navigator, "maximum");
        }
コード例 #23
0
        /// <summary>
        /// Populates this <see cref="CarePlanTask"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the CarePlanTask data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));
            _description            = XPathHelper.GetOptNavValue(navigator, "description");
            _startDate              = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "start-date");
            _endDate                = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "end-date");
            _targetCompletionDate   = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "target-completion-date");
            _sequenceNumber         = XPathHelper.GetOptNavValueAsInt(navigator, "sequence-number");
            _taskAssociatedTypeInfo = XPathHelper.GetOptNavValue <AssociatedTypeInfo>(navigator, "associated-type-info");
            _recurrence             = XPathHelper.GetOptNavValue <CarePlanTaskRecurrence>(navigator, "recurrence");
            _referenceId            = XPathHelper.GetOptNavValue(navigator, "reference-id");
        }
コード例 #24
0
        /// <summary>
        /// Populates this <see cref="HealthEvent"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the HealthEvent data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a HealthEvent node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            Validator.ThrowIfArgumentNull(typeSpecificXml, nameof(typeSpecificXml), Resources.ParseXmlNavNull);

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("health-event");

            Validator.ThrowInvalidIfNull(itemNav, Resources.HealthEventUnexpectedNode);

            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));
            _event = new CodableValue();
            _event.ParseXml(itemNav.SelectSingleNode("event"));
            _category = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "category");
        }
コード例 #25
0
        /// <summary>
        /// Populates this <see cref="Concern"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the concern data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a concern node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("concern");

            Validator.ThrowInvalidIfNull(itemNav, Resources.ConcernUnexpectedNode);

            // description
            _description = new CodableValue();
            _description.ParseXml(itemNav.SelectSingleNode("description"));

            // status
            _status =
                XPathHelper.GetOptNavValue <CodableValue>(itemNav, "status");
        }
コード例 #26
0
        /// <summary>
        /// Populates this <see cref="TestResultRange"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the test result range data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The first node in <paramref name="navigator"/> is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // type
            _rangeType = new CodableValue();
            _rangeType.ParseXml(navigator.SelectSingleNode("type"));

            // text
            _text = new CodableValue();
            _text.ParseXml(navigator.SelectSingleNode("text"));

            // value
            _value = XPathHelper.GetOptNavValue <TestResultRangeValue>(navigator, "value");
        }
コード例 #27
0
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML containing the name information.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _full = navigator.SelectSingleNode("full").Value;

            XPathNavigator titleNav =
                navigator.SelectSingleNode("title");

            if (titleNav != null)
            {
                _title = new CodableValue();
                _title.ParseXml(titleNav);
            }

            XPathNavigator firstNav =
                navigator.SelectSingleNode("first");

            if (firstNav != null)
            {
                _first = firstNav.Value;
            }

            XPathNavigator middleNav =
                navigator.SelectSingleNode("middle");

            if (middleNav != null)
            {
                _middle = middleNav.Value;
            }

            XPathNavigator lastNav =
                navigator.SelectSingleNode("last");

            if (lastNav != null)
            {
                _last = lastNav.Value;
            }

            XPathNavigator suffixNav =
                navigator.SelectSingleNode("suffix");

            if (suffixNav != null)
            {
                _suffix = new CodableValue();
                _suffix.ParseXml(suffixNav);
            }
        }
コード例 #28
0
        /// <summary>
        /// Populates this <see cref="GoalRecurrence"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the GoalRecurrence data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException(
                          nameof(navigator),
                          Resources.ParseXmlNavNull);
            }

            _interval = new CodableValue();
            _interval.ParseXml(navigator.SelectSingleNode("interval"));
            int?timesInInterval = XPathHelper.GetOptNavValueAsInt(navigator, "times-in-interval");

            Validator.ThrowInvalidIfNull(timesInInterval, Resources.TimesInIntervalNull);
            timesInInterval = timesInInterval.Value;
        }
コード例 #29
0
        /// <summary>
        /// Populates this <see cref="Condition"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the condition data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a condition node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            _name.Clear();
            XPathNavigator conditionNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("condition");

            Validator.ThrowInvalidIfNull(conditionNav, Resources.ConditionUnexpectedNode);

            _name.ParseXml(conditionNav.SelectSingleNode("name"));

            XPathNavigator onsetNav =
                conditionNav.SelectSingleNode("onset-date");

            if (onsetNav != null)
            {
                _onsetDate = new ApproximateDateTime();
                _onsetDate.ParseXml(onsetNav);
            }

            XPathNavigator statusNav =
                conditionNav.SelectSingleNode("status");

            if (statusNav != null)
            {
                _status = new CodableValue();
                _status.ParseXml(statusNav);
            }

            XPathNavigator stopDateNav =
                conditionNav.SelectSingleNode("stop-date");

            if (stopDateNav != null)
            {
                _stopDate = new ApproximateDateTime();
                _stopDate.ParseXml(stopDateNav);
            }

            XPathNavigator stopReasonNav =
                conditionNav.SelectSingleNode("stop-reason");

            if (stopReasonNav != null)
            {
                _stopReason = stopReasonNav.Value;
            }
        }
コード例 #30
0
        /// <summary>
        /// Populates this <see cref="CalorieGuideline"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the calorie guideline data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a "calorie-guideline" node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("calorie-guideline");

            Validator.ThrowInvalidIfNull(itemNav, Resources.CalorieGuidelineUnexpectedNode);

            // when (approxi-date-time, mandatory)
            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // measurement-name (codable-value, mandatory)
            _name = new CodableValue();
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            // calories (general-measurement, mandatory)
            _calories = new GeneralMeasurement();
            _calories.ParseXml(itemNav.SelectSingleNode("calories"));
        }