Skip to content

Commit

Permalink
Fixed required fields and date validations (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckote authored Sep 7, 2023
1 parent fd21033 commit 9764e61
Showing 1 changed file with 96 additions and 47 deletions.
143 changes: 96 additions & 47 deletions configuration/ampathforms/MCH_Postnatal_Visit.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,25 @@
"isExpanded": "true",
"questions": [
{
"label": "PNC Register Number:",
"label": "PNC Number:",
"type": "obs",
"id": "pncRegisterNumber",
"required": "true",
"questionOptions": {
"concept": "1646AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "text"
"rendering": "number",
"min": "0"
}
},
{
"label": "PNC Visit Number:",
"type": "obs",
"id": "pncVisitNumber",
"required": "true",
"questionOptions": {
"concept": "159893AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"min": "0"
}
}
]
Expand All @@ -82,7 +86,13 @@
"questionOptions": {
"concept": "5599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
}
},
"validators": [
{
"type": "date",
"allowFutureDates": "false"
}
]
},
{
"label": "Mode of Delivery:",
Expand Down Expand Up @@ -198,7 +208,9 @@
"id": "temperature",
"questionOptions": {
"concept": "5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"min": "25",
"max": "43"
}
},
{
Expand All @@ -207,7 +219,9 @@
"id": "pulseRate",
"questionOptions": {
"concept": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "230",
"min": "0"
}
},
{
Expand All @@ -216,7 +230,9 @@
"id": "diastolicBp",
"questionOptions": {
"concept": "5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "250",
"min": "0"
}
},
{
Expand All @@ -225,7 +241,9 @@
"id": "systolicBp",
"questionOptions": {
"concept": "5086AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "150",
"min": "0"
}
},
{
Expand All @@ -234,7 +252,9 @@
"id": "respiratoryRate",
"questionOptions": {
"concept": "5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "99",
"min": "0"
}
},
{
Expand All @@ -243,7 +263,9 @@
"id": "oxygenSaturation",
"questionOptions": {
"concept": "5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "100",
"min": "0"
}
},
{
Expand All @@ -261,7 +283,9 @@
"id": "height",
"questionOptions": {
"concept": "5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "272",
"min": "10"
}
},
{
Expand All @@ -270,7 +294,9 @@
"id": "weight",
"questionOptions": {
"concept": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "number"
"rendering": "number",
"max": "250",
"min": "0"
}
},
{
Expand All @@ -280,6 +306,8 @@
"questionOptions": {
"rendering": "number",
"concept": "1342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"max": "100",
"min": "0",
"calculate": {
"calculateExpression": "calcBMI(height,weight)"
}
Expand Down Expand Up @@ -408,13 +436,13 @@
"concept": "1175AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Not applicable"
},
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
},
{
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Yes"
},
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
}
]
}
Expand Down Expand Up @@ -442,7 +470,7 @@
]
},
"hide": {
"hideWhenExpression": "isEmpty(pallor) || !arrayContains(['1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'], pallor)"
"hideWhenExpression": "isEmpty(pallor) || pallor !== '1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand Down Expand Up @@ -477,7 +505,7 @@
},
"validators": [],
"hide": {
"hideWhenExpression": "isEmpty(deliveryMode) || deliveryMode != '1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
"hideWhenExpression": "isEmpty(deliveryMode) || deliveryMode !== '1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand Down Expand Up @@ -569,6 +597,9 @@
"label": "Postoperative wound infection"
}
]
},
"hide": {
"hideWhenExpression": "isEmpty(deliveryMode) || deliveryMode !== '1170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand Down Expand Up @@ -731,6 +762,9 @@
"label": "REPLACEMENT FEEDING"
}
]
},
"hide": {
"hideWhenExpression": "babyConditionSingle !== '160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand Down Expand Up @@ -766,6 +800,9 @@
"label": "Neonatal umbilical stump not clean"
}
]
},
"hide": {
"hideWhenExpression": "babyConditionSingle !== '160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand All @@ -789,6 +826,9 @@
"label": "Yes"
}
]
},
"hide": {
"hideWhenExpression": "babyConditionSingle !== '160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
}
]
Expand Down Expand Up @@ -1022,15 +1062,15 @@
"id": "resultsGiven/",
"questionOptions": {
"concept": "164848AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
"rendering": "radio",
"answers": [
{
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "YES"
"label": "Yes"
},
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "NO"
"label": "No"
}
]
}
Expand All @@ -1041,7 +1081,7 @@
"id": "coupleCounselled",
"questionOptions": {
"concept": "bfe0cbb2-eea0-4431-a5c5-d0f49a4ed21b",
"rendering": "select",
"rendering": "radio",
"answers": [
{
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand All @@ -1060,15 +1100,15 @@
"id": "partnerTested",
"questionOptions": {
"concept": "161557AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
"rendering": "radio",
"answers": [
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
},
{
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Yes"
},
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
}
]
}
Expand Down Expand Up @@ -1135,6 +1175,7 @@
{
"label": "Was HAART for Mother given?",
"type": "obs",
"required": "true",
"id": "haartGiven",
"questionOptions": {
"concept": "163783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand Down Expand Up @@ -1191,6 +1232,7 @@
{
"label": "When did Infant come for HAART and Infant Prophylaxis and Treatment ?",
"type": "obs",
"required": "true",
"id": "haartProphylaxisTreatment",
"questionOptions": {
"concept": "166665AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand All @@ -1214,6 +1256,7 @@
"label": "AZT for the baby dispensed?",
"type": "obs",
"id": "aztDispensed",
"required": "true",
"questionOptions": {
"concept": "1282AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand All @@ -1239,6 +1282,7 @@
{
"label": "NVP for the baby dispensed?",
"type": "obs",
"required": "true",
"id": "nvpDispensed",
"questionOptions": {
"concept": "1282AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand Down Expand Up @@ -1332,15 +1376,15 @@
"id": "ironSupplimentation",
"questionOptions": {
"concept": "161004AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
"rendering": "radio",
"answers": [
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
},
{
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Yes"
},
{
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
}
]
}
Expand All @@ -1353,6 +1397,10 @@
"concept": "159921AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
"answers": [
{
"concept": "1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "None"
},
{
"concept": "1118AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Not done"
Expand All @@ -1361,10 +1409,6 @@
"concept": "127847AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Rectovaginal fistula"
},
{
"concept": "1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "None"
},
{
"concept": "49AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Vesicovaginal Fistula"
Expand Down Expand Up @@ -1443,12 +1487,12 @@
"rendering": "select",
"answers": [
{
"concept": "160652AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
"concept": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Yes"
},
{
"concept": "965AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Yes"
"concept": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "No"
}
]
}
Expand Down Expand Up @@ -1623,13 +1667,18 @@
"questionOptions": {
"concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
}
}
],
"validators": [
{
"type": "date",
"allowFutureDates": "true"
},
"validators": [
{
"type": "date",
"allowFutureDates": "true"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')",
"message": "Return to clinic date should be greater than the encounter date."
}
]
}
]
},
Expand Down

0 comments on commit 9764e61

Please sign in to comment.