From 90ed1b3bc3e048849fd43cae3a9ea2b1f284b3f3 Mon Sep 17 00:00:00 2001 From: Saningo Lekalantula Date: Wed, 15 Nov 2023 12:44:13 +0300 Subject: [PATCH 01/11] Prep line Lists to populate data on the columns (#1338) Co-authored-by: kantush --- .../patient-list-with-contacts-template.json | 114 ++++++++++++++++++ .../new/new-for-prep-base.json | 31 ++++- 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/app/reporting-framework/json-reports/patient-list-with-contacts-template.json b/app/reporting-framework/json-reports/patient-list-with-contacts-template.json index f7ac08f90..0dc61d894 100755 --- a/app/reporting-framework/json-reports/patient-list-with-contacts-template.json +++ b/app/reporting-framework/json-reports/patient-list-with-contacts-template.json @@ -103,6 +103,14 @@ "type": "LEFT", "joinCondition": "delivery_report.person_id = t1.person_id and DATE_FORMAT(delivery_report.date_created, '%Y-%m-%d')='{startDate}'" } + }, + { + "table": "etl.flat_prep_summary_v1_1", + "alias": "fps", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = fps.person_id AND fps.next_encounter_datetime IS NULL AND fps.encounter_type NOT IN (99999)" + } } ], "columns": [ @@ -142,6 +150,112 @@ "expression": "extract(year from (from_days(datediff(now(),t1.birthdate))))" } }, + { + "type": "simple_column", + "alias": "prev_rtc_date", + "column": "date_format(fps.prev_rtc_date, '%Y-%m-%d')" + }, + { + "type": "simple_column", + "alias": "cur_prep_meds_names", + "column": "fps.cur_prep_meds_names" + }, + { + "type": "simple_column", + "alias": "rapid_test_date", + "column": "date_format(fps.hiv_rapid_test_date, '%Y-%m-%d')" + }, + { + "type": "derived_column", + "alias": "hiv_rapid_test", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "fps.hiv_rapid_test_result = 703", + "value": "Positive" + }, + { + "condition": "fps.hiv_rapid_test_result = 664", + "value": "Negative" + }, + { + "condition": "fps.hiv_rapid_test_result = 1138", + "value": "Indeterminate" + }, + { + "condition": "fps.hiv_rapid_test_result = 1304", + "value": "Poor sample quality" + }, + { + "condition": "fps.hiv_rapid_test_result = 1067", + "value": "Unknown" + } + ] + } + }, + { + "type": "derived_column", + "alias": "population_type_category", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "fps.sub_population_type = 1", + "value": "MSM" + }, + { + "condition": "fps.sub_population_type = 2", + "value": "MSW" + }, + { + "condition": "fps.sub_population_type = 3", + "value": "FSW" + }, + { + "condition": "fps.sub_population_type = 4", + "value": "IDU" + }, + { + "condition": "fps.sub_population_type = 5", + "value": "TRANS WOMAN" + }, + { + "condition": "fps.sub_population_type = 6", + "value": "TRANS MAN" + }, + { + "condition": "fps.sub_population_type = 7", + "value": "FISHER FOLK" + }, + { + "condition": "fps.sub_population_type = 8", + "value": "CSW" + }, + { + "condition": "fps.sub_population_type = 9", + "value": "DISPLACED PERSONS" + }, + { + "condition": "fps.sub_population_type = 10", + "value": "Military and other" + }, + { + "condition": "fps.sub_population_type = 12", + "value": "TRUCK/LORRY DRIVER" + }, + { + "condition": "fps.sub_population_type = 13", + "value": "NIDU" + } + ] + } + }, + { + "type": "simple_column", + "alias": "enrollment_date", + "column": "date_format(fps.enrollment_date, '%Y-%m-%d')" + }, { "type": "derived_column", "alias": "person_name", diff --git a/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json b/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json index b0880c767..aa31e79ce 100644 --- a/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json +++ b/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json @@ -43,7 +43,7 @@ { "type": "simple_column", "alias": "ccc_number", - "column": "fi.ccc" + "column": "IFNULL(fi.ccc, 'No CCC')" }, { "type": "simple_column", @@ -60,6 +60,11 @@ "alias": "age", "column": "pd.age" }, + { + "type": "simple_column", + "alias": "latest_rtc_date", + "column": "date_format(pd.rtc_date, '%Y-%m-%d')" + }, { "type": "simple_column", "alias": "location_id", @@ -76,9 +81,29 @@ "column": "l.uuid" }, { - "type": "simple_column", + "type": "derived_column", "alias": "population_type", - "column": "pd.population_type" + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "pd.population_type = 1", + "value": "discordant" + }, + { + "condition": "pd.population_type = 2", + "value": "priority" + }, + { + "condition": "pd.population_type = 3 or pd.population_type is null", + "value": "general" + }, + { + "condition": "pd.population_type = 4", + "value": "key" + } + ] + } }, { "type": "derived_column", From 135ff2f5e58e73dfab41fac188784c932f6f0bba Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:19:13 +0300 Subject: [PATCH 02/11] POC-584a (#1343) * display patient intervention status based on latest pre-follow-up form * pre.encounter --------- Co-authored-by: Drizzentic --- .../ml-weekly-predictions-base.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index f2fa4b3a7..847dff7fa 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -46,7 +46,16 @@ "alias": "pre", "join": { "type": "LEFT", - "joinCondition": "pre.person_id = ml.person_id" + "joinCondition": "pre.person_id = ml.person_id and(DATEDIFF(ml.start_date, pre.encounter_datetime) <= 7)" + } + }, + + { + "table": "( select max(is_successful_phone_follow_up) as latest_phone_follow_up, person_id, follow_up_type from etl.pre_appointment_summary group by person_id )", + "alias": "s", + "join": { + "type": "LEFT", + "joinCondition": "pre.person_id = s.person_id" } } ], @@ -180,12 +189,12 @@ }, { "filterType": "tableColumns", - "conditionExpression": "(if((pre.is_successful_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)) = ?", + "conditionExpression": "(if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)) = ?", "parameterName": "successfulOutcome" }, { "filterType": "tableColumns", - "conditionExpression": "(if((pre.is_successful_phone_follow_up = 'NO' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'NO')), 1, 0)) = ?", + "conditionExpression": "(if((latest_phone_follow_up = 'NO' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'NO')), 1, 0)) = ?", "parameterName": "failedOutcome" }, { From f39d96ebdc47358714a518420cabac8d0b72ca7b Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:46:35 +0300 Subject: [PATCH 03/11] Poc 549 (#1341) * POC-549: change TPT reminder * changed IPT to TPT --------- Co-authored-by: Drizzentic --- service/patient-reminder.service.js | 42 ++++++++--------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index f52fd9f7b..582953566 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -424,6 +424,12 @@ function TPTReminders(data) { data.inh_treatment_days_remaining < 150 ) { showReminder = true; + } else if ( + data.is_on_inh_treatment && + data.inh_treatment_days_remaining <= 30 && + data.inh_treatment_days_remaining > 0 + ) { + showReminder = true; } // INH Treatment Reminder - last month try { @@ -432,7 +438,7 @@ function TPTReminders(data) { message: 'Patient started ' + months + - ' months' + + ' months ' + treatment + ' treatment on (' + Moment(data.ipt_start_date).format('DD-MM-YYYY') + @@ -442,7 +448,7 @@ function TPTReminders(data) { '). ' + data.inh_treatment_days_remaining + ' days remaining.', - title: 'INH Treatment Reminder', + title: 'TPT Treatment Reminder', type: 'danger', display: { banner: true, @@ -453,32 +459,6 @@ function TPTReminders(data) { } catch (e) { console.log(e); } - // INH Treatment Reminder - last month - if ( - data.is_on_inh_treatment && - data.inh_treatment_days_remaining <= 30 && - data.inh_treatment_days_remaining > 0 - ) { - reminders.push({ - message: - 'Patient started ' + - months + - ' month ' + - treatment + - 'treatment since (' + - Moment(data.ipt_start_date).format('DD-MM-YYYY') + - '). Expected to end on (' + - Moment(data.ipt_completion_date).format('DD-MM-YYYY') + - ') ', - title: 'INH Treatment Reminder', - type: 'danger', - display: { - banner: true, - toast: true - } - }); - } - // TPT Reminders if ( calculateAge(data.birth_date) >= 1 && @@ -761,11 +741,11 @@ function getIptCompletionReminder(data) { message: 'Patient started ' + months + - ' month IPT on ' + + ' month TPT on ' + Moment(data.ipt_start_date).format('DD-MM-YYYY') + ' and was supposed to be completed on ' + Moment(data.ipt_start_date).add(months, 'months').format('DD-MM-YYYY'), - title: 'IPT Completion Reminder', + title: 'TPT Completion Reminder', type: 'danger', display: { banner: true, @@ -773,7 +753,7 @@ function getIptCompletionReminder(data) { } }); } else { - console.info.call('No IPT Completion Reminder For Selected Patient'); + console.info.call('No TPT Completion Reminder For Selected Patient'); } return reminders; From b87f768900e6a18fa566ec3859c2f9eca1818bba Mon Sep 17 00:00:00 2001 From: derrick rono Date: Thu, 16 Nov 2023 10:50:54 +0300 Subject: [PATCH 04/11] Revert viremia changes and add new ml locations --- programs/patient-program-config.json | 6 +++--- programs/scope-builder.service.js | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index 49deeab16..4527cb34a 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -4444,7 +4444,7 @@ { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", "display": "ADULTRETURN", - "allowedIf": "!isViremicHighVL && age > 24", + "allowedIf": "age > 24", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } @@ -4452,7 +4452,7 @@ { "uuid": "4e7553b4-373d-452f-bc89-3f4ad9a01ce7", "display": "YOUTHRETURN", - "allowedIf": "!isViremicHighVL && age >= 10 && age <= 24", + "allowedIf": "age >= 10 && age <= 24", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } @@ -4460,7 +4460,7 @@ { "uuid": "8d5b3108-c2cc-11de-8d13-0010c6dffd0f", "display": "PEDSRETURN", - "allowedIf": "!isViremicHighVL && age <= 14", + "allowedIf": "age <= 14", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } diff --git a/programs/scope-builder.service.js b/programs/scope-builder.service.js index c9e8f4dfb..60e7c3101 100755 --- a/programs/scope-builder.service.js +++ b/programs/scope-builder.service.js @@ -29,7 +29,13 @@ function buildScope(dataDictionary) { 'db2bdd7c-5fe6-4ea3-adc1-d2d8dfb3d658', '17c97881-90e5-43c8-b8a3-cc0322f89a89', 'e9f515c2-7c48-4099-ac76-41db9977f96f', - 'f7aabb83-7915-4c24-88b2-bcde8b3a9977' + 'f7aabb83-7915-4c24-88b2-bcde8b3a9977', + '08feae7c-1352-11df-a1f1-0026b9348838', + '1ce5034b-f05d-46b6-910f-fc959e091641', + '29124daf-6422-4896-b70e-daad3b252c9d', + '08fec42a-1352-11df-a1f1-0026b9348838', + 'a36c86bb-7ca3-4319-8674-28c66ba14deb', + '345514ae-8f37-42fc-9bbe-993828c2910d' ].includes(dataDictionary.intendedVisitLocationUuid); if (dataDictionary.patient) { buildPatientScopeMembers(scope, dataDictionary.patient); @@ -93,7 +99,13 @@ function buildScope(dataDictionary) { 'db2bdd7c-5fe6-4ea3-adc1-d2d8dfb3d658', '17c97881-90e5-43c8-b8a3-cc0322f89a89', 'e9f515c2-7c48-4099-ac76-41db9977f96f', - 'f7aabb83-7915-4c24-88b2-bcde8b3a9977' + 'f7aabb83-7915-4c24-88b2-bcde8b3a9977', + '08feae7c-1352-11df-a1f1-0026b9348838', + '1ce5034b-f05d-46b6-910f-fc959e091641', + '29124daf-6422-4896-b70e-daad3b252c9d', + '08fec42a-1352-11df-a1f1-0026b9348838', + 'a36c86bb-7ca3-4319-8674-28c66ba14deb', + '345514ae-8f37-42fc-9bbe-993828c2910d' ].includes(dataDictionary.intendedVisitLocationUuid); } From 00029c22e7730fef490660e5c152cff4505fe8bc Mon Sep 17 00:00:00 2001 From: Henry Korir <5462699+henrykorir@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:28:45 +0300 Subject: [PATCH 05/11] POC-583: Stop display of the Reminder To Start TPT when the Client is on TB Treatment (#1347) --- .../clinical-reminder-report.json | 30 +++++++++++++++++++ service/patient-reminder.service.js | 3 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/clinical-reminder-report.json b/app/reporting-framework/json-reports/clinical-reminder-report.json index af46abd99..4af7a002a 100644 --- a/app/reporting-framework/json-reports/clinical-reminder-report.json +++ b/app/reporting-framework/json-reports/clinical-reminder-report.json @@ -229,6 +229,36 @@ "alias": "latest_CD4_Date", "column": "ls.cd4_1_date" }, + { + "type": "simple_column", + "alias": "ipt_start_date", + "column": "ls.ipt_start_date" + }, + { + "type": "simple_column", + "alias": "ipt_stop_date", + "column": "ls.ipt_stop_date" + }, + { + "type": "simple_column", + "alias": "on_ipt", + "column": "ls.on_ipt" + }, + { + "type": "simple_column", + "alias": "ipt_completion_date", + "column": "ls.ipt_completion_date" + }, + { + "type": "simple_column", + "alias": "tb_tx_start_date", + "column": "ls.tb_tx_start_date" + }, + { + "type": "simple_column", + "alias": "tb_tx_end_date", + "column": "ls.tb_tx_end_date" + }, { "type": "simple_column", "alias": "on_tb_tx", diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index 582953566..37cac3049 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -463,7 +463,8 @@ function TPTReminders(data) { if ( calculateAge(data.birth_date) >= 1 && !data.ipt_start_date && - !data.on_tb_tx + !data.on_tb_tx && + !(data.tb_tx_start_date && !data.tb_tx_end_date) ) { reminders.push({ message: From e82f61ef10e79c3958b64bbdd48cf7397f2e627c Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:26:48 +0300 Subject: [PATCH 06/11] Added turbo new sites --- service/eid/eid-facility-mappings.json | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/service/eid/eid-facility-mappings.json b/service/eid/eid-facility-mappings.json index 5c46b9a0b..719daf228 100755 --- a/service/eid/eid-facility-mappings.json +++ b/service/eid/eid-facility-mappings.json @@ -2834,6 +2834,33 @@ "cityVillage": "", "eidDisplay": "" }, + "0cc1e6c8-69a5-4b78-932d-6170fcfb98fe": { + "mrsId": 496, + "mrsDisplay": "Bravo Module-Turbo", + "description": "Bravo Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, + "a844aa95-e9a6-416b-942b-ac07c1ef84fe": { + "mrsId": 497, + "mrsDisplay": "Maisha Module-Turbo", + "description": "Maisha Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, + "c22318da-d854-43fa-bd1e-8cb7d1d16ebf": { + "mrsId": 498, + "mrsDisplay": "Victor's Module-Turbo", + "description": "Victor's Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, "469bb74e-18a4-4d74-872e-55fcebe12dc7": { "mrsId": 328, "mrsDisplay": "Soy MCH", From e035541ec915e7198c99782ae80c3e296c552cb5 Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:53:42 +0300 Subject: [PATCH 07/11] failed follow-up attempt checks latest pre-appointment encounter (#1353) --- .../json-reports/ml-predictions/ml-weekly-predictions-base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index 847dff7fa..657e44139 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -165,7 +165,7 @@ "alias": "was_follow_up_successful", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((pre.is_successful_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" + "expression": "if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" } }, { From 73089a6c8b86ba9f805d56e61bd51c93ae1825d2 Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:12:11 +0300 Subject: [PATCH 08/11] POC-570: remove reminder after patient has made clinical visit (#1350) * remove reminder after patient has made clinical visit * POC-570: worked on query to select clinical encounters only --------- Co-authored-by: Drizzentic --- .../json-reports/clinical-reminder-report.json | 2 +- service/patient-reminder.service.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/reporting-framework/json-reports/clinical-reminder-report.json b/app/reporting-framework/json-reports/clinical-reminder-report.json index 4af7a002a..c5e0f3be0 100644 --- a/app/reporting-framework/json-reports/clinical-reminder-report.json +++ b/app/reporting-framework/json-reports/clinical-reminder-report.json @@ -222,7 +222,7 @@ { "type": "simple_column", "alias": "last_encounter_date", - "column": "ls.encounter_datetime" + "column": "t1.encounter_datetime" }, { "type": "simple_column", diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index 37cac3049..74498f2b2 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -945,7 +945,10 @@ function getFPExpiryDate(data) { function generateAppointmentNoShowUpRiskReminder(data) { let reminders = []; const predicted_score = (data.predicted_prob_disengage * 100).toFixed(2); - if (data.predicted_risk) { + if ( + data.predicted_risk && + data.last_encounter_date < data.prediction_generated_date + ) { if (data.predicted_risk === 'Medium Risk') { reminders.push({ message: From d5628163dc57ae5c8d3440c8549966200d396b6c Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:35:26 +0300 Subject: [PATCH 09/11] POC-492: added query to track failed phone attempts (#1340) * POC-492: added query to track failed phone attempts * added query to indicate number of failed phone attempts within prediction cycle * POC-492:added query to indicate number of failed phone attempts within prediction cycle --------- Co-authored-by: Drizzentic --- .../ml-predictions/ml-weekly-predictions-base.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index 657e44139..39d5293e8 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -49,7 +49,6 @@ "joinCondition": "pre.person_id = ml.person_id and(DATEDIFF(ml.start_date, pre.encounter_datetime) <= 7)" } }, - { "table": "( select max(is_successful_phone_follow_up) as latest_phone_follow_up, person_id, follow_up_type from etl.pre_appointment_summary group by person_id )", "alias": "s", @@ -57,6 +56,14 @@ "type": "LEFT", "joinCondition": "pre.person_id = s.person_id" } + }, + { + "table": "(SELECT et.person_id, SUM(CASE WHEN et.is_successful_phone_follow_up = 'YES' THEN 0 WHEN et.is_successful_phone_follow_up = 'NO' THEN 1 ELSE 0 END) AS counter FROM etl.pre_appointment_summary et left join predictions.ml_weekly_predictions mwl on et.person_id = mwl.person_id WHERE et.encounter_datetime BETWEEN mwl.prediction_generated_date AND DATE_ADD(mwl.prediction_generated_date, INTERVAL 14 DAY) GROUP BY et.person_id)", + "alias": "etc", + "join": { + "type": "LEFT", + "joinCondition": "ml.person_id = etc.person_id" + } } ], "columns": [ @@ -168,6 +175,11 @@ "expression": "if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" } }, + { + "type": "simple_column", + "alias": "number_of_failed_phone_attempts", + "column": "etc.counter" + }, { "type": "simple_column", "alias": "comments", From 7f7578e2b2d917534ac925a5f9e3971f5fe5b9b6 Mon Sep 17 00:00:00 2001 From: Saningo Lekalantula Date: Wed, 29 Nov 2023 13:04:17 +0300 Subject: [PATCH 10/11] POC-560 (#1335) * Validate ART Preparion Form * Add validation in art prepartion form for Adult, Youth and Ped clients --------- Co-authored-by: kantush Co-authored-by: Drizzentic --- programs/patient-program-config.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index 4527cb34a..0a04af3f0 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -125,6 +125,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "61ad56ae-a2c3-4ddb-a351-8c8ae253378c", + "display": "ADULTARTPREPARATION" } ] }, @@ -319,6 +323,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "bda00ff3-c811-4223-a602-3eb31c96d1f2", + "display": "PEDARTPREPARATION" } ] }, @@ -498,6 +506,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "a400ea27-7052-4745-b51f-d9370aaef4dc", + "display": "YOUTHARTPREPARATION" } ] }, From 0a6e1cb170fe107ef0c288a412e9f37b7fb46536 Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:03:13 +0300 Subject: [PATCH 11/11] added reminders for patients who wish to reschedule appointments (#1349) Co-authored-by: Drizzentic --- .../clinical-reminder-report.json | 18 +++++++++++ service/patient-reminder.service.js | 31 +++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/app/reporting-framework/json-reports/clinical-reminder-report.json b/app/reporting-framework/json-reports/clinical-reminder-report.json index c5e0f3be0..5b738f5f1 100644 --- a/app/reporting-framework/json-reports/clinical-reminder-report.json +++ b/app/reporting-framework/json-reports/clinical-reminder-report.json @@ -79,6 +79,14 @@ "joinCondition": "mwl.person_id = t1.person_id" } }, + { + "table": "etl.pre_appointment_summary", + "alias": "pre_s", + "join": { + "type": "left", + "joinCondition": "mwl.person_id = pre_s.person_id " + } + }, { "table": "amrs.relationship", "alias": "t6", @@ -335,6 +343,16 @@ "alias": "prediction_generated_date", "column": "mwl.prediction_generated_date" }, + { + "type": "simple_column", + "alias": "reschedule_appointment", + "column": "pre_s.reschedule_appointment" + }, + { + "type": "simple_column", + "alias": "rescheduled_date", + "column": "pre_s.rescheduled_date" + }, { "type": "simple_column", "alias": "test_date", diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index 74498f2b2..06932baeb 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -985,8 +985,27 @@ function generateAppointmentNoShowUpRiskReminder(data) { return reminders; } +function generateAppointmentRescheduledReminder(data) { + let reminders = []; + if (data.reschedule_appointment && data.reschedule_appointment === 'YES') { + if (data.last_encounter_date < data.prediction_generated_date) { + reminders.push({ + message: + 'Promised to come date is ' + + Moment(data.rescheduled_date).format('DD-MM-YYYY'), + title: 'Appointment reschedule request', + type: 'ml', + display: { + banner: true, + toast: true + } + }); + } + } + return reminders; +} + async function generateReminders(etlResults, eidResults) { - // console.log('REMINDERS generateReminders'); let reminders = []; let patientReminder; if (etlResults && etlResults.length > 0) { @@ -1028,6 +1047,9 @@ async function generateReminders(etlResults, eidResults) { let appointmentNoShowUpRiskReminder = generateAppointmentNoShowUpRiskReminder( data ); + let appointmentRescheduledRiskReminder = generateAppointmentRescheduledReminder( + data + ); let currentReminder = []; if (pending_vl_lab_result.length > 0) { @@ -1056,8 +1078,11 @@ async function generateReminders(etlResults, eidResults) { reminders = reminders.concat(currentReminder); - // Add appointment no show up risk reminder - reminders = reminders.concat(appointmentNoShowUpRiskReminder); + // Add appointment no show up risk reminder and + reminders = reminders.concat( + appointmentNoShowUpRiskReminder, + appointmentRescheduledRiskReminder + ); patientReminder.reminders = reminders; return patientReminder;