feat: Update cleaner and uploader to load gender data from parent surveys

Implement graph views for parent gender data
This commit is contained in:
rebuilt 2025-05-23 16:35:12 -07:00
parent 7ebe8234cb
commit 9d8543afae
16 changed files with 262 additions and 98 deletions

View file

@ -1,9 +1,9 @@
StartDate,EndDate,Status,IPAddress,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,DistributionChannel,UserLanguage,DESE ID,Number of Children,Gender-1,Gender-1_7_TEXT,Race-1,Race-1_7_TEXT,Gender-2,Gender-2_7_TEXT,Race-2,Race-2_7_TEXT,Gender-3,Gender-3_7_TEXT,Race-3,Race-3_7_TEXT,Gender-4,Gender-4_7_TEXT,Race-4,Race-4_7_TEXT,Gender-5,Gender-5_7_TEXT,Race-5,Race-5_7_TEXT,Gender,Gender_7_TEXT,p-scrp-q3,p-scrp-q2,p-valm-q1,p-valm-q2,p-valm-q3,p-valm-q4,p-comm-q1,p-comm-q2,p-comm-q3,p-tcom-q1,P-tcom-q2,p-tcom-q3,p-evnt-q4,p-comm-q4,p-evnt-q3,p-evnt-q1,p-evnt-q2,p-socx-q3,p-socx-q4,p-scrp-q1,p-socx-q1,p-sosu-q1,p-sosu-q2,p-sosu-q3,p-socx-q2,p-sosu-q4,p-phys-q3,p-acpr-q1,p-acpr-q2,p-acpr-q3,p-acpr-q4,p-cure-q1,p-cure-q2,p-cure-q3,p-cure-q4,Housing,Housing_100_TEXT,Employment,Employment_100_TEXT,Caregivers,Caregivers_100_TEXT,Education,Education_100_TEXT,Benefits,Benefits_100_TEXT,Language,Language_100_TEXT,Raw Income,Income,Raw ELL,ELL,Raw SpEd,SpEd,Progress Count
5/1/2024 10:04:34,5/1/2024 10:10:49,0,72.93.86.98,100,374,1,2021-03-31T10:01:36,parent_survey_response_1,email,EN,1500025,1,,,1,,,,,,,,,,,,,,,,,,2,,4,5,5,4,5,5,5,5,5,4,4,5,4,5,3,4,5,4,4,5,5,5,5,5,5,5,1,2,2,2,1,4,5,5,5,1,,1,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:03:52,5/1/2024 10:14:42,0,73.69.182.58,100,649,1,2021-04-01T10:01:36,parent_survey_response_2,email,EN,1500025,1,,,,,,,,,,,6,,,,7,,,,,,1,,4,4,5,5,5,5,5,5,5,5,5,5,3,5,4,5,5,5,5,5,4,4,4,4,5,5,1,5,4,5,5,5,5,5,5,1,,99,,2,,3,,1,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:06:44,5/1/2024 10:15:41,0,50.235.109.170,100,537,1,2021-04-02T10:01:36,parent_survey_response_3,email,EN,1500025,2,2,,4,,2,,"1,5",,,,,,,,,,,,,,2,,5,5,5,4,5,5,5,5,5,4,4,5,4,4,3,4,4,4,4,5,4,4,5,5,2,5,3,4,4,4,4,5,5,5,5,1,,1,,3,,6,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:23,5/1/2024 10:22:22,0,73.38.238.192,100,478,1,2021-04-03T10:01:36,parent_survey_response_4,email,EN,1500025,1,,,,,,,,,,,,,,,,,,,,,1,,5,5,5,5,5,5,5,4,5,4,4,4,2,5,4,5,4,5,5,5,3,5,5,5,2,5,1,5,5,5,5,5,5,5,5,1,,1,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:18:39,5/1/2024 10:23:49,0,73.69.158.255,100,310,1,2021-04-04T10:01:36,parent_survey_response_5,email,EN,1500025,2,2,,"1,2,3",,1,,"4,5,8",,,,,,,,,,,,,,2,,5,4,5,5,5,5,1,1,1,1,1,1,3,1,4,4,5,1,1,1,4,1,1,1,4,5,1,5,5,5,5,1,5,1,1,1,,"2,4",,3,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:20:30,5/1/2024 10:25:16,0,73.182.146.201,100,285,1,2021-04-05T10:01:36,parent_survey_response_6,email,EN,1500025,1,,,,,,,,,,,,,,,1,,,,"2,3,4,5,8",,1,,3,3,3,1,3,2,4,2,4,1,1,3,3,4,3,4,1,5,5,4,3,5,4,3,3,1,3,5,5,4,5,4,4,5,4,2,,2,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:01,5/1/2024 10:27:19,0,209.107.182.203,100,798,1,2021-04-06T10:01:36,parent_survey_response_7,email,EN,1500025,2,1,,5,,1,,5,,,,,,,,,,,,,,1,,3,3,3,1,3,2,4,2,4,1,1,3,3,4,3,4,1,5,5,4,3,5,4,3,3,1,3,5,5,4,5,4,4,5,4,1,,1,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:01,5/1/2024 10:27:19,0,209.107.182.203,100,798,1,2021-04-06T10:01:36,parent_survey_response_8,email,EN,1500025,2,1,,5,,1,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
5/1/2024 10:06:44,5/1/2024 10:15:41,0,50.235.109.170,100,537,1,2021-04-02T10:01:36,parent_survey_response_3,email,EN,1500025,2,1,,4,,2,,"1,5",,,,,,,,,,,,,,2,,5,5,5,4,5,5,5,5,5,4,4,5,4,4,3,4,4,4,4,5,4,4,5,5,2,5,3,4,4,4,4,5,5,5,5,1,,1,,3,,6,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:23,5/1/2024 10:22:22,0,73.38.238.192,100,478,1,2021-04-03T10:01:36,parent_survey_response_4,email,EN,1500025,1,3,,7,,,,,,,,,,,,,,,,,,4,,5,5,5,5,5,5,5,4,5,4,4,4,2,5,4,5,4,5,5,5,3,5,5,5,2,5,1,5,5,5,5,5,5,5,5,1,,1,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:18:39,5/1/2024 10:23:49,0,73.69.158.255,100,310,1,2021-04-04T10:01:36,parent_survey_response_5,email,EN,1500025,2,2,,"1,2,3",,,,"4,5,8",,,,,,,,,,,,,,2,,5,4,5,5,5,5,1,1,1,1,1,1,3,1,4,4,5,1,1,1,4,1,1,1,4,5,1,5,5,5,5,1,5,1,1,1,,"2,4",,3,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:20:30,5/1/2024 10:25:16,0,73.182.146.201,100,285,1,2021-04-05T10:01:36,parent_survey_response_6,email,EN,1500025,1,,,,,,,,,,,,,,,1,,,,"2,3,4,5,8",,,,3,3,3,1,3,2,4,2,4,1,1,3,3,4,3,4,1,5,5,4,3,5,4,3,3,1,3,5,5,4,5,4,4,5,4,2,,2,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:01,5/1/2024 10:27:19,0,209.107.182.203,100,798,1,2021-04-06T10:01:36,parent_survey_response_7,email,EN,1500025,2,6,,5,,,,5,,,,,,,,,,,,,,,,3,3,3,1,3,2,4,2,4,1,1,3,3,4,3,4,1,5,5,4,3,5,4,3,3,1,3,5,5,4,5,4,4,5,4,1,,1,,2,,5,,2,,1,,,Economically Disadvantaged - N,,Not ELL,,Not Special Education,34
5/1/2024 10:14:01,5/1/2024 10:27:19,0,209.107.182.203,100,798,1,2021-04-06T10:01:36,parent_survey_response_8,email,EN,1500025,2,Prefer not to disclose,,5,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

1 StartDate EndDate Status IPAddress Progress Duration (in seconds) Finished RecordedDate ResponseId DistributionChannel UserLanguage DESE ID Number of Children Gender-1 Gender-1_7_TEXT Race-1 Race-1_7_TEXT Gender-2 Gender-2_7_TEXT Race-2 Race-2_7_TEXT Gender-3 Gender-3_7_TEXT Race-3 Race-3_7_TEXT Gender-4 Gender-4_7_TEXT Race-4 Race-4_7_TEXT Gender-5 Gender-5_7_TEXT Race-5 Race-5_7_TEXT Gender Gender_7_TEXT p-scrp-q3 p-scrp-q2 p-valm-q1 p-valm-q2 p-valm-q3 p-valm-q4 p-comm-q1 p-comm-q2 p-comm-q3 p-tcom-q1 P-tcom-q2 p-tcom-q3 p-evnt-q4 p-comm-q4 p-evnt-q3 p-evnt-q1 p-evnt-q2 p-socx-q3 p-socx-q4 p-scrp-q1 p-socx-q1 p-sosu-q1 p-sosu-q2 p-sosu-q3 p-socx-q2 p-sosu-q4 p-phys-q3 p-acpr-q1 p-acpr-q2 p-acpr-q3 p-acpr-q4 p-cure-q1 p-cure-q2 p-cure-q3 p-cure-q4 Housing Housing_100_TEXT Employment Employment_100_TEXT Caregivers Caregivers_100_TEXT Education Education_100_TEXT Benefits Benefits_100_TEXT Language Language_100_TEXT Raw Income Income Raw ELL ELL Raw SpEd SpEd Progress Count
2 5/1/2024 10:04:34 5/1/2024 10:10:49 0 72.93.86.98 100 374 1 2021-03-31T10:01:36 parent_survey_response_1 email EN 1500025 1 1 2 4 5 5 4 5 5 5 5 5 4 4 5 4 5 3 4 5 4 4 5 5 5 5 5 5 5 1 2 2 2 1 4 5 5 5 1 1 2 5 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
3 5/1/2024 10:03:52 5/1/2024 10:14:42 0 73.69.182.58 100 649 1 2021-04-01T10:01:36 parent_survey_response_2 email EN 1500025 1 6 7 1 4 4 5 5 5 5 5 5 5 5 5 5 3 5 4 5 5 5 5 5 4 4 4 4 5 5 1 5 4 5 5 5 5 5 5 1 99 2 3 1 1 Economically Disadvantaged - N Not ELL Not Special Education 34
4 5/1/2024 10:06:44 5/1/2024 10:15:41 0 50.235.109.170 100 537 1 2021-04-02T10:01:36 parent_survey_response_3 email EN 1500025 2 2 1 4 2 1,5 2 5 5 5 4 5 5 5 5 5 4 4 5 4 4 3 4 4 4 4 5 4 4 5 5 2 5 3 4 4 4 4 5 5 5 5 1 1 3 6 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
5 5/1/2024 10:14:23 5/1/2024 10:22:22 0 73.38.238.192 100 478 1 2021-04-03T10:01:36 parent_survey_response_4 email EN 1500025 1 3 7 1 4 5 5 5 5 5 5 5 4 5 4 4 4 2 5 4 5 4 5 5 5 3 5 5 5 2 5 1 5 5 5 5 5 5 5 5 1 1 2 5 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
6 5/1/2024 10:18:39 5/1/2024 10:23:49 0 73.69.158.255 100 310 1 2021-04-04T10:01:36 parent_survey_response_5 email EN 1500025 2 2 1,2,3 1 4,5,8 2 5 4 5 5 5 5 1 1 1 1 1 1 3 1 4 4 5 1 1 1 4 1 1 1 4 5 1 5 5 5 5 1 5 1 1 1 2,4 3 5 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
7 5/1/2024 10:20:30 5/1/2024 10:25:16 0 73.182.146.201 100 285 1 2021-04-05T10:01:36 parent_survey_response_6 email EN 1500025 1 1 2,3,4,5,8 1 3 3 3 1 3 2 4 2 4 1 1 3 3 4 3 4 1 5 5 4 3 5 4 3 3 1 3 5 5 4 5 4 4 5 4 2 2 2 5 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
8 5/1/2024 10:14:01 5/1/2024 10:27:19 0 209.107.182.203 100 798 1 2021-04-06T10:01:36 parent_survey_response_7 email EN 1500025 2 1 6 5 1 5 1 3 3 3 1 3 2 4 2 4 1 1 3 3 4 3 4 1 5 5 4 3 5 4 3 3 1 3 5 5 4 5 4 4 5 4 1 1 2 5 2 1 Economically Disadvantaged - N Not ELL Not Special Education 34
9 5/1/2024 10:14:01 5/1/2024 10:27:19 0 209.107.182.203 100 798 1 2021-04-06T10:01:36 parent_survey_response_8 email EN 1500025 2 1 Prefer not to disclose 5 1 5

View file

@ -315,7 +315,7 @@ def reads_headers_from_raw_csv(processed_data)
"s-grit-q1", "s-grit-q2", "s-grit-q3", "s-grit-q4", "s-expa-q1", "s-poaf-q1", "s-poaf-q2", "s-poaf-q3",
"s-poaf-q4", "s-tint-q1-1", "s-tint-q2-1", "s-tint-q3-1", "s-tint-q4-1", "s-tint-q5-1", "s-acpr-q1-1",
"s-acpr-q2-1", "s-acpr-q3-1", "s-acpr-q4-1", "s-peff-q1-1", "s-peff-q2-1", "s-peff-q3-1", "s-peff-q4-1",
"s-peff-q5-1", "s-peff-q6-1", "Raw Income", "Income", "Raw ELL", "ELL", "Raw SpEd", "SpEd", "Progress Count", "Housing Status", "Raw Housing Status", "Home Language", "Home Languages", "Declared Races of Children from Parents"].to_set.sort
"s-peff-q5-1", "s-peff-q6-1", "Raw Income", "Income", "Raw ELL", "ELL", "Raw SpEd", "SpEd", "Progress Count", "Housing Status", "Raw Housing Status", "Home Language", "Home Languages", "Declared Races of Children from Parents", "Declared Genders of Children from Parents"].to_set.sort
end
def invalid_rows_are_rejected_for_the_correct_reasons(data)

View file

@ -129,12 +129,12 @@ describe SurveyResponsesDataLoader do
let(:unknown_race) { create(:race, qualtrics_code: 99, designation: "Race/Ethnicity Not Listed") }
let(:multiracial) { create(:race, qualtrics_code: 100, designation: "Multiracial") }
let(:languages){
let(:languages) do
create(:language, designation: "English")
create(:language, designation: "Spanish")
create(:language, designation: "Portuguese")
create(:language, designation: "Unknown")
}
end
let(:setup) do
ay_2020_21
@ -277,6 +277,10 @@ describe SurveyResponsesDataLoader do
it "loads the correct set of races for parents" do
assigns_races_to_parents
end
it "loads the correct set of genders for parents" do
assigns_genders_to_parents
end
end
end
@ -470,18 +474,18 @@ def assigns_races_to_students
end
end
def assigns_races_to_parents
results = {
"parent_survey_response_1" => [american_indian],
"parent_survey_response_2" => [unknown_race],
"parent_survey_response_3" => [american_indian, latinx, white, multiracial],
"parent_survey_response_4" => [unknown_race],
"parent_survey_response_5" => [american_indian, asian, black, latinx, white, middle_eastern,
multiracial],
"parent_survey_response_6" => [american_indian, asian, black, latinx, white, middle_eastern,
multiracial],
"parent_survey_response_7" => [white] }
"parent_survey_response_1" => [american_indian],
"parent_survey_response_2" => [unknown_race],
"parent_survey_response_3" => [american_indian, latinx, white, multiracial],
"parent_survey_response_4" => [unknown_race],
"parent_survey_response_5" => [american_indian, asian, black, latinx, white, middle_eastern,
multiracial],
"parent_survey_response_6" => [american_indian, asian, black, latinx, white, middle_eastern,
multiracial],
"parent_survey_response_7" => [white]
}
results.each do |key, value|
race = SurveyItemResponse.find_by_response_id(key).parent.races.to_a
@ -489,3 +493,17 @@ def assigns_races_to_parents
expect(race).to eq value
end
end
def assigns_genders_to_parents
results = { "parent_survey_response_1" => [male],
"parent_survey_response_2" => [female],
"parent_survey_response_3" => [female, male],
"parent_survey_response_4" => [non_binary],
"parent_survey_response_5" => [male],
"parent_survey_response_6" => [unknown_gender] }
# "parent_survey_response_7" => [non_binary] }
results.each do |key, value|
expect(SurveyItemResponse.where(response_id: key).first.parent.genders).to eq value
end
end