Skip to content

Commit

Permalink
Adding of required fields and date validations (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckote authored Sep 6, 2023
1 parent 2710dd7 commit 4b3697b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
13 changes: 12 additions & 1 deletion configuration/ampathforms/Enhanced_Adherence_Screening.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@
"questionOptions": {
"concept": "164891AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
}
},
"validators": [
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(myValue)).isAfter((new moment(encDate)), 'day')",
"message": "First session date should not be after encounter date"
}
]
},
{
"label": "Pill count adherence % (from pill count):",
Expand Down
3 changes: 0 additions & 3 deletions configuration/ampathforms/HIV_Discontinuation.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
"concept": "1543AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"rendering": "date"
},
"hide": {
"hideWhenExpression": "isEmpty(idReason) || idReason !== '160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'"
},
"validators": [
{
"type": "date",
Expand Down
4 changes: 2 additions & 2 deletions configuration/ampathforms/HIV_Enrollment.json
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@
]
},
"hide": {
"hideWhenExpression": "patientType === '4bd29eed-e486-426d-a2b6-7e5bb75319f6' || patientType === '159833AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patientType === '164144AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patient.gender !== 'F'"
"hideWhenExpression": "patientType === '4bd29eed-e486-426d-a2b6-7e5bb75319f6' || patientType === '159833AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patientType === '164144AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || sex !== 'F'"
}
},
{
Expand All @@ -1236,7 +1236,7 @@
]
},
"hide": {
"hideWhenExpression": "patientType === '4bd29eed-e486-426d-a2b6-7e5bb75319f6' || patientType === '159833AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patientType === '164144AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patient.gender !== 'F'"
"hideWhenExpression": "patientType === '4bd29eed-e486-426d-a2b6-7e5bb75319f6' || patientType === '159833AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || patientType === '164144AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || sex !== 'F'"
}
},
{
Expand Down
4 changes: 0 additions & 4 deletions configuration/ampathforms/HTS_Eligibility_Screening.json
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,6 @@
{
"concept": "0",
"label": "No"
},
{
"concept": "162570AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"label": "Declined to answer"
}
]
},
Expand Down
11 changes: 11 additions & 0 deletions configuration/ampathforms/KP_Clinical_Enrollment.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
{
"label": "Have you been contacted by a peer educator for health services?",
"type": "obs",
"required": "true",
"id": "peerEducator",
"questionOptions": {
"concept": "d83bca86-6734-4b26-b67c-c2133948fbac",
Expand All @@ -72,6 +73,7 @@
{
"label": "Do you have a regular(Non-Paying) sexual partner?",
"type": "obs",
"required": "true",
"id": "regularSexPartner",
"questionOptions": {
"concept": "0d2f24cd-0bd9-4159-b71d-a92f2c11a396",
Expand Down Expand Up @@ -161,6 +163,7 @@
{
"label": "Ever experienced sexual violence?",
"type": "obs",
"required": "true",
"id": "expriencedSexViolence",
"questionOptions": {
"concept": "123160AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand All @@ -180,6 +183,7 @@
{
"label": "Ever experienced physical violence?",
"type": "obs",
"required": "true",
"id": "expriencedPhysicalViolence",
"questionOptions": {
"concept": "81bbc312-d0f6-4950-822a-f7a47e599013",
Expand All @@ -205,6 +209,7 @@
{
"label": "Have you ever been tested for HIV?",
"type": "obs",
"required": "true",
"id": "everTested",
"questionOptions": {
"concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand All @@ -224,6 +229,7 @@
{
"label": "The last time you received HIV testing, how did you test?",
"type": "obs",
"required": "true",
"id": "testType",
"questionOptions": {
"concept": "d85ff219-0f5a-408d-8df0-96bcc9be5071",
Expand All @@ -247,6 +253,7 @@
{
"label": "Would you like to share your LAST test result with me? (circle the number)",
"type": "obs",
"required": "true",
"id": "shareTest",
"questionOptions": {
"concept": "193d9d3b-d1c5-42f6-b44d-0c1905940c73",
Expand Down Expand Up @@ -274,6 +281,7 @@
{
"label": "Are you willing to be tested for HIV?",
"type": "obs",
"required": "true",
"id": "willingTester",
"questionOptions": {
"concept": "9255b7a2-9924-41ce-8e70-7813fe5ca59a",
Expand All @@ -297,6 +305,7 @@
{
"label": "Reason:",
"type": "obs",
"required": "true",
"id": "declineReason",
"questionOptions": {
"concept": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand All @@ -316,6 +325,7 @@
{
"label": "Are you receiving HIV care?",
"type": "obs",
"required": "true",
"id": "receivingCare",
"questionOptions": {
"concept": "159811AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
Expand Down Expand Up @@ -431,6 +441,7 @@
{
"label": "In case you are due for clinical services, could we contact you?",
"type": "obs",
"required": "true",
"id": "contactedIncaseAppointment",
"questionOptions": {
"concept": "722aaeee-d839-41aa-9f4e-b1a759cf02c3",
Expand Down
6 changes: 3 additions & 3 deletions configuration/ampathforms/KP_Contact.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@
},
{
"type": "js_expression",
"failsWhenExpression": "moment(birthdate).isBefore(moment(myValue), 'day')",
"failsWhenExpression": "moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "Should not be less than the date of birth."
}
]
Expand All @@ -626,7 +626,7 @@
},
{
"type": "js_expression",
"failsWhenExpression": "moment(birthdate).isBefore(moment(myValue), 'day')",
"failsWhenExpression": "moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "Should not be less than the date of birth."
}
],
Expand All @@ -648,7 +648,7 @@
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(birthdate)).isBefore((new moment(myValue)), 'day')",
"failsWhenExpression": "moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "Should not be less than the date of birth."
}
],
Expand Down
4 changes: 0 additions & 4 deletions configuration/ampathforms/OTZ_Discontinuation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isAfter((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')"
}
]
},
Expand Down

0 comments on commit 4b3697b

Please sign in to comment.