feat: add special education disaggregation

This commit is contained in:
rebuilt 2023-10-05 14:51:36 -07:00
parent a9b4f97a84
commit acfdaf5587
23 changed files with 379 additions and 52 deletions

View file

@ -21,6 +21,10 @@ describe DemographicLoader do
["ELL", "Not ELL", "Unknown"]
end
let(:speds) do
["Special Education", "Not Special Education", "Unknown"]
end
before :each do
DemographicLoader.load_data(filepath:)
end
@ -68,5 +72,12 @@ describe DemographicLoader do
expect(Ell.find_by_designation(ell).designation).to eq ell
end
end
it "load all the special ed designations" do
expect(Sped.all.count).to eq 3
speds.each do |sped|
expect(Sped.find_by_designation(sped).designation).to eq sped
end
end
end
end

View file

@ -251,6 +251,44 @@ RSpec.describe SurveyItemValues, type: :model do
end
end
context ".sped" do
before :each do
attleboro
ay_2022_23
end
it 'translates "active" into "Special Education"' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "active" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Special Education"
end
it 'translates "exited" into "Not Special Education"' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "exited" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Not Special Education"
end
it 'translates blanks into "Not Special Education' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Not Special Education"
end
it 'tranlsates NA into "Unknown"' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "NA" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Unknown"
row = { "Raw SpEd" => "#NA" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Unknown"
end
end
context ".valid_duration" do
context "when duration is valid" do
it "returns true" do