Skip to content

Commit

Permalink
Changes include mandatory fields & date validation (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckote authored Sep 5, 2023
1 parent 56c7e95 commit 23b5514
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 15 deletions.
53 changes: 49 additions & 4 deletions configuration/ampathforms/HIV_Discontinuation.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
"questionOptions": {
"rendering": "ui-select-extended"
},
"id": "encDate"
"id": "encDate",
"validators": [
{
"type": "date",
"allowFutureDates": "false"
}
]
},
{
"label": "Provider:",
Expand Down Expand Up @@ -55,6 +61,7 @@
"label": "Effective discontinuation date",
"type": "obs",
"id": "discontinueDate",
"required": "true",
"questionOptions": {
"concept": "164384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
Expand All @@ -63,13 +70,19 @@
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day'))",
"message": "Discontinuation Date should not be greater than the encounter date."
}
]
},
{
"label": "Reason:",
"type": "obs",
"id": "idReason",
"required": "true",
"questionOptions": {
"concept": "161555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
Expand Down Expand Up @@ -120,13 +133,22 @@
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day'))",
"message": "Date client died should not be greater than the encounter date."
}
]
],
"hide": {
"hideWhenExpression": "isEmpty(idReason) || idReason !== '160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
"label": "Death reason:",
"type": "obs",
"id": "deathReason",
"required": "true",
"questionOptions": {
"concept": "1599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "select",
Expand Down Expand Up @@ -168,6 +190,7 @@
{
"label": "Specific cause of death:",
"type": "obs",
"required": "true",
"id": "specificCauseOfDeath",
"questionOptions": {
"concept": "1748AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand Down Expand Up @@ -313,7 +336,18 @@
},
"hide": {
"hideWhenExpression": "isEmpty(idReason) || idReason !== '159492AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
"validators": [
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day'))",
"message": "Date transferred out should not be greater than the encounter date."
}
]
},
{
"label": "Transfer out verified?",
Expand Down Expand Up @@ -347,7 +381,18 @@
},
"hide": {
"hideWhenExpression": "isEmpty(idReason) || (trVerifiedObs !== '1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && trVerifiedObs !== '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') || trVerifiedObs === '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
"validators": [
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day'))",
"message": "Date verified should not be greater than the encounter date."
}
]
}
]
}
Expand Down
8 changes: 8 additions & 0 deletions configuration/ampathforms/HTS_Eligibility_Screening.json
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@
"label": "Traditional /non-medical procedures e.g. scarification, plastic tooth extraction, Circumcision, uvulectomy etc",
"type": "obs",
"id": "__tDI8Dp4Ly",
"required": "true",
"questionOptions": {
"concept": "166365AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand Down Expand Up @@ -1231,6 +1232,7 @@
"label": "Has the client recently experienced GBV?",
"type": "obs",
"id": "experiencedGbv",
"required": "true",
"questionOptions": {
"concept": "167161AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand Down Expand Up @@ -1434,6 +1436,7 @@
"label": "Has the client been screened for TB?",
"type": "obs",
"id": "screenedTB",
"required": "true",
"questionOptions": {
"concept": "cddbf6fe-4bcd-40b6-a7ea-8573e4080192",
"rendering": "radio",
Expand Down Expand Up @@ -1554,6 +1557,7 @@
"label": "Client currently pregnant?",
"type": "obs",
"id": "preGnant",
"required": "true",
"questionOptions": {
"concept": "5272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand Down Expand Up @@ -1666,6 +1670,7 @@
"label": "Did you recommend HIV testing?",
"type": "obs",
"id": "reCommeNHiVtest",
"required": "true",
"questionOptions": {
"concept": "167229AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand All @@ -1688,6 +1693,7 @@
"label": "Why did you recommend testing?",
"type": "obs",
"id": "ReasonOnE",
"required": "true",
"questionOptions": {
"concept": "164082AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand All @@ -1714,6 +1720,7 @@
"label": "Why did you not recommend testing?",
"type": "obs",
"id": "ReasonTwO",
"required": "true",
"questionOptions": {
"concept": "160416AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand All @@ -1740,6 +1747,7 @@
"label": "Client referred for testing :",
"type": "obs",
"id": "clientReferred",
"required": "true",
"questionOptions": {
"concept": "162699AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "radio",
Expand Down
8 changes: 5 additions & 3 deletions configuration/ampathforms/HTS_Initial.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@
},
"id": "willingToShareResults",
"hide": {
"hideWhenExpression": "isEmpty(selfTestLastTwelveMonths) || selfTestLastTwelveMonths != '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
"hideWhenExpression": "isEmpty(selfTestLastTwelveMonths) || selfTestLastTwelveMonths !== '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand All @@ -576,7 +576,7 @@
},
"id": "selfTestResults",
"hide": {
"hideWhenExpression": "isEmpty(willingToShareResults) || willingToShareResults != '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
"hideWhenExpression": "isEmpty(willingToShareResults) || willingToShareResults !== '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand All @@ -594,7 +594,7 @@
}
],
"hide": {
"hideWhenExpression": "isEmpty(willingToShareResults) || willingToShareResults != '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
"hideWhenExpression": "isEmpty(willingToShareResults) || willingToShareResults !== '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
}
]
Expand Down Expand Up @@ -827,6 +827,7 @@
]
},
"id": "htsFacilityEntryPoint",
"required": "true",
"hide": {
"hideWhenExpression": "isEmpty(htsSetting) || htsSetting != '1537AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
Expand Down Expand Up @@ -857,6 +858,7 @@
]
},
"id": "htsCommunityEntryPoint",
"required": "true",
"hide": {
"hideWhenExpression": "isEmpty(htsSetting) || htsSetting != '163488AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
Expand Down
6 changes: 5 additions & 1 deletion configuration/ampathforms/HTS_Retest.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@
}
]
},
"id": "htsApproach"
"id": "htsApproach",
"required": "true"
}
]
},
Expand Down Expand Up @@ -827,6 +828,7 @@
]
},
"id": "htsFacilityEntryPoint",
"required": "true",
"hide": {
"hideWhenExpression": "isEmpty(htsSetting) || htsSetting != '1537AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
Expand Down Expand Up @@ -857,6 +859,7 @@
]
},
"id": "htsCommunityEntryPoint",
"required": "true",
"hide": {
"hideWhenExpression": "isEmpty(htsSetting) || htsSetting != '163488AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
Expand Down Expand Up @@ -1298,6 +1301,7 @@
]
},
"id": "resultsGiven",
"required": "true",
"validators": [],
"hide": {
"hideWhenExpression": "isEmpty(consentGiven) || consentGiven !== 'true'"
Expand Down
8 changes: 4 additions & 4 deletions configuration/ampathforms/KP_Clinical_Enrollment.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'day')",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'year')",
"message": "Should not be less than the date of birth."
}
]
Expand All @@ -127,7 +127,7 @@
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'day')",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'year')",
"message": "Should not be less than the date of birth."
}
],
Expand All @@ -149,12 +149,12 @@
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'day')",
"failsWhenExpression": "(new moment(birthdate)).isAfter((new moment(myValue)), 'year')",
"message": "Should not be less than the date of birth."
}
],
"hide": {
"hideWhenExpression": "keyPopTypeFemale !=='642945a8-045a-4010-b3f3-bc50aaaab386' && keyPopTypeMale !== '642945a8-045a-4010-b3f3-bc50aaaab386' || keyPopTypeFemale !=='105AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && keyPopTypeMale !== '105AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' "
"hideWhenExpression": "keyPopTypeFemale !=='642945a8-045a-4010-b3f3-bc50aaaab386' && keyPopTypeMale !== '642945a8-045a-4010-b3f3-bc50aaaab386' || keyPopTypeFemale !=='105AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && keyPopTypeMale !== '105AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
}
},
{
Expand Down
5 changes: 5 additions & 0 deletions configuration/ampathforms/KP_Contact.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"label": "Patient Type?",
"type": "obs",
"id": "patientType",
"required": "true",
"questionOptions": {
"concept": "423c034e-14ac-4243-ae75-80d1daddce55",
"rendering": "radio",
Expand Down Expand Up @@ -396,6 +397,7 @@
"label": "Implementation county",
"type": "obs",
"id": "county",
"required": "true",
"questionOptions": {
"concept": "167131AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "text"
Expand All @@ -405,6 +407,7 @@
"label": "Implementation sub-county",
"type": "obs",
"id": "subCounty",
"required": "true",
"questionOptions": {
"concept": "161551AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "text"
Expand All @@ -414,6 +417,7 @@
"label": "Implementation ward",
"type": "obs",
"id": "ward",
"required": "true",
"questionOptions": {
"concept": "161550AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "text"
Expand Down Expand Up @@ -484,6 +488,7 @@
"label": "Hot spot mostly frequented",
"type": "obs",
"id": "hotspotFrequented",
"required": "true",
"questionOptions": {
"concept": "07944782-2ad1-4319-b3bd-b5acd097a328",
"rendering": "text"
Expand Down
1 change: 1 addition & 0 deletions configuration/ampathforms/MCH_Postnatal_Visit.json
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@
"label": "Next appointment date:",
"type": "obs",
"id": "returnVisitDate",
"required": "true",
"questionOptions": {
"concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
Expand Down
7 changes: 4 additions & 3 deletions configuration/ampathforms/VMMC_Enrollment.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"isExpanded": "true",
"questions": [
{
"label": "Date:",
"label": "Encounter Date:",
"type": "encounterDatetime",
"questionOptions": {
"rendering": "ui-select-extended"
Expand All @@ -36,7 +36,7 @@
"id": "encDate"
},
{
"label": "Provider:",
"label": "VMMC Enrollment Provider:",
"type": "encounterProvider",
"questionOptions": {
"rendering": "ui-select-extended"
Expand Down Expand Up @@ -180,7 +180,8 @@
"rendering": "text",
"concept": "167131AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
"id": "county"
"id": "county",
"required": "true"
}
]
}
Expand Down

0 comments on commit 23b5514

Please sign in to comment.