private HealthSample CreateBloodPressureSample(DateTimeOffset date, BloodPressureUnit systolic, BloodPressureUnit diastolic)
        {
            var dateRange = new HealthSample.HealthSampleDateRange(date, date);
            var sample    = new HealthSample()
            {
                DateRange          = dateRange,
                Type               = "blood_pressure",
                ClientAssignedId   = Guid.NewGuid().ToString(),
                CorrelationObjects = new List <HealthSample>()
                {
                    new HealthSample()
                    {
                        DateRange        = dateRange,
                        Type             = "blood_pressure_systolic",
                        QuantityValue    = systolic,
                        ClientAssignedId = Guid.NewGuid().ToString()
                    },
                    new HealthSample()
                    {
                        DateRange        = dateRange,
                        Type             = "blood_pressure_diastolic",
                        QuantityValue    = diastolic,
                        ClientAssignedId = Guid.NewGuid().ToString()
                    }
                }
            };

            return(sample);
        }
        public static BloodPressureUnitCategory Categorise(BloodPressureUnit unit, BloodPressureUnits asUnit)
        {
            switch (asUnit)
            {
            case BloodPressureUnits.Diastolic:
                return(CategoriseDiastolicValue(unit));

            case BloodPressureUnits.Systolic:
                return(CategoriseSystolicValue(unit));
            }
            throw new NotSupportedException("Unsupported BloodPressureUnits specified");
        }
        private static BloodPressureUnitCategory CategoriseSystolicValue(BloodPressureUnit unit)
        {
            var systolic = unit.MmHg;

            if (systolic < 90)
            {
                return(BloodPressureUnitCategory.Low);
            }

            if (systolic > 140)
            {
                return(BloodPressureUnitCategory.High);
            }

            if (systolic > 120)
            {
                return(BloodPressureUnitCategory.PreHigh);
            }

            return(BloodPressureUnitCategory.Normal);
        }
        private static BloodPressureUnitCategory CategoriseDiastolicValue(BloodPressureUnit unit)
        {
            var diastolic = unit.MmHg;

            if (diastolic < 60)
            {
                return(BloodPressureUnitCategory.Low);
            }

            if (diastolic > 90)
            {
                return(BloodPressureUnitCategory.High);
            }

            if (diastolic > 80)
            {
                return(BloodPressureUnitCategory.PreHigh);
            }

            return(BloodPressureUnitCategory.Normal);
        }
 public static (BloodPressureUnitCategory SystolicCategory, BloodPressureUnitCategory DiastolicCategory) CategoriseBloodPressureReading(BloodPressureUnit systolic, BloodPressureUnit diastolic)
 {
     return(CategoriseSystolicValue(systolic), CategoriseDiastolicValue(diastolic));
 }