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

Feature/fct school acquisition metrics #52

Merged
merged 20 commits into from
Jan 21, 2024

Conversation

bakerfranke
Copy link
Contributor

@bakerfranke bakerfranke commented Jan 16, 2024

Description

This PR is a second pass at defining a weekly school acquisition metrics table for use with MIR.

int_school_weeks

A major contribution to this PR is the definition of a new intermediate table called int_school_weeks. The attempt here is to solve the problem of how to align school year weeks with standard ISO weeks and this table proposes a solution. (This issue is mentioned in this ticket)

Please read the comments in the code, and the methodology of int_school_weeks carefully because it will define how we define weeks of the school year moving forward. Its design is an attempt to mimic int_school_years in terms of how analysts or modelers would join to it, and also to not conflict with what have become our standard school year boundaries.

I think that is a good solution moving forward, and better than what we currently use in terms of standardizing school weeks. It will mean validation might get tricky because some schools might shift from one schoolyard to another based on how we currently do reporting, but I think those differences well in the end be marginal and it's worth this change to standardize the way we segment data by weeks of the school year.

**THIS PR IS LARGELY ABOUT APPROVING int_school_weeks and merging it into main.

The weekly school acquisition metrics code, was updated to incorporate this new table, but follow up work is to validate.

Followup work

  • validate School acquisition metrics against current reporting

Copy link
Collaborator

@allison-code-dot-org allison-code-dot-org left a comment

Choose a reason for hiding this comment

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

made some minor formatting changes and added tests/documentation. Although the code looks convoluted, I can see how it runs faster than the alternative approach mapped out. Tested the build and verified the table for a few school years- all looks good!

dbt/models/intermediate/int_school_weeks.sql Show resolved Hide resolved
dbt/models/intermediate/int_school_weeks.sql Outdated Show resolved Hide resolved
@bakerfranke bakerfranke requested review from jordan-springer and removed request for jordan-springer January 16, 2024 22:44
Copy link
Collaborator

@allison-code-dot-org allison-code-dot-org left a comment

Choose a reason for hiding this comment

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

niiiice

@jordan-springer jordan-springer self-assigned this Jan 19, 2024
Copy link
Collaborator

@jordan-springer jordan-springer left a comment

Choose a reason for hiding this comment

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

the school_level_simple logic is redundant here, let's remove and go back to the bit fields we are pre-processing for you in the base/staging layers and providing in dim_schools

select
school_year,
sssy.school_year,
school_level_simple,
Copy link
Collaborator

Choose a reason for hiding this comment

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

best practice here is to attach an alias to each column when joining (eg. sssy.school_year)

where status like 'active %'
group by 1,2,3,4,5
group by 1,2,3,4,5,6,7
Copy link
Collaborator

Choose a reason for hiding this comment

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

{{ dbt_utils.group_by(7) }}

@jordan-springer jordan-springer merged commit c7b3222 into main Jan 21, 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.

3 participants