Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor of get chart data endpoint #139

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'}
]
]
2 changes: 2 additions & 0 deletions .sqlfluffignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/
.aws-sam/
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
Loading