Updated readme file. Removed legacy readme sections

pull/1/head
rebuilt 4 years ago
parent 1e4d710bff
commit 9859b8a03a

@ -1,117 +0,0 @@
# EDCONTEXT
Displays graphs representing school quality measures.
## Site links
Live app: [https://mciea-dashboard.herokuapp.com/](https://mciea-dashboard.herokuapp.com/)
Live dashboard: [http://mciea-dashboard.herokuapp.com/districts/winchester/schools/winchester-high-school/dashboard?year=2020-21](http://mciea-dashboard.herokuapp.com/districts/winchester/schools/winchester-high-school/dashboard?year=2020-21)
## Techologies
This is a rails project, deployed on Heroku
### 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
None yet
### css
Bootstrap 5
## Local development
```bash
bundle install
bundle exec rake db:create db:migrate db:seed
```
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.
## Loading Data
This 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 150,000 SurveyItemResponses per year.
```bash
# locally
bundle exec rake data:load_survey_responses
# on heroku staging environment
heroku run -a mciea-beta rake data:load_survey_responses
# on heroku production environment
heroku run -a mciea-dashboard rake data:load_survey_responses
```
## Continuous Integration
Pushing commits to the main branch triggers auto-deployment to the staging environment.
Deployments to production must be done through the Heroku web interface or via the Heroku command line
## Testing
Prepare the test database.
```bash
bundle exec rake db:test:prepare
```
If you need to look at the rails console for the test environment
```bash
RAILS_ENV=test rails c
```
Run tests
```bash
bundle exec rake
#or
rspec
# single file
rspec spec/presenters/measure_graph_row_presenter_spec.rb
#output: 20 examples, 0 failures
# start test from any line
rspec spec/presenters/measure_graph_row_presenter_spec.rb:84
# output: 4 examples, 0 failures
```

@ -7,6 +7,11 @@ This project contains three pieces:
This is a Rails project, deployed on Heroku. This is a Rails project, deployed on Heroku.
## Site links
Live app: [https://mciea-dashboard.herokuapp.com/](https://mciea-dashboard.herokuapp.com/)
Live dashboard: [http://mciea-dashboard.herokuapp.com/districts/winchester/schools/winchester-high-school/dashboard?year=2020-21](http://mciea-dashboard.herokuapp.com/districts/winchester/schools/winchester-high-school/dashboard?year=2020-21)
## Local development ## Local development
Install Postgres and running first. Install Postgres and running first.
@ -16,6 +21,14 @@ Install Postgres and running first.
$ brew install postgres $ brew install postgres
$ brew services start postgresql $ brew services start postgresql
``` ```
Linux:
Install postgres. Known working version is version 13
```
https://www.postgresql.org/download/
```
Once postgres is installed and running, install the required gems and then migrate the database. Once postgres is installed and running, install the required gems and then migrate the database.
``` ```
@ -24,79 +37,86 @@ $ bundle exec rake db:create db:migrate db:seed
``` ```
At this point you can run the app and login. There won't be any data yet though; keep reading! 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
None yet
### css
Bootstrap 5
## Loading Data ## Loading Data
Postgres is the primary data store for the webapp, but the definitions of the questions and measures are stored in `.json` files and raw survey data is stored in `.csv` files. These are collected offline, and then processed by the rake tasks to load that data into Postgres for use by the webapp.
There are several different kinds of data needed: SurveyItemResponses is the most important table to understand.
- `measures.json`
- `questions.json`
- `student_responses.csv`
- `teacher_responses.csv`
You can load these into the database and index them for use in the webapp by running rake tasks. SurveyItemResponses is the data that will change year to year and makes up the majority of the database records. Roughly 150,000 SurveyItemResponses per year.
You can start by generating fake data: ```bash
``` # locally
$ bundle exec rake db:fixtures:load bundle exec rake data:load_survey_responses
# on heroku staging environment
heroku run -a mciea-beta rake data:load_survey_responses
# on heroku production environment
heroku run -a mciea-dashboard rake data:load_survey_responses
``` ```
## Running tests ## Running tests
Prepare the test database.
```bash
bundle exec rake db:test:prepare
``` ```
$ bundle exec rake
If you need to look at the rails console for the test environment
```bash
RAILS_ENV=test rails c
``` ```
## Demo deploy
Get the code and make a new repo without any history.
``` ```
$ mkdir edcos-demo $ bundle exec rake
$ git clone https://github.com/jaredcosulich/edcontext.git
$ cd edcontext
# git co feature/ecos-demo
$ rm -rf .git # remove past git history, which has secrets and response data
$ git init
$ git co -b master
$ git commit -m "Initial demo commit"
``` ```
Make a new Heroku app and deploy: ## Continuous Integration
1. Create a new Heroku app
2. Add Postgres Pushing commits to the main branch triggers auto-deployment to the staging environment.
3. Deploy
4. Run `heroku run rake db:migrate db:seed data:generate` Deployments to production must be done through the Heroku web interface or via the Heroku command line
5. Run `heroku run rails console` and add a demo user (eg, `User.create!(email: 'demo@demo.edcontext.org', password: '123456')`)
5. Try it out!
## Path to open source
- [x] Personal phone numbers in code - these are removed (`seed.rb`)
- [x] API keys in code - these are removed (`attempts_controller.rb`)
- [x] Create generator task for demo site
- [x] Remove .csv responses
- [ ] `target_group` in questions aren't set
## Data
Loading attempts took a while. I factored data rake task out into Ruby class to call methods more directly, and then added whitelist option for importing only data for a particular school. I used the Vinson school as my test case.
## Making site navigable
- loading data - uncomment and split to bulk
- creating new admin user manually
- moving `#verify_super_admin` to `application_controller`, adding it for `/admin` pages
- `welcome/index.html.haml` to remove commented code and require login
- Login goes to `/user`, add in link to home page there
- Moved seed code into `pilot_parent_test.rake`, removed individual names and phone numbers
- Added `recipients` and `recipient_lists` links to `school/show.html.haml`
- Added `import` link to `recipients` page
- Added `index` action and view for school schedules
- Edit questions without school_id
- Deleted API keys and numbers in `attempts_controller.rb`
## Other Issues
- can't get categories pages to show questions
- looks like computation is inverted for some questions like `http://localhost:3000/schools/vinson-owen-elementary-school/categories/student-emotional-safety`
- back link not working editing schools and districts
- superadmin is done by user id
- no schools for default user?
- endpoints for school/categories, school/questions
- attempts route and controller commented out

Loading…
Cancel
Save