WIP: Update the parent table to hold a reference to a language

Update the data uploader script to read the language from the csv and update the language information for any parent items that already exist (or create database entries if none already exist)
This commit is contained in:
rebuilt 2025-04-15 15:03:32 -07:00
parent a48a2b1d7a
commit 446b3b1096
11 changed files with 182 additions and 23 deletions

View file

@ -0,0 +1,46 @@
module Analyze
module Graph
module Column
module Parent
class Language < ColumnBase
attr_reader :parent
def initialize(parent:)
@parent = parent
end
def label
["#{parent.designation}"]
end
def basis
"parent"
end
def show_irrelevancy_message?(measure:)
false
end
def show_insufficient_data_message?(measure:, school:, academic_years:)
false
end
def type
:parent
end
def n_size(measure:, school:, academic_year:)
SurveyItemResponse.where( survey_item: measure.parent_survey_items, school:, academic_year:),
academic_year:).select(:response_id).distinct.count
end
def score(measure:, school:, academic_year:)
Score.new(average: 3,
meets_teacher_threshold: false,
meets_student_threshold:,
meets_admin_data_threshold: false)
end
end
end
end
end

View file

@ -0,0 +1,42 @@
# frozen_string_literal: true
module Analyze
module Graph
class ParentsByLanguage
attr_reader :speds
def initialize(speds:)
@speds = speds
end
def to_s
"Parents by Language"
end
def slug
"parents-by-language"
end
def columns
[].tap do |array|
speds.each do |sped|
array << Analyze::Graph::Column::Sped.new(sped:)
end
array << Analyze::Graph::Column::AllStudent.new
end
end
def source
Analyze::Source::SurveyData.new(slices: nil, graph: self)
end
def slice
Analyze::Slice::StudentsByGroup.new(graph: self)
end
def group
Analyze::Group::Base.new(name: "Special Education", slug: "sped", graph: self)
end
end
end
end