Exemplo n.º 1
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");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Populates this <see cref="CarePlanGoalRange"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the CarePlanGoalRange 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);

            _statusIndicator = XPathHelper.GetOptNavValueAsInt(navigator, "status-indicator").Value;
            _minimumValue    = XPathHelper.GetOptNavValueAsDouble(navigator, "minimum-value");
            _maximumValue    = XPathHelper.GetOptNavValueAsDouble(navigator, "maximum-value");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Populates this <see cref="CarePlanTaskRecurrence"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the CarePlanTaskRecurrence 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);

            _icalRecurrence  = XPathHelper.GetOptNavValue(navigator, "ical-recurrence");
            _interval        = XPathHelper.GetOptNavValue <CodableValue>(navigator, "interval");
            _timesInInterval = XPathHelper.GetOptNavValueAsInt(navigator, "times-in-interval");
        }
        /// <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");
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Populates this <see cref="CholesterolProfile"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the cholesterol profile data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a cholesterol-profile node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "cholesterol-profile");

            Validator.ThrowInvalidIfNull(itemNav, Resources.CholesterolProfileUnexpectedNode);

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

            _ldl = XPathHelper.GetOptNavValueAsInt(itemNav, "ldl");

            _hdl = XPathHelper.GetOptNavValueAsInt(itemNav, "hdl");

            _totalCholesterol = XPathHelper.GetOptNavValueAsInt(itemNav, "total-cholesterol");

            _triglyceride = XPathHelper.GetOptNavValueAsInt(itemNav, "triglyceride");
        }
        /// <summary>
        /// Information related to a pregnancy.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the pregnancy data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a pregnancy node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("pregnancy");

            Validator.ThrowInvalidIfNull(itemNav, Resources.PregnancyUnexpectedNode);

            _dueDate = XPathHelper.GetOptNavValue<ApproximateDate>(itemNav, "due-date");
            _lastMenstrualPeriod = XPathHelper.GetOptNavValue<HealthServiceDate>(itemNav, "last-menstrual-period");
            _conceptionMethod = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "conception-method");
            _fetusCount = XPathHelper.GetOptNavValueAsInt(itemNav, "fetus-count");
            _gestationalAge = XPathHelper.GetOptNavValueAsInt(itemNav, "gestational-age");

            _delivery.Clear();
            foreach (XPathNavigator deliveryNav in itemNav.Select("delivery"))
            {
                Delivery delivery = new Delivery();
                delivery.ParseXml(deliveryNav);
                _delivery.Add(delivery);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Populates this health problem instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the health problem data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a health problem node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("problem");

            Validator.ThrowInvalidIfNull(itemNav, Resources.ProblemUnexpectedNode);

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

            // <diagnosis>
            XPathNodeIterator diagnosisIterator =
                itemNav.Select("diagnosis");

            _diagnosis.Clear();
            foreach (XPathNavigator diagnosisNav in diagnosisIterator)
            {
                CodableValue value = new CodableValue();
                value.ParseXml(diagnosisNav);
                _diagnosis.Add(value);
            }

            // <duration>
            XPathNodeIterator durationIterator =
                itemNav.Select("duration");

            _duration.Clear();
            foreach (XPathNavigator durationNav in durationIterator)
            {
                DurationValue value = new DurationValue();
                value.ParseXml(durationNav);
                _duration.Add(value);
            }

            // <importance>
            _importance =
                XPathHelper.GetOptNavValueAsInt(
                    itemNav,
                    "importance");
        }
Exemplo n.º 10
0
        /// <summary>
        /// Populates this Prescription instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML containing the prescription information.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node indicated by <paramref name="navigator"/> is not a prescription node.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // <prescribed-by>
            _prescribedBy = new PersonItem();
            _prescribedBy.ParseXml(navigator.SelectSingleNode("prescribed-by"));

            // <date-prescribed>
            _datePrescribed =
                XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "date-prescribed");

            // <amount-prescribed>
            _amountPrescribed =
                XPathHelper.GetOptNavValue <GeneralMeasurement>(navigator, "amount-prescribed");

            // <substitution>
            _substitution =
                XPathHelper.GetOptNavValue <CodableValue>(navigator, "substitution");

            // <refills>
            _refills =
                XPathHelper.GetOptNavValueAsInt(navigator, "refills");

            // <days-supply>
            _daysSupply =
                XPathHelper.GetOptNavValueAsInt(navigator, "days-supply");

            // <prescription-expiration>
            _expiration =
                XPathHelper.GetOptNavValue <HealthServiceDate>(navigator, "prescription-expiration");

            // <instructions>
            _instructions =
                XPathHelper.GetOptNavValue <CodableValue>(navigator, "instructions");
        }
        /// <summary>
        /// Populates the data for the length from the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML node representing the length.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            XPathNavigator modeNav =
                navigator.SelectSingleNode("mode");

            _mode.Clear();
            if (modeNav != null)
            {
                _mode.ParseXml(modeNav);
            }

            XPathNavigator distanceNav =
                navigator.SelectSingleNode("distance");

            if (distanceNav != null)
            {
                _distance = new Length();
                _distance.ParseXml(distanceNav);
            }

            _minutes =
                XPathHelper.GetOptNavValueAsDouble(navigator, "minutes");

            int?currentIntensity =
                XPathHelper.GetOptNavValueAsInt(navigator, "intensity");

            if (currentIntensity != null)
            {
                _intensity = (RelativeRating)(int)currentIntensity;
            }

            _peakHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "peak-heartrate");

            _averageHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "avg-heartrate");

            _minHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "min-heartrate");

            _energy =
                XPathHelper.GetOptNavValueAsDouble(navigator, "energy");

            _energyFromFat =
                XPathHelper.GetOptNavValueAsDouble(navigator, "energy-from-fat");

            _peakSpeed =
                XPathHelper.GetOptNavValue <SpeedMeasurement>(
                    navigator,
                    "peak-speed");

            _averageSpeed =
                XPathHelper.GetOptNavValue <SpeedMeasurement>(
                    navigator,
                    "avg-speed");

            _minSpeed =
                XPathHelper.GetOptNavValue <SpeedMeasurement>(
                    navigator,
                    "min-speed");

            _peakPace =
                XPathHelper.GetOptNavValue <PaceMeasurement>(
                    navigator,
                    "peak-pace");

            _averagePace =
                XPathHelper.GetOptNavValue <PaceMeasurement>(
                    navigator,
                    "avg-pace");

            _minPace =
                XPathHelper.GetOptNavValue <PaceMeasurement>(
                    navigator,
                    "min-pace");

            _peakPower =
                XPathHelper.GetOptNavValue <PowerMeasurement>(
                    navigator,
                    "peak-power");

            _averagePower =
                XPathHelper.GetOptNavValue <PowerMeasurement>(
                    navigator,
                    "avg-power");

            _minPower =
                XPathHelper.GetOptNavValue <PowerMeasurement>(
                    navigator,
                    "min-power");

            _peakTorque =
                XPathHelper.GetOptNavValue <TorqueMeasurement>(
                    navigator,
                    "peak-torque");

            _averageTorque =
                XPathHelper.GetOptNavValue <TorqueMeasurement>(
                    navigator,
                    "avg-torque");

            _minTorque =
                XPathHelper.GetOptNavValue <TorqueMeasurement>(
                    navigator,
                    "min-torque");

            _leftRightBalance =
                XPathHelper.GetOptNavValueAsDouble(
                    navigator,
                    "left-right-balance");

            _peakCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "peak-cadence");

            _averageCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "avg-cadence");

            _minCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "min-cadence");

            _peakTemperature =
                XPathHelper.GetOptNavValue <TemperatureMeasurement>(
                    navigator,
                    "peak-temperature");

            _averageTemperature =
                XPathHelper.GetOptNavValue <TemperatureMeasurement>(
                    navigator,
                    "avg-temperature");

            _minTemperature =
                XPathHelper.GetOptNavValue <TemperatureMeasurement>(
                    navigator,
                    "min-temperature");

            _peakAltitude =
                XPathHelper.GetOptNavValue <AltitudeMeasurement>(
                    navigator,
                    "peak-altitude");

            _averageAltitude =
                XPathHelper.GetOptNavValue <AltitudeMeasurement>(
                    navigator,
                    "avg-altitude");

            _minAltitude =
                XPathHelper.GetOptNavValue <AltitudeMeasurement>(
                    navigator,
                    "min-altitude");

            _elevationGain =
                XPathHelper.GetOptNavValue <Length>(
                    navigator,
                    "elevation-gain");

            _elevationLoss =
                XPathHelper.GetOptNavValue <Length>(
                    navigator,
                    "elevation-loss");

            _numberOfSteps =
                XPathHelper.GetOptNavValueAsInt(
                    navigator,
                    "number-of-steps");

            _numberOfAerobicSteps =
                XPathHelper.GetOptNavValueAsInt(
                    navigator,
                    "number-of-aerobic-steps");

            _aerobicStepMinutes =
                XPathHelper.GetOptNavValueAsDouble(
                    navigator,
                    "aerobic-step-minutes");
        }
Exemplo n.º 12
0
        /// <summary>
        /// Populates this <see cref="BasicV2"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the basic data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a basic node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator basicNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("basic");

            Validator.ThrowInvalidIfNull(basicNav, Resources.BasicUnexpectedNode);

            XPathNavigator genderNav =
                basicNav.SelectSingleNode("gender");

            if (genderNav != null)
            {
                string genderString = genderNav.Value;
                if (string.Equals(
                        genderString,
                        "m",
                        StringComparison.Ordinal))
                {
                    _gender = ItemTypes.Gender.Male;
                }
                else if (
                    string.Equals(
                        genderString,
                        "f",
                        StringComparison.Ordinal))
                {
                    _gender = ItemTypes.Gender.Female;
                }
                else
                {
                    _gender = ItemTypes.Gender.Unknown;
                }
            }

            _birthYear  = XPathHelper.GetOptNavValueAsInt(basicNav, "birthyear");
            _country    = XPathHelper.GetOptNavValue <CodableValue>(basicNav, "country");
            _postalCode = XPathHelper.GetOptNavValue(basicNav, "postcode");
            _city       = XPathHelper.GetOptNavValue(basicNav, "city");

            _stateOrProvince =
                XPathHelper.GetOptNavValue <CodableValue>(basicNav, "state");

            XPathNavigator dayOfWeekNav =
                basicNav.SelectSingleNode("firstdow");

            if (dayOfWeekNav != null)
            {
                _firstDayOfWeek = (DayOfWeek)(dayOfWeekNav.ValueAsInt - 1);
            }

            XPathNodeIterator languageIterator =
                basicNav.Select("language");

            if (languageIterator != null)
            {
                foreach (XPathNavigator languageNav in languageIterator)
                {
                    Language newLanguage = new Language();
                    newLanguage.ParseXml(languageNav);

                    _languages.Add(newLanguage);
                }
            }
        }