baarkerlounger
b17253c5af
|
3 years ago | |
---|---|---|
.github/workflows | 3 years ago | |
app | 3 years ago | |
bin | 3 years ago | |
config | 3 years ago | |
db | 3 years ago | |
doc/adr | 3 years ago | |
lib | 3 years ago | |
log | 3 years ago | |
public | 3 years ago | |
spec | 3 years ago | |
storage | 3 years ago | |
tmp | 3 years ago | |
vendor | 3 years ago | |
.browserslistrc | 3 years ago | |
.dockerignore | 3 years ago | |
.editorconfig | 3 years ago | |
.env.example | 3 years ago | |
.gitignore | 3 years ago | |
.overcommit.yml | 3 years ago | |
.rspec | 3 years ago | |
.rubocop.yml | 3 years ago | |
.ruby-version | 3 years ago | |
Dockerfile | 3 years ago | |
Gemfile | 3 years ago | |
Gemfile.lock | 3 years ago | |
LICENSE | 3 years ago | |
README.md | 3 years ago | |
Rakefile | 3 years ago | |
babel.config.js | 3 years ago | |
config.ru | 3 years ago | |
docker-compose.yml | 3 years ago | |
package-lock.json | 3 years ago | |
package.json | 3 years ago | |
postcss.config.js | 3 years ago | |
yarn.lock | 3 years ago |
README.md
Data Collection App
This is the codebase for the Ruby/Rails app that will handle the submission of Lettings and Sales of Social Housing in England data.
Required Setup
Pre-requisites
- Ruby
- Rails
- Postgres
Setup Quickstart
Copy the .env.example
to .env
and replace the database credentials with your local postgres user credentials.
Create the database
rake db:create
Start the rails server
rails s
This starts the rails server on localhost:3000
or using Docker
docker-compose build
docker-compose run --rm app rails db:create
docker-compose up
This exposes the rails server on localhost:8080.
Note docker-compose runs the production docker image (RAILS_ENV=production) as the Dockerfile doesn't include development gems to keep the image size down.
Infrastructure
The cloud infrastructure running this application is set up using the infrastructure repository
Single log submission
The form for this is driven by a json file in /config/forms/{start_year}_{end_year}.json
The JSON should follow the structure:
{
form_type: [lettings/sales]
start_year: yyyy
end_year: yyyy
sections: {
snake case section name string: {
label: string,
subsections: {
snake case subsection name string: {
label: string,
pages: {
snake case page name string: {
header: string,
description: string,
questions: {
snake case question name string: {
header: string,
hint_text: string,
type: [text / numeric / radio / select ],
min: integer, (numeric only),
max: integer, (numeric only),
step: integer (numeric only),
answer_options: { (select and radio only)
"0": string,
"1": string
}
}
}
}
}
}
}
}
}
}
Assumptions made by the format:
- All forms have at least 1 section
- All sections have at least 1 subsection
- All subsections have at least 1 page
- All pages have at least 1 question
- The ActiveRecord case log model has a field for each question name (must match)
- Text not required by a page/question such as a header or hint text should be passed as an empty string