internal static BloodPressure ToBloodPressure(this Observation observation) { var bloodPressure = observation.ToThingBase <BloodPressure>(); bloodPressure.When = ObservationToHealthVault.GetHealthVaultTimeFromEffectiveDate(observation.Effective); bloodPressure.IrregularHeartbeatDetected = observation.GetBoolExtension(HealthVaultVocabularies.IrregularHeartBeatExtensionName); if (observation.Component != null) { foreach (var component in observation.Component) { if (component.Code != null && component.Code.Coding != null) { foreach (var code in component.Code.Coding) { if (code.Code != null) { if (HealthVaultVocabularies.SystemContainsHealthVaultUrl(code.System)) { if (code.Code == HealthVaultVitalStatisticsCodes.BloodPressureDiastolic.Code) { SetDiastolic(bloodPressure, component); } else if (code.Code == HealthVaultVitalStatisticsCodes.BloodPressureSystolic.Code) { SetSystolic(bloodPressure, component); } else if (code.Code == HealthVaultVitalStatisticsCodes.HeartRate.Code) { SetPulse(bloodPressure, component); } } else { switch (code.Code.ToLowerInvariant()) { // HeartRate component case "8867-4": SetPulse(bloodPressure, component); break; // Systolic LOINC, SNOMED, ACME codes case "8480-6": case "271649006": case "bp-s": SetSystolic(bloodPressure, component); break; // Diastolic LOINC code case "8462-4": SetDiastolic(bloodPressure, component); break; default: continue; } break; } } } } } } return(bloodPressure); }