Skip to content

Add parents#17

Open
tomreitz wants to merge 3 commits intomainfrom
feature/add_parents
Open

Add parents#17
tomreitz wants to merge 3 commits intomainfrom
feature/add_parents

Conversation

@tomreitz
Copy link
Contributor

@tomreitz tomreitz commented Feb 11, 2026

This PR adds Ed-Fi parents to the OneRoster users, according to the OneRoster 1.1 specification.

Most parent data here is coming from dim_parent – which already collapses Ed-Fi parents and contacts. However, emails and telephones are coming from (the stage layer) of parents only. I'm curious for suggestions of a more robust approach... or should edu_edfi_source also be merging contacts.emails withparents.emails (here), and contacts.telephones with parents.telephones (here)?

Separately, OneRoster has not only role parent but also guardian; in Ed-Fi, guardians and parents both go in parents or contacts, with different student[Parent|Contact]Associations.relationshipTypeDescriptors. It's possible to set the OneRoster user's role dynamically, but would we need a xwalk to map different relationshipTypeDescriptor values to different OneRoster roles?

I tested this in TX, it added 1.8M OneRoster users with role='parent'. Due to the additional CTEs and joins, it runs a little slower (~27s) but this seems reasonable.

I'll add a self-review with a few other specific comments/questions.

tomreitz and others added 2 commits February 11, 2026 12:50
This PR adds Ed-Fi parents to the OneRoster users.
edu_wh.row_pluck(ref('stg_ef3__parents__emails'),
key='k_parent',
column='email_type',
preferred=var('oneroster:student_email_type', 'Home/Personal'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm re-using 'oneroster:student_email_type' here; should it be broken out to a separate 'oneroster:parent_email_type'?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

),
parent_email as (
{{
edu_wh.row_pluck(ref('stg_ef3__parents__emails'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here and on telephones below, I mimicked querying the stage layer like int_users_student does - please see my PR comment about also supporting stg__contacts__emails.

Copy link
Contributor

Choose a reason for hiding this comment

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

stg__contacts__emails/telephones should be used instead of stg___parents. the contacts versions have already combined across parents/contacts, and that's what's done in dim_parent with addresses

group by all
),

parent_students as (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OneRoster has users.agentSourcedIds about which the docs say

Humans may have relationships with other humans. For example, a student may have parents. The "agents" attribute allows for relationships between humans to be expressed. Note that these are typically from the point of view of the student - so a student will link to its parents (via the agent attribute). The reverse view MUST also be modeled, so for example, a user of role "parent" MUST have agents that are of type "student".

This CTE constructs the array of sourcedIds of students for each parent; a similar CTE was added to int_user_student to construct the array of sourcedIds of parents for each student.

parent_email.email_address as "email",
null::string as "sms",
parent_telephone.phone_number as "phone",
parent_students_agg.students as "agentSourcedIds",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept agentSourcedIds here because that's what the staff and student users use, but I think according to the OneRoster 1.1 spec it should be just agents?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤨 i truly don't know

select * from {{ ref('fct_student_school_association') }}
where school_year = {{ var('oneroster:active_school_year')}}
),
{% if var('oneroster:include_parents', False) %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All parent-related logic in the students model is behind the include_parents switch so the model shouldn't slow down if parents aren't included.

Copy link
Contributor

Choose a reason for hiding this comment

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

do we think it's more common that implementations want this OFF vs. ON?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question; I don't know.

Are you thinking if the default/common is ON, we should remove these if sections to make the code simpler/more readable?

@tomreitz tomreitz requested a review from rlittle08 February 11, 2026 20:22
Copy link
Contributor

@rlittle08 rlittle08 left a comment

Choose a reason for hiding this comment

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

Code looks good & nicely consistent with staff/student. A couple requests

  1. Can we move the student-parent agent relationship stuff to a bld model for DRYness
  2. I'm torn on whether we use 'parent' vs. 'contact' naming throughout. Ed-Fi has moved to 'Contact', and EDU should do the same someday. If we go with contact now in this package, then any downstream oneroster apps would be safe from breaking change later on..

@tomreitz
Copy link
Contributor Author

@rlittle08 thanks for the thorough review.

  1. Can we move the student-parent agent relationship stuff to a bld model for DRYness

Sounds good, done. (I tested the latest version of this branch in TX - see the result in dev_analytics.dev_tr_oneroster_1_1.users.)

  1. I'm torn on whether we use 'parent' vs. 'contact' naming throughout. Ed-Fi has moved to 'Contact', and EDU should do the same someday. If we go with contact now in this package, then any downstream oneroster apps would be safe from breaking change later on..

Do you mean things like naming the model or1_1__int_users_contact.sql (instead of ..._users_parent.sql)? My lean would be to keep parent since that's how they're known in OneRoster. (Of course we can reference the contact-named EDU models, not parent-named ones. Is there a plan to eventually change dim_parent to dim_contact in `edu_wh?)

@tomreitz tomreitz requested a review from rlittle08 February 24, 2026 20:20
@rlittle08
Copy link
Contributor

The idea is eventually to rename parent stuff to contact in edu_wh. But given parent naming in oneroster, and no clear timeline for this^ yet, let's cross that bridge another day. LGTM

@tomreitz
Copy link
Contributor Author

@rlittle08 awesome, thanks. I don't have permission to merge or release. What's the process for that - can you just do it? or do we need sign-off from someone else?

(This is needed in TX - not extremely urgent but the sooner the better. Do you think it can be released this week?)

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