/// <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 definies 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> /// Populates this medication instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medication data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a medication node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("medication"); Validator.ThrowInvalidIfNull(itemNav, "MedicationUnexpectedNode"); _name = new CodableValue(); _name.ParseXml(itemNav.SelectSingleNode("name")); _genericName = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "generic-name"); _dose = XPathHelper.GetOptNavValue<GeneralMeasurement>(itemNav, "dose"); _strength = XPathHelper.GetOptNavValue<GeneralMeasurement>(itemNav, "strength"); _frequency = XPathHelper.GetOptNavValue<GeneralMeasurement>(itemNav, "frequency"); _route = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "route"); _indication = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "indication"); _dateStarted = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "date-started"); _dateDiscontinued = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "date-discontinued"); _prescribed = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "prescribed"); _prescription = XPathHelper.GetOptNavValue<Prescription>(itemNav, "prescription"); }
/// <summary> /// Initialize a new instance of the <see cref="LabTestResultValue"/> /// class with the specified measurement. /// </summary> /// /// <param name="measurement"> /// The value of the lab results. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="measurement"/> is <b> null </b>. /// </exception> /// public LabTestResultValue(GeneralMeasurement measurement) { Measurement = measurement; }
/// <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 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 "carolie-guideline" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("calorie-guideline"); Validator.ThrowInvalidIfNull(itemNav, "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")); }
/// <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 in <paramref name="typeSpecificXml"/> 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"); }