Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rob/61 create social determinants of health custom query #78

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions query-connector/e2e/alternate_queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ test.describe("alternate queries with the Query Connector", () => {
await expect(
page.getByRole("heading", { name: "Select a query" }),
).toBeVisible();
// await page.getByTestId("Select").selectOption("social-determinants");
await page.getByTestId("Select").selectOption("cancer");
await page.getByTestId("Select").selectOption("social-determinants");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

Expand Down
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';
9 changes: 4 additions & 5 deletions query-connector/src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ export const demoQueryOptions = [
{ value: "chlamydia", label: "Chlamydia case investigation" },
{ value: "gonorrhea", label: "Gonorrhea case investigation" },
{ value: "newborn-screening", label: "Newborn screening follow-up" },
// Temporarily remove social determinants
// {
// value: "social-determinants",
// label: "Gather social determinants of health",
// },
{
value: "social-determinants",
label: "Gather social determinants of health",
},
{ value: "syphilis", label: "Syphilis case investigation" },
];

Expand Down
Loading