add disaggregation glossary

This commit is contained in:
Nelson Jovel 2024-05-14 15:25:00 -07:00
parent 63b4c4762a
commit ea2feb138b
9 changed files with 160 additions and 104 deletions

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