Commit d2e5d61
fix k_course fanout (#150)
* fix k_course fanout
Because of the longitudinal nature of course transcripts, we get copies of the same records in each school year -- e.g. a student's 2019 course transcript will appear in 2019, 2020, 2021, etc.
Ideally we would link the course metadata from the year the course was taken to the transcript record, however:
1. We do not have a reliable way to backfill course metadata for arbitrary years of history
2. This is not really how Ed-Fi works either: transcripts are directly linked to the contemporary year's course transcript.
Because dim_course is annualized, our key generation uses the year the transcript was _submitted_ to generate `k_course`. This means that each subsequent copy of the transcript record is unique when we include `k_course` in the grain.
This code changes the grain to the course's non-annualized observables, which has the effect of choosing the course metadata from the year the transcript was submitted (and preferring the most recent submission), which avoids fanning out the transcript record by the `k_course` corresponding to each unique year in which we received it.
* apply 2 dedupes to retrieve all most recent non-deleted records
* rename to correct CTEs
* update filter for is_deleted
* duplicated code
---------
Co-authored-by: gnguyen87 <gnguyen@macalester.edu>
Co-authored-by: rlittle08 <rlittle@edanalytics.org>1 parent 02796ab commit d2e5d61
1 file changed
Lines changed: 17 additions & 6 deletions
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
29 | 44 | | |
30 | 45 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 46 | + | |
0 commit comments