Skip to content

Commit

Permalink
regression/template test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Feb 1, 2024
1 parent 936dc2d commit ff299df
Show file tree
Hide file tree
Showing 5 changed files with 11,234 additions and 11,234 deletions.
2 changes: 1 addition & 1 deletion cumulus_library/studies/core/count_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def count_core_condition(self, duration: str = "month"):
cols = [
["category_code", "varchar", "cond_category_code"],
[f"recorded_{duration}", "date", "cond_month"],
["code_display", "varchar", None],
["code_display", "varchar", "cond_code_display"],
]
return self.count_condition(table_name, from_table, cols)

Expand Down
20 changes: 10 additions & 10 deletions cumulus_library/studies/core/reference_sql/count_core.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TABLE core__count_condition_month AS (
--noqa: disable=RF03, AL02
s."category_code" AS cond_category_code,
s."recorded_month" AS cond_month,
s."code_display"
s."code_display" AS cond_code_display
--noqa: enable=RF03, AL02
FROM core__condition AS s
),
Expand All @@ -33,29 +33,29 @@ CREATE TABLE core__count_condition_month AS (
'cumulus__none'
) AS cond_month,
coalesce(
cast(code_display AS varchar),
cast(cond_code_display AS varchar),
'cumulus__none'
) AS code_display
) AS cond_code_display
FROM filtered_table
),
secondary_powerset AS (
SELECT
count(DISTINCT encounter_ref) AS cnt_encounter_ref,
"cond_category_code",
"cond_month",
"code_display",
"cond_code_display",
concat_ws(
'-',
COALESCE("cond_category_code",''),
COALESCE("cond_month",''),
COALESCE("code_display",'')
COALESCE("cond_code_display",'')
) AS id
FROM null_replacement
GROUP BY
cube(
"cond_category_code",
"cond_month",
"code_display"
"cond_code_display"
)
),

Expand All @@ -64,27 +64,27 @@ CREATE TABLE core__count_condition_month AS (
count(DISTINCT subject_ref) AS cnt_subject_ref,
"cond_category_code",
"cond_month",
"code_display",
"cond_code_display",
concat_ws(
'-',
COALESCE("cond_category_code",''),
COALESCE("cond_month",''),
COALESCE("code_display",'')
COALESCE("cond_code_display",'')
) AS id
FROM null_replacement
GROUP BY
cube(
"cond_category_code",
"cond_month",
"code_display"
"cond_code_display"
)
)

SELECT
s.cnt_encounter_ref AS cnt,
p."cond_category_code",
p."cond_month",
p."code_display"
p."cond_code_display"
FROM powerset AS p
JOIN secondary_powerset AS s on s.id = p.id
WHERE
Expand Down
Loading

0 comments on commit ff299df

Please sign in to comment.