/// <summary> /// Constructs the new blood glucose health record item 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) { this.When = when; this.Value = value; this.GlucoseMeasurementType = glucoseMeasurementType; }
public CustomHealthTypeWrapper( HealthRecordItemCustomBase wrappedInstance) : base(new Guid(ApplicationCustomTypeID)) { m_wrappedObject = wrappedInstance; // Test for null here because the deserialization code // needs to create this object first... if (wrappedInstance != null) { wrappedInstance.Wrapper = this; } m_when = new HealthServiceDateTime(); }
/// <summary> /// Creates a new instance of the <see cref="MedicalImageStudySeries"/> class /// specifying mandatory values. /// </summary> /// /// <param name="acquisitionDateTime"> /// The date and time that the image was acquired. /// </param> /// <param name="images"> /// Medical image study series images. /// </param> /// /// <exception cref="ArgumentException"> /// If <paramref name="images"/> parameter is <b>null</b> or doesn't contain any images. /// </exception> /// public MedicalImageStudySeries( HealthServiceDateTime acquisitionDateTime, ICollection<MedicalImageStudySeriesImage> images) { Validator.ThrowIfArgumentNull(images, "images", "ImagesMandatory"); Validator.ThrowArgumentExceptionIf( images.Count == 0, "images", "ImagesMandatory"); AcquisitionDateTime = acquisitionDateTime; foreach (MedicalImageStudySeriesImage image in images) { _images.Add(image); } }
public HVJournalEntry(JournalEntry entry) : base(new Guid("a5033c9d-08cf-4204-9bd3-cb412ce39fc0")) { m_when = new HealthServiceDateTime(DateTime.Now); // clone the entry coming in without reference to object JournalEntry = new JournalEntry() { Created = entry.Created, EntryDate = entry.EntryDate, Id = entry.Id, IsDay = entry.IsDay, Latitude = entry.Latitude, Longitude = entry.Longitude, MissedWorkSchool = entry.MissedWorkSchool, PeakFlowReading = entry.PeakFlowReading, RecordId = entry.RecordId, SawDoctor = entry.SawDoctor, SawEmergency = entry.SawEmergency, UserId = entry.UserId }; }
/// <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, "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); } }
/// <summary> /// Populates this medical encounter instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medical encounter data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a medical encounter node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("encounter"); Validator.ThrowInvalidIfNull(itemNav, "EncounterUnexpectedNode"); // <when> _when = new HealthServiceDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // <type> _type = XPathHelper.GetOptNavValue(itemNav, "type"); // <id> _id = XPathHelper.GetOptNavValue(itemNav, "id"); // <duration> _duration = XPathHelper.GetOptNavValue<DurationValue>( itemNav, "duration"); // <location> _location = XPathHelper.GetOptNavValue<Address>( itemNav, "location"); // <consent-granted> _consentGranted = XPathHelper.GetOptNavValueAsBool( itemNav, "consent-granted"); }
/// <summary> /// Creates a new instance of the <see cref="Emotion"/> class with the /// specified date/time. /// </summary> /// /// <param name="when"> /// The date/time when the emotion occurred. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public Emotion(HealthServiceDateTime when) : base(TypeId) { this.When = when; }
/// <summary> /// Populates this <see cref="Personal"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the personal data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a personal node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("personal"); Validator.ThrowInvalidIfNull(itemNav, "PersonalUnexpectedNode"); _name = XPathHelper.GetOptNavValue<Name>(itemNav, "name"); _birthDate = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "birthdate"); _bloodtype = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "blood-type"); _ethnicity = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "ethnicity"); _ssn = XPathHelper.GetOptNavValue(itemNav, "ssn"); _maritalStatus = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "marital-status"); _employmentStatus = XPathHelper.GetOptNavValue(itemNav, "employment-status"); // <is-deceased> _isDeceased = XPathHelper.GetOptNavValueAsBool( itemNav, "is-deceased"); // <date-of-death> _dateOfDeath = XPathHelper.GetOptNavValue<ApproximateDateTime>( itemNav, "date-of-death"); // <religion> _religion = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "religion"); // <is-veteran> _isVeteran = XPathHelper.GetOptNavValueAsBool(itemNav, "is-veteran"); // <highest-education-level> _highestEducationLevel = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "highest-education-level"); // <is-disabled> _isDisabled = XPathHelper.GetOptNavValueAsBool(itemNav, "is-disabled"); // <organ-donor> _organDonor = XPathHelper.GetOptNavValue(itemNav, "organ-donor"); }
/// <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, "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; } }
/// <summary> /// Creates a new instance of the <see cref="AerobicSession"/> class with /// the specified date and time and summary. /// </summary> /// /// <param name="when"> /// The date/time when the aerobic session occurred. /// </param> /// /// <param name="session"> /// The summary information about the aerobic session. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> or <paramref name="session"/> parameter /// is <b>null</b>. /// </exception> /// public AerobicSession(HealthServiceDateTime when, AerobicData session) : base(TypeId) { this.When = when; this.Session = session; }
/// <summary> /// Populates this medical device instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medical device data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a medical device node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("device"); Validator.ThrowInvalidIfNull(itemNav, "DeviceUnexpectedNode"); // <when> _when = new HealthServiceDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // <device-name> _deviceName = XPathHelper.GetOptNavValue(itemNav, "device-name"); // <vendor> _vendor = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "vendor"); // <model> _model = XPathHelper.GetOptNavValue(itemNav, "model"); // <serial-number> _serialNumber = XPathHelper.GetOptNavValue(itemNav, "serial-number"); // <anatomic-site> _anatomicSite = XPathHelper.GetOptNavValue(itemNav, "anatomic-site"); // <description> _description = XPathHelper.GetOptNavValue(itemNav, "description"); }
protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator navigator = typeSpecificXml.CreateNavigator(); navigator = navigator.SelectSingleNode("app-specific"); if (navigator == null) { throw new ArgumentNullException("null navigator"); } XPathNavigator when = navigator.SelectSingleNode( "when"); m_when = new HealthServiceDateTime(); m_when.ParseXml(when); XPathNavigator formatAppid = navigator.SelectSingleNode("format-appid"); string appid = formatAppid.Value; XPathNavigator formatTag = navigator.SelectSingleNode("format-tag"); string wrappedTypeName = formatTag.Value; if (wrappedTypeName != NullObjectTypeName) { m_wrappedObject = (HealthRecordItemCustomBase) CreateObjectByName(wrappedTypeName); if (m_wrappedObject != null) { m_wrappedObject.Wrapper = this; XPathNavigator customType = navigator.SelectSingleNode("CustomType"); if (customType != null) { m_wrappedObject.ParseXml(customType); } } } }
/// <summary> /// Populates this group membership instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the group membership data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a group membership node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("group-membership"); Validator.ThrowInvalidIfNull(itemNav, "GroupMembershipUnexpectedNode"); XPathNodeIterator membershipIterator = itemNav.Select("membership"); _groupMemberships.Clear(); foreach (XPathNavigator membershipNav in membershipIterator) { GroupMembershipType groupMembership = new GroupMembershipType(); groupMembership.ParseXml(membershipNav); _groupMemberships.Add(groupMembership); } _expires = XPathHelper.GetOptNavValue<HealthServiceDateTime>(itemNav, "expires"); }
/// <summary> /// Creates a new instance of the <see cref="AllergicEpisode"/> class /// with the specified date and name. /// </summary> /// /// <param name="when"> /// The date/time when the allergic episode occurred. /// </param> /// /// <param name="name"> /// The name of the allergy. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> or <paramref name="name"/> parameter is <b>null</b>. /// </exception> /// public AllergicEpisode(HealthServiceDateTime when, CodableValue name) : base(TypeId) { this.When = when; this.Name = name; }
public void WhenNullPassedToEquals_ThenFalseReturned() { HealthServiceDateTime dateTime = new HealthServiceDateTime(); Assert.IsFalse(dateTime.Equals(null), "The equals should return false."); }
/// <summary> /// Creates a new instance of the <see cref="AerobicSession"/> class with /// the specified date and time. /// </summary> /// /// <param name="when"> /// The date/time when the aerobic session occurred. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public AerobicSession(HealthServiceDateTime when) : base(TypeId) { this.When = when; }
/// <summary> /// Creates a new instance of the <see cref="Device"/> class with the /// specified date and time. /// </summary> /// /// <param name="when"> /// The date and time relevant for the medical device. /// </param> /// /// <exception cref="ArgumentException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public Device(HealthServiceDateTime when) : base(TypeId) { this.When = when; }
/// <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, "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"); }
/// <summary> /// Populates this <see cref="AerobicProfile"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the aerobic profile data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// an aerobic-session node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator aerobicProfileNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "aerobic-profile"); Validator.ThrowInvalidIfNull(aerobicProfileNav, "AerobicProfileUnexpectedNode"); _when = new HealthServiceDateTime(); _when.ParseXml(aerobicProfileNav.SelectSingleNode("when")); XPathNavigator maxHrNav = aerobicProfileNav.SelectSingleNode("max-heartrate"); if (maxHrNav != null) { _maxHr = maxHrNav.ValueAsInt; } XPathNavigator restingHrNav = aerobicProfileNav.SelectSingleNode("resting-heartrate"); if (restingHrNav != null) { _restingHr = restingHrNav.ValueAsInt; } XPathNavigator atNav = aerobicProfileNav.SelectSingleNode("anaerobic-threshold"); if (atNav != null) { _anaerobicThreshold = atNav.ValueAsInt; } XPathNavigator vo2MaxNav = aerobicProfileNav.SelectSingleNode("VO2-max"); if (vo2MaxNav != null) { XPathNavigator vo2AbsNav = vo2MaxNav.SelectSingleNode("absolute"); if (vo2AbsNav != null) { _vo2Absolute = vo2AbsNav.ValueAsDouble; } XPathNavigator vo2RelNav = vo2MaxNav.SelectSingleNode("relative"); if (vo2RelNav != null) { _vo2Relative = vo2RelNav.ValueAsDouble; } } XPathNodeIterator zoneGroupIterator = aerobicProfileNav.Select("heartrate-zone-group"); foreach (XPathNavigator groupNav in zoneGroupIterator) { HeartRateZoneGroup zoneGroup = new HeartRateZoneGroup(); zoneGroup.ParseXml(groupNav); _zoneGroups.Add(zoneGroup); } }
/// <summary> /// Populates this <see cref="Directive"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the directive data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node of the <paramref name="typeSpecificXml"/> /// parameter is not a directive node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("directive"); Validator.ThrowInvalidIfNull(itemNav, "DirectiveUnexpectedNode"); // <start-date> _startDate = new ApproximateDateTime(); _startDate.ParseXml(itemNav.SelectSingleNode("start-date")); // <stop-date> _stopDate = new ApproximateDateTime(); _stopDate.ParseXml(itemNav.SelectSingleNode("stop-date")); // <description> _description = XPathHelper.GetOptNavValue(itemNav, "description"); // <full-resuscitation> _fullResuscitation = XPathHelper.GetOptNavValueAsBool(itemNav, "full-resuscitation"); // <prohibited-interventions> _prohibitedInterventions = XPathHelper.GetOptNavValue<CodableValue>( itemNav, "prohibited-interventions"); // <additional-instructions> _additionalInstructions = XPathHelper.GetOptNavValue(itemNav, "additional-instructions"); // <attending-physician> _attendingPhysician = XPathHelper.GetOptNavValue<PersonItem>( itemNav, "attending-physician"); // <attending-physician-endorsement> _attendingPhysicianEndorsement = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "attending-physician-endorsement"); // <attending-nurse> _attendingNurse = XPathHelper.GetOptNavValue<PersonItem>( itemNav, "attending-nurse"); // <attending-nurse-endorsement" type="d:date-time"> _attendingNurseEndorsement = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "attending-nurse-endorsement"); // <expiration-date> _expirationDate = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "expiration-date"); // <discontinuation-date> _discontinuationDate = XPathHelper.GetOptNavValue<ApproximateDateTime>( itemNav, "discontinuation-date"); // <discontinuation-physician> _discontinuationPhysician = XPathHelper.GetOptNavValue<PersonItem>( itemNav, "discontinuation-physician"); // <discontinuation-physician-endorsement> _discontinuationPhysicianEndorsement = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "discontinuation-physician-endorsement"); // <discontinuation-nurse> _discontinuationNurse = XPathHelper.GetOptNavValue<PersonItem>( itemNav, "discontinuation-nurse"); // <discontinuation-nurse-endorsement> _discontinuationNurseEndorsement = XPathHelper.GetOptNavValue<HealthServiceDateTime>( itemNav, "discontinuation-nurse-endorsement"); }
/// <summary> /// Creates a new instance of the <see cref="AerobicProfile"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="when"> /// The date/time when the aerobic profile was take. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public AerobicProfile(HealthServiceDateTime when) : base(TypeId) { this.When = when; }
/// <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) { this.When = when; this.InsulinType = insulinType; this.Amount = amount; }
/// <summary> /// Creates a new instance of the <see cref="QuestionAnswer"/> class with the specified /// date and time and the question that was asked. /// </summary> /// /// <param name="when"> /// The date and time the question was asked. /// </param> /// /// <param name="question"> /// The question that was asked. /// </param> /// /// <param name="answerChoice"> /// The possible answers to the question. See <see cref="AnswerChoice"/> for more information /// and the preferred vocabulary. /// </param> /// /// <param name="answer"> /// The answer to the question. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> or <paramref name="question"/> is <b>null</b>. /// </exception> /// public QuestionAnswer( HealthServiceDateTime when, CodableValue question, IList<CodableValue> answerChoice, IList<CodableValue> answer) : this(when, question) { if (answerChoice != null) { foreach (CodableValue choice in answerChoice) { _answerChoice.Add(choice); } } if (answer != null) { foreach (CodableValue answerValue in answer) { _answer.Add(answerValue); } } }
/// <summary> /// Populates this <see cref="Emotion"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the emotion data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a emotion node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator emotionNav = typeSpecificXml.CreateNavigator().SelectSingleNode("emotion"); Validator.ThrowInvalidIfNull(emotionNav, "EmotionUnexpectedNode"); _when = new HealthServiceDateTime(); _when.ParseXml(emotionNav.SelectSingleNode("when")); XPathNavigator moodNav = emotionNav.SelectSingleNode("mood"); if (moodNav != null) { _mood = (Mood)moodNav.ValueAsInt; } XPathNavigator stressNav = emotionNav.SelectSingleNode("stress"); if (stressNav != null) { _stress = (RelativeRating)stressNav.ValueAsInt; } XPathNavigator wellbeingNav = emotionNav.SelectSingleNode("wellbeing"); if (wellbeingNav != null) { _wellbeing = (Wellbeing)wellbeingNav.ValueAsInt; } }
/// <summary> /// Populates this question/answer instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the question/answer data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a question-answer node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("question-answer"); Validator.ThrowInvalidIfNull(itemNav, "QuestionAnswerUnexpectedNode"); // <when> _when = new HealthServiceDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // <question> _question = new CodableValue(); _question.ParseXml(itemNav.SelectSingleNode("question")); // <answer-choice> _answerChoice.Clear(); XPathNodeIterator choiceIterator = itemNav.Select("answer-choice"); foreach (XPathNavigator choiceNav in choiceIterator) { CodableValue choice = new CodableValue(); choice.ParseXml(choiceNav); _answerChoice.Add(choice); } // <answer> _answer.Clear(); XPathNodeIterator answerIterator = itemNav.Select("answer"); foreach (XPathNavigator answerNav in answerIterator) { CodableValue answer = new CodableValue(); answer.ParseXml(answerNav); _answer.Add(answer); } }
/// <summary> /// Creates a new instance of the <see cref="EncounterV1"/> class with the /// specified date and time. /// </summary> /// /// <param name="when"> /// The date/time for the medical encounter. /// </param> /// /// <param name="type"> /// The type of the medical encounter. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// The <paramref name="type"/> parameter is <b>null</b> or empty. /// </exception> /// public EncounterV1( HealthServiceDateTime when, string type) : base(TypeId) { this.When = when; this.Type = type; }
/// <summary> /// Creates a new instance of the <see cref="QuestionAnswer"/> class with the specified /// date and time and the question that was asked. /// </summary> /// /// <param name="when"> /// The date and time the question was asked. /// </param> /// /// <param name="question"> /// The question that was asked. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> or <paramref name="question"/> is <b>null</b>. /// </exception> /// public QuestionAnswer(HealthServiceDateTime when, CodableValue question) : base(TypeId) { this.When = when; this.Question = question; }
/// <summary> /// Creates a new instance of the <see cref="EncounterV1"/> class with the /// specified date and time. /// </summary> /// /// <param name="when"> /// The date/time for the medical encounter. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public EncounterV1(HealthServiceDateTime when) : base(TypeId) { this.When = when; }
/// <summary> /// Populates the data from the specified XML. /// </summary> /// /// <param name="navigator"> /// The XML containing the medical image study series. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="navigator"/> parameter is <b>null</b>. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); _acquisitionDateTime = XPathHelper.GetOptNavValue<HealthServiceDateTime>(navigator, "acquisition-datetime"); _description = XPathHelper.GetOptNavValue(navigator, "description"); _images.Clear(); XPathNodeIterator imageIterator = navigator.Select("images"); foreach (XPathNavigator imageNav in imageIterator) { MedicalImageStudySeriesImage image = new MedicalImageStudySeriesImage(); image.ParseXml(imageNav); _images.Add(image); } _institutionName = XPathHelper.GetOptNavValue<Organization>(navigator, "institution-name"); _modality = XPathHelper.GetOptNavValue<CodableValue>(navigator, "modality"); _bodyPart = XPathHelper.GetOptNavValue<CodableValue>(navigator, "body-part"); _previewBlobName = XPathHelper.GetOptNavValue(navigator, "preview-blob-name"); _seriesInstanceUID = XPathHelper.GetOptNavValue(navigator, "series-instance-uid"); }
/// <summary> /// Creates a new instance of the <see cref="HealthAssessment"/> class with the specified /// mandatory parameters. /// </summary> /// /// <param name="when"> /// The date and time the assessment was completed. /// </param> /// /// <param name="name"> /// The application's name for the assessment. See <see cref="Name"/> for more information. /// </param> /// /// <param name="category"> /// The type of the assessment. /// </param> /// /// <param name="result"> /// The results of the assessment. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> or <paramref name="category"/>, or <paramref name="result"/> /// is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// If <paramref name="name"/> is <b>null</b> or empty or <paramref name="result"/> is empty. /// </exception> /// public HealthAssessment( HealthServiceDateTime when, String name, CodableValue category, IList<Assessment> result) : base(TypeId) { this.When = when; this.Name = name; this.Category = category; Validator.ThrowIfArgumentNull(result, "result", "HealthAssessmentResultMandatory"); if (result.Count == 0) { throw Validator.ArgumentException("result", "HealthAssessmentResultMandatory"); } _result.Clear(); foreach (Assessment assessment in result) { _result.Add(assessment); } }
/// <summary> /// Populates this AerobicSession instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the aerobic session data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// an aerobic-session node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator aerobicSessionNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "aerobic-session"); Validator.ThrowInvalidIfNull(aerobicSessionNav, "AerobicSessionUnexpectedNode"); _when = new HealthServiceDateTime(); _when.ParseXml(aerobicSessionNav.SelectSingleNode("when")); _session = new AerobicData(); _session.ParseXml(aerobicSessionNav.SelectSingleNode("session")); XPathNavigator samplesNav = aerobicSessionNav.SelectSingleNode("session-samples"); if (samplesNav != null) { _sessionSamples = new AerobicSessionSamples(); _sessionSamples.ParseXml(samplesNav); } XPathNodeIterator lapsIterator = aerobicSessionNav.Select("lap-session"); _lapSessions = new Collection<LapSession>(); foreach (XPathNavigator lapNav in lapsIterator) { LapSession lap = new LapSession(); lap.ParseXml(lapNav); _lapSessions.Add(lap); } }