From 9d5fa3c5ab3d2fe2cdb3bccb2f4be32af66b2184 Mon Sep 17 00:00:00 2001 From: Angie-540 Date: Fri, 12 Jan 2024 16:28:44 +0300 Subject: [PATCH 1/2] added sms outcome column --- .../ml-predictions/ml-weekly-predictions-base.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 39d5293e8..89b9728a2 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 @@ -64,6 +64,14 @@ "type": "LEFT", "joinCondition": "ml.person_id = etc.person_id" } + }, + { + "table": "(SELECT ps.* FROM etl.pre_appointment_summary ps JOIN ( SELECT MAX(encounter_datetime) AS max_encounter_datetime, person_id FROM etl.pre_appointment_summary GROUP BY person_id ) latest_dates ON ps.encounter_datetime = latest_dates.max_encounter_datetime AND ps.person_id = latest_dates.person_id)", + "alias": "utd", + "join": { + "type": "LEFT", + "joinCondition": "ml.person_id = utd.person_id" + } } ], "columns": [ @@ -157,6 +165,11 @@ "alias": "was_client_found", "column": "pre.was_client_found" }, + { + "type": "simple_column", + "alias": "comments", + "column": "utd.comments" + }, { "type": "simple_column", "alias": "reason_client_not_found", From 41da367ceaeb018decaa6576112004b4c94ec2e7 Mon Sep 17 00:00:00 2001 From: Angie-540 Date: Thu, 18 Jan 2024 12:28:06 +0300 Subject: [PATCH 2/2] added sms outcome column --- .../ml-weekly-predictions-base.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 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 89b9728a2..4dae9b4fc 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,6 +49,14 @@ "joinCondition": "pre.person_id = ml.person_id and(DATEDIFF(ml.start_date, pre.encounter_datetime) <= 7)" } }, + { + "table": "etl.sms_delivery_report", + "alias": "sm", + "join": { + "type": "LEFT", + "joinCondition": "sm.person_id = pre.person_id" + } + }, { "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", @@ -120,6 +128,11 @@ "alias": "prediction_generated_date", "column": "DATE_FORMAT(ml.prediction_generated_date,'%Y-%m-%d')" }, + { + "type": "simple_column", + "alias": "sms_delivery_status", + "column": "sm.delivery_status" + }, { "type": "simple_column", "alias": "rtc_date", @@ -192,11 +205,6 @@ "type": "simple_column", "alias": "number_of_failed_phone_attempts", "column": "etc.counter" - }, - { - "type": "simple_column", - "alias": "comments", - "column": "pre.comments" } ], "filters": {