diff --git a/app/models/income.rb b/app/models/income.rb index f0c37179..cf7507bf 100644 --- a/app/models/income.rb +++ b/app/models/income.rb @@ -7,7 +7,7 @@ class Income < ApplicationRecord friendly_id :designation, use: [:slugged] def self.to_designation(income) - return "Unknown" if income.blank? or income.nil? + return "Economically Disadvantaged - N" if income.blank? or income.nil? case income in /Free\s*Lunch|Reduced\s*Lunch|Low\s*Income|Reduced\s*price\s*lunch|true|1/i diff --git a/app/models/sped.rb b/app/models/sped.rb index 49c2c17e..756579a5 100644 --- a/app/models/sped.rb +++ b/app/models/sped.rb @@ -10,7 +10,7 @@ class Sped < ApplicationRecord case sped in /active|^A$|1|^Special\s*Education$/i "Special Education" - in /^I$|exited|0|^Not\s*Special\s*Education$|Does\s*not\s*apply/i + in /^I$|exited|0|^Not\s*Special\s*Education$|Does\s*not\s*apply|Referred|Ineligible/i "Not Special Education" in %r{^#*N/*A$|Unknown}i "Unknown" diff --git a/spec/fixtures/demographic_glossary.csv b/spec/fixtures/demographic_glossary.csv index 60eaeb76..63daa419 100644 --- a/spec/fixtures/demographic_glossary.csv +++ b/spec/fixtures/demographic_glossary.csv @@ -3,14 +3,13 @@ EL student not 1st year,ELL,EL Student First Year,A,Special Education,Special Ed "EL student, not 1st year",ELL,Raw ELL,active,Special Education,Raw SPED,Reduced Lunch,Economically Disadvantaged – Y,Raw Income EL student 1st year,ELL,ELL- SIS,1,Special Education,SPED- SIS,LowIncome,Economically Disadvantaged – Y,SES- SIS "EL student, 1st year",ELL,DirectCert,Special Education,Special Education,SPED,Low Income,Economically Disadvantaged – Y,EconDisadvantaged -EL - Early Child. or PK,ELL,,Referred,Special Education,,Reduced price lunch,Economically Disadvantaged – Y,Income SIS -1,ELL,,Ineligible,Not Special Education,,TRUE,Economically Disadvantaged – Y, +EL - Early Child. or PK,ELL,ELL,Referred,Not Special Education,,Reduced price lunch,Economically Disadvantaged – Y,Income SIS +1,ELL,,Ineligible,Not Special Education,,TRUE,Economically Disadvantaged – Y,SES lep student 1st year,ELL,,I,Not Special Education,,1,Economically Disadvantaged – Y, lep student not 1st year,ELL,,exited,Not Special Education,,Not Eligible,Economically Disadvantaged – N, LEP Not1stYr,ELL,,0,Not Special Education,,FALSE,Economically Disadvantaged – N, LEP1stYr US Sch,ELL,,Not Special Education,Not Special Education,,0,Economically Disadvantaged – N, -"Does not apply -",Not ELL,,Does not apply,Not Special Education,,[blanks],Unknown, +Does not apply,Not ELL,,Does not apply,Not Special Education,,[blanks],Economically Disadvantaged – N, 0,Not ELL,,[blanks],Not Special Education,,#NA,Unknown, 2,Not ELL,,#NA,Unknown,,NA,Unknown, 3,Not ELL,,NA,Unknown,,N/A,Unknown, diff --git a/spec/fixtures/test_2020-21_student_survey_responses.csv b/spec/fixtures/test_2020-21_student_survey_responses.csv index 5f7c83dc..aee4bf05 100644 --- a/spec/fixtures/test_2020-21_student_survey_responses.csv +++ b/spec/fixtures/test_2020-21_student_survey_responses.csv @@ -2,7 +2,7 @@ Start Date,End Date,Response Type,IP Address,Progress,Duration (in seconds),Fini 2020-09-29 18:28:41,2020-09-29 18:48:28,0,73.249.89.226,6,1186,0,2020-09-30T18:48:50,student_survey_response_1,123456,,,,,,,anonymous,EN,1,8,1500025,,,,dddd,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,0,some non-integer response,6,,,,5,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,EN,,,,,1,888,11th,1,Free Lunch,Economically Disadvantaged – Y,Does not apply,Not ELL,exited 2021-02-23 15:12:58,2021-02-23 15:13:17,0,50.207.254.114,0,19,0,2021-02-24T15:13:19,student_survey_response_2,234567,,,,,,,anonymous,EN,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,NA,,,,,,,,,,,,,,,,,,,,,EN,,,,,,888,10,,Not Eligible,Economically Disadvantaged – N,,Not ELL,Unknown 2021-03-31 9:50:19,2021-03-31 9:59:01,0,108.7.17.250,100,522,1,2021-03-31T09:59:02,student_survey_response_3,345678,,,,,42.53340149,-70.96530151,anonymous,EN,3,2,1500505,12,4,108,3300,7,1,,,,,,,,,,,,,,2,4,2,1,4,3,3,,,,,3,3,3,3,,,,,NA,,,,,,,,,3,2,3,3,2,1,3,3,4,1,3,3,4,4,2,4,3,3,4,3,3,3,4,3,3,3,3,3,,,,,,,,,,3,4,4,2,3,3,1,,3,,EN,Math teacher,,,,"2,3,4",888,8,2,Reduced Lunch,Economically Disadvantaged – Y,,Not ELL,Unknown -2021-03-31 9:50:09,2021-03-31 10:00:16,0,67.186.188.168,100,607,1,2021-03-31T10:00:17,student_survey_response_4,456789,,,,,42.63510132,-71.30139923,anonymous,EN,3,2,1500505,12,18,108,2064,7,1,,2,2,1,,,,,,,,,,,,,,,,,,,,,,,,,3,5,3,3,,,,,,,,,,4,4,3,4,5,1,,1,5,1,3,2,4,4,1,2,1,3,2,3,3,3,4,2,5,3,4,5,5,3,3,4,3,,,,,4,4,4,4,3,5,2,,2,,EN,,,,English teacher,7,888,8,3,,Unknown,LEP student not 1st year,ELL,active +2021-03-31 9:50:09,2021-03-31 10:00:16,0,67.186.188.168,100,607,1,2021-03-31T10:00:17,student_survey_response_4,456789,,,,,42.63510132,-71.30139923,anonymous,EN,3,2,1500505,12,18,108,2064,7,1,,2,2,1,,,,,,,,,,,,,,,,,,,,,,,,,3,5,3,3,,,,,,,,,,4,4,3,4,5,1,,1,5,1,3,2,4,4,1,2,1,3,2,3,3,3,4,2,5,3,4,5,5,3,3,4,3,,,,,4,4,4,4,3,5,2,,2,,EN,,,,English teacher,7,888,8,3,,Economically Disadvantaged – N,LEP student not 1st year,ELL,active 2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_5,567890,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8,6,7",888,7,4,Free Lunch,Economically Disadvantaged – Y,EL Student First Year,ELL,active 2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_6,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8",888,3,NA,Not Eligible,Economically Disadvantaged – N,Unknown,Unknown,NA 2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_7,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,5,,4,7,Reduced Lunch,Economically Disadvantaged – Y,#N/A,Unknown, diff --git a/spec/services/survey_item_values_spec.rb b/spec/services/survey_item_values_spec.rb index bea60e93..0bbdbe64 100644 --- a/spec/services/survey_item_values_spec.rb +++ b/spec/services/survey_item_values_spec.rb @@ -523,11 +523,11 @@ RSpec.describe SurveyItemValues, type: :model do expect(values.income).to eq "Economically Disadvantaged - N" end - it "translates blanks to Unknown" do + it "translates blanks to 'Economically Disadvantaged - N'" do headers = ["LowIncome"] row = { "LowIncome" => "" } values = SurveyItemValues.new(row:, headers:, survey_items:, schools:) - expect(values.income).to eq "Unknown" + expect(values.income).to eq "Economically Disadvantaged - N" end # NOTE: This will halt test runs too diff --git a/spec/services/survey_responses_data_loader_spec.rb b/spec/services/survey_responses_data_loader_spec.rb index 1151dbf7..731875e4 100644 --- a/spec/services/survey_responses_data_loader_spec.rb +++ b/spec/services/survey_responses_data_loader_spec.rb @@ -328,7 +328,7 @@ end def assigns_income_to_responses results = { "student_survey_response_1" => low_income, "student_survey_response_3" => low_income, - "student_survey_response_4" => unknown_income, + "student_survey_response_4" => high_income, "student_survey_response_5" => low_income, "student_survey_response_6" => high_income, "student_survey_response_7" => low_income } @@ -349,8 +349,6 @@ def assigns_ell_to_responses results.each do |key, value| ell = SurveyItemResponse.find_by_response_id(key).ell - puts key - puts value expect(ell).to eq value end end