public void Classification_GivenParams_ReturnsCorrectAscvdRiskClassification(GenderIdentity genderIdentity,
                                                                                     int systolic, double hdl, double totalCholesterol, double ldl,
                                                                                     bool diabetic, bool antiHypertensive, bool smoker, bool ascvdPresent, AscvdRiskClassification expected)
        {
            _patient.Gender = Gender.Build(genderIdentity);

            if (diabetic)
            {
                _patient.Comorbidities.Add(ChronicDisease.Diabetes);
            }
            if (antiHypertensive)
            {
                _patient.Comorbidities.Add(ChronicDisease.HypertensionTreated);
            }
            if (smoker)
            {
                _patient.Comorbidities.Add(ChronicDisease.TobaccoSmoker);
            }
            if (ascvdPresent)
            {
                _patient.Comorbidities.Add(ChronicDisease.DiagnosedCardiovascularDisease);
            }

            var ascvdClassification = new AscvdClassification(AscvdParameters.Build(_patient,
                                                                                    BloodPressure.Build(systolic, 75), Quantitative.Serum.CholesterolTotal(totalCholesterol),
                                                                                    Quantitative.Serum.LowDensityLipoprotein(ldl), Quantitative.Serum.HighDensityLipoprotein(hdl)));

            Assert.Equal(expected, ascvdClassification.Classification.TenYearRiskClassification);
        }
        public void MaleResultInRange()
        {
            _patient.Gender = Gender.Build(GenderIdentity.Male);

            var result = CalculateVo2Max.FromTreadmillStressTest(_protocol, _timeDuration, _patient);

            Assert.InRange(result, 40, 41);
        }
        public void Classification_GivenValues_ReturnsCorrectClassification(GenderIdentity gender, double left,
                                                                            double right, GripStrengthScore expected)
        {
            _patient.Gender = Gender.Build(gender);
            var gs = GripStrength.Build(left, right);

            var classification = new GripStrengthClassification(new GripStrengthClassificationParameters(gs, _patient))
                                 .Classification;

            Assert.Equal(expected, classification.WorseSide);
        }
        public void Classification_Given40yrMale50lbsL150lbsR_ReturnsWorseSideWeakLateralityLeft()
        {
            _patient.Gender = Gender.Build(GenderIdentity.Male);
            var gs = GripStrength.Build(50, 150);

            var classification = new GripStrengthClassification(new GripStrengthClassificationParameters(gs, _patient))
                                 .Classification;

            Assert.Equal(GripStrengthScore.Weak, classification.WorseSide);
            Assert.Equal(Laterality.Left, classification.Laterality);
        }
Beispiel #5
0
        public void QuantitativeLabTestosterone_GivenValues_ReturnsCorrectClassification(int result,
                                                                                         GenderIdentity genderIdentity, QuantitativeLabResult expectedResult)
        {
            _patient.Gender = Gender.Build(genderIdentity);
            var test = Quantitative.Serum.TestosteroneTotal(result);

            var classification =
                new QuantitativeLabClassification(new QuantitativeLabClassificationParameters(test, _patient))
                .Classification;

            Assert.Equal(expectedResult, classification);
        }
        public void Classification_GivenPatientAndData_ReturnsCorrectClassifiation(int distance, int age,
                                                                                   GenderIdentity genderIdentity, FitnessClassification expectedFitnessClassification)
        {
            _patient.DateOfBirth = DateTime.Now.AddYears(-age);
            _patient.Gender      = Gender.Build(genderIdentity);

            var situps = Situps.Build(distance);

            var classification =
                new SitupsClassification(new SitupsClassificationParameters(situps, _patient)).Classification;

            Assert.Equal(expectedFitnessClassification, classification);
        }
Beispiel #7
0
        public void Classification_GivenPushupCountAndPatient_ReturnsCorrectClassification(int count,
                                                                                           GenderIdentity genderIdentity, int age, FitnessClassification expectedClassification)
        {
            var pushups = Pushups.Build(count);

            _patient.Gender      = Gender.Build(genderIdentity);
            _patient.DateOfBirth = DateTime.Now.AddYears(-age);

            var classification =
                new PushupsClassification(new PushupsClassificationParameters(pushups, _patient))
                .Classification;

            Assert.Equal(expectedClassification, classification);
        }
        public void Classify_GivenBodyCompositionAndBodyFatPercent_ReturnsCorrectClassification(double percentBodyFat,
                                                                                                GenderIdentity genderIdentity, PercentBodyFat expectedClassification)
        {
            _patient.Gender = Gender.Build(genderIdentity);

            var bce = BodyCompositionExpandedBuilder.Initialize()
                      .SetBodyFatPercentage(percentBodyFat)
                      .BuildWithoutModelValidation();

            var classification =
                new PercentBodyFatClassification(new BodyCompositionExpandedClassificationParameters(bce, _patient))
                .Classification;

            Assert.Equal(expectedClassification, classification);
        }
Beispiel #9
0
        public void Classification_GivenHipToWaistRatioAndGender_ReturnsCorrectClassification(double ratio,
                                                                                              GenderIdentity genderIdentity, HipToWaistRatio expectedClassifcation)
        {
            _patient.Gender = Gender.Build(genderIdentity);

            var bodyComposition = BodyCompositionBuilder.Initialize()
                                  .SetHips(1)
                                  .SetWaist(ratio)
                                  .BuildWithoutModelValidation();

            var classification =
                new HipToWaistClassification(new BodyCompositionClassificationParameters(bodyComposition, _patient))
                .Classification;

            Assert.Equal(expectedClassifcation, classification);
        }
        public void Classification_GivenPatientAndData_ReturnsCorrectClassification(double ratio,
                                                                                    GenderIdentity genderIdentity, WaistToHeightRatio expectedWaistToHeightRatio)
        {
            _patient.Gender = Gender.Build(genderIdentity);

            var bodyComposition = BodyCompositionBuilder.Initialize()
                                  .SetHeight(LengthConversion.CentimetersToInches(1))
                                  .SetWaist(LengthConversion.CentimetersToInches(ratio))
                                  .BuildWithoutModelValidation();

            var classification =
                new WaistToHeightRatioClassification(
                    new BodyCompositionClassificationParameters(bodyComposition, _patient)).Classification;

            Assert.Equal(expectedWaistToHeightRatio, classification);
        }
        public void IdealLifeTimeRisk_IsCorrect(GenderIdentity gender, double expectedRisk)
        {
            _patient.Gender = Gender.Build(gender);

            _parametersBuilder
            .SetPatient(_patient)
            .SetBloodPressure(default(int), default(int))
            .SetTotalCholesterol(default(int))
            .SetHdlCholesterol(default(int));

            var idealAscvdLifetimeRisk =
                new PooledCohortsEquation(_parametersBuilder.Build()).IdealAscvdLifetimeRiskPercentage;

            const double tolerance = 0.1;

            Assert.InRange(idealAscvdLifetimeRisk, expectedRisk - tolerance, expectedRisk + tolerance);
        }
        public void Value_GivenTreadmillAndPatientData_ReturnsCorrectValue(GenderIdentity gender, int age,
                                                                           int maxHeartRate, double minutes, double seconds, double expectedScore)
        {
            _patient.DateOfBirth = DateTime.Now.AddYears(-age);
            _patient.Gender      = Gender.Build(gender);

            var tmst = TreadmillExerciseStressTestBuilder.Initialize()
                       .SetMaximumHeartRate(maxHeartRate)
                       .SetTime(minutes, seconds)
                       .BuildWithoutModelValidation();

            var fitScore =
                new FitTreadmillScoreClassification(
                    new TreadmillExerciseStressTestClassificationParameters(tmst, _patient)).Value;

            Assert.InRange(fitScore, expectedScore - 0.001, expectedScore + 0.001);
        }
Beispiel #13
0
        public void IdealPercentAscvdRisk10Year_Given2013AccAhaSampleParams_ReturnsCorrectRiskPercentage(Race race,
                                                                                                         GenderIdentity genderIdentity, double expected)
        {
            _patient.Gender = Gender.Build(genderIdentity);
            _patient.Race   = race;

            _parametersBuilder
            .SetPatient(_patient)
            .SetBloodPressure(BloodPressure.Build(default(int), default(int)))
            .SetTotalCholesterol(default(int))
            .SetHdlCholesterol(default(int));

            var idealAscvd = new PooledCohortsEquation(_parametersBuilder.Build()).IdealAscvd10YearRiskPercentage;

            const double tolerance = 0.31; // Tolerance necessary because expected values are estimates.

            Assert.InRange(idealAscvd, expected - tolerance, expected + tolerance);
        }
        public void Classification_GivenTreadmillAndPatientData_ReturnsCorrectClassification(GenderIdentity gender,
                                                                                             int age,
                                                                                             int maxHeartRate, double minutes, double seconds, FitTreadmillScoreMortality expectedClassification)
        {
            _patient.DateOfBirth = DateTime.Now.AddYears(-age);
            _patient.Gender      = Gender.Build(gender);

            var tmst = TreadmillExerciseStressTestBuilder.Initialize()
                       .SetMaximumHeartRate(maxHeartRate)
                       .SetTime(minutes, seconds)
                       .BuildWithoutModelValidation();

            var classification =
                new FitTreadmillScoreClassification(
                    new TreadmillExerciseStressTestClassificationParameters(tmst, _patient)).Classification;

            Assert.Equal(expectedClassification, classification);
        }
Beispiel #15
0
        public void PercentAscvdRisk10Year_Given2013AccAhaSampleParams_ReturnsCorrectRiskPercentage(Race race,
                                                                                                    GenderIdentity genderIdentity, bool hypertensionTreatment, bool diabetes,
                                                                                                    bool smoker, double expected)
        {
            _patient.Gender = Gender.Build(genderIdentity);
            _patient.Race   = race;

            _parametersBuilder
            .SetPatient(_patient)
            .ConfirmDiabetic(diabetes)
            .ConfirmOnAntiHypertensiveMedication(hypertensionTreatment)
            .ConfirmSmoker(smoker);

            var ascvd = new PooledCohortsEquation(_parametersBuilder.Build()).Ascvd10YearRiskPercentage;

            const double tolerance = 0.1;

            Assert.InRange(ascvd, expected - tolerance, expected + tolerance);
        }
        public void PercentAscvdRiskLifetime_GivenValues_ReturnsCorrectRiskPercentage(
            GenderIdentity gender, double totalCholesterol,
            int systolicBloodPressure, bool hypertensionTreatment, bool diabetes,
            bool smoker, double expected)
        {
            _patient.Gender = Gender.Build(gender);

            _parametersBuilder
            .SetPatient(_patient)
            .SetBloodPressure(systolicBloodPressure, 75)
            .SetTotalCholesterol(totalCholesterol)
            .SetHdlCholesterol(50)
            .ConfirmDiabetic(diabetes)
            .ConfirmOnAntiHypertensiveMedication(hypertensionTreatment)
            .ConfirmSmoker(smoker);

            var lifetime = new PooledCohortsEquation(_parametersBuilder.Build()).AscvdLifetimeRiskPercentage;

            const double tolerance = 0.1;

            Assert.InRange(lifetime, expected - tolerance, expected + tolerance);
        }
Beispiel #17
0
 public PatientBuilder SetGender(GenderIdentity gender)
 {
     _gender = Gender.Build(gender);
     return(this);
 }