diff --git a/contents/guideline_hearts.json b/contents/guideline_hearts.json index 7dfe265..e8cacc2 100644 --- a/contents/guideline_hearts.json +++ b/contents/guideline_hearts.json @@ -1044,7 +1044,7 @@ "from": 8.0, "unit": "mmol/L" }, - "target": "< 90mg/dL (5 mmol/L)" + "target": "< 195mg/dL (5 mmol/L)" }], "code": "CHOL-REFER" }, @@ -1056,7 +1056,7 @@ "from": 31, "unit": "%" }, - "target": "<90mg/dL (5mmol/L)" + "target": "<195mg/dL (5mmol/L)" }], "code": "CHOL-VERY-HIGH-CVD-RISK" }, @@ -1074,7 +1074,7 @@ "to": 7.9, "unit": "mmol/L" }, - "target": "< 90mg/dL (5 mmol/L)" + "target": "< 195mg/dL (5 mmol/L)" }], "code": "CHOL-ELEVATED-WITH-HIGH-CVD-RISK" }, @@ -1087,7 +1087,7 @@ "to": 20, "unit": "%" }, - "target": "< 90mg/dL (5 mmol/L)" + "target": "< 195mg/dL (5 mmol/L)" }], "code": "CHOL-MOD-CVD-RISK" }, @@ -1100,7 +1100,7 @@ "to": 10, "unit": "%" }, - "target": "Below 90mg/dL (5 mmol/L)" + "target": "Below 195mg/dL (5 mmol/L)" }], "code": "CHOL-LOW-CVD-RISK" }, @@ -1112,14 +1112,14 @@ "to": 1, "unit": "%" }, - "target": "Below 90mg/dL (5 mmol/L)" + "target": "Below 195mg/dL (5 mmol/L)" }, { "range": { "to": 8.0, "unit": "mmol/L" }, - "target": "Below 90mg/dL (5 mmol/L)" + "target": "Below 195mg/dL (5 mmol/L)" } ], "code": "CHOL-NO-CVD-RISK" diff --git a/pkg/engine/cholesterol.go b/pkg/engine/cholesterol.go index 0a74c6d..51a0cc8 100644 --- a/pkg/engine/cholesterol.go +++ b/pkg/engine/cholesterol.go @@ -40,7 +40,7 @@ type CholesterolGuidelines []CholesterolGuideline // Process function func (b *CholesterolGuidelines) Process(cvd, age, chol float64, cholUnit, cholType string, medications map[string]bool) (Response, error) { - cholesterol := tools.CalculateMMOLValue(chol, cholUnit) + cholesterol := tools.CalculateCholMMOLValue(chol, cholUnit) code := "" value := fmt.Sprintf("%.1f%s", chol, cholUnit) @@ -81,10 +81,10 @@ func (b *CholesterolGuidelines) Process(cvd, age, chol float64, cholUnit, cholTy if c.Range != nil { if c.Range.From != nil { - cholFrom = tools.CalculateMMOLValue(*c.Range.From, *c.Range.Unit) + cholFrom = tools.CalculateCholMMOLValue(*c.Range.From, *c.Range.Unit) } if c.Range.To != nil { - cholTo = tools.CalculateMMOLValue(*c.Range.To, *c.Range.Unit) + cholTo = tools.CalculateCholMMOLValue(*c.Range.To, *c.Range.Unit) } } diff --git a/pkg/tools/calculate.go b/pkg/tools/calculate.go index 855f950..c8d01f5 100644 --- a/pkg/tools/calculate.go +++ b/pkg/tools/calculate.go @@ -66,6 +66,15 @@ func CalculateMMOLValue(value float64, unit string) float64 { return value } +// CalculateCholMMOLValue to convert value into mmol/L +func CalculateCholMMOLValue(value float64, unit string) float64 { + if strings.ToLower(unit) == "mg/dl" { + return value / 38.67 + } + + return value +} + // CalculateLength to convert units func CalculateLength(value float64, unit, toUnit string) float64 { result := value