Skip to content

Commit

Permalink
adding modified flyway datA
Browse files Browse the repository at this point in the history
  • Loading branch information
robertandremitchell committed Oct 28, 2024
1 parent 9f770ab commit 395e5c6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions query-connector/flyway/sql/V01_02__load_tcr_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -175312,3 +175312,4 @@ INSERT INTO icd_crosswalk VALUES('81590','Z993','V463','00000');
INSERT INTO icd_crosswalk VALUES('81591','Z9981','V462','00000');
INSERT INTO icd_crosswalk VALUES('81592','Z9989','V468','10000');
INSERT INTO icd_crosswalk VALUES('81593','Z9989','V469','10000');

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSERT INTO conditions VALUES('1','DIBBs Local Code System','Newborn Screening','20240909');
INSERT INTO conditions VALUES('2','DIBBs Local Code System','Cancer (Leukemia)','20240909');
INSERT INTO conditions VALUES('3','DIBBs Local Code System','Social Determinants of Health','20240909'); -- has no valuesets
INSERT INTO conditions VALUES('3','DIBBs Local Code System','Social Determinants of Health','20240909');

-- Newborn Screening valueset(s)
INSERT INTO valuesets VALUES('1_20240909','1','20240909','Newborn Screening','DIBBs','lotc');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- Insert hardcoded values for Social Determinants of Health
INSERT INTO valuesets VALUES('17_20241028','17','20241028','Social Determinants of Health','DIBBs','lrtc');

-- Add SDOH concepts related to housing
INSERT INTO concepts VALUES('1_71802-3','71802-3','http://loinc.org','Housing status','','2024-10');

-- These 3 are already in the data
-- INSERT INTO concepts VALUES('1_11350-6','11350-6','http://loinc.org','History of Sexual behavior Narrative','','2024-10');
-- INSERT INTO concepts VALUES('1_82810-3','82810-3','http://loinc.org','Pregnancy status','','2024-10'); --already in the data
-- INSERT INTO concepts VALUES('1_83317-8','83317-8','http://loinc.org','Sexual activity with anonymous partner in the past year','','2024-10');

-- Add SDOH as valueset belonging to SDOH condition
INSERT INTO condition_to_valueset VALUES('1530','1','17_20241028','DIBBs');

-- Add SDOH "labs" valueset to concept mappings
INSERT INTO valueset_to_concept VALUES('45507','17_20241028','1_71802-3');
INSERT INTO valueset_to_concept VALUES('45508','17_20241028','1_11350-6');
INSERT INTO valueset_to_concept VALUES('45509','17_20241028','1_82810-3');
INSERT INTO valueset_to_concept VALUES('45510','17_20241028','1_83317-8');

-- Insert relevant query data
-- Map the new valueset to the SDOH query & get the newly created id
WITH inserted AS (
INSERT INTO query_to_valueset (id, query_id, valueset_id, valueset_oid)
VALUES (
uuid_generate_v4(),
(SELECT id FROM query WHERE query_name = 'Social Determinants of Health'),
'17_20241028',
'17'
)
RETURNING id
)
-- Insert the concepts from the valueset into the query_included_concepts table
INSERT INTO query_included_concepts (id, query_by_valueset_id, concept_id, include)
SELECT
uuid_generate_v4(),
(SELECT id FROM inserted),
concept_id,
true
FROM valueset_to_concept
WHERE valueset_id = '17_20241028';

0 comments on commit 395e5c6

Please sign in to comment.