add disaggregation glossary

This commit is contained in:
Nelson Jovel 2024-05-14 15:25:00 -07:00
parent ab39928080
commit d4db4e0fa2
9 changed files with 158 additions and 101 deletions

View file

@ -5,14 +5,16 @@ class Ell < ApplicationRecord
friendly_id :designation, use: [:slugged]
def self.to_designation(ell)
return "Not ELL" if ell.blank? || ell.nil?
return "Not ELL" if ell.blank?
ell = ell.delete(",")
case ell
in /lep\s*student\s*1st\s*year|LEP\s*student\s*not\s*1st\s*year|EL\s*Student\s*First\s*Year|LEP\s*student|^EL|true/i
in /lep\s*student\s*1st\s*year|LEP\s*student\s*not\s*1st\s*year|EL\s*Student\s*First\s*Year|LEP\s*student|^EL|true|1/i
"ELL"
in /^NA$|^#NA$|^NA|0|Does\s*not\s*apply|Unknown/i
in /0|2|3|Does\s*not\s*apply/i
"Not ELL"
in %r{^#*N/*A$|Unknown}i
"Unknown"
else
puts "************************************"
puts "******** ERROR **********"

View file

@ -4,19 +4,21 @@ class Gender < ApplicationRecord
}
def self.qualtrics_code_from(word)
return 99 if word.blank?
case word
when /Female|^F|1/i
when /Female|^F$|1/i
1
when /Male|^M|2/i
when /Male|^M$|2/i
2
when /Another\s*Gender|Gender Identity not listed above|3|7/i
4 # We categorize any self reported gender as non-binary
when /Non-Binary|^N|4/i
when /Non-Binary|^N$|4/i
4
when /Prefer not to disclose|6/i
99
when %r{^#*N/*A$}i
nil
99
else
99
end

View file

@ -9,6 +9,8 @@ class Race < ApplicationRecord
}
def self.qualtrics_code_from(word)
return nil if word.blank?
case word
when /Native\s*American|American\s*Indian|Alaskan\s*Native|1/i
1

View file

@ -5,14 +5,14 @@ class Sped < ApplicationRecord
friendly_id :designation, use: [:slugged]
def self.to_designation(sped)
return "Not Special Education" if sped.blank? || sped.nil?
return "Not Special Education" if sped.blank?
case sped
in /active|^A$|1|Special\s*Education/i
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/i
"Not Special Education"
in /^NA$|^#NA$|Unknown/i
in %r{^#*N/*A$|Unknown}i
"Unknown"
else
puts "************************************"

View file

@ -147,17 +147,17 @@ class SurveyItemValues
race_codes ||= []
race_codes = race_codes.split(",")
.map do |word|
word.split(/\s+and\s+/i)
end.flatten
.reject(&:blank?)
.map { |race| Race.qualtrics_code_from(race) }.map(&:to_i)
.map { |word| word.split(/\s+and\s+/i) }
.flatten
.reject(&:blank?)
.map { |race| Race.qualtrics_code_from(race) }
.map(&:to_i)
# Only check the secondary hispanic column if we don't have self reported data and are relying on SIS data
if self_report.nil? && sis.present?
hispanic = value_from(pattern: /Hispanic\s*Latino/i)&.downcase
race_codes = race_codes.reject { |code| code == 5 } if hispanic == "true" && race_codes.count == 1
race_codes = race_codes.push(4) if hispanic == "true"
race_codes = race_codes.push(4) if hispanic == "true" || hispanic == "1"
end
Race.normalize_race_list(race_codes)
@ -202,8 +202,6 @@ class SurveyItemValues
output ||= row[match]&.strip
end
return nil if output&.match?(%r{^#*N/*A$}i) || output.blank?
output
end