mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
updates to UI to handle nonlikert data, sample nonlikert data
This commit is contained in:
parent
76b98c2c25
commit
adc2c1318a
5 changed files with 36 additions and 11 deletions
|
|
@ -5,7 +5,8 @@ AggregatedResponses = Struct.new(
|
|||
:count,
|
||||
:answer_index_total,
|
||||
:answer_index_average,
|
||||
:most_popular_answer
|
||||
:most_popular_answer,
|
||||
:zscore
|
||||
)
|
||||
|
||||
class Question < ApplicationRecord
|
||||
|
|
|
|||
|
|
@ -27,9 +27,15 @@
|
|||
|
||||
|
||||
- if @school_category.zscore.present?
|
||||
%b Administrative Data
|
||||
= @school_category.zscore.round(1) + 3
|
||||
(out of 5)
|
||||
%b Administrative Data:
|
||||
- if @school_category.nonlikert.present?
|
||||
= @school_category.nonlikert
|
||||
= "(Benchmark: #{@school_category.category.benchmark})"
|
||||
|
||||
- if @school_category.zscore.present?
|
||||
= [(@school_category.zscore.round(1) + 3), 5].min
|
||||
(out of 5)
|
||||
|
||||
|
||||
.indicator-container.py-3
|
||||
= render 'school_categories/indicator', info: @school_category
|
||||
|
|
|
|||
1
data/MCIEA_16-17AdminData.csv
Normal file
1
data/MCIEA_16-17AdminData.csv
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
|||
NonLikert Title,District,School,Value,Z-Score
Percentage of Teachers Working in Area of Licensure,Winchester,Vinson-Owen Elementary School,100%,2
Percentage of Teachers Working in Area of Licensure,Winchester,Lynch Elementary School,100%,2
Percentage of Teachers Working in Area of Licensure,Winchester,McCall Middle School,100%,2
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace :data do
|
|||
Rake::Task["data:load_questions"].invoke
|
||||
Rake::Task["db:seed"].invoke
|
||||
Rake::Task["data:load_responses"].invoke
|
||||
Rake::Task["data:load_nonlikert_values"].invoke
|
||||
end
|
||||
|
||||
desc 'Load in category data'
|
||||
|
|
@ -123,7 +124,7 @@ namespace :data do
|
|||
bad_answers = {}
|
||||
year = '2017'
|
||||
|
||||
timeToRun = 10 * 60
|
||||
timeToRun = 120 * 60
|
||||
startIndex = 0
|
||||
stopIndex = 100000
|
||||
startTime = Time.new
|
||||
|
|
@ -251,19 +252,36 @@ namespace :data do
|
|||
task load_nonlikert_values: :environment do
|
||||
ENV['BULK_PROCESS'] = 'true'
|
||||
|
||||
csv_string = File.read(File.expand_path("../../../data/samplenonlikert.csv", __FILE__))
|
||||
csv_string = File.read(File.expand_path("../../../data/MCIEA_16-17AdminData.csv", __FILE__))
|
||||
csv = CSV.parse(csv_string, :headers => true)
|
||||
puts("LOADING NONLIKERT CSV: #{csv.length} ROWS")
|
||||
|
||||
t = Time.new
|
||||
school_category_id = -1
|
||||
csv.each_with_index do |row, index|
|
||||
nonlikert_category = Category.find_by_name(row["NonLikert Title"])
|
||||
district = District.find_by_name(row["District"])
|
||||
school = district.schools.find_by_name(row["School"])
|
||||
base = Category
|
||||
category_ids = row["Category"].split("-")
|
||||
category_ids.each do |category_id|
|
||||
puts("#{category_id} -> #{base.find_by_external_id(category_id).try(:name)}")
|
||||
base = base.find_by_external_id(category_id).child_categories
|
||||
end
|
||||
|
||||
nonlikert_category = base.find_or_create_by(name: row["NonLikert Title"])
|
||||
|
||||
if nonlikert_category.nil?
|
||||
puts("Unable to find nonlikert category: #{row["NonLikert Title"]}")
|
||||
next
|
||||
else
|
||||
if (benchmark = row["B_MCIEA"]).present?
|
||||
nonlikert_category.update(benchmark: benchmark)
|
||||
end
|
||||
end
|
||||
|
||||
district = District.find_or_create_by(name: row["District"], state_id: 1)
|
||||
school = district.schools.find_or_create_by(name: row["School"])
|
||||
school_category = school.school_categories.find_or_create_by(category: nonlikert_category)
|
||||
school_category.update(
|
||||
nonlikert: row["Value"],
|
||||
nonlikert: row["NL_Value"],
|
||||
zscore: row["Z-Score"]
|
||||
)
|
||||
school_category_id = school_category.id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue