From 6501c2cda3981b2578dc4da60f0536ebc758628a Mon Sep 17 00:00:00 2001 From: Makombe Kennedy Date: Wed, 6 Sep 2023 13:14:11 +0300 Subject: [PATCH] LMP date should not be before date of birth (#174) Co-authored-by: Makombe --- configuration/ampathforms/Delivery.json | 5 +++++ configuration/ampathforms/HIV_Green_Card.json | 5 +++++ configuration/ampathforms/MCH-MS_Enrollment.json | 7 ++++++- configuration/ampathforms/PrEP_Follow_Up.json | 5 +++++ configuration/ampathforms/PrEP_Initial.json | 7 ++++++- configuration/ampathforms/Triage.json | 7 ++++++- 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/configuration/ampathforms/Delivery.json b/configuration/ampathforms/Delivery.json index 1b1e6624..19645e7a 100644 --- a/configuration/ampathforms/Delivery.json +++ b/configuration/ampathforms/Delivery.json @@ -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." } ] }, diff --git a/configuration/ampathforms/HIV_Green_Card.json b/configuration/ampathforms/HIV_Green_Card.json index ef78d4d4..9a325cb0 100644 --- a/configuration/ampathforms/HIV_Green_Card.json +++ b/configuration/ampathforms/HIV_Green_Card.json @@ -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": { diff --git a/configuration/ampathforms/MCH-MS_Enrollment.json b/configuration/ampathforms/MCH-MS_Enrollment.json index f40d926f..b21b621c 100644 --- a/configuration/ampathforms/MCH-MS_Enrollment.json +++ b/configuration/ampathforms/MCH-MS_Enrollment.json @@ -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." + } ] }, { diff --git a/configuration/ampathforms/PrEP_Follow_Up.json b/configuration/ampathforms/PrEP_Follow_Up.json index 961cab3e..3ef5f652 100644 --- a/configuration/ampathforms/PrEP_Follow_Up.json +++ b/configuration/ampathforms/PrEP_Follow_Up.json @@ -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": { diff --git a/configuration/ampathforms/PrEP_Initial.json b/configuration/ampathforms/PrEP_Initial.json index 669442aa..e807c23b 100644 --- a/configuration/ampathforms/PrEP_Initial.json +++ b/configuration/ampathforms/PrEP_Initial.json @@ -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'" diff --git a/configuration/ampathforms/Triage.json b/configuration/ampathforms/Triage.json index 587ac30a..ec1a6273 100644 --- a/configuration/ampathforms/Triage.json +++ b/configuration/ampathforms/Triage.json @@ -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)"