-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20948 from code-dot-org/dtl_candidate_de30436e
- Loading branch information
Showing
195 changed files
with
2,425 additions
and
6,437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
create table analysis.csf_plugged_stage_counts ( | ||
script_id int, | ||
plugged_stage_counts int | ||
); | ||
|
||
insert into analysis.csf_plugged_stage_counts values | ||
(1,9), | ||
(17,11), | ||
(18,11), | ||
(19,14), | ||
(23,16), | ||
(236,5), | ||
(237,6), | ||
(238,9), | ||
(239,12), | ||
(240,8), | ||
(241,10), | ||
(258,19), | ||
(259,7); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
create table analysis.school_years ( | ||
school_year varchar, | ||
started_at date, | ||
ended_at date | ||
); | ||
|
||
insert into analysis.school_years values | ||
('2015-16', '2015-07-01', '2016-06-30'), | ||
('2016-17', '2016-07-01', '2017-06-30'), | ||
('2017-18', '2017-07-01', '2018-06-30'); | ||
|
||
GRANT ALL PRIVILEGES ON analysis.school_years TO GROUP admin; | ||
GRANT SELECT ON analysis.school_years TO GROUP reader, GROUP reader_pii; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
drop view analysis.census_details; | ||
create view analysis.census_details as | ||
with csa as | ||
( | ||
select ss.school_id, case when cso.school_code is not null then 1 else 0 end as teaches_csa | ||
from school_stats ss | ||
left join ap_school_codes sc on sc.school_id = ss.school_id | ||
left join ap_cs_offerings cso on cso.school_code = sc.school_code and cso.course = 'CSA' | ||
where ss.school_type in ('public','charter') -- only include known status for public and charter schools, as we don't have data for private schools | ||
select ss.school_id, | ||
case when cso.school_code is not null then 1 | ||
when cso.school_code is null and ss.school_type in ('public', 'charter') then 0 -- only include known status for public and charter schools, as we don't have data for private schools | ||
end as teaches_csa | ||
from analysis.school_stats ss | ||
left join dashboard_production.ap_school_codes sc on sc.school_id = ss.school_id | ||
left join dashboard_production.ap_cs_offerings cso on cso.school_code = sc.school_code and cso.course = 'CSA' | ||
), | ||
csp as | ||
( | ||
select ss.school_id, case when cso.school_code is not null then 1 else 0 end as teaches_csp | ||
from school_stats ss | ||
left join ap_school_codes sc on sc.school_id = ss.school_id | ||
left join ap_cs_offerings cso on cso.school_code = sc.school_code and cso.course = 'CSP' | ||
where ss.school_type in ('public','charter') -- only include known status for public and charter schools, as we don't have data for private schools | ||
select ss.school_id, | ||
case when cso.school_code is not null then 1 | ||
when cso.school_code is null and ss.school_type in ('public', 'charter') then 0 -- only include known status for public and charter schools, as we don't have data for private schools | ||
end as teaches_csp | ||
from analysis.school_stats ss | ||
left join dashboard_production.ap_school_codes sc on sc.school_id = ss.school_id | ||
left join dashboard_production.ap_cs_offerings cso on cso.school_code = sc.school_code and cso.course = 'CSP' | ||
), | ||
census as | ||
( | ||
select school_id, | ||
max(case when how_many_do_hoc is null then null when how_many_do_hoc = 'I DON\'T KNOW' then null when how_many_do_hoc in ('SOME', 'ALL') then 1 else 0 end) hoc, | ||
max(case when how_many_after_school is null then null when how_many_after_school = 'I DON\'T KNOW' then null when how_many_after_school in ('SOME', 'ALL') then 1 else 0 end) after_school | ||
from census_submissions cs | ||
join census_submissions_school_infos cssi on cssi.census_submission_id = cs.id | ||
join school_infos si on si.id = cssi.school_info_id | ||
from dashboard_production_pii.census_submissions cs | ||
join dashboard_production.census_submissions_school_infos cssi on cssi.census_submission_id = cs.id | ||
join dashboard_production.school_infos si on si.id = cssi.school_info_id | ||
where school_id is not null | ||
group by 1 | ||
) | ||
select ss.school_id, teaches_csa, teaches_csp, hoc, after_school | ||
from school_stats ss | ||
from analysis.school_stats ss | ||
left join csp on csp.school_id = ss.school_id | ||
left join csa on csa.school_id = ss.school_id | ||
left join census cen on cen.school_id = ss.school_id; | ||
left join census cen on cen.school_id = ss.school_id | ||
with no schema binding; | ||
|
||
GRANT ALL PRIVILEGES ON analysis.census_details TO GROUP admin; | ||
GRANT SELECT ON analysis.census_details TO GROUP reader, GROUP reader_pii; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
drop view analysis.csf_completed; | ||
create view analysis.csf_completed as | ||
select us.user_id, | ||
us.script_id, | ||
us.script_name, | ||
us.school_year, | ||
started_at as completed_at -- starting the Nth stage (dependent on script) representing "completing" the course | ||
from | ||
( | ||
select us.user_id, sc.name script_name, script_id, stage_id, school_year, us.started_at::date, | ||
row_number() over(partition by us.user_id, us.script_id order by us.started_at asc) stage_order | ||
from analysis.user_stages us | ||
join dashboard_production.scripts sc on sc.id = us.script_id | ||
join analysis.school_years sy on us.started_at between sy.started_at and sy.ended_at | ||
) us | ||
join analysis.csf_plugged_stage_counts sc on sc.script_id = us.script_id and us.stage_order = sc.plugged_stage_counts | ||
with no schema binding; | ||
|
||
GRANT ALL PRIVILEGES ON analysis.csf_completed TO GROUP admin; | ||
GRANT SELECT ON analysis.csf_completed TO GROUP reader, GROUP reader_pii; |
Oops, something went wrong.