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

Conversation

dogversioning
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Nov 4, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
690 658 95% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/dashboard/get_chart_data/get_chart_data.py 97% 🟢
src/shared/errors.py 100% 🟢
TOTAL 99% 🟢

updated for commit: af76971 by action🐍

src/dashboard/get_chart_data/get_chart_data.py Outdated Show resolved Hide resolved
Comment on lines 33 to 37
{%- if stratifier_column %}
"{{ stratifier_column }}", "{{ data_column }}"
{%- else %}
"{{ data_column }}"
{%- endif %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will point out here that because you don't care about the prettiness of the resulting SQL (right?), you can instead try to make the jinja code more readable / maintainable.

Things like reducing the duplication here:

        {%- if stratifier_column %}
        "{{ stratifier_column }}",
        {%- endif %}
        "{{ data_column }}"

And/or proper indenting throughout for the if/else blocks, plus whatever else. The fact that the jinja in Library is usually hard to read is partly our fault.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think we can make some compromises over here that we cant/wont in the library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think we can make ditch some compromises over here that we cant/wont in the library.

Fixed that for ya 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, added a sqlfluff config that didn't aggresively squash things.

@dogversioning dogversioning force-pushed the mg/filter-refactor branch 3 times, most recently from 87ba837 to a5041f7 Compare November 7, 2024 16:23
f'SELECT gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" '
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT NULL AND gender IS NOT NULL "
"GROUP BY gender ORDER BY gender",
f"""SELECT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are getting particularly irritating to maintain - I did open #140 for considering ditching this in favor of an actual in-DB test.

@dogversioning dogversioning marked this pull request as ready for review November 7, 2024 16:38
src/dashboard/get_chart_data/get_chart_data.py Outdated Show resolved Hide resolved
@dogversioning dogversioning merged commit 7e72e89 into main Nov 7, 2024
2 checks passed
@dogversioning dogversioning deleted the mg/filter-refactor branch November 7, 2024 21:11
This was referenced Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants