Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Aug 20, 2024
1 parent 89821ec commit f3efef7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

### Checklist
- [ ] Consider if documentation (like in `docs/`) needs to be updated
- [ ] Consider if documentation (like in `docs/`, or if you've changed the structure of a table) needs to be updated
- [ ] Consider if tests should be added
- [ ] Update template repo if there are changes to study configuration
22 changes: 11 additions & 11 deletions cumulus_library/studies/core/reference_sql/builder_condition.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CREATE TABLE core__condition_dn_category AS (
s.row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand Down Expand Up @@ -66,7 +66,7 @@ CREATE TABLE core__condition_dn_clinical_status AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand Down Expand Up @@ -131,7 +131,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -147,7 +147,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'1' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -163,7 +163,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'2' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -179,7 +179,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'3' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -195,7 +195,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'4' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -211,7 +211,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'5' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand All @@ -227,7 +227,7 @@ CREATE TABLE core__condition_codable_concepts_display AS (
'6' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand Down Expand Up @@ -351,7 +351,7 @@ CREATE TABLE core__condition_codable_concepts_all AS (
0 AS row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand Down Expand Up @@ -391,7 +391,7 @@ CREATE TABLE core__condition_dn_verification_status AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
condition AS s,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TABLE core__documentreference_dn_type AS (
0 AS row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
documentreference AS s,
Expand Down Expand Up @@ -65,7 +65,7 @@ CREATE TABLE core__documentreference_dn_category AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand Down Expand Up @@ -121,46 +121,14 @@ CREATE TABLE core__documentreference_dn_category AS (

-- ###########################################################

<<<<<<< HEAD
CREATE TABLE core__documentreference_dn_format AS (
WITH

system_format_0 AS (
SELECT DISTINCT
s.id AS id,
u.parent_col.format.code,
u.parent_col.format.display,
u.parent_col.format.system AS system
FROM
documentreference AS s,
UNNEST(s.content) AS u (parent_col)
), --noqa: LT07

union_table AS (
SELECT
id,
system,
code,
display
FROM system_format_0

)
SELECT
id,
code,
system,
display
FROM union_table
=======
CREATE TABLE IF NOT EXISTS "cumulus_mhg_dev_db"."core__documentreference_dn_format"
AS (
SELECT * FROM (
VALUES
(cast(NULL AS varchar),cast(NULL AS varchar),cast(NULL AS varchar),cast(NULL AS varchar))
)
AS t ("id","code","code_system","display")
AS t ("id","code","system","display")
WHERE 1 = 0 -- ensure empty table
>>>>>>> 67643ad (sql regen)
);

-- ###########################################################
Expand Down
69 changes: 16 additions & 53 deletions cumulus_library/studies/core/reference_sql/builder_encounter.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CREATE TABLE core__encounter_dn_type AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -42,7 +42,7 @@ CREATE TABLE core__encounter_dn_type AS (
'1' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -58,7 +58,7 @@ CREATE TABLE core__encounter_dn_type AS (
'2' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -74,7 +74,7 @@ CREATE TABLE core__encounter_dn_type AS (
'3' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -90,7 +90,7 @@ CREATE TABLE core__encounter_dn_type AS (
'4' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -106,7 +106,7 @@ CREATE TABLE core__encounter_dn_type AS (
'5' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -122,7 +122,7 @@ CREATE TABLE core__encounter_dn_type AS (
'6' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -138,7 +138,7 @@ CREATE TABLE core__encounter_dn_type AS (
'7' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -154,7 +154,7 @@ CREATE TABLE core__encounter_dn_type AS (
'8' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand Down Expand Up @@ -334,7 +334,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'0' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -350,7 +350,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'1' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -366,7 +366,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'2' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -382,7 +382,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'3' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -398,7 +398,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'4' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand All @@ -414,7 +414,7 @@ CREATE TABLE core__encounter_dn_reasoncode AS (
'5' AS priority,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand Down Expand Up @@ -520,51 +520,14 @@ CREATE TABLE core__encounter_dn_reasoncode AS (

-- ###########################################################

<<<<<<< HEAD
CREATE TABLE core__encounter_dn_dischargedisposition AS (
WITH

system_dischargedisposition_0 AS (
SELECT DISTINCT
s.id AS id,
0 AS row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.userSelected
FROM
encounter AS s,
UNNEST(s.hospitalization.dischargedisposition.coding) AS u (coding)
), --noqa: LT07

union_table AS (
SELECT
id,
row,
system,
code,
display,
userSelected
FROM system_dischargedisposition_0

)
SELECT
id,
code,
system,
display,
userSelected
FROM union_table
=======
CREATE TABLE IF NOT EXISTS "cumulus_mhg_dev_db"."core__encounter_dn_dischargedisposition"
AS (
SELECT * FROM (
VALUES
(cast(NULL AS varchar),cast(NULL AS bigint),cast(NULL AS varchar),cast(NULL AS varchar),cast(NULL AS varchar),cast(NULL AS boolean))
)
AS t ("id","row","code","code_system","display","userSelected")
AS t ("id","row","code","system","display","userSelected")
WHERE 1 = 0 -- ensure empty table
>>>>>>> 67643ad (sql regen)
);

-- ###########################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CREATE TABLE core__medicationrequest_dn_inline_code AS (
0 AS row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
medicationrequest AS s,
Expand Down Expand Up @@ -88,7 +88,7 @@ CREATE TABLE core__medicationrequest_dn_category AS (
s.row,
u.coding.code,
u.coding.display,
u.coding.system AS system,
u.coding.system,
u.coding.userSelected
FROM
flattened_rows AS s,
Expand Down
Loading

0 comments on commit f3efef7

Please sign in to comment.