Skip to content

Conversation

@nmdefries
Copy link
Contributor

@nmdefries nmdefries commented Sep 15, 2023

Summary:

Update flusurv table schema to support #1278. Also make sure rate_age_5, 6, and 7 are returned.

Necessary for #1247

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

@nmdefries
Copy link
Contributor Author

nmdefries commented Sep 15, 2023

@korlaxxalrok Tentatively tagging you for review. If you're not familiar with these files, let me know and I'll ask around for an alternative! :)

@nmdefries nmdefries removed the request for review from korlaxxalrok September 18, 2023 14:41
Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

looks good, just a few optional things about repeated information across comments in various places

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

looks good!

@melange396
Copy link
Collaborator

This got lost somehow... Im going to merge it now; I just need to remember to run the migration before release deployment!

@melange396 melange396 merged commit 9de7d64 into ndefries/flusurv-new-endpoint May 8, 2024
@melange396 melange396 deleted the ndefries/flusurv-new-columns branch May 8, 2024 00:15
@melange396
Copy link
Collaborator

aw crap, i wasnt paying attention and i thought this was going to merge into the dev branch... im going to try to revert it and revisit it again when i have a chance to review #1278

@melange396
Copy link
Collaborator

ugh, i made a mess. this PR's status can't be changed from "Merged". I will leave a note on #1278 that it needs to re-merge this (which is now probably best done by reverting #1426)

nmdefries added a commit that referenced this pull request Oct 29, 2025
* initial switch to new API endpoint; doesn't account for format change

* separate fetch fn for whole api obj

* get_current_issue to use existing json response

* cleanup names and comments

- rename input arg to `update` to avoid reassignment later
- comment and reuse args_insert
- spelling
- comment magic constant used in output format
- rename location-network/catchmentid map

* store extracted rates by strata name rather than position

Previously, age strata were numbered sequentially which allowed us to
store rate values by position in a list. With the introduction of the
new strata, this system is not robust enough to track all the different
groups (e.g. ageids are no longer sequential and there are now race and
sex groupings with separate numbering systems).

* define function to convert json obs to dict grouped by location and epiweek

* auto-map from valueids to ordinal and label-based group names

* add new strata to sql insert statement by name, not order

* pass seasonids around to use in requests for location-specific data

* include old and new example API responses

* flusurv tests

* pass metadata around to reduce API calls

* add season label as a descriptive column

* move example API responses to make it clear they are not for prod use

* add new columns to flusurv endpoint spec

* add new age, sex, race strata, and season to schema

* list new signals in documentation

* move new season column to end of table

* add migration script to add new fields to flusurv table

* add field descriptions; reformat table so don't need to match line lengths

* point from acquisition script to docs and schema def to deduplicate

* review cleanup

* capitalize constant max_age

* move paren to subtract from # of dates

Co-authored-by: melange396 <[email protected]>

* move n_exected_groups and big groupid comment to global

* convert asserts to if-raise

* for robust group checking, list all expected groups and do set diff

* separate data fetching fns into metadata and location classes

* programmatically create location-networkid map; create constants file

* switch missing data assert to exception

* mock metadata and api objs for tests

* stop doing recent season filtering

Catchment metadata is not updated with most recent season, so doing this
will stop us from fetching data.

* warn when no location data returned

* test metadata attributes together

* correct local module name to load classes from

* map some long race groups to abbreviated names

* programmatically create sql query to avoid ordering issues

* return empty result with right format when no data available

* warning prefix

* add tests for geo-abbr conversion and location fetching

* don't error for missing groups -- some are expected

* fn to add empty sex breakdowns to UT

* with UT sex subsets getting filled, error on missing groups again

* Update flusurv schema and docs with new age, sex, and race groups (#1287)

* add new columns to flusurv endpoint spec

* add new age, sex, race strata, and season to schema

* list new signals in documentation

* move new season column to end of table

* add migration script to add new fields to flusurv table

* add field descriptions; reformat table so don't need to match line lengths

* point from acquisition script to docs and schema def to deduplicate

* Revert "Update flusurv schema and docs with new age, sex, and race groups" (#1426)

This reverts commit 9de7d64.

* add new age rate signals

* add new columns to flusurv endpoint spec

* add schema migration script

* move base url to constants

* add max age as CLI arg

* add flu a/b to DB table

* hardcode valueid->signal name; add flu signals

* remove ordinal conditional blocks from _groupid_to_name definition

* add back female col to sql schema

* make error types more specific

* add new cols to integration test

* remove trailing comma

* specify flusurv return fields

* warn on unexpected or missing keys and fill in

* use unexpected key's ids as suffix; drop UT sex group handling

* cast ids to str

* drop trailing location

* comments and cleanup

* cast CLI args to types

* note format issue in reference JSONs; rename metadata methods for clarity

* filter weeks with user-provided age threshold

* add season field to test

---------

Co-authored-by: melange396 <[email protected]>
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.

4 participants