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

Test chart data endpoint w/ duckdb #148

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dogversioning
Copy link
Contributor

This adds a duckdb fixture to the aggregator and uses it for testing the chart data endpoint, and fixes several issues found as a result.

Copy link

☂️ Python Coverage

current status: ❌

Overall Coverage

Lines Covered Coverage Threshold Status
878 853 97% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/dashboard/get_chart_data/get_chart_data.py 97% 🟢
src/shared/functions.py 97% 🟢
src/site_upload/cache_api/cache_api.py 83% 🔴
TOTAL 93% 🔴

updated for commit: 5d18189 by action🐍

@@ -196,6 +198,7 @@ def _build_query(query_params: dict, filter_groups: list, path_params: dict) ->
coalesce_columns=columns,
inline_configs=inline_configs,
none_configs=none_configs,
extra_filter_configs=[], # extra_filter_configs
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this line about? Did you mean to leave that comment like that?

Copy link
Contributor Author

@dogversioning dogversioning Feb 20, 2025

Choose a reason for hiding this comment

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

That was from an in process attempt to fix the underlying jinja template, which moved away from; will delete

Comment on lines +52 to +53
"version": version.split("__")[2],
"id": f"{dp_detail['study']}__{dp_detail['name']}__{version.split('__')[2]}",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is version worth splitting separately into a variable, for clarity?

Like _version_package, version_number = version.split("__", 2) or something. (for example, I don't know what the first part of the version is, so I just made up a variable name)

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 buy it

return value

db = duckdb.connect(tmp_path / "duck.db")
db.create_function(
Copy link
Contributor

Choose a reason for hiding this comment

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

Obviously you thought about this, but let's spill a tiny amount of digital ink. Pros/cons of having tests depend on cumulus-library and grabbing its DuckdbDatabase class? Not worth it yet, I'm guessing?

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, a couple thoughts

  • the aggregator doesn't have Python version matrix compatibility problems. It runs on a specific version and there's some workaround code for Python 311 in there that just doesn't apply here.
    • there's one weird case where we want this to perform slightly differently around, just not caring about finding real time stamps in the database with test data
  • we're only dealing with this one function for now, so the library class is a little heavy and having its own thing provides a nice isolation. If that changed that I might feel more strongly about importing that class.

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