Skip to content

Commit

Permalink
cla snapshot fix filter
Browse files Browse the repository at this point in the history
  • Loading branch information
robjharrison committed Aug 22, 2024
1 parent 6f5014b commit eae222b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
1 change: 0 additions & 1 deletion cms_ssd_clone_la_deployment/bradford
Submodule bradford deleted from 59f7d1
1 change: 0 additions & 1 deletion cms_ssd_clone_la_deployment/east-sussex
Submodule east-sussex deleted from 59f7d1
1 change: 0 additions & 1 deletion cms_ssd_clone_la_deployment/knowsley
Submodule knowsley deleted from 59f7d1
Original file line number Diff line number Diff line change
Expand Up @@ -3928,6 +3928,11 @@ Status: [R]elease
Remarks: Dev: Note that <multiple> 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 <FROM ssd_development.ssd_person> 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
Expand All @@ -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"}
Expand Down
30 changes: 30 additions & 0 deletions sparse_branch_init.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 6 additions & 3 deletions tools-ssd_chat_plus/component1_cla_snapshot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ SELECT
r.clar_cla_review_cancelled,
r.clar_cla_review_participation


FROM
ssd_development.ssd_person AS p

Expand All @@ -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;
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;
2 changes: 2 additions & 0 deletions tools-ssd_chat_plus/component2_caseload_aggregation.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit eae222b

Please sign in to comment.