Skip to content

Commit ffcbf34

Browse files
committed
Re-implement weight_desc widget with clauses
1 parent 9eaff9b commit ffcbf34

File tree

1 file changed

+81
-2
lines changed

1 file changed

+81
-2
lines changed

data/json/ui/weight.json

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,86 @@
44
"type": "widget",
55
"label": "Weight",
66
"style": "text",
7-
"var": "weight_text",
8-
"//": "Uses display::weight_text_color"
7+
"clauses": [
8+
{
9+
"id": "skeletal",
10+
"text": "Skeletal",
11+
"color": "red",
12+
"condition": { "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 14000 } ] }
13+
},
14+
{
15+
"id": "emaciated",
16+
"text": "Emaciated",
17+
"color": "light_red",
18+
"condition": {
19+
"and": [
20+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 14000 } ] },
21+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 16000 } ] }
22+
]
23+
}
24+
},
25+
{
26+
"id": "underweight",
27+
"text": "Underweight",
28+
"color": "yellow",
29+
"condition": {
30+
"and": [
31+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 16000 } ] },
32+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 18500 } ] }
33+
]
34+
}
35+
},
36+
{
37+
"id": "normal",
38+
"text": "Normal",
39+
"color": "light_gray",
40+
"//": "Actually 18.5 - 25",
41+
"condition": {
42+
"and": [
43+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 18500 } ] },
44+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 25000 } ] }
45+
]
46+
}
47+
},
48+
{
49+
"id": "overweight",
50+
"text": "Overweight",
51+
"color": "yellow",
52+
"condition": {
53+
"and": [
54+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 25000 } ] },
55+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 30000 } ] }
56+
]
57+
}
58+
},
59+
{
60+
"id": "obese",
61+
"text": "Obese",
62+
"color": "light_red",
63+
"condition": {
64+
"and": [
65+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 30000 } ] },
66+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 35000 } ] }
67+
]
68+
}
69+
},
70+
{
71+
"id": "very_obese",
72+
"text": "Very Obese",
73+
"color": "red",
74+
"condition": {
75+
"and": [
76+
{ "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 35000 } ] },
77+
{ "compare_int": [ { "u_val": "bmi_permil" }, "<=", { "const": 40000 } ] }
78+
]
79+
}
80+
},
81+
{
82+
"id": "morbidly_obese",
83+
"text": "Morbidly Obese",
84+
"color": "red",
85+
"condition": { "compare_int": [ { "u_val": "bmi_permil" }, ">", { "const": 40000 } ] }
86+
}
87+
]
988
}
1089
]

0 commit comments

Comments
 (0)