/// <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");
        }
예제 #2
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");
        }
 /// <summary>
 /// Creates a new instance of the <see cref="ApproximateDateTime"/>
 /// class with the specified date, time, and time zone.
 /// </summary>
 ///
 /// <param name="approximateDate">
 /// The approximation of the date.
 /// </param>
 ///
 /// <param name="approximateTime">
 /// The approximation of the time.
 /// </param>
 ///
 /// <param name="timeZone">
 /// The time zone of the approximate time.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="approximateDate"/> parameter is <b>null</b>.
 /// </exception>
 ///
 public ApproximateDateTime(
     ApproximateDate approximateDate,
     ApproximateTime approximateTime,
     CodableValue timeZone)
     : this(approximateDate, approximateTime)
 {
     _timeZone = timeZone;
 }
예제 #4
0
 /// <summary>
 /// Creates a new instance of the <see cref="HealthEvent"/> class
 /// specifying mandatory values.
 /// </summary>
 ///
 /// <remarks>
 /// This item is not added to the health record until the <see cref="IThingClient.CreateNewThingsAsync{ThingBase}(Guid, ICollection{ThingBase})"/> method is called.
 /// </remarks>
 ///
 /// <param name="when">
 /// The date and time the event occurred.
 /// </param>
 /// <param name="eventValue">
 /// The name of the health event.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/> is <b>null</b>.
 /// If <paramref name="eventValue"/> is <b>null</b>.
 /// </exception>
 ///
 public HealthEvent(
     ApproximateDateTime when,
     CodableValue eventValue)
     : base(TypeId)
 {
     When  = when;
     Event = eventValue;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="InsulinInjection"/> class
 /// with the specified insulin type and amount.
 /// </summary>
 ///
 /// <param name="insulinType">
 /// The type of insulin being used.
 /// </param>
 ///
 /// <param name="amount">
 /// The amount of insulin.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="amount"/> or <paramref name="insulinType"/> parameter
 /// is <b>null</b>.
 /// </exception>
 ///
 public InsulinInjection(
     CodableValue insulinType,
     InsulinInjectionMeasurement amount)
     : base(TypeId)
 {
     InsulinType = insulinType;
     Amount      = amount;
 }
 /// <summary>
 /// Creates an instance of <see cref="ExerciseSamples"/> with specified parameters.
 /// </summary>
 ///
 /// <param name="when">The date and time the samples were recorded.</param>
 /// <param name="name">The kind of information that is stored in this set of samples.</param>
 /// <param name="unit">The unit of measure for the samples.</param>
 /// <param name="samplingInterval">The time interval between samples in seconds.</param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/> is <b>null</b>.
 /// </exception>
 ///
 public ExerciseSamples(ApproximateDateTime when, CodableValue name, CodableValue unit, double samplingInterval)
     : base(TypeId)
 {
     When             = when;
     Name             = name;
     Unit             = unit;
     SamplingInterval = samplingInterval;
     Sections        |= ThingSections.BlobPayload;
 }
예제 #7
0
 /// <summary>
 /// Creates a new instance of the <see cref="Service"/> class specifying mandatory values.
 /// </summary>
 ///
 /// <remarks>
 /// This item is not added to the health record until the <see cref="IThingClient.CreateNewThingsAsync{ThingBase}(Guid, ICollection{ThingBase})"/> method is called.
 /// </remarks>
 ///
 /// <param name="serviceType">
 /// The type of the service.
 /// </param>
 /// <param name="serviceDates">
 /// The dates for this service.
 /// </param>
 /// <param name="claimAmounts">
 /// The financial information for this service.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="serviceType"/> is <b> null </b>.
 /// If <paramref name="serviceDates"/> is <b> null </b>.
 /// If <paramref name="claimAmounts"/> is <b> null </b>.
 /// </exception>
 ///
 public Service(
     CodableValue serviceType,
     DurationValue serviceDates,
     ClaimAmounts claimAmounts)
 {
     ServiceType  = serviceType;
     ServiceDates = serviceDates;
     ClaimAmounts = claimAmounts;
 }
        /// <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"));
        }
 /// <summary>
 /// Creates a new instance of the <see cref="HealthServiceDateTime"/>
 /// class with the specified date, time, and time zone.
 /// </summary>
 ///
 /// <param name="date">
 /// The date.
 /// </param>
 ///
 /// <param name="time">
 /// The approximate time.
 /// </param>
 ///
 /// <param name="timeZone">
 /// The optional time zone for the <paramref name="time"/>.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="date"/> parameter is <b>null</b>.
 /// </exception>
 ///
 public HealthServiceDateTime(
     HealthServiceDate date,
     ApproximateTime time,
     CodableValue timeZone)
 {
     Date     = date;
     Time     = time;
     TimeZone = timeZone;
 }
예제 #10
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>
 /// Creates an instance of information about the body composition of the record owner
 /// with specified time, measurement name, and value.
 /// </summary>
 ///
 /// <remarks>
 /// Examples: % body fat, lean muscle mass.
 /// </remarks>
 ///
 /// <param name="when">
 /// The date and time of the measurement.
 /// </param>
 ///
 /// <param name="measurementName">
 /// The name of the measurement.
 /// </param>
 ///
 /// <param name="compositionValue">
 /// The value of the measurement.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/>, <paramref name="measurementName"/> or
 /// <paramref name="compositionValue"/> is <b>null</b>.
 /// </exception>
 ///
 public BodyComposition(
     ApproximateDateTime when,
     CodableValue measurementName,
     BodyCompositionValue compositionValue)
     : base(TypeId)
 {
     When            = when;
     MeasurementName = measurementName;
     Value           = compositionValue;
 }
예제 #12
0
 /// <summary>
 /// Creates a new instance of the  <see cref="Name"/> class with the
 /// specified first, middle, and last name and suffix.
 /// </summary>
 ///
 /// <param name="fullName">
 /// The full name.
 /// </param>
 ///
 /// <param name="first">
 /// The first name (given name).
 /// </param>
 ///
 /// <param name="middle">
 /// The middle name.
 /// </param>
 ///
 /// <param name="last">
 /// The last name (surname).
 /// </param>
 ///
 /// <param name="suffix">
 /// The name suffix.
 /// </param>
 ///
 /// <exception cref="ArgumentException">
 /// The <paramref name="fullName"/> parameter is <b>null</b> or empty.
 /// </exception>
 ///
 public Name(
     string fullName,
     string first,
     string middle,
     string last,
     CodableValue suffix)
     : this(fullName, first, middle, last)
 {
     Suffix = suffix;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DailyMedicationUsage"/> class
 /// specifying the mandatory values.
 /// </summary>
 ///
 /// <param name="when">
 /// The date when the medication/supplement was consumed.
 /// </param>
 ///
 /// <param name="drugName">
 /// The name of the drug.
 /// </param>
 ///
 /// <param name="dosesConsumed">
 /// The number of doses consumed by the person.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="when"/> or <paramref name="drugName"/> parameter is <b>null</b>.
 /// </exception>
 ///
 public DailyMedicationUsage(
     HealthServiceDate when,
     CodableValue drugName,
     int dosesConsumed)
     : base(TypeId)
 {
     When          = when;
     DrugName      = drugName;
     DosesConsumed = dosesConsumed;
 }
        /// <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"));
        }
예제 #15
0
 /// <summary>
 /// Stores a body dimension.
 /// </summary>
 ///
 /// <remarks>
 /// Examples: Waist size, head circumference, length (pediatric).
 /// </remarks>
 ///
 /// <param name="when">
 /// The date and time of the body dimension measurement.
 /// </param>
 ///
 /// <param name="measurementName">
 /// The name of the body dimension measurement.
 /// </param>
 ///
 /// <param name="value">
 /// The value of the body dimension measurement.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/>, <paramref name="measurementName"/> or
 /// <paramref name="value"/> is <b>null</b>.
 /// </exception>
 ///
 public BodyDimension(
     ApproximateDateTime when,
     CodableValue measurementName,
     Length value)
     : base(TypeId)
 {
     When            = when;
     MeasurementName = measurementName;
     Value           = value;
 }
 /// <summary>
 /// Constructs the new blood glucose thing instance
 /// specifying the mandatory values.
 /// </summary>
 ///
 /// <param name="when">
 /// The date/time when the blood glucose reading was take.
 /// </param>
 ///
 /// <param name="value">
 /// The blood glucose value of the reading.
 /// </param>
 ///
 /// <param name="glucoseMeasurementType">
 /// How the glucose was measured; whole blood, plasma, etc.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="when"/> parameter is <b>null</b>.
 /// </exception>
 ///
 public BloodGlucose(
     HealthServiceDateTime when,
     BloodGlucoseMeasurement value,
     CodableValue glucoseMeasurementType)
     : base(TypeId)
 {
     When  = when;
     Value = value;
     GlucoseMeasurementType = glucoseMeasurementType;
 }
예제 #17
0
 /// <summary>
 /// Constructs an instance of suggested calorie intake guideline with specified values.
 /// </summary>
 ///
 /// <remarks>
 /// Examples: Daily calories suggested for weight loss, calories needed for weight
 /// maintenance, BMR.
 /// </remarks>
 ///
 /// <param name="when">
 /// The date and time the guidelines were created.
 /// </param>
 ///
 /// <param name="name">
 /// The name defines the guideline.
 /// </param>
 ///
 /// <param name="calories">
 /// The number of calories to support the guideline.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/>, <paramref name="name"/> or <paramref name="calories"/>
 /// is <b>null</b>.
 /// </exception>
 ///
 public CalorieGuideline(
     ApproximateDateTime when,
     CodableValue name,
     GeneralMeasurement calories)
     : base(TypeId)
 {
     When     = when;
     Name     = name;
     Calories = calories;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="InsulinInjectionUse"/> class
 /// with the specified date/time, insulin type, and amount.
 /// </summary>
 ///
 /// <param name="when">
 /// The date/time when the injection was administrated.
 /// </param>
 ///
 /// <param name="insulinType">
 /// The type of insulin being used.
 /// </param>
 ///
 /// <param name="amount">
 /// The amount of insulin.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="when"/>,
 /// <paramref name="amount"/>, or <paramref name="insulinType"/> parameter
 /// is <b>null</b>.
 /// </exception>
 ///
 public InsulinInjectionUse(
     HealthServiceDateTime when,
     CodableValue insulinType,
     InsulinInjectionMeasurement amount)
     : base(TypeId)
 {
     When        = when;
     InsulinType = insulinType;
     Amount      = amount;
 }
        /// <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"));
            }
        }
        /// <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);
                }
            }
        }
        /// <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");
        }
예제 #22
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");
        }
        /// <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");
        }
예제 #24
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");
        }
예제 #25
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");
        }
예제 #26
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");
        }
        /// <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");
        }
예제 #28
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");
        }
예제 #29
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");
        }
예제 #30
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);
            }
        }