var vital = { "HR": { "unit": "bpm", "values": [ { "min": 0, "max": 60, "interpretation": "atRisk", "quantitativeInterpretation": "low", "title": "< 60" }, { "min": 80, "max": 100, "interpretation": "poor", "quantitativeInterpretation": "normal", "title": "80-100" }, { "min": 60, "max": 80, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "60-80" }, { "min": 100, "max": 0, "interpretation": "atRisk", "quantitativeInterpretation": "high", "title": "≥ 100" }, ] },"hrvv": { "unit": "ms", "values":[ { "min": 0, "max": 10.8, "interpretation": "atRisk", "quantitativeInterpretation": "low", "title": "< 10.8" }, { "min": 10.8, "max": 35.0, "interpretation": "poor", "quantitativeInterpretation": "low", "title": "10.8-16.4" }, { "min": 35.0, "max": 51.5, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "35.0-51.5" }, { "min": 51.5, "max": 0, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "≥ 51.5" } ] }, "Sp02": { "unit": "%", "values": [ { "min": 0, "max": 90, "interpretation": "atRisk", "quantitativeInterpretation": "low", "title": "≥ 90" }, { "min": 90, "max": 95, "interpretation": "poor", "quantitativeInterpretation": "possiblyLow", "title": "90-95" }, { "min": 95, "max": 97, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "95-97" }, { "min": 97, "max": 100, "interpretation": "excellent", "quantitativeInterpretation": "normal", "isMaxIncluded": true, "title": "97-100" } ] }, "blood_pressure": { "unit": "mmHg", "values": [ { "quotient": "0-90", "systolic-lng": { "min": 0, "max": 90, "interpretation": "atRisk", "quantitativeInterpretation": "low", "title": "0-90", "heading": "systolic-lng" }, "diastolic-lng": { "min": 0, "max": 60, "interpretation": "atRisk", "quantitativeInterpretation": "low", "title": "0-60", "heading": "diastolic-lng" } }, { "quotient": "90-120", "systolic-lng": { "min": 90, "max": 120, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "90-120", "heading": "systolic-lng" }, "diastolic-lng": { "min": 60, "max": 70, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "60-70", "heading": "diastolic-lng" } }, { "quotient": "120-130", "systolic-lng": { "min": 120, "max": 130, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "120-130", "heading": "systolic-lng" }, "diastolic-lng": { "min": 70, "max": 80, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "70-80", "heading": "diastolic-lng" } }, { "quotient": "130-140", "systolic-lng": { "min": 130, "max": 140, "interpretation": "poor", "quantitativeInterpretation": "slightlyHigh", "title": "130-140", "heading": "systolic-lng" }, "diastolic-lng": { "min": 80, "max": 90, "interpretation": "poor", "quantitativeInterpretation": "normal", "title": "80-90", "heading": "diastolic-lng" } }, { "quotient": "≥ 140 /90", "systolic-lng": { "min": 140, "max": 0, "interpretation": "atRisk", "quantitativeInterpretation": "high", "title": "140-200", "heading": "systolic-lng" }, "diastolic-lng": { "min": 90, "max": 200, "interpretation": "atRisk", "quantitativeInterpretation": "high", "title": "≥ 90", "heading": "diastolic-lng" } } ] }, "bmi": { "unit": "", "values": [ { "min": 0, "max": 18.5, "interpretation": "poor", "quantitativeInterpretation": "normal", "title": "< 18.5" }, { "min": 18.5, "max": 25, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "25-30" },{ "min": 25, "max": 30, "interpretation": "poor", "quantitativeInterpretation": "normal", "title": "25-30" }, { "min": 30, "max": 40, "interpretation": "atRisk", "quantitativeInterpretation": "high", "title": "30-40" }, { "min": 40, "max": 0, "interpretation": "atRisk", "quantitativeInterpretation": "high", "title": "≥40" }, ] }, "respiratoryRate": { "unit": "bpm", "values": [ { "min": 0, "max": 12, "interpretation": "poor", "quantitativeInterpretation": "low", "title": "< 12" }, { "min": 12, "max": 20, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "25-30" }, { "min": 20, "max": 0, "interpretation": "poor", "quantitativeInterpretation": "high", "title": "≥ 20" }, ] }, "cvd": { "unit": "%", "values": [ { "min": 0, "max": 1, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "< 1" }, { "min": 1, "max": 10, "interpretation": "Average", "quantitativeInterpretation": "slightlyHigh", "title": "1-10" }, { "min": 10, "max": 20, "interpretation": "poor", "quantitativeInterpretation": "moderatelyHigh", "title": "10-20" }, { "min": 20, "max": 0, "interpretation": "atRisk", "quantitativeInterpretation": " high", "title": "≥ 20" }, ] }, "generalWellness": { "unit": "", "values": [ { "min": 0, "max": 40, "interpretation": "poor", "quantitativeInterpretation": "low", "title": "< 40" }, { "min": 40, "max": 80, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "40-80" }, { "min": 80, "max": 100, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "80-100", "isMaxIncluded": true }, ] }, "stressLevel": { "unit": "", "values": [ { "min": 0, "max": 2, "interpretation": "excellent", "quantitativeInterpretation": "normal", "title": "0-2" }, { "min": 2, "max": 3, "interpretation": "good", "quantitativeInterpretation": "normal", "title": "2-3" }, { "min": 3, "max": 0, "interpretation": "poor", "quantitativeInterpretation": "high", "title": "80-100", }, ] }, }; var vitalValues = { "HR": { "excellent": ["60-80"], "poor": ["80-100"], "atRisk": ["< 60", "≥ 100"] }, "hrvv": { "excellent": ["≥ 51.5"], "good": ["35.0-51.5"], "poor": ["10.8-16.4"], "atRisk": ["< 10.8"] }, "Sp02": { "excellent": ["97-100"], "good": ["95-97"], "poor": ["90-95"], "atRisk": ["≥ 90"] }, "blood_pressure": { "systolic-lng": { "excellent": ["90-120"], "good": ["120-130"], "poor": ["130-140"], "atRisk": ["0-90", "140-200"] }, "diastolic-lng": { "excellent": ["60-70"], "good": ["70-80"], "poor": ["80-90"], "atRisk": ["0-60", "≥ 90"] } }, // "bmi": { // "unit": "", // "values": [ // { // "min": 0, // "max": 18.5, // "interpretation": "poor", // "quantitativeInterpretation": "normal", // "title": "< 18.5" // }, // { // "min": 18.5, // "max": 25, // "interpretation": "excellent", // "quantitativeInterpretation": "normal", // "title": "25-30" // },{ // "min": 25, // "max": 30, // "interpretation": "poor", // "quantitativeInterpretation": "normal", // "title": "25-30" // }, // { // "min": 30, // "max": 40, // "interpretation": "atRisk", // "quantitativeInterpretation": "high", // "title": "30-40" // }, // { // "min": 40, // "max": 0, // "interpretation": "atRisk", // "quantitativeInterpretation": "high", // "title": "≥40" // }, // ] "bmi": { "excellent":["18.5-25"], "poor": ["< 18.5", "25-30"], "atRisk": ["30-40", "≥40"], }, "respiratoryRate": { "excellent": ["25-30"], "poor": ["< 12", "≥ 20"] }, "cvd": { "excellent": ["< 1"], "Average": ["1-10"], "poor": ["10-20"], "atRisk": ["≥ 20"] }, "generalWellness": { "excellent": ["80-100"], "good": ["40-80"], "poor": ["< 40"] }, "stressLevel": { "excellent": ["0-2"], "good": ["2-3"], "poor": ["80-100"] } }; var bloodPressure = ["systolic-lng", "diastolic-lng"]; class RangeConditionWithTitle { String? unit; List? condition; RangeCondition? current; RangeConditionWithTitle({this.unit, this.condition}); RangeConditionWithTitle.fromJson(Map json, String formatValueToTwoDp) { this.unit = json['unit']; var conditions = json['values'] as List?; this.condition = conditions?.map((item) => RangeCondition.fromJson(item,formatValueToTwoDp)).toList(); print("the value is $formatValueToTwoDp"); current = condition?.where((element)=>element.isSelected == true).first; } } class RangeConditionForBloodPressure { String? unit; List? condition; BloodPressure? systolic; BloodPressure? diastolic; RangeCondition? getValue(String key){ switch(key){ case 'systolic-lng': return systolic?.systolic; case 'diastolic-lng': return diastolic?.diastolic; } } RangeConditionForBloodPressure({this.unit, this.condition}); RangeConditionForBloodPressure.fromJson( Map json, String formatValueToTwoDp) { this.unit = json['unit']; var conditions = json['values'] as List?; this.condition = conditions ?.map((item) => BloodPressure.fromJson(item, formatValueToTwoDp)) .toList(); print("the value is $formatValueToTwoDp"); systolic = condition ?.where((element) => element.systolic?.isSelected == true ).first; diastolic = condition ?.where((element) => element.diastolic?.isSelected == true ).first; } } class BloodPressure { RangeCondition? systolic; RangeCondition? diastolic; String? quotient; BloodPressure.fromJson(Map json, String selectedValue) { systolic = RangeCondition.fromJson(json['systolic-lng'], selectedValue.split("/")[0]); diastolic = RangeCondition.fromJson(json['diastolic-lng'], selectedValue.split("/")[1]); quotient = json['quotient'] ?? ''; } RangeCondition? getValue(String key) { switch (key) { case 'systolic-lng': return this.systolic; case 'diastolic-lng': return this.diastolic; } } } class RangeCondition { String? heading; double? min; double? max; bool? isMaxIncluded; String? interpretation; String? quantitativeInterpretation; String? title; bool? isSelected; RangeCondition(this.min, this.max, this.interpretation, this.quantitativeInterpretation, this.isMaxIncluded); RangeCondition.fromJson(Map json, String selectedValue) { min = json['min'].toDouble(); max = json['max'].toDouble(); interpretation = json['interpretation']; quantitativeInterpretation = json['quantitativeInterpretation']; isMaxIncluded = json['isMaxIncluded']; title = json['title']; isSelected = isInRange(selectedValue); heading = json['heading']; } bool isInRange(String data) { num value = num.parse(data); if (max == 0 && min != 0) return value >= min!; if (min == 0 && max != 0) return value < max!; if (isMaxIncluded == true) return value >= min! && value <= max!; return value >= min! && value < max!; } }