Convert gender and race text into qualtrics codes during cleaning. Abide by 'prefer not to disclose' for self reported race. Give priority to self reported data but use SIS information as backup

This commit is contained in:
Nelson Jovel 2023-11-30 20:57:04 -08:00
parent 305ddf2b1a
commit e325f38c43
6 changed files with 62 additions and 9 deletions

View file

@ -4,7 +4,7 @@ require "fileutils"
RSpec.describe Cleaner do
let(:district) { create(:district, name: "Maynard Public Schools") }
let(:second_district) { create(:district, name: "District2") }
let(:school) { create(:school, dese_id: 1_740_505, district:) }
let(:school) { create(:school, dese_id: 1_740_505, district:, name: "Maynard High School") }
let(:second_school) { create(:school, dese_id: 1_740_305, district:) }
let(:third_school) { create(:school, dese_id: 222_222, district: second_district) }
@ -156,7 +156,7 @@ RSpec.describe Cleaner do
filename = Cleaner.new(input_filepath:, output_filepath:, log_filepath:).filename(
headers: standard_survey_items, data:
)
expect(filename).to eq "maynard.standard.2022-23.csv"
expect(filename).to eq "maynard.maynard-high-school.standard.2022-23.csv"
end
context "when the file is based on short form survey items" do
@ -168,7 +168,7 @@ RSpec.describe Cleaner do
filename = Cleaner.new(input_filepath:, output_filepath:, log_filepath:).filename(
headers: short_form_survey_items, data:
)
expect(filename).to eq "maynard.short_form.2022-23.csv"
expect(filename).to eq "maynard.maynard-high-school.short_form.2022-23.csv"
end
end
@ -181,7 +181,7 @@ RSpec.describe Cleaner do
filename = Cleaner.new(input_filepath:, output_filepath:, log_filepath:).filename(
headers: early_education_survey_items, data:
)
expect(filename).to eq "maynard.early_education.2022-23.csv"
expect(filename).to eq "maynard.maynard-high-school.early_education.2022-23.csv"
end
end
context "when the file is based on teacher survey items" do
@ -193,7 +193,7 @@ RSpec.describe Cleaner do
filename = Cleaner.new(input_filepath:, output_filepath:, log_filepath:).filename(
headers: teacher_survey_items, data:
)
expect(filename).to eq "maynard.teacher.2022-23.csv"
expect(filename).to eq "maynard.maynard-high-school.teacher.2022-23.csv"
end
end

View file

@ -285,15 +285,15 @@ RSpec.describe SurveyItemValues, type: :model do
expect(values.sped).to eq "Not Special Education"
end
it 'tranlsates NA into "Unknown"' do
it 'tranlsates NA into "Not Special Education"' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "NA" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Unknown"
expect(values.sped).to eq "Not Special Education"
row = { "Raw SpEd" => "#NA" }
values = SurveyItemValues.new(row:, headers:, genders:, survey_items:, schools:)
expect(values.sped).to eq "Unknown"
expect(values.sped).to eq "Not Special Education"
end
end