Skip to content

Refactor to use new simplified pinval.vw_assessment_card data model#85

Merged
jeancochrane merged 5 commits intomainfrom
jeancochrane/855-avoid-selecting-star-from-modelassessment_card-in-pinvalvw_assessment_card
Jul 11, 2025
Merged

Refactor to use new simplified pinval.vw_assessment_card data model#85
jeancochrane merged 5 commits intomainfrom
jeancochrane/855-avoid-selecting-star-from-modelassessment_card-in-pinvalvw_assessment_card

Conversation

@jeancochrane
Copy link
Member

@jeancochrane jeancochrane commented Jul 10, 2025

This PR updates our Hugo report generation code to handle the changes to the pinval.vw_assessment_card data model that we're making in ccao-data/data-architecture#856.

In addition, we fold in one small change to improve the experience of testing changes to the data model: Factoring out constants for PINVAL_ASSESSMENT_CARD_TABLE and PINVAL_COMP_TABLE. By centralizing the references to these two tables, we can more easily change them when we need to test a corresponding change in data-architecture.

See PIN 06171140020000 on the staging site for an example of a deployed report.

Connects ccao-data/data-architecture#855.

{{ template "card-content"
(dict "card" $card
"var_labels" $.Params.var_labels
"Params" $.Params
Copy link
Member Author

Choose a reason for hiding this comment

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

While debugging an issue with .Params being unavailable in the context of the card-content template, I realized that we can just pass the whole object into the template in order to make it available. That way we don't need to add more arguments to the template in order to access stuff from the .Params object.

Comment on lines +5 to +8
# Currently we don't need more than one run because comps and cards are using the same
# final run ID, but we're keeping this map around with the expectation that we may
# need it for a more permanent fix
RUN_ID_MAP = {"2025-02-11-charming-eric": "2025-02-11-charming-eric"}
Copy link
Member Author

Choose a reason for hiding this comment

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

See here for an explanation of this (confusing) change, and why I'm not bothering cleaning it up just yet: ccao-data/data-architecture#856 (comment)

@jeancochrane jeancochrane marked this pull request as ready for review July 10, 2025 22:11
Copy link
Member

@wagnerlmichael wagnerlmichael left a comment

Choose a reason for hiding this comment

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

Nice work. I took a look at the updated PIN on the staging site and it looks good with all the columns intact. I did have on question about the constants file that I left in my review

# It's helpful to factor these tables out into shared constants because we often
# need to switch to dev tables for testing
PINVAL_ASSESSMENT_CARD_TABLE = "z_dev_jecochr_pinval.vw_assessment_card"
PINVAL_COMP_TABLE = "z_dev_jecochr_pinval.vw_comp"
Copy link
Member

Choose a reason for hiding this comment

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

[Question, non-blocking]: So is the idea here to essentially use this a params file where the developer changes this locally to select which asset to pull from during development? So you'd change this to production tables before merging this into main? Do I have that right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you asking about the constants.py module in its entirety, or specifically about the PINVAL_*_TABLE constants? The PINVAL_*_TABLE constants are indeed intended to offer us a way of controlling which assets we use during development, but I think the constants.py module is useful for a wider range of tasks. For example, we probably won't change RUN_ID_MAP very often, and it should largely stay the same between dev and prod; however, if we ever do need to change the mapping between chars run ID and comps run ID, the fact that it is factored out to a centralized constant will make that change simpler.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, good catch on changing the PINVAL_*_TABLE constants back prior to merging! I reverted the change in 22e0ca9 so they should point to the prod tables now.

@jeancochrane jeancochrane merged commit f5f9254 into main Jul 11, 2025
1 check passed
@jeancochrane jeancochrane deleted the jeancochrane/855-avoid-selecting-star-from-modelassessment_card-in-pinvalvw_assessment_card branch July 11, 2025 21:15
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