Skip to content

Commit

Permalink
Deprecate observation notice, optional fields, sql writing guide (#280)
Browse files Browse the repository at this point in the history
* optional fields/deprecation docs

* Added sql guide

* sql regen

* PR feedback

* table doc update
  • Loading branch information
dogversioning authored Aug 20, 2024
1 parent ed96510 commit 7f1770f
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 602 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,38 +121,16 @@ CREATE TABLE core__documentreference_dn_category AS (

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

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

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))
)
SELECT
id,
code,
system,
display
FROM union_table
AS t ("id","code","system","display")
WHERE 1 = 0 -- ensure empty table
);


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


Expand Down
Loading

0 comments on commit 7f1770f

Please sign in to comment.