Skip to content

Commit

Permalink
Merge pull request #1362 from Angie-540/POC-563a
Browse files Browse the repository at this point in the history
Poc-563a
  • Loading branch information
Alfred-Mutai authored Jan 19, 2024
2 parents 342a720 + 41da367 commit f8bbbb5
Showing 1 changed file with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -64,6 +72,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": [
Expand Down Expand Up @@ -112,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",
Expand Down Expand Up @@ -157,6 +178,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",
Expand All @@ -179,11 +205,6 @@
"type": "simple_column",
"alias": "number_of_failed_phone_attempts",
"column": "etc.counter"
},
{
"type": "simple_column",
"alias": "comments",
"column": "pre.comments"
}
],
"filters": {
Expand Down

0 comments on commit f8bbbb5

Please sign in to comment.