Skip to content

Commit

Permalink
LMP date should not be before date of birth (#174)
Browse files Browse the repository at this point in the history
Co-authored-by: Makombe <makombe>
  • Loading branch information
makombe authored Sep 6, 2023
1 parent 4f2d5eb commit 6501c2c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
5 changes: 5 additions & 0 deletions configuration/ampathforms/Delivery.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
{
"type": "date",
"allowFutureDates": "true"
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions configuration/ampathforms/HIV_Green_Card.json
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,11 @@
"type": "js_expression",
"failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day')",
"message": "LMP date should not be greater than the encounter date."
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
],
"hide": {
Expand Down
7 changes: 6 additions & 1 deletion configuration/ampathforms/MCH-MS_Enrollment.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@
"type": "js_expression",
"failsWhenExpression": "isEmpty(lmpDate) && serviceType == '1622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'",
"message": "If service type is ANC. Please provide LMP Date."
}
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
]
},
{
Expand Down
5 changes: 5 additions & 0 deletions configuration/ampathforms/PrEP_Follow_Up.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@
{
"type": "date",
"allowFutureDates": "false"
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
],
"hide": {
Expand Down
7 changes: 6 additions & 1 deletion configuration/ampathforms/PrEP_Initial.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@
{
"type": "date",
"allowFutureDates": "false"
}
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
],
"hide": {
"hideWhenExpression": "menoPausE ==='134346AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' || sex !== 'F'"
Expand Down
7 changes: 6 additions & 1 deletion configuration/ampathforms/Triage.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@
{
"type": "date",
"allowFutureDates": "false"
}
},
{
"type": "js_expression",
"failsWhenExpression": "!isEmpty(myValue) && moment(myValue).isBefore(moment(birthdate), 'day')",
"message": "LMP date should not be before the date of birth."
}
],
"hide": {
"hideWhenExpression": "sex !== 'F' || sex ==='F' && (age < 10 || age > 49)"
Expand Down

0 comments on commit 6501c2c

Please sign in to comment.