Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

ministryofjustice/hmpps-reference-data

Repository files navigation

hmpps-reference-data

Docker badge

https://hmpps-reference-data.apps.live-1.cloud-platform.service.justice.gov.uk/

🧑‍🔬 This is an experimental project: it may change.

Intent

Store reference data as flat files with the following characteristics:

  • each entry has a single primary key ID in the first column (:warning: uniqueness is not currently validated)
  • entries are not deleted (instead, end-date entries by adding a start_date/end_date column pair)
  • data structure changes are backwards-compatible in the same file:
    • cannot remove existing columns
    • cannot rename existing columns
    • can add new columns

The rules are in CheckCompatibility.kt.

These guarantees are validated during CI build.

Where are the files?

The reference data files are CSVs in the ./registers/ directory.

These are converted to JSON files during the Docker build and published.

To start the published service locally:

$ docker run --pull=always --rm -p 8000:8000 ghcr.io/ministryofjustice/hmpps-reference-data:main
{snip}
nginx 12:00:13.77 INFO  ==> ** Starting NGINX **

Then visit

to access the probation region reference data.

Checking backwards compatibility

To build, test, assemble the project:

$ ./gradlew build
<snip>
BUILD SUCCESSFUL in 2s
10 actionable tasks: 10 executed

To run the tool:

$ ./gradlew run

> Task :app:run
🔍 Checking if register files are backwards compatible with 'origin/main'...
registers/nomis-ethnicity.csv: ✅ pass
registers/nomis-gender.csv: ✅ pass
registers/nomis-locations.csv: ✅ pass
registers/nomis-suffix.csv: ✅ pass
registers/nomis-titles.csv: ✅ pass
registers/offences.csv: ✅ pass
registers/pcc-regions-for-probation-v0.csv: ✅ pass
registers/probation-delivery-units-v0.csv: ✅ pass
registers/probation-offices-v0.csv: ✅ pass
registers/probation-regions-v0.csv: ✅ pass

BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date