feat: pull down new admin data. Fix problems with some scrapers. For 5D-ii make sure the likert score is 1 if the nurse count is 0. Prevent devision by zero returning infinity. For 3A-ii make sure not to perform division by zero. Likert score will be 1 if the number of guidance couselors, psychologists, or paraprofessionals is zero.

This commit is contained in:
rebuilt 2025-03-12 13:46:01 -07:00
parent 7caae8dd3e
commit 044a77cd3d
10 changed files with 45452 additions and 41916 deletions

View file

@ -6,7 +6,7 @@ module Dese
attr_reader :filepaths
def scrape_enrollments(filepath:)
headers = ['Raw likert calculation', 'Likert Score', 'Admin Data Item', 'Academic Year', 'School Name', 'DESE ID',
headers = ['Raw likert calculation', 'Likert Score', 'Admin Data Item', 'Academic Year', 'School Name', 'School Code',
'PK', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'SP', 'Total']
write_headers(filepath:, headers:)
run do |academic_year|

View file

@ -17,7 +17,7 @@ module Dese
filepath = filepaths[1]
headers = ['Raw likert calculation', 'Likert Score', 'Admin Data Item', 'Academic Year', 'School Name', 'DESE ID',
'<26 yrs (# )', '26-32 yrs (#)', '33-40 yrs (#)', '41-48 yrs (#)', '49-56 yrs (#)', '57-64 yrs (#)', 'Over 64 yrs (#)', 'FTE Count']
'<26 yrs (# )', '26-32 yrs (#)', '33-40 yrs (#)', '41-48 yrs (#)', '49-56 yrs (#)', '57-64 yrs (#)', 'Over 64 yrs (#)', 'FTE Count', 'Student Count', 'Student to Nurse Ratio']
write_headers(filepath:, headers:)
run_a_phya_i1(filepath:)
@ -45,8 +45,12 @@ module Dese
dese_id = items[headers['School Code']].to_i
num_of_students = student_count(filepath: filepaths[0], dese_id:, year: academic_year.range) || 0
items << num_of_students
items << (num_of_students / nurse_count)
((benchmark - (num_of_students / nurse_count)) + benchmark) * 4 / benchmark
return 0 if nurse_count == 0
student_to_nurse_ratio = num_of_students / nurse_count
items << student_to_nurse_ratio
((benchmark - student_to_nurse_ratio) + benchmark) * 4 / benchmark
}
Prerequisites.new(filepath, url, selectors, submit_id, admin_data_item_id, calculation)
end

View file

@ -67,7 +67,7 @@ module Dese
num_of_students = student_count(filepath: filepaths[0], dese_id:, year: academic_year.range) || 0
items << num_of_students
benchmark = 250
if fte_index.present? && !items[fte_index] != ""
if fte_index.present? && num_of_guidance_counselors != 0
result = ((benchmark - (num_of_students / num_of_guidance_counselors)) + benchmark) * 4 / benchmark
end
items << (num_of_students / num_of_guidance_counselors)
@ -93,10 +93,9 @@ module Dese
num_of_students = student_count(filepath: filepaths[0], dese_id:, year: academic_year.range) || 0
items << num_of_students
benchmark = 250
if fte_index.present? && !items[fte_index] != ""
if fte_index.present? && num_of_psychologists != 0
result = ((benchmark - (num_of_students / num_of_psychologists)) + benchmark) * 4 / benchmark
end
items << (num_of_students / num_of_psychologists)
result
}
@ -120,7 +119,7 @@ module Dese
num_of_students = student_count(filepath: filepaths[0], dese_id:, year: academic_year.range) || 0
items << num_of_students
benchmark = 43.4
if fte_index.present? && !items[fte_index] != ""
if fte_index.present? && num_of_paraprofessionals != 0
result = ((benchmark - (num_of_students / num_of_paraprofessionals)) + benchmark) * 4 / benchmark
end
@ -148,7 +147,7 @@ module Dese
num_of_students = student_count(filepath: filepaths[0], dese_id:, year: academic_year.range) || 0
items << num_of_students
benchmark = 500
if num_of_art_teachers.present?
if num_of_art_teachers.present? && num_of_art_teachers != 0
result = ((benchmark - (num_of_students / num_of_art_teachers)) + benchmark) * 4 / benchmark
end

View file

@ -21,10 +21,10 @@ module Dese
run_teacher_demographics(filepath:)
filepath = filepaths[1]
headers = ["Raw likert calculation", "Likert Score", "Admin Data Item", "Academic Year", "Non-White Teachers %", "Non-White Students %", "School Name", "DESE ID",
headers = ["Raw likert calculation", "Likert Score", "Admin Data Item", "Academic Year", "School Name", "DESE ID",
"African American", "Asian", "Hispanic", "White", "Native American",
"Native Hawaiian or Pacific Islander", "Multi-Race or Non-Hispanic", "Males",
"Females", "Non-Binary", "Students of color (%)"]
"Females", "Non-Binary", "Students of color (%)", "Non-White Teachers %", "Non-White Students %"]
write_headers(filepath:, headers:)
run_student_demographics(filepath:)
@ -101,12 +101,12 @@ module Dese
white_number = items[white_index].to_f
dese_id = items[headers["School Code"]].to_i
non_white_student_percentage = (100 - white_number).to_f
items.unshift(non_white_student_percentage)
items << non_white_student_percentage
count_of_teachers = teacher_count(filepath: filepaths[0], dese_id:, year: academic_year.range)
return "NA" if count_of_teachers == "NA"
non_white_teacher_percentage = count_of_teachers.to_f
items.unshift(non_white_teacher_percentage)
items << non_white_teacher_percentage
floor = 5
benchmark = 0.25