Skip to content

Commit

Permalink
Refactor of get chart data endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Nov 7, 2024
1 parent 042c129 commit 8eb30f6
Show file tree
Hide file tree
Showing 14 changed files with 1,071 additions and 334 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Run sqlfluff on jinja templates
run: |
sqlfluff lint
- name: Run ruff
if: success() || failure() # still run ruff if above checks fails
run: |
Expand Down
49 changes: 49 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[sqlfluff]
templater = jinja
dialect = athena
sql_file_exts = .sql,.sql.jinja
exclude_rules=
# these rule overfires on athena nested arrays
references.from,
structure.column_order,
aliasing.unused,
# this rule interferes with FHIR naming conventions
capitalisation.identifiers
max_line_length = 90

[sqlfluff:rules:layout.long_lines]
ignore_comment_lines = true

[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper


[sqlfluff:templater:jinja]
load_macros_from_path = src/dashboard/get_chart_data/templates

[sqlfluff:templater:jinja:context]
data_column = 'foo'
stratifier_column= 'bar'
count_columns=['cnt']
schema='schema'
data_package_id='study__table__001'
coalesce_columns=['baz','foobar']
inline_configs=[
[
{'data':'foo','type': 'matches': 'a'},
{'data':'foo','type': 'matches': 'b'}
],
[
{'data':'baz','type': 'eq', 'matches': '1'},
{'data':'baz','type': 'isNull'}
]
]
none_configs=[
[
{'data':'foo','type': 'matches': 'a'},
{'data':'foo','type': 'matches': 'b'}
],
[
{'data':'baz','type': 'isNull'}
]
]
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies= [
"arrow >=1.2.3",
"awswrangler >=3.5, <4",
"boto3",
"Jinja2 >=3.1.4, <4",
"pandas >=2, <3",
"requests", # scripts only
"rich",
Expand Down Expand Up @@ -48,8 +49,9 @@ test = [
"pytest-mock"
]
dev = [
"ruff < 0.6",
"pre-commit",
"ruff < 0.6",
"sqlfluff >= 3.2.5"
]

[tool.coverage.run]
Expand Down
107 changes: 0 additions & 107 deletions src/dashboard/get_chart_data/filter_config.py

This file was deleted.

Loading

0 comments on commit 8eb30f6

Please sign in to comment.