Maintains a list of family mediators. Provides an API and an admin UI for uploading spreadsheets of mediator data .
Work should be based off of, and PRed to, the main branch. We use the GitHub PR approval process so once your PR is ready you'll need to have one person approve it, and the CI tests passing, before it can be merged.
Clone this repository then cd
into the new directory
$ git clone git@github.com:ministryofjustice/correspondence_tool_staff.git
$ cd correspondence_tool_staff
If you don't have rbenv
already installed, install it as follows:
$ brew install rbenv ruby-build
$ rbenv init
Follow the instructions printed out from the rbenv init
command and update your ~/.bash_profile
or equivalent file accordingly, then start a new terminal and navigate to the repo directory.
Use rbenv
to install the latest version of ruby as defined in .ruby-version
(make sure you are in the repo path):
$ rbenv install
Postgresql
$ brew install postgresql
Use the following commands to install gems and javascript packages then create the database
$ bundle install
$ bundle exec rake db:setup
$ bundle exec rackup
The site will be accessible at http://localhost:9292/api/v1/mediators.
$ bundle exec rack-console
$ bundle exec rspec
$ bundle exec cucumber
$ bundle exec rubocop
RACK_ENV=development irb -r bundle exec './lib/env' -r './lib/mediators'
irb> require_relative 'lib/mediators'
irb> API::Models::Mediator.all.to_a
irb> ...etc
The following environment variables are used:
- LOG_LEVEL - Can be one of debug, error, info, warn or fatal. Assumes debug if not set.
- RACK_ENV - Can be one of staging or production. The app uses the development environment if this is not set.
- DATABASE_URL - Must be set if RACK_ENV is staging or production.
- USERNAME - For logging into the admin area.
- PASSWORD_HASH - A hash of the password for logging into the admin area.
To generate the password hash, use bcrypt-ruby. In irb:
require 'bcrypt'
BCrypt::Password.create("my password")
#=> "$2a$10$vI8aWBnW3fID.ZQ4/zo1G.q1lRps.9cGLcZEiGDMVr5yUP1KUOYTa"
...and use the long string generated.
When running the app locally you can set these ENV variables in the .env
file.
Documentation is generated as part of the docker build, using aglio to parse an API Blueprint.
Although this documentation can be also generated locally, it requires a vast amount of node modules dependencies, so if you want to see the generated documentation it is quicker and easier to view on the live site - https://familymediators.service.justice.gov.uk/api/documentation
- /api/v1/healthcheck - Check health of service
- /api/v1/mediators - List all mediators
- /api/v1/mediators/:id - Show a mediator's information
- detail=[simple|full] Controls the amount of information returned. Default is full, but will switch to simple in the near future so use ?detail=full if you need all the fields. Fields included in each are described in the Fields section.
A call to the API will return JSON. The root JSON object contains 2 object values, 'meta', describing the result set, and 'data', containing the results.
All dates are in ISO 8601 standard. All booleans are a string 'Yes' or 'No', to remain consistent with extra FMC-provided data.
- id int: internal ID of the mediator
- urn string: registration number of the mediator, composed of a numeric root followed by a letter [ATPS] indicating the status of the mediator. 'A' means certified, 'P' provisionally certified 'T' in training and 'S' student. Students are removed on import.
- dcc boolean: Whether the mediator is habilitated to work with children directly.
- title string: 'Mr', 'Mrs', etc.
- first_name string: Given name - 'Sue', 'Peter', etc.
- last_name string: Patronymic name - 'Smith', 'Jones', etc.
- fmca_date date: Date at which the mediator was certified with an FMCA.
- practices array: An array containing the addresses and contact details of where this mediator practices. Each address is an object containing
- tel string: The phone number to contact the mediator at this practice.
- website string: Website URL for this practice.
- email string: Email to contact the mediator at this practice
- address string: Full address of the practice
- legal_aid_franchise boolean: Whether the mediator is part of an organisation registered with Legal Aid.
- legal_aid_qualified boolean: Whether the mediator is qualified to work within Legal Aid. If both this and legal_aid_franchise are true then the mediator can work with clients receiving Legal Aid.
In addition to the previous field set, the full set also comprises the following fields. These fields are not validated, and are present at the discretion of FMC. They may disappear or change meaning and format without warning, so caveat emptor.
- com boolean: Whether the mediator is a member of CoM.
- fma boolean: Whether the mediator is a member of FMA.
- nfm boolean: Whether the mediator is a member of NFM.
- resolution boolean: Whether the mediator is a member of Resolution.
- adrg boolean: Whether the mediator is a member of ADRG.
- law_soc boolean: Whether the mediator is a member of the Law Society.
- ppc boolean: Whether the mediator is a PPC (supervises other mediators).
- ppc_urn string: The URN of this mediator's PPC.
- ppc_name string: The name of this mediator's supervisor.
- ppcs_previous_12_months string: This mediator's supervisors in the previous 12 months, if they changed.
- dbs_date date: Date of the mediator's last DBS
- trained_with string: Organisation that trained this mediator.
- training_date date: Date on which this mediator started training.
- accredited_for string:
- cpd_up_to_date string: