Skip to content

Commit

Permalink
linting, sqlfluff
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Jan 9, 2024
1 parent 7689c81 commit ae004d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cumulus_library/.sqlfluff
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ignore_comment_lines = true
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper

[sqlfluff:templater:jinja]
load_macros_from_path = cumulus_library/studies/core/core_templates

[sqlfluff:templater:jinja:context]
code_systems = ["http://snomed.info/sct", "http://hl7.org/fhir/sid/icd-10-cm"]
col_type_list = ["a string","b string"]
Expand Down Expand Up @@ -44,6 +47,7 @@ prefix = Test
primary_ref = encounter_ref
pos_source_table = pos_source_table
schema_name = test_schema
schema = {'condition': {'category': {'coding': True, 'code': True, 'display': True, 'system': True, 'userSelected': True, 'version': True, 'text': True}, 'clinicalstatus': {'coding': True, 'code': True, 'display': True, 'system': True, 'userSelected': True, 'version': True, 'text': True}, 'id': True, 'recordeddate': True, 'verificationstatus': {'coding': True, 'code': True, 'display': True, 'system': True, 'userSelected': True, 'version': True, 'text': True}, 'subject': {'reference': True, 'display': False, 'type': True}, 'encounter': {'reference': True, 'display': False, 'type': True}}}
source_table = source_table
source_id = source_id
table_cols = ["a","b"]
Expand Down
3 changes: 3 additions & 0 deletions cumulus_library/studies/core/builder_prereq_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ def prepare_queries(self, cursor: object, schema: str, *args, **kwargs):
with open(dir_path / sql_file) as file:
queries = sqlparse.split(file.read())
self.queries += queries
self.comment_queries()
self.write_queries()
exit()
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SELECT
tc.display AS code_display,
tc.subject_ref,
tc.encounter_ref,
tc.id as condition_id,
tc.id AS condition_id,
tc.condition_ref,
tc.recordeddate,
date_trunc('week', date(tc.recordeddate)) AS recorded_week,
Expand All @@ -48,4 +48,4 @@ FROM temp_condition AS tc,
unnest(category) AS t_category (category_coding),
unnest(category_coding.coding) AS t_category_coding (category_row)

WHERE tc.recordeddate BETWEEN date('2016-01-01') AND current_date;
WHERE tc.recordeddate BETWEEN date('2016-01-01') AND current_date;
2 changes: 1 addition & 1 deletion cumulus_library/studies/core/fhir_lookup_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ FROM
'virtual'
)
)
AS t (code, display)
AS t (code, display);
2 changes: 1 addition & 1 deletion cumulus_library/studies/core/fhir_mapping_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ SELECT * FROM
('PRENC', 'PRENC'),
('SS', 'SS'),
('VR', 'VR')
) AS t (expected, found)
) AS t (expected, found);

0 comments on commit ae004d3

Please sign in to comment.