-
Notifications
You must be signed in to change notification settings - Fork 5
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/Contacts and StudentContactAssociations #96
Conversation
-- we can't use the gen_skey macro here because we're bringing in the deprecated parents endpoint data, which contains a parentReference that won't work | ||
iff( | ||
contact_unique_id is not null, | ||
md5(cast(coalesce(cast(tenant_code as TEXT), '') || '-' || coalesce(cast(lower(contact_unique_id) as TEXT), '') as TEXT)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use dbt_utils.surrogate key? and what's the case where contact_unique_id is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, good call! updated to use surrogate_key. and it shouldn't ever be null, that's a mistake on my part.
{{ gen_skey('k_student_xyear') }}, | ||
api_year as school_year, | ||
unioned.* | ||
{{ extract_extension(model_name=this.name, flatten=True) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this lose extensions from student_parent_associations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so because the two v_ext
columns have been unioned together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I think the macro will only extract the extensions configured under this.name
, which is stg_ef3__student_contact_associations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the macro can take a list of model names, so I added extensions configured under parents: {{ extract_extension([model_name=this.name, 'stg_ef3__parents'], flatten=True) }}
I don't have an implementation with extensions to test this on, but it should work based on the documentation of the macro
@rlittle08 I added a variable that has to be set to True in implementations that want to use Contacts (to avoid a big breaking change). Current name is |
when we merge this, add to migration notes that implementations should copy in this codegen update: https://github.com/edanalytics/edu_project_template/pull/40/files |
* New DS5 optional fields for `Section`, `CourseTranscript`, and `StudentSectionAssociation` (#104) * add section_type * bring into line with correct json names * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * fix typo (#90) * fix typo * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Feature/Contacts and StudentContactAssociations (#96) * redraft * add student contact associations * switch from parent to contact * add comments about name change * can't use gsn_skey * add note about new fields * update changelog * use dbt utils surrogate key * use parents if contacts are not enabled * add docs * remove configurability * extract extenstions configured with parent naming too * fix bad syntax --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Bugfix/Updated Surrogate Keys to include lower() in student_unique_id inputs (#100) * added lower to student_unique_id in surrogate keys * Update stg_ef3__student_objective_assessments.sql * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Feature/new DS5 optional fields on staff (#103) * add new optional fields * fix typo * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * flatten student cohort year (#92) * flatten student cohort year * grab school year and term * rename fields * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * explicitly call extract macro from this package (#98) * explicitly call extract macro from this package * Update CHANGELOG.md --------- Co-authored-by: John C. Merfeld <John.Merfeld@gmail.com> Co-authored-by: ejoranlienea <ejoranlien@edanalytics.org> Co-authored-by: Samantha LeBlanc <56237580+sleblanc23@users.noreply.github.com> Co-authored-by: Angelica Lastra <107369214+AngelicaLastra@users.noreply.github.com> Co-authored-by: keen <51969358+keenzarate213@users.noreply.github.com>
… for grading periods v5.0) (#99) * draft of grading_period key change for v5.0 * update from main (#106) * New DS5 optional fields for `Section`, `CourseTranscript`, and `StudentSectionAssociation` (#104) * add section_type * bring into line with correct json names * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * fix typo (#90) * fix typo * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Feature/Contacts and StudentContactAssociations (#96) * redraft * add student contact associations * switch from parent to contact * add comments about name change * can't use gsn_skey * add note about new fields * update changelog * use dbt utils surrogate key * use parents if contacts are not enabled * add docs * remove configurability * extract extenstions configured with parent naming too * fix bad syntax --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Bugfix/Updated Surrogate Keys to include lower() in student_unique_id inputs (#100) * added lower to student_unique_id in surrogate keys * Update stg_ef3__student_objective_assessments.sql * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * Feature/new DS5 optional fields on staff (#103) * add new optional fields * fix typo * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * flatten student cohort year (#92) * flatten student cohort year * grab school year and term * rename fields * Update CHANGELOG.md --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org> * explicitly call extract macro from this package (#98) * explicitly call extract macro from this package * Update CHANGELOG.md --------- Co-authored-by: John C. Merfeld <John.Merfeld@gmail.com> Co-authored-by: ejoranlienea <ejoranlien@edanalytics.org> Co-authored-by: Samantha LeBlanc <56237580+sleblanc23@users.noreply.github.com> Co-authored-by: Angelica Lastra <107369214+AngelicaLastra@users.noreply.github.com> Co-authored-by: keen <51969358+keenzarate213@users.noreply.github.com> * add ods & dm version to every base table --------- Co-authored-by: John C. Merfeld <John.Merfeld@gmail.com> Co-authored-by: ejoranlienea <ejoranlien@edanalytics.org> Co-authored-by: Samantha LeBlanc <56237580+sleblanc23@users.noreply.github.com> Co-authored-by: Angelica Lastra <107369214+AngelicaLastra@users.noreply.github.com> Co-authored-by: keen <51969358+keenzarate213@users.noreply.github.com>
Description & motivation
In Data Standard v5.0, Parents were renamed to Contacts. The new Contact entity is identical to the previous Parent entity with the addition of an optional GenderIdentity, PreferredFirstName, and PreferredLastName fields. StudentParentAssociations was also renamed to StudentContactAssociations and the parentReference in SurveyResponses was renamed to contactReference.
This PR adds base and stage models for the new resources, which union in the data from the deprecated parent-named resources.
Breaking changes introduced by this PR:
stg_ef3__survey_responses
now includesk_contact
instead ofk_parent
.PR Merge Priority:
Changes to existing files:
gen_skey
: addk_contact
to key definitionsbase_ef3__parents
: add three new fields which were introduced along with the Contacts rename in order to allow the tables to be unioned in stagebase_ef3__survey_responses
: coalesce parentReference and contactReference into a singlecontact_reference
stg_ef3__survey_responses
: rename k_parent to k_contactNew files created:
Base and stage models for
contacts
,student_contact_associations
, and unpackedcontacts
lists.Tests and QC done:
Ran in Stadium SCDE; confirmed that columns were populating correctly (where data is available) and staging tables included both Parent and Contact data.
Future ToDos & Questions:
k_contact
instg_ef3__survey_responses
is small, possibly none - we don't have any warehouse models for surveys yet and I didn't see the field referenced in any implementation repos.