From eae222bc449e6b35ba78a9fab5fc1722c076c85d Mon Sep 17 00:00:00 2001 From: Rob Harrison <48765695+robjharrison@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:09:05 +0000 Subject: [PATCH] cla snapshot fix filter --- cms_ssd_clone_la_deployment/bradford | 1 - cms_ssd_clone_la_deployment/east-sussex | 1 - cms_ssd_clone_la_deployment/knowsley | 1 - ...iquidlogic_sqlserver_v1.2.1_1_20240812.sql | 7 ++++- sparse_branch_init.sh | 30 +++++++++++++++++++ .../component1_cla_snapshot.sql | 9 ++++-- .../component2_caseload_aggregation.sql | 2 ++ 7 files changed, 44 insertions(+), 7 deletions(-) delete mode 160000 cms_ssd_clone_la_deployment/bradford delete mode 160000 cms_ssd_clone_la_deployment/east-sussex delete mode 160000 cms_ssd_clone_la_deployment/knowsley create mode 100644 sparse_branch_init.sh diff --git a/cms_ssd_clone_la_deployment/bradford b/cms_ssd_clone_la_deployment/bradford deleted file mode 160000 index 59f7d18..0000000 --- a/cms_ssd_clone_la_deployment/bradford +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59f7d1804a4d873c3a81dd95c820b9b93bb2e940 diff --git a/cms_ssd_clone_la_deployment/east-sussex b/cms_ssd_clone_la_deployment/east-sussex deleted file mode 160000 index 59f7d18..0000000 --- a/cms_ssd_clone_la_deployment/east-sussex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59f7d1804a4d873c3a81dd95c820b9b93bb2e940 diff --git a/cms_ssd_clone_la_deployment/knowsley b/cms_ssd_clone_la_deployment/knowsley deleted file mode 160000 index 59f7d18..0000000 --- a/cms_ssd_clone_la_deployment/knowsley +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59f7d1804a4d873c3a81dd95c820b9b93bb2e940 diff --git a/cms_ssd_extract_sql/systemc/live/liquidlogic_sqlserver_v1.2.1_1_20240812.sql b/cms_ssd_extract_sql/systemc/live/liquidlogic_sqlserver_v1.2.1_1_20240812.sql index ce0ac5d..446ddbc 100644 --- a/cms_ssd_extract_sql/systemc/live/liquidlogic_sqlserver_v1.2.1_1_20240812.sql +++ b/cms_ssd_extract_sql/systemc/live/liquidlogic_sqlserver_v1.2.1_1_20240812.sql @@ -3928,6 +3928,11 @@ Status: [R]elease Remarks: Dev: Note that refs to ssd_person need changing when porting code to tempdb.. versions. Dev: Ensure index on ssd_person.pers_person_id is intact to ensure performance on references in the CTEs(added for performance) Dev: Revised V3/4 to aid performance on large involvements table aggr + + This table the cohort of children who are preparing to leave care, typically 15/16/17yrs+; + Not those who are finishing a period of care. + clea_care_leaver_eligibility == LAC for 13wks+(since 14yrs)+LAC since 16yrs + Dependencies: - FACT_INVOLVEMENTS - FACT_CLA_CARE_LEAVERS @@ -3951,7 +3956,7 @@ CREATE TABLE ssd_development.ssd_care_leavers ( clea_table_id NVARCHAR(48) PRIMARY KEY, -- metadata={"item_ref":"CLEA001A"} clea_person_id NVARCHAR(48), -- metadata={"item_ref":"CLEA002A"} - clea_care_leaver_eligibility NVARCHAR(100), -- metadata={"item_ref":"CLEA003A"} + clea_care_leaver_eligibility NVARCHAR(100), -- metadata={"item_ref":"CLEA003A", "info":"LAC for 13wks(since 14yrs)+LAC since 16yrs"} clea_care_leaver_in_touch NVARCHAR(100), -- metadata={"item_ref":"CLEA004A"} clea_care_leaver_latest_contact DATETIME, -- metadata={"item_ref":"CLEA005A"} clea_care_leaver_accommodation NVARCHAR(100), -- metadata={"item_ref":"CLEA006A"} diff --git a/sparse_branch_init.sh b/sparse_branch_init.sh new file mode 100644 index 0000000..e6dd0ad --- /dev/null +++ b/sparse_branch_init.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# chmod +x sparse_branch.sh +# This not yet set up to iterate over LAs + +cd .. + +# # Rem +# rm -rf ssd-deployment + +# Clone +git clone https://github.com/data-to-insight/ssd-deployment.git + +cd ssd-deployment + +# create la deployment folders +mkdir -p bradford/cms_ssd_extract_sql/systemc/live/ + +# cp extracts over +cp -r ../cms_ssd_extract_sql/systemc/live/* bradford/cms_ssd_extract_sql/systemc/live/ + +# cp key markdown files +cp ../CHANGELOG.md ../CONTRIBUTORS.md ../README.md bradford/ + +# to git staging +git add bradford/cms_ssd_extract_sql/systemc/live/ +git add bradford/CHANGELOG.md bradford/CONTRIBUTORS.md bradford/README.md + +git commit -m "Manual import of files from ssd-data-model-init test" + +git push origin main diff --git a/tools-ssd_chat_plus/component1_cla_snapshot.sql b/tools-ssd_chat_plus/component1_cla_snapshot.sql index d32715c..bd0de77 100644 --- a/tools-ssd_chat_plus/component1_cla_snapshot.sql +++ b/tools-ssd_chat_plus/component1_cla_snapshot.sql @@ -129,7 +129,6 @@ SELECT r.clar_cla_review_cancelled, r.clar_cla_review_participation - FROM ssd_development.ssd_person AS p @@ -143,6 +142,10 @@ LEFT JOIN RecentHealthCheck AS hc ON p.pers_person_id = hc.clah_person_id AND hc.rn = 1 LEFT JOIN RecentVisit AS v ON p.pers_person_id = v.clav_person_id AND v.rn = 1 - LEFT JOIN - RecentReview AS r ON cla.clae_cla_id = r.clar_cla_id AND r.rn = 1; \ No newline at end of file + RecentReview AS r ON cla.clae_cla_id = r.clar_cla_id AND r.rn = 1 + +-- join to ssd_cin_episodes towards filter for active episodes, cine_close_date being NULL +JOIN + ssd_development.ssd_cin_episodes AS cine ON p.pers_person_id = cine.cine_person_id + AND cine.cine_close_date IS NULL; diff --git a/tools-ssd_chat_plus/component2_caseload_aggregation.sql b/tools-ssd_chat_plus/component2_caseload_aggregation.sql index 87886cf..83dcb70 100644 --- a/tools-ssd_chat_plus/component2_caseload_aggregation.sql +++ b/tools-ssd_chat_plus/component2_caseload_aggregation.sql @@ -1,4 +1,6 @@ +Use HDM_Local; + /* Caseload count by Team only */ SELECT ISNULL(d.dept_team_name, 'Unassigned') AS TeamName, -- NULL Team vals become unassigned