This component is one of 3 that combine to give you the ability to store a document or details of a permit or pass, to link those documents to users that can view and be able to have different access for internal and external users. With a front end it will enable most processes to capture, share and view details of permits and or licence style information
Permit Repository: https://github.com/DEFRA/water-abstraction-permit-repository
IDM: https://github.com/DEFRA/water-abstraction-tactical-idm
CRM: https://github.com/DEFRA/water-abstraction-tactical-crm
The permit repository is a lightweight general purpose data store for licences and permits.
The licences are organised in the following heirarchy:
Regime > Licence Type > Licence
These are:
Regime: a high level means of grouping licences, e.g. ‘Water’ or ‘Waste’ Licence Type: a means of grouping licences within a regime, e.g. ‘Water Abstraction Licence’, ‘Water Impoundment Licence’ Licence: holds the licence data within a particular regime and licence type
The store is developed in HAPI/NodeJS and backed by a Postgres SQL database. All data is transferred via a REST API with JWT authentication.
The REST API supports basic filtering and pagination operations on all endpoints.
Licence data itself is stored as a blob of JSON data, together with start and expiry dates and reference number.
Implementation of user interfaces, CRM, and access control is left open to the specific use case requirements.
Gulp (global)
npm install --only=dev
gulp clean && gulp copy-govuk-files && gulp install-govuk-files && gulp copy-static-assets && gulp sass
The required environment variables for local development can be found in the .env.example file.
node index.js
A valid JWT token is required for requests to the API. This should be appended to the URL in the format /API/1.0/org?token=[insert token here].
Please note that a mechanism for obtaining the JWT token is not yet in place.
The following RESTful endpoints are exposed:
Returns a list of available regimes
{
"error": null,
"data": [
{
"regime_nm": "Water Licencing",
"regime_id": "1"
}
]
}
Create a new regime
{
"regime_nm": "New Org 1"
}
{
"error": null,
"data": [
{
"regime_id": "5"
}
]
}
Returns a list of available system level datatypes
{
"error": null,
"data": [
{
"field_nm": "DateField",
"field_definition": {
"type": "date"
},
"field_active": "1",
"field_id": "17",
"field_is_search_key": null
}
]
}
Returns regime details
{
"error": null,
"data": [
{
"regime_nm": "Example Org",
"regime_id": "1"
}
]
}
Returns list of licence types for regime [org id]
{
"error": null,
"data": [
{
"type_nm": "Example Licence",
"type_id": 1
},
]
}
Create a licence type for regime [org id]
{"type_nm":"sample licence"}
{
"error": null,
"data": [
{
"type_id": 4
}
]
}
Add a single field to licence type [type id] for regime [org id].
{
"field_id":"20",
"is_required":"0",
"is_public_domain":"1",
"type_field_alias":"test4"
}
{
"error": null,
"data": []
}
Add a multiple fields to licence type [type id] for regime [org id].
{"types":
[
{
"field_id":"20",
"is_required":"0",
"is_public_domain":"1",
"type_field_alias":"test4"
},
{
"field_id":"20",
"is_required":"0",
"is_public_domain":"1",
"type_field_alias":"test5"
}
]
}
{
"error": null,
"data": []
}
Returns custom attribute definition of a licence of type [type id] for regime [org id]
{
"error": null,
"data": [
{
"type_id": 1,
"attributedata": [
{
"type_fields_id": 4,
"field_id": 10,
"type_field_alias": "Attribute1",
"field_definition": {
"type": "text"
},
"is_required": "1",
"is_public_domain": null,
"field_nm": "ArrayField"
}
]
}
]
}
Returns list of licences of type [type id] for regime [org id]
{
"error": null,
"data": [
{
"licence_id": "1",
"licence_ref": "Example Licence 1",
"licence_search_key": "SearchKey"
}
}
Create a licence of type [type id] for regime [org id]
{
"licence_ref": "New Licence",
"licence_start_dt": "2017-01-01T00:00:00.000Z",
"licence_end_dt": "2018-01-01T00:00:00.000Z",
"licence_status_id": "1",
"attributes": {
"Attribute1": "Text Value"
}
}
{
"licence_id": "51"
}
Update a licence with ID [licence id] of type [type id] for regime [org id]
{
"licence_ref": "New Licence",
"licence_start_dt": "2017-01-01T00:00:00.000Z",
"licence_end_dt": "2018-01-01T00:00:00.000Z",
"licence_status_id": "1",
"attributes": {
"Attribute1": "Text Value"
}
}
{
"error": null,
"data": [
{
"licence_id": "51"
}
]
}
Returns detail of licence [licence id] of type [type id] for regime [org id]
{
"licence_id": "1",
"licence_ref": "Example Licence 1",
"licence_start_dt": "2017-01-01T00:00:00.000Z",
"licence_end_dt": "2018-01-01T00:00:00.000Z",
"licence_status_id": "1",
"licence_type_id": "1",
"licence_regime_id": "1",
"attributes": {
"Attribute1": "Attribute value"
}
}
Please read the contribution guidelines before submitting a pull request.
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
The following attribution statement MUST be cited in your products and applications when using this information.
Contains public sector information licensed under the Open Government license v3
The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.
This module was developed by the Water Resource Licensing Service team as part of a digital transformation project at DEFRA, a department of the UK government
To find out more about planned reforms to the abstraction licensing service, see the policy paper: Water abstraction plan: Abstraction licensing service