11with
22 stacked_data as (
3-
4- /* denominator groupings for inquiries, applications, waitlisted, offers,
3+ /* EVER denominator groupings for inquiries, applications, offers,
54 assigned school and accepted. need distinct to bring only one row per
65 student when they have multiple statuses per group */
76 select distinct
4241 when ' Offers'
4342 then 3
4443 when ' Accepted'
45- then 5
44+ then 4
4645 else 0
4746 end as grouped_status_order,
4847
109108
110109 union all
111110
112- -- currently enrolled numerator
111+ -- CURRENT enrolled numerator
113112 select
114113 aligned_enrollment_academic_year,
115114 aligned_enrollment_academic_year_display,
@@ -139,21 +138,108 @@ with
139138
140139 ' All' as aligned_enrollment_type,
141140
142- 7 as grouped_status_order,
141+ 8 as grouped_status_order,
143142
144143 status_start_date as grouped_status_start_date,
145144
146145 from {{ ref(" int_students__finalsite_student_roster" ) }}
147146 where
148147 detailed_status = ' Enrolled'
148+ and latest_status = ' Enrolled'
149+ and status_start_date is not null
150+ and not qa_flag
151+
152+ union all
153+
154+ -- CURRENT waitlisted numerator
155+ select
156+ aligned_enrollment_academic_year,
157+ aligned_enrollment_academic_year_display,
158+ enrollment_academic_year,
159+ enrollment_academic_year_display,
160+ current_academic_year,
161+ next_academic_year,
162+ org,
163+ region,
164+ schoolid,
165+ school,
166+ finalsite_enrollment_id as finalsite_id,
167+ powerschool_student_number,
168+ first_name,
169+ last_name,
170+ grade_level,
171+ aligned_enrollment_academic_year_grade_level,
172+ self_contained,
173+ enrollment_academic_year_enrollment_type,
174+ detailed_status as grouped_status,
175+ sre_academic_year_start,
176+ sre_academic_year_end,
177+ is_enrolled_fdos,
178+ is_enrolled_oct01,
179+ is_enrolled_oct15,
180+ latest_status,
181+
182+ ' All' as aligned_enrollment_type,
183+
184+ 0 as grouped_status_order,
185+
186+ status_start_date as grouped_status_start_date,
187+
188+ from {{ ref(" int_students__finalsite_student_roster" ) }}
189+ where
190+ detailed_status = ' Waitlisted'
191+ and latest_status = ' Waitlisted'
192+ and status_start_date is not null
193+ and not qa_flag
194+
195+ union all
196+
197+ -- CURRENT enrollment in progress numerator
198+ select
199+ aligned_enrollment_academic_year,
200+ aligned_enrollment_academic_year_display,
201+ enrollment_academic_year,
202+ enrollment_academic_year_display,
203+ current_academic_year,
204+ next_academic_year,
205+ org,
206+ region,
207+ schoolid,
208+ school,
209+ finalsite_enrollment_id as finalsite_id,
210+ powerschool_student_number,
211+ first_name,
212+ last_name,
213+ grade_level,
214+ aligned_enrollment_academic_year_grade_level,
215+ self_contained,
216+ enrollment_academic_year_enrollment_type,
217+ detailed_status as grouped_status,
218+ sre_academic_year_start,
219+ sre_academic_year_end,
220+ is_enrolled_fdos,
221+ is_enrolled_oct01,
222+ is_enrolled_oct15,
223+ latest_status,
224+
225+ ' All' as aligned_enrollment_type,
226+
227+ 7 as grouped_status_order,
228+
229+ status_start_date as grouped_status_start_date,
230+
231+ from {{ ref(" int_students__finalsite_student_roster" ) }}
232+ where
233+ detailed_status = ' Enrollment In Progress'
234+ and latest_status = ' Enrollment In Progress'
149235 and status_start_date is not null
150236 and not qa_flag
151237
152238 union all
153239
154- /* numerator groupings for pending offer and currently accepted need distinct
155- to bring only one row per student when they have multiple statuses per
156- group */
240+ /* CURRENT numerator groupings for pending offers and currently accepted need
241+ distinct to bring only one row per student when they have multiple statuses
242+ per group */
157243 select distinct
158244 aligned_enrollment_academic_year,
159245 aligned_enrollment_academic_year_display,
183269
184270 ' All' as aligned_enrollment_type,
185271
186- if(status_group_numerator = ' Pending Offers' , 4 , 6 ) as grouped_status_order,
272+ if(status_group_numerator = ' Pending Offers' , 6 , 5 ) as grouped_status_order,
187273
188274 max (status_start_date) over (
189275 partition by
@@ -195,13 +281,26 @@ with
195281 from {{ ref(" int_students__finalsite_student_roster" ) }}
196282 where
197283 status_group_numerator is not null
284+ and detailed_status != ' Waitlisted'
285+ and latest_status in (
286+ ' Accepted' ,
287+ ' Assigned School' ,
288+ ' Campus Transfer Requested' ,
289+ ' Enrollment In Progress' ,
290+ ' Not Enrolling' ,
291+ ' Enrolled' ,
292+ ' Mid Year Withdrawal' ,
293+ ' Never Atended' ,
294+ ' Retained' ,
295+ ' Summer Withdraw'
296+ )
198297 and status_start_date is not null
199298 and not qa_flag
200299
201300 union all
202301
203- /* numerator for conversion metrics groupings need distinct to bring only one
204- row per student when they have multiple statuses per group */
302+ /* CURRENT numerator for conversion metrics groupings need distinct to bring
303+ only one row per student when they have multiple statuses per group */
205304 select distinct
206305 aligned_enrollment_academic_year,
207306 aligned_enrollment_academic_year_display,
@@ -244,6 +343,15 @@ with
244343 where
245344 conversion_metric_numerator is not null
246345 and status_start_date is not null
346+ and latest_status in (
347+ ' Enrollment In Progress' ,
348+ ' Not Enrolling' ,
349+ ' Enrolled' ,
350+ ' Mid Year Withdrawal' ,
351+ ' Never Attended' ,
352+ ' Retained' ,
353+ ' Summer Withdrawal'
354+ )
247355 and not qa_flag
248356 )
249357
0 commit comments