No description
Find a file
2021-12-07 14:26:45 +01:00
.github/workflows Remove landing-page-jest branch from CI pipeline 2021-10-16 00:09:16 +02:00
app Report that admin data is not included 2021-12-02 16:37:24 -05:00
bin Add css bundling (again!) 2021-11-17 10:52:35 -05:00
config Add css bundling (again!) 2021-11-17 10:52:35 -05:00
data Add migration to make DESE IDs unique, update one-off script accordingly 2021-11-22 15:37:38 -05:00
db Add migration to make DESE IDs unique, update one-off script accordingly 2021-11-22 15:37:38 -05:00
doc Format prod deploy steps as a checklist 2021-12-01 13:37:42 -05:00
lib Remove obsolete one_off:remove_dupes rake task 2021-12-02 11:05:17 -05:00
log first commit 2017-02-23 12:52:56 -05:00
public Complete styling for _quality_framework_indicators 2021-10-07 17:33:17 +02:00
scripts Default to beta when loading a database from heroku, if no argument is presented 2021-12-01 13:34:45 -05:00
spec Report that admin data is not included 2021-12-02 16:37:24 -05:00
tmp first commit 2017-02-23 12:52:56 -05:00
vendor/assets first commit 2017-02-23 12:52:56 -05:00
.editorconfig we have a gauge! next up, let's style the page 2021-10-01 13:32:10 -04:00
.gitignore Add css bundling (again!) 2021-11-17 10:52:35 -05:00
.prettierrc Add missing javascript dependencies to package.json. Move javascripts files to app/javascript. Add first javascript test. Change test mode 2021-10-16 00:03:44 +02:00
.rspec user and recipient and tests 2017-02-25 11:00:27 -05:00
.ruby-version update to ruby 3.0 2021-10-18 13:30:36 -04:00
babel.config.js Set up jest with babel. Add failing test to see if it passes CI 2021-10-16 00:03:44 +02:00
config.ru first commit 2017-02-23 12:52:56 -05:00
Gemfile Add css bundling (again!) 2021-11-17 10:52:35 -05:00
Gemfile.lock Upgrade cssbundling-rails and jsbundling-rails 2021-11-17 16:35:03 -05:00
package.json Add css bundling (again!) 2021-11-17 10:52:35 -05:00
Procfile Run migrations when deploying to Heroku 2021-11-02 09:27:14 -04:00
Procfile.dev Add css bundling (again!) 2021-11-17 10:52:35 -05:00
Rakefile first commit 2017-02-23 12:52:56 -05:00
README.md Update readme to explain how to create a postgres db on linux devices 2021-12-07 14:26:45 +01:00
yarn-error.log Switch from sprockets to cssbundling for bundling css assets. 2021-10-23 19:59:34 +02:00
yarn.lock Add css bundling (again!) 2021-11-17 10:52:35 -05:00

edcontext

This project contains three pieces:

  • A webapp for visualizing and understanding MCIEA survey data
  • Tasks for processing and indexing raw survey data
  • Experimental work to conduct survey samples via text message

This is a Rails project, deployed on Heroku.

Live app: https://mciea-dashboard.herokuapp.com/ Live dashboard: http://mciea-dashboard.herokuapp.com/districts/winchester/schools/winchester-high-school/dashboard?year=2020-21

Local development

Install Postgres and running first.

(MacOS, Optional), you can use Homebrew:

brew install postgres
brew services start postgresql

Linux:

Install postgres. Known working version is version 13

https://www.postgresql.org/download/

On linux, if you run into problems creating the postgres database, edit /etc/postgresql/13/main/pg_hba.conf. Change the connection method of IPv4 and IPv6 connections from md5 to trust.

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Once postgres is installed and running, install the required gems and then migrate the database.

bundle install
bundle exec rake db:create db:schema:load db:seed

Install the javascript dependencies

yarn install

At this point you can run the app and login. There won't be any data yet though; keep reading!

The seed file populates the following tables

Name Description
School School ids are only unique to their district. More than one school has an id of 1
District Districts and schools have attached slugs. We find search for these models by their slugs
SqmCategory The legacy name here is Category. It still exits in the database. We wanted the freedom to make changes and still preserve the legacy site until the end of the engagement.
Measure In the bar graph measures represent a single bar
SurveyItem This table has an attribute prompt that is the question asked

SurveyItemResponses does not get populated at this stage.

Database

Postgres

Gems

Name Description
puma webserver
pg postgres
sassc-rails sass compiler
jquery-rails legacy, allows use of jquery
jbuilder legacy, build json objects
haml legacy, write views in haml syntax
bootstrap css framework
newrelic_rpm legacy?, application monitoring
devise authentication
omniauth authentication
twilio-ruby legacy, text messaging
activerecord-import faster database imports

External APIs

None yet. Hoping to integrate with Powerschool and Aspen for school administrative data.

Javascript libraries

Esbuild is used as the javascript bundler. The javascript testing library is jest.

css

Bootstrap 5

Loading Data

SurveyItemResponses is the most important table to understand. SurveyItemResponses is the data that will change year to year and makes up the majority of the database records. Roughly 500,000 SurveyItemResponses per year.

Some notes:

  • The data loading task assumes that the CSV files live in the #{RAILS_ROOT}/data/survey_responses directory
  • The data loading task is idempotent, i.e. it can be run multiple times without duplicating previously-ingested data

How to run the data loading task:

# locally
$ bundle exec rake data:load_survey_responses

# on heroku staging environment
$ heroku run:detached -a mciea-beta bundle exec rake data:load_survey_responses

# on heroku production environment
$ heroku run:detached -a mciea-dashboard bundle rake data:load_survey_responses

For convenience, you can use the following script for loading data on Heroku:

# on heroku staging environment
$ ./scripts/load_survey_responses_on_heroku beta

# on heroku production environment
$ ./scripts/load_survey_responses_on_heroku dashboard

Running tests

Prepare the test database.

bundle exec rake db:test:prepare

If you need to look at the rails console for the test environment

RAILS_ENV=test rails c
bundle exec rake

Run javascript tests

yarn test

Continuous Integration

Pushing commits to the main branch triggers auto-deployment to the staging environment. Use the ship-it script from the main branch when you're ready to deploy to staging

scripts/ship-it.sh

Deployments to production must be done through the Heroku web interface or via the Heroku command line

Running the development server

Start esbuild for dynamic compilation of javascript assets.

yarn build --watch

Start the puma web server

bin/rails s