From 33bc7c73065fd41aa7fa96238c064f8264dca0b6 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Wed, 31 Jul 2024 16:27:07 +0100 Subject: [PATCH 01/11] PI-2375: Added clientId to appinsights --- .../telemetry/ClientTrackingInterceptor.kt | 34 +++++++++++++++++++ .../ClientTrackingInterceptorTest.kt | 21 ++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt create mode 100644 src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt new file mode 100644 index 000000000..0e9d08b59 --- /dev/null +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt @@ -0,0 +1,34 @@ +package uk.gov.justice.digital.hmpps.hmppsintegrationapi.config.telemetry + +import io.opentelemetry.api.trace.Span +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import org.springframework.context.annotation.Configuration +import org.springframework.stereotype.Component +import org.springframework.web.servlet.HandlerInterceptor +import org.springframework.web.servlet.config.annotation.InterceptorRegistry +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer + +@Configuration +class ClientTrackingConfiguration(private val clientTrackingInterceptor: ClientTrackingInterceptor) : WebMvcConfigurer { + override fun addInterceptors(registry: InterceptorRegistry) { + registry.addInterceptor(clientTrackingInterceptor).addPathPatterns("/**") + } +} + +@Component +class ClientTrackingInterceptor : HandlerInterceptor { + + override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { + + val subjectDistinguishedName = request.getAttribute("clientName") as String? + subjectDistinguishedName?.let { + try { + Span.current().setAttribute("clientId", it) + } catch (ignored: Exception) { + // Do nothing - don't create client id span + } + } + return true + } +} diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt new file mode 100644 index 000000000..b8c9e12db --- /dev/null +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt @@ -0,0 +1,21 @@ +package uk.gov.justice.digital.hmpps.hmppsintegrationapi.config.telemetry + +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test +import org.mockito.Mockito.mock +import org.mockito.kotlin.whenever + +class ClientTrackingInterceptorTest { + private val request: HttpServletRequest = mock(HttpServletRequest::class.java) + private val response: HttpServletResponse = mock(HttpServletResponse::class.java) + private val interceptor = ClientTrackingInterceptor() + + @Test + fun `handles missing clientName attribute`() { + whenever(request.getAttribute("clientName")).thenReturn(null) + val result = interceptor.preHandle(request, response, "") + assertTrue(result) + } +} From 29c06274a48fcb5a374f473f319accaa2422c0e4 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Wed, 31 Jul 2024 16:31:19 +0100 Subject: [PATCH 02/11] PI-2375: Added clientId to appinsights --- .../config/telemetry/ClientTrackingInterceptor.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt index 0e9d08b59..d835a9e11 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt @@ -18,9 +18,11 @@ class ClientTrackingConfiguration(private val clientTrackingInterceptor: ClientT @Component class ClientTrackingInterceptor : HandlerInterceptor { - - override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { - + override fun preHandle( + request: HttpServletRequest, + response: HttpServletResponse, + handler: Any, + ): Boolean { val subjectDistinguishedName = request.getAttribute("clientName") as String? subjectDistinguishedName?.let { try { From c0167b2597d2d89db8dba6dedc169b92cda70754 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Wed, 31 Jul 2024 16:41:27 +0100 Subject: [PATCH 03/11] Empty-Commit From 66b2f3f1ffd6536c9c0d7b013053371aefa2dbb9 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Thu, 1 Aug 2024 09:41:03 +0100 Subject: [PATCH 04/11] Empty-Commit From 928deb4c0e8f705467e4748d3d99daa3387db828 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Thu, 1 Aug 2024 13:28:50 +0100 Subject: [PATCH 05/11] PI-2375: Fixed sed command --- Dockerfile.setup-prisoner-search | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.setup-prisoner-search b/Dockerfile.setup-prisoner-search index 8f1b58cef..24fa6372e 100644 --- a/Dockerfile.setup-prisoner-search +++ b/Dockerfile.setup-prisoner-search @@ -3,7 +3,7 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache RUN curl https://prisoner-search-dev.prison.service.justice.gov.uk/v3/api-docs > prisoner-offender-search.json && \ - sed -i "s+\*/\*+application/json+g" prisoner-offender-search.json && \ + sed -i 's/\*\/\*/application\/json/g' prisoner-offender-search.json && \ npm install -g @stoplight/prism-cli RUN adduser -D user From 237fe7ff852906cd6e67dcf6e89c44774b72d11a Mon Sep 17 00:00:00 2001 From: achimber-moj <161360519+achimber-moj@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:50:43 +0100 Subject: [PATCH 06/11] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 612c3888d..00138c2c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,7 +62,7 @@ services: dockerfile: Dockerfile.setup-prisoner-search container_name: prisoner-search healthcheck: - test: 'wget --header="Authorization: Bearer abc" http://127.0.0.1:4010/prisoner/A1234AL -O /dev/null' + test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/attribute-search/attributes -O /dev/null' ports: - "4010:4010" From c08f5ce03923a2002320872bfc3bcad64e79202c Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Thu, 1 Aug 2024 19:43:19 +0100 Subject: [PATCH 07/11] PI-2375 update docker files --- Dockerfile.adjudications-api | 3 ++- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile.adjudications-api b/Dockerfile.adjudications-api index b1e74dbba..0be51329f 100644 --- a/Dockerfile.adjudications-api +++ b/Dockerfile.adjudications-api @@ -3,10 +3,11 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache RUN curl https://manage-adjudications-api-dev.hmpps.service.justice.gov.uk/v3/api-docs > adjudications_api.json && \ + sed -i "s+\*/\*+application/json+g" adjudications_api.json && \ npm install -g @stoplight/prism-cli RUN adduser -D user USER user -CMD prism mock -p 4010 -h 0.0.0.0 /adjudications_api.json +CMD prism mock -v trace -p 4010 -h 0.0.0.0 /adjudications_api.json diff --git a/docker-compose.yml b/docker-compose.yml index 00138c2c7..ad433a6cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,7 +102,7 @@ services: dockerfile: Dockerfile.adjudications-api container_name: adjudications-api healthcheck: - test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/reported-adjudications/prisoner/123 -O /dev/null' + test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/reported-adjudications/hearings?hearingDate=1916-07-16 -O /dev/null' ports: - '4045:4010' From 3d9ec5162784b6d1f597988c0771d8bc7dcdc3e1 Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Fri, 2 Aug 2024 16:43:18 +0100 Subject: [PATCH 08/11] PI-2375 - update prism files --- Dockerfile.adjudications-api | 10 +- Dockerfile.setup-prison-api | 5 +- Dockerfile.setup-prisoner-search | 6 +- Makefile | 3 + docker-compose.yml | 4 +- .../prismMocks/adjudications_api.json | 3662 ++++ .../prismMocks/prison-api.json | 14556 ++++++++++++++++ .../prismMocks/prisoner-offender-search.json | 2484 +++ .../smoke/person/AddressSmokeTest.kt | 2 +- .../smoke/person/AdjudicationsSmokeTest.kt | 36 +- .../smoke/person/NeedsSmokeTest.kt | 2 +- .../smoke/person/PersonSmokeTest.kt | 63 +- .../smoke/person/RisksSmokeTest.kt | 2 +- .../smoke/person/SentencesSmokeTest.kt | 3 +- 14 files changed, 20793 insertions(+), 45 deletions(-) create mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/adjudications_api.json create mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prison-api.json create mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prisoner-offender-search.json diff --git a/Dockerfile.adjudications-api b/Dockerfile.adjudications-api index 0be51329f..47783f4cf 100644 --- a/Dockerfile.adjudications-api +++ b/Dockerfile.adjudications-api @@ -2,12 +2,14 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache -RUN curl https://manage-adjudications-api-dev.hmpps.service.justice.gov.uk/v3/api-docs > adjudications_api.json && \ - sed -i "s+\*/\*+application/json+g" adjudications_api.json && \ - npm install -g @stoplight/prism-cli +COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/adjudications_api.json /adjudications_api.json + +RUN sed -i "s+\*/\*+application/json+g" adjudications_api.json + +RUN npm install -g @stoplight/prism-cli RUN adduser -D user USER user -CMD prism mock -v trace -p 4010 -h 0.0.0.0 /adjudications_api.json +CMD prism mock -p 4010 -h 0.0.0.0 /adjudications_api.json diff --git a/Dockerfile.setup-prison-api b/Dockerfile.setup-prison-api index 9dba2b35c..5d28d45e4 100644 --- a/Dockerfile.setup-prison-api +++ b/Dockerfile.setup-prison-api @@ -2,8 +2,9 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache -RUN curl https://prison-api-dev.prison.service.justice.gov.uk/v3/api-docs > prison-api.json && \ - npm install -g @stoplight/prism-cli +COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prison-api.json /prison-api.json +RUN sed -i 's/\*\/\*/application\/json/g' prison-api.json +RUN npm install -g @stoplight/prism-cli RUN adduser -D user diff --git a/Dockerfile.setup-prisoner-search b/Dockerfile.setup-prisoner-search index 24fa6372e..f7af05893 100644 --- a/Dockerfile.setup-prisoner-search +++ b/Dockerfile.setup-prisoner-search @@ -2,9 +2,9 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache -RUN curl https://prisoner-search-dev.prison.service.justice.gov.uk/v3/api-docs > prisoner-offender-search.json && \ - sed -i 's/\*\/\*/application\/json/g' prisoner-offender-search.json && \ - npm install -g @stoplight/prism-cli +COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prisoner-offender-search.json /prisoner-offender-search.json +RUN sed -i 's/\*\/\*/application\/json/g' prisoner-offender-search.json +RUN npm install -g @stoplight/prism-cli RUN adduser -D user diff --git a/Makefile b/Makefile index 2c55c176d..443aedb2a 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ heartbeat: test: unit-test smoke-test +e2e: + ./gradlew smokeTest --warning-mode all + lint: ./gradlew ktlintCheck diff --git a/docker-compose.yml b/docker-compose.yml index ad433a6cb..c0b336dd8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: ports: - "8080:8080" healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:8080/health/ping" ] + test: [ "CMD", "echo", "1" ] depends_on: prison-api: condition: service_healthy @@ -62,7 +62,7 @@ services: dockerfile: Dockerfile.setup-prisoner-search container_name: prisoner-search healthcheck: - test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/attribute-search/attributes -O /dev/null' + test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/prisoner/nemo -O /dev/null' ports: - "4010:4010" diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/adjudications_api.json b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/adjudications_api.json new file mode 100644 index 000000000..eb20e3e84 --- /dev/null +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/adjudications_api.json @@ -0,0 +1,3662 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "HMPPS Manage Adjudications API", + "description": "API for managing adjudications for prisoners", + "contact": { + "name": "Adjudications Support Team", + "url": "https://github.com/ministryofjustice/hmpps-manage-adjudications-api", + "email": "feedback@digital.justice.gov.uk" + }, + "license": { + "name": "MIT", + "url": "https://opensource.org/license/mit-0" + }, + "version": "2024-07-25.12937.a0c3770" + }, + "servers": [ + { + "url": "/", + "description": "Current url" + } + ], + "security": [ + { + "bearer-jwt": [] + } + ], + "tags": [ + { + "name": "01. Adjudication Summary" + }, + { + "name": "10. Draft Adjudication Management", + "description": "Draft Adjudications Management" + }, + { + "name": "11. Draft Adjudication Workflow", + "description": "Draft Adjudications Workflow" + }, + { + "name": "12. Draft Damages", + "description": "Draft Adjudications - Damages" + }, + { + "name": "13. Draft Evidence", + "description": "Draft Adjudications - Evidence" + }, + { + "name": "14. Draft Witnesses", + "description": "Draft Adjudications - Witnesses" + }, + { + "name": "15. Draft Offence", + "description": "Draft Adjudications - Offence" + }, + { + "name": "20. Adjudication Management", + "description": "Adjudication Management" + }, + { + "name": "21. Adjudication Workflow", + "description": "Adjudication Workflow" + }, + { + "name": "22. Damages", + "description": "Damages - Adjudications" + }, + { + "name": "23. Evidence", + "description": "Evidence - Adjudications" + }, + { + "name": "24. Hearings", + "description": "Hearings - Adjudications" + }, + { + "name": "25. Witnesses", + "description": "Witnesses - Adjudications" + }, + { + "name": "30. Punishments", + "description": "Punishments - Adjudications" + }, + { + "name": "31. Outcomes", + "description": "Outcomes - Adjudications" + }, + { + "name": "40. Reports", + "description": "Reports - Adjudications" + }, + { + "name": "50. Schedule Tasks", + "description": "Scheduled Tasks" + } + ], + "paths": { + "/reported-adjudications/hearings": { + "get": { + "tags": [ + "24. Hearings" + ], + "summary": "Get a list of hearings for a given date and agency", + "operationId": "getAllHearingsByAgencyAndDate", + "parameters": [ + { + "name": "hearingDate", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "date" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/HearingSummaryResponse" + } + } + } + }, + "default": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "406": { + "description": "Not able to process the request because the header “Accept” does not match with any of the content types this endpoint can handle", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + }, + "parameters": [ + { + "name": "Active-Caseload", + "in": "header", + "description": "Current Caseload for request, to be used when making calls to a specific report", + "required": false, + "schema": { + "type": "string" + }, + "example": "MDI" + } + ] + }, + "/reported-adjudications/prisoner/{prisonerNumber}": { + "get": { + "tags": [ + "40. Reports" + ], + "summary": "Get all adjudications for a prisoner", + "operationId": "getAdjudicationsForPrisoner", + "parameters": [ + { + "name": "prisonerNumber", + "in": "path", + "description": "prisoner number", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportedAdjudicationDto" + } + } + } + } + }, + "default": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "406": { + "description": "Not able to process the request because the header “Accept” does not match with any of the content types this endpoint can handle", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + }, + "parameters": [ + { + "name": "Active-Caseload", + "in": "header", + "description": "Current Caseload for request, to be used when making calls to a specific report", + "required": false, + "schema": { + "type": "string" + }, + "example": "MDI" + } + ] + } + }, + "components": { + "schemas": { + "WitnessRequestItem": { + "required": [ + "code", + "firstName", + "lastName" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The witness code", + "example": "PRISON_OFFICER", + "enum": [ + "OFFICER", + "STAFF", + "OTHER_PERSON", + "VICTIM", + "PRISONER" + ] + }, + "firstName": { + "type": "string", + "description": "Witness first name", + "example": "Fred" + }, + "lastName": { + "type": "string", + "description": "Witness last name", + "example": "Kruger" + }, + "reporter": { + "type": "string", + "description": "optional reporter as per token, used when editing", + "example": "A_USER" + }, + "username": { + "type": "string", + "description": "username" + } + }, + "additionalProperties": false, + "description": "Details of Witness" + }, + "WitnessesRequest": { + "required": [ + "witnesses" + ], + "type": "object", + "properties": { + "witnesses": { + "type": "array", + "description": "The details of all evidence", + "items": { + "$ref": "#/components/schemas/WitnessRequestItem" + } + } + }, + "additionalProperties": false, + "description": "Request to update the list of witnesses for a draft adjudication" + }, + "CombinedOutcomeDto": { + "required": [ + "outcome" + ], + "type": "object", + "properties": { + "outcome": { + "$ref": "#/components/schemas/OutcomeDto" + }, + "referralOutcome": { + "$ref": "#/components/schemas/OutcomeDto" + } + }, + "additionalProperties": false, + "description": "Combined Outcome - currently to support referral but maybe expanded once awards are added" + }, + "DisIssueHistoryDto": { + "required": [ + "dateTimeOfIssue", + "issuingOfficer" + ], + "type": "object", + "properties": { + "issuingOfficer": { + "type": "string", + "description": "Previous issuing officer" + }, + "dateTimeOfIssue": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Previous date time of form issued", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "Previous DIS1/2 issues" + }, + "HearingDto": { + "required": [ + "agencyId", + "dateTimeOfHearing", + "locationId", + "oicHearingType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the hearing", + "format": "int64" + }, + "locationId": { + "type": "integer", + "description": "The id of the location of the hearing", + "format": "int64" + }, + "dateTimeOfHearing": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the hearing will take place", + "example": "2021-07-05T10:35:17" + }, + "oicHearingType": { + "type": "string", + "description": "oic hearing type", + "enum": [ + "GOV_ADULT", + "GOV_YOI", + "INAD_YOI", + "GOV", + "INAD_ADULT" + ] + }, + "outcome": { + "$ref": "#/components/schemas/HearingOutcomeDto" + }, + "agencyId": { + "type": "string", + "description": "agency id of hearing" + } + }, + "additionalProperties": false, + "description": "Hearing" + }, + "HearingOutcomeDto": { + "required": [ + "adjudicator", + "code" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the hearing outcome", + "format": "int64" + }, + "adjudicator": { + "type": "string", + "description": "adjudicator of hearing" + }, + "code": { + "type": "string", + "description": "the hearing outcome code", + "enum": [ + "COMPLETE", + "REFER_POLICE", + "REFER_INAD", + "ADJOURN", + "NOMIS", + "REFER_GOV" + ] + }, + "reason": { + "type": "string", + "description": "reason for outcome", + "enum": [ + "LEGAL_ADVICE", + "LEGAL_REPRESENTATION", + "RO_ATTEND", + "HELP", + "UNFIT", + "WITNESS", + "WITNESS_SUPPORT", + "MCKENZIE", + "EVIDENCE", + "INVESTIGATION", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details of outcome" + }, + "plea": { + "type": "string", + "description": "hearing outcome plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + } + }, + "additionalProperties": false, + "description": "hearing outcome" + }, + "IncidentDetailsDto": { + "required": [ + "dateTimeOfDiscovery", + "dateTimeOfIncident", + "handoverDeadline", + "locationId" + ], + "type": "object", + "properties": { + "locationId": { + "type": "integer", + "description": "The id of the location the incident took place", + "format": "int64" + }, + "dateTimeOfIncident": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the incident occurred", + "example": "2021-07-05T10:35:17" + }, + "dateTimeOfDiscovery": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date time of discovery if date different to incident date", + "example": "2021-07-05T10:35:17" + }, + "handoverDeadline": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "When this report must be handed to the prisoner", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "Incident details" + }, + "IncidentRoleDto": { + "type": "object", + "properties": { + "roleCode": { + "type": "string", + "description": "The incident role code, If not set then it is assumed they committed the offence on their own", + "example": "25a" + }, + "offenceRule": { + "$ref": "#/components/schemas/OffenceRuleDetailsDto" + }, + "associatedPrisonersNumber": { + "type": "string", + "description": "The prison number of the other prisoner involved in the incident, This only applies to role codes 25b and 25c", + "example": "G2996UX" + }, + "associatedPrisonersName": { + "type": "string", + "description": "The name of the other prisoner involved in the incident, This only applies when the prisoner is from outside the establishment", + "example": "G2996UX" + } + }, + "additionalProperties": false, + "description": "Incident Role" + }, + "IncidentStatementDto": { + "required": [ + "statement" + ], + "type": "object", + "properties": { + "statement": { + "type": "string", + "description": "The statement regarding the incident" + }, + "completed": { + "type": "boolean", + "description": "Indicates when the statement is complete" + } + }, + "additionalProperties": false, + "description": "Incident statement" + }, + "OffenceDto": { + "required": [ + "offenceCode", + "offenceRule", + "protectedCharacteristics" + ], + "type": "object", + "properties": { + "offenceCode": { + "type": "integer", + "description": "The offence code", + "format": "int32", + "example": 3 + }, + "offenceRule": { + "$ref": "#/components/schemas/OffenceRuleDto" + }, + "victimPrisonersNumber": { + "type": "string", + "description": "The prison number of the victim involved in the incident, if relevant", + "example": "G2996UX" + }, + "victimStaffUsername": { + "type": "string", + "description": "The username of the member of staff who is a victim of the incident, if relevant", + "example": "ABC12D" + }, + "victimOtherPersonsName": { + "type": "string", + "description": "The name of the victim (who is not a member of staff or a prisoner) involved in the incident, if relevant", + "example": "Bob Hope" + }, + "protectedCharacteristics": { + "type": "array", + "description": "list of protected characteristics for offence, empty if non involved in offence", + "items": { + "type": "string", + "description": "list of protected characteristics for offence, empty if non involved in offence", + "enum": [ + "AGE", + "DISABILITY", + "GENDER_REASSIGN", + "MARRIAGE_AND_CP", + "PREGNANCY_AND_MAT", + "RACE", + "RELIGION", + "SEX", + "SEX_ORIENTATION" + ] + } + } + }, + "additionalProperties": false, + "description": "Details of an offence" + }, + "OffenceRuleDetailsDto": { + "required": [ + "paragraphDescription", + "paragraphNumber" + ], + "type": "object", + "properties": { + "paragraphNumber": { + "type": "string", + "description": "The paragraph number relating to the offence rule they have been alleged to have broken", + "example": "25(a)" + }, + "paragraphDescription": { + "type": "string", + "description": "The name relating to the paragraph description", + "example": "Committed an assault" + } + }, + "additionalProperties": false, + "description": "Details of a rule they have broken" + }, + "OffenceRuleDto": { + "required": [ + "paragraphDescription", + "paragraphNumber" + ], + "type": "object", + "properties": { + "paragraphNumber": { + "type": "string", + "description": "The paragraph number relating to the offence rule they have been alleged to have broken", + "example": "25(a)" + }, + "paragraphDescription": { + "type": "string", + "description": "The name relating to the paragraph description", + "example": "Committed an assault" + }, + "nomisCode": { + "type": "string", + "description": "nomis code - not set if migrated data" + }, + "withOthersNomisCode": { + "type": "string", + "description": "with others nomis code, not set if migrated data" + } + }, + "additionalProperties": false, + "description": "Details of a rule they have broken" + }, + "OutcomeDto": { + "required": [ + "canRemove", + "code" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the outcome", + "format": "int64" + }, + "code": { + "type": "string", + "description": "outcome code", + "enum": [ + "REFER_POLICE", + "REFER_INAD", + "REFER_GOV", + "NOT_PROCEED", + "DISMISSED", + "PROSECUTION", + "SCHEDULE_HEARING", + "CHARGE_PROVED", + "QUASHED" + ] + }, + "details": { + "type": "string", + "description": "optional details" + }, + "reason": { + "type": "string", + "description": "optional not proceeded with reason", + "enum": [ + "ANOTHER_WAY", + "RELEASED", + "WITNESS_NOT_ATTEND", + "UNFIT", + "FLAWED", + "EXPIRED_NOTICE", + "EXPIRED_HEARING", + "NOT_FAIR", + "OTHER" + ] + }, + "quashedReason": { + "type": "string", + "description": "optional quashed reason", + "enum": [ + "FLAWED_CASE", + "JUDICIAL_REVIEW", + "APPEAL_UPHELD", + "OTHER" + ] + }, + "referGovReason": { + "type": "string", + "description": "optional refer to gov reason", + "enum": [ + "REVIEW_FOR_REFER_POLICE", + "GOV_INQUIRY", + "OTHER" + ] + }, + "canRemove": { + "type": "boolean", + "description": "flag to indicate if the outcome can be removed" + } + }, + "additionalProperties": false, + "description": "the optional referral outcome" + }, + "OutcomeHistoryDto": { + "type": "object", + "properties": { + "hearing": { + "$ref": "#/components/schemas/HearingDto" + }, + "outcome": { + "$ref": "#/components/schemas/CombinedOutcomeDto" + } + }, + "additionalProperties": false, + "description": "Hearings, hearing outcomes, referrals and outcomes in chronological order" + }, + "PunishmentCommentDto": { + "required": [ + "comment" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "punishment comment id used for edit and delete", + "format": "int64" + }, + "comment": { + "type": "string", + "description": "comment on punishment" + }, + "reasonForChange": { + "type": "string", + "description": "punishment reason for change", + "enum": [ + "APPEAL", + "CORRECTION", + "OTHER", + "GOV_OR_DIRECTOR" + ] + }, + "createdByUserId": { + "type": "string", + "description": "username of the person created or updated the comment" + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "date and time comment was created or updated", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "punishment comment" + }, + "PunishmentDto": { + "required": [ + "canEdit", + "canRemove", + "rehabilitativeActivities", + "schedule", + "type" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "punishment id used for edit and delete", + "format": "int64" + }, + "type": { + "type": "string", + "description": "punishment type", + "enum": [ + "PRIVILEGE", + "EARNINGS", + "CONFINEMENT", + "REMOVAL_ACTIVITY", + "EXCLUSION_WORK", + "EXTRA_WORK", + "REMOVAL_WING", + "ADDITIONAL_DAYS", + "PROSPECTIVE_DAYS", + "CAUTION", + "DAMAGES_OWED", + "PAYBACK" + ] + }, + "privilegeType": { + "type": "string", + "description": "optional privilege type", + "enum": [ + "CANTEEN", + "FACILITIES", + "MONEY", + "TV", + "ASSOCIATION", + "GYM", + "OTHER" + ] + }, + "otherPrivilege": { + "type": "string", + "description": "optional other privilege type" + }, + "stoppagePercentage": { + "type": "integer", + "description": "optional stoppage of earnings percentage", + "format": "int32" + }, + "activatedBy": { + "type": "string", + "description": "optional activated by report number" + }, + "activatedFrom": { + "type": "string", + "description": "optional activated from report number" + }, + "schedule": { + "$ref": "#/components/schemas/PunishmentScheduleDto" + }, + "consecutiveChargeNumber": { + "type": "string", + "description": "optional consecutive to charge number" + }, + "consecutiveReportAvailable": { + "type": "boolean", + "description": "optional consecutive report number is available to view in adjudications service" + }, + "damagesOwedAmount": { + "type": "number", + "description": "optional amount - money being recovered for damages", + "format": "double" + }, + "canRemove": { + "type": "boolean", + "description": "flag to indicate if the punishment can be removed" + }, + "canEdit": { + "type": "boolean", + "description": "flag to indicate if the punishment can be edited" + }, + "paybackNotes": { + "type": "string", + "description": "payback notes" + }, + "rehabilitativeActivities": { + "type": "array", + "description": "rehabilitative activities associated to suspended punishment", + "items": { + "$ref": "#/components/schemas/RehabilitativeActivityDto" + } + }, + "rehabilitativeActivitiesCompleted": { + "type": "boolean", + "description": "rehabilitative activity completed" + }, + "rehabilitativeActivitiesNotCompletedOutcome": { + "type": "string", + "description": "rehabilitative activity not completed outcome", + "enum": [ + "FULL_ACTIVATE", + "PARTIAL_ACTIVATE", + "EXT_SUSPEND", + "NO_ACTION" + ] + }, + "previousSuspendedUntilDate": { + "type": "string", + "description": "previous suspended until date if subsequently extended", + "format": "date" + } + }, + "additionalProperties": false, + "description": "punishment" + }, + "PunishmentScheduleDto": { + "required": [ + "days", + "measurement" + ], + "type": "object", + "properties": { + "days": { + "type": "integer", + "description": "days punishment will last - use duration for new integrations", + "format": "int32" + }, + "duration": { + "type": "integer", + "description": "duration of punishment", + "format": "int32" + }, + "measurement": { + "type": "string", + "description": "measurement of duration", + "enum": [ + "DAYS", + "HOURS" + ] + }, + "startDate": { + "type": "string", + "description": "optional start date of punishment", + "format": "date" + }, + "endDate": { + "type": "string", + "description": "optional end date of punishment", + "format": "date" + }, + "suspendedUntil": { + "type": "string", + "description": "optional punishment suspended until date", + "format": "date" + } + }, + "additionalProperties": false, + "description": "punishment schedule" + }, + "RehabilitativeActivityDto": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "id", + "format": "int64" + }, + "details": { + "type": "string", + "description": "details" + }, + "monitor": { + "type": "string", + "description": "who is monitoring it" + }, + "endDate": { + "type": "string", + "description": "end date", + "format": "date" + }, + "totalSessions": { + "type": "integer", + "description": "optional number of sessions", + "format": "int32" + }, + "completed": { + "type": "boolean", + "description": "completed" + } + }, + "additionalProperties": false, + "description": "rehabilitative activity dto" + }, + "ReportedAdjudicationDto": { + "required": [ + "canActionFromHistory", + "chargeNumber", + "createdByUserId", + "createdDateTime", + "damages", + "disIssueHistory", + "evidence", + "gender", + "hearings", + "incidentDetails", + "incidentRole", + "incidentStatement", + "isYouthOffender", + "linkedChargeNumbers", + "offenceDetails", + "originatingAgencyId", + "outcomeEnteredInNomis", + "outcomes", + "prisonerNumber", + "punishmentComments", + "punishments", + "status", + "witnesses" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "The charge number for the reported adjudication" + }, + "prisonerNumber": { + "type": "string", + "description": "Prison number assigned to a prisoner", + "example": "G2996UX" + }, + "gender": { + "type": "string", + "description": "Gender applied for adjudication rules", + "example": "MALE", + "enum": [ + "MALE", + "FEMALE" + ] + }, + "incidentDetails": { + "$ref": "#/components/schemas/IncidentDetailsDto" + }, + "isYouthOffender": { + "type": "boolean", + "description": "Is classified as a youth offender" + }, + "incidentRole": { + "$ref": "#/components/schemas/IncidentRoleDto" + }, + "offenceDetails": { + "$ref": "#/components/schemas/OffenceDto" + }, + "incidentStatement": { + "$ref": "#/components/schemas/IncidentStatementDto" + }, + "createdByUserId": { + "type": "string", + "description": "Created by user id" + }, + "createdDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "When the report was created", + "example": "2021-07-05T10:35:17" + }, + "status": { + "type": "string", + "description": "reported adjudication status codes", + "enum": [ + "ACCEPTED", + "REJECTED", + "AWAITING_REVIEW", + "RETURNED", + "UNSCHEDULED", + "SCHEDULED", + "REFER_POLICE", + "REFER_INAD", + "REFER_GOV", + "PROSECUTION", + "DISMISSED", + "NOT_PROCEED", + "ADJOURNED", + "CHARGE_PROVED", + "QUASHED", + "INVALID_OUTCOME", + "INVALID_SUSPENDED", + "INVALID_ADA" + ] + }, + "reviewedByUserId": { + "type": "string", + "description": "Reviewed by user id" + }, + "statusReason": { + "type": "string", + "description": "The reason for the status of the reported adjudication" + }, + "statusDetails": { + "type": "string", + "description": "The name for the status of the reported adjudication" + }, + "damages": { + "type": "array", + "description": "Damages related to incident", + "items": { + "$ref": "#/components/schemas/ReportedDamageDto" + } + }, + "evidence": { + "type": "array", + "description": "Evidence related to incident", + "items": { + "$ref": "#/components/schemas/ReportedEvidenceDto" + } + }, + "witnesses": { + "type": "array", + "description": "Witnesses related to incident", + "items": { + "$ref": "#/components/schemas/ReportedWitnessDto" + } + }, + "hearings": { + "type": "array", + "description": "Hearings related to adjudication", + "items": { + "$ref": "#/components/schemas/HearingDto" + } + }, + "issuingOfficer": { + "type": "string", + "description": "The last issuing officer" + }, + "dateTimeOfIssue": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The last date time of form issued", + "example": "2021-07-05T10:35:17" + }, + "disIssueHistory": { + "type": "array", + "description": "Previous DIS1/2 issues", + "items": { + "$ref": "#/components/schemas/DisIssueHistoryDto" + } + }, + "dateTimeOfFirstHearing": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "date time of first hearing", + "example": "2021-07-05T10:35:17" + }, + "outcomes": { + "type": "array", + "description": "Hearings, hearing outcomes, referrals and outcomes in chronological order", + "items": { + "$ref": "#/components/schemas/OutcomeHistoryDto" + } + }, + "punishments": { + "type": "array", + "description": "punishments", + "items": { + "$ref": "#/components/schemas/PunishmentDto" + } + }, + "punishmentComments": { + "type": "array", + "description": "punishments", + "items": { + "$ref": "#/components/schemas/PunishmentCommentDto" + } + }, + "outcomeEnteredInNomis": { + "type": "boolean", + "description": "flag to indicate a hearing outcome was entered in NOMIS" + }, + "overrideAgencyId": { + "type": "string", + "description": "optional override agency id" + }, + "originatingAgencyId": { + "type": "string", + "description": "agency id where report was created" + }, + "transferableActionsAllowed": { + "type": "boolean", + "description": "optional actions flag to indicate if an ALO can carry out actions against a transferable adjudication, null if not transferable" + }, + "createdOnBehalfOfOfficer": { + "type": "string", + "description": "Name the officer the report was created on behalf of" + }, + "createdOnBehalfOfReason": { + "type": "string", + "description": "Reason why the report was created on behalf of another officer" + }, + "linkedChargeNumbers": { + "type": "array", + "description": "list of linked nomis charges, where multiple offences recorded on a single charge", + "items": { + "type": "string", + "description": "list of linked nomis charges, where multiple offences recorded on a single charge" + } + }, + "canActionFromHistory": { + "type": "boolean", + "description": "flag to indicate if the user can action this item via the history page" + } + }, + "additionalProperties": false, + "description": "Reported adjudication details" + }, + "ReportedAdjudicationResponse": { + "required": [ + "reportedAdjudication" + ], + "type": "object", + "properties": { + "reportedAdjudication": { + "$ref": "#/components/schemas/ReportedAdjudicationDto" + } + }, + "additionalProperties": false, + "description": "Reported adjudication response" + }, + "ReportedDamageDto": { + "required": [ + "code", + "details", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The damage code based on an enum for defined damages", + "example": "CLEANING", + "enum": [ + "ELECTRICAL_REPAIR", + "PLUMBING_REPAIR", + "FURNITURE_OR_FABRIC_REPAIR", + "LOCK_REPAIR", + "REDECORATION", + "CLEANING", + "REPLACE_AN_ITEM" + ] + }, + "details": { + "type": "string", + "description": "The details of the damage", + "example": "the kettle was broken" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "Reported damages" + }, + "ReportedEvidenceDto": { + "required": [ + "code", + "details", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The evidence code based on an enum for defined evidence", + "example": "PHOTO", + "enum": [ + "PHOTO", + "BODY_WORN_CAMERA", + "CCTV", + "BAGGED_AND_TAGGED", + "OTHER" + ] + }, + "identifier": { + "type": "string", + "description": "Evidence identifier", + "example": "Tag number or Camera number" + }, + "details": { + "type": "string", + "description": "The details of the evidence", + "example": "ie what does the photo describe" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "Reported evidence" + }, + "ReportedWitnessDto": { + "required": [ + "code", + "firstName", + "lastName", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The witness code based on an enum for defined witness", + "example": "PRISON_OFFICER", + "enum": [ + "OFFICER", + "STAFF", + "OTHER_PERSON", + "VICTIM", + "PRISONER" + ] + }, + "firstName": { + "type": "string", + "description": "Witness first name", + "example": "Fred" + }, + "lastName": { + "type": "string", + "description": "Witness last name", + "example": "Kruger" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "Reported witness" + }, + "ReportedAdjudicationStatusRequest": { + "required": [ + "status" + ], + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "reported adjudication status codes", + "enum": [ + "ACCEPTED", + "REJECTED", + "AWAITING_REVIEW", + "RETURNED", + "UNSCHEDULED", + "SCHEDULED", + "REFER_POLICE", + "REFER_INAD", + "REFER_GOV", + "PROSECUTION", + "DISMISSED", + "NOT_PROCEED", + "ADJOURNED", + "CHARGE_PROVED", + "QUASHED", + "INVALID_OUTCOME", + "INVALID_SUSPENDED", + "INVALID_ADA" + ] + }, + "statusReason": { + "maxLength": 128, + "minLength": 0, + "type": "string", + "description": "The reason the status has been set" + }, + "statusDetails": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Details of why the status has been set" + } + }, + "additionalProperties": false, + "description": "Request to set the state for an a reported adjudication" + }, + "PunishmentRequest": { + "required": [ + "rehabilitativeActivities", + "type" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "id of punishment", + "format": "int64" + }, + "type": { + "type": "string", + "description": "punishment type", + "enum": [ + "PRIVILEGE", + "EARNINGS", + "CONFINEMENT", + "REMOVAL_ACTIVITY", + "EXCLUSION_WORK", + "EXTRA_WORK", + "REMOVAL_WING", + "ADDITIONAL_DAYS", + "PROSPECTIVE_DAYS", + "CAUTION", + "DAMAGES_OWED", + "PAYBACK" + ] + }, + "privilegeType": { + "type": "string", + "description": "privilege type - only use if punishment type is PRIVILEGE", + "enum": [ + "CANTEEN", + "FACILITIES", + "MONEY", + "TV", + "ASSOCIATION", + "GYM", + "OTHER" + ] + }, + "otherPrivilege": { + "type": "string", + "description": "other privilege type - only use if privilege type is OTHER" + }, + "stoppagePercentage": { + "type": "integer", + "description": "stoppage percentage - use if punishment type is EARNINGS", + "format": "int32" + }, + "duration": { + "type": "integer", + "description": "duration of punishment", + "format": "int32" + }, + "startDate": { + "type": "string", + "description": "punishment start date, required if punishment is not suspended", + "format": "date" + }, + "endDate": { + "type": "string", + "description": "punishment end date, required if punishment is not suspended", + "format": "date" + }, + "suspendedUntil": { + "type": "string", + "description": "punishment suspended until date, required if punishment is suspended", + "format": "date" + }, + "activatedFrom": { + "type": "string", + "description": "optional activated from report number" + }, + "consecutiveChargeNumber": { + "type": "string", + "description": "optional consecutive charge number" + }, + "damagesOwedAmount": { + "type": "number", + "description": "optional amount - money being recovered for damages - only use if type is DAMAGED_OWED", + "format": "double" + }, + "paybackNotes": { + "type": "string", + "description": "payback punishment notes" + }, + "rehabilitativeActivities": { + "type": "array", + "description": "optional rehabilitative activities associated to suspended punishment", + "items": { + "$ref": "#/components/schemas/RehabilitativeActivityRequest" + } + } + }, + "additionalProperties": false, + "description": "punishment request" + }, + "PunishmentsRequest": { + "required": [ + "punishments" + ], + "type": "object", + "properties": { + "punishments": { + "type": "array", + "description": "list of punishments", + "items": { + "$ref": "#/components/schemas/PunishmentRequest" + } + } + }, + "additionalProperties": false, + "description": "punishments request" + }, + "RehabilitativeActivityRequest": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "id", + "format": "int64" + }, + "details": { + "type": "string", + "description": "details" + }, + "monitor": { + "type": "string", + "description": "who is monitoring it" + }, + "endDate": { + "type": "string", + "description": "end date", + "format": "date" + }, + "totalSessions": { + "type": "integer", + "description": "optional number of sessions", + "format": "int32" + } + }, + "additionalProperties": false, + "description": "rehabilitative activity" + }, + "ErrorResponse": { + "required": [ + "status" + ], + "type": "object", + "properties": { + "status": { + "type": "integer", + "format": "int32" + }, + "errorCode": { + "type": "string" + }, + "userMessage": { + "type": "string" + }, + "developerMessage": { + "type": "string" + }, + "moreInfo": { + "type": "string" + } + }, + "additionalProperties": false + }, + "PunishmentCommentRequest": { + "required": [ + "comment" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "id of punishment comment", + "format": "int64" + }, + "comment": { + "type": "string", + "description": "punishment comment" + }, + "reasonForChange": { + "type": "string", + "description": "punishment reason for change", + "enum": [ + "APPEAL", + "CORRECTION", + "OTHER", + "GOV_OR_DIRECTOR" + ] + } + }, + "additionalProperties": false, + "description": "punishment comment request" + }, + "AmendOutcomeRequest": { + "required": [ + "details" + ], + "type": "object", + "properties": { + "details": { + "type": "string", + "description": "details" + }, + "reason": { + "type": "string", + "description": "not proceed reason", + "enum": [ + "ANOTHER_WAY", + "RELEASED", + "WITNESS_NOT_ATTEND", + "UNFIT", + "FLAWED", + "EXPIRED_NOTICE", + "EXPIRED_HEARING", + "NOT_FAIR", + "OTHER" + ] + }, + "quashedReason": { + "type": "string", + "description": "quashed reason", + "enum": [ + "FLAWED_CASE", + "JUDICIAL_REVIEW", + "APPEAL_UPHELD", + "OTHER" + ] + }, + "referGovReason": { + "type": "string", + "description": "refer back to gov reason", + "enum": [ + "REVIEW_FOR_REFER_POLICE", + "GOV_INQUIRY", + "OTHER" + ] + } + }, + "additionalProperties": false, + "description": "amend outcome without a hearing - NOT PROCEED, REFER POLICE, QUASHED" + }, + "IssueRequest": { + "required": [ + "dateTimeOfIssue" + ], + "type": "object", + "properties": { + "dateTimeOfIssue": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date time of issue", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "Request to issue a DIS" + }, + "HearingRequest": { + "required": [ + "dateTimeOfHearing", + "locationId", + "oicHearingType" + ], + "type": "object", + "properties": { + "locationId": { + "type": "integer", + "description": "The id of the location of the hearing", + "format": "int64" + }, + "dateTimeOfHearing": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time of the hearing", + "example": "2021-07-05T10:35:17" + }, + "oicHearingType": { + "type": "string", + "description": "oic hearing type", + "enum": [ + "GOV_ADULT", + "GOV_YOI", + "INAD_YOI", + "GOV", + "INAD_ADULT" + ] + } + }, + "additionalProperties": false, + "description": "Request to add a hearing" + }, + "AmendHearingOutcomeRequest": { + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "adjournReason": { + "type": "string", + "description": "the adjourn reason", + "enum": [ + "LEGAL_ADVICE", + "LEGAL_REPRESENTATION", + "RO_ATTEND", + "HELP", + "UNFIT", + "WITNESS", + "WITNESS_SUPPORT", + "MCKENZIE", + "EVIDENCE", + "INVESTIGATION", + "OTHER" + ] + }, + "notProceedReason": { + "type": "string", + "description": "not proceed reason", + "enum": [ + "ANOTHER_WAY", + "RELEASED", + "WITNESS_NOT_ATTEND", + "UNFIT", + "FLAWED", + "EXPIRED_NOTICE", + "EXPIRED_HEARING", + "NOT_FAIR", + "OTHER" + ] + }, + "referGovReason": { + "type": "string", + "description": "refer back to gov reason", + "enum": [ + "REVIEW_FOR_REFER_POLICE", + "GOV_INQUIRY", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details" + }, + "plea": { + "type": "string", + "description": "plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + } + }, + "additionalProperties": false, + "description": "amend hearing outcome request" + }, + "EvidenceRequest": { + "required": [ + "evidence" + ], + "type": "object", + "properties": { + "evidence": { + "type": "array", + "description": "The details of all evidence", + "items": { + "$ref": "#/components/schemas/EvidenceRequestItem" + } + } + }, + "additionalProperties": false, + "description": "Request to update the list of evidence for a draft adjudication" + }, + "EvidenceRequestItem": { + "required": [ + "code", + "details" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The evidence code", + "example": "PHOTO", + "enum": [ + "PHOTO", + "BODY_WORN_CAMERA", + "CCTV", + "BAGGED_AND_TAGGED", + "OTHER" + ] + }, + "identifier": { + "type": "string", + "description": "Evidence identifier", + "example": "Tag number or Camera number" + }, + "details": { + "type": "string", + "description": "details of the evidence", + "example": "ie description of photo" + }, + "reporter": { + "type": "string", + "description": "optional reporter as per token, used when editing", + "example": "A_USER" + } + }, + "additionalProperties": false, + "description": "Details of Evidence" + }, + "DamageRequestItem": { + "required": [ + "code", + "details" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The damage code", + "example": "CLEANING", + "enum": [ + "ELECTRICAL_REPAIR", + "PLUMBING_REPAIR", + "FURNITURE_OR_FABRIC_REPAIR", + "LOCK_REPAIR", + "REDECORATION", + "CLEANING", + "REPLACE_AN_ITEM" + ] + }, + "details": { + "type": "string", + "description": "details of the damage", + "example": "the kettle was broken" + }, + "reporter": { + "type": "string", + "description": "optional reporter as per token, used when editing", + "example": "A_USER" + } + }, + "additionalProperties": false, + "description": "Details of Damage" + }, + "DamagesRequest": { + "required": [ + "damages" + ], + "type": "object", + "properties": { + "damages": { + "type": "array", + "description": "The details of all damages the prisoner is accused of", + "items": { + "$ref": "#/components/schemas/DamageRequestItem" + } + } + }, + "additionalProperties": false, + "description": "Request to update the list of damages for a draft adjudication" + }, + "CreatedOnBehalfOfRequest": { + "required": [ + "createdOnBehalfOfOfficer", + "createdOnBehalfOfReason" + ], + "type": "object", + "properties": { + "createdOnBehalfOfOfficer": { + "type": "string", + "description": "Name the officer the report was created on behalf of" + }, + "createdOnBehalfOfReason": { + "type": "string", + "description": "Reason why the report was created on behalf of another officer" + } + }, + "additionalProperties": false, + "description": "Request to update created on behalf of" + }, + "RetryDlqResult": { + "required": [ + "messagesFoundCount" + ], + "type": "object", + "properties": { + "messagesFoundCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "PurgeQueueResult": { + "required": [ + "messagesFoundCount" + ], + "type": "object", + "properties": { + "messagesFoundCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "DamageDto": { + "required": [ + "code", + "details", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The damage code based on an enum for defined damages", + "example": "CLEANING", + "enum": [ + "ELECTRICAL_REPAIR", + "PLUMBING_REPAIR", + "FURNITURE_OR_FABRIC_REPAIR", + "LOCK_REPAIR", + "REDECORATION", + "CLEANING", + "REPLACE_AN_ITEM" + ] + }, + "details": { + "type": "string", + "description": "The details of the damage", + "example": "the kettle was broken" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "damages" + }, + "DraftAdjudicationDto": { + "required": [ + "gender", + "id", + "incidentDetails", + "originatingAgencyId", + "prisonerNumber" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Draft adjudication id", + "format": "int64" + }, + "chargeNumber": { + "type": "string", + "description": "The charge number for the reported adjudication, Will only be present if this adjudication has been submitted to Prison-API", + "example": "4567123" + }, + "prisonerNumber": { + "type": "string", + "description": "Prison number assigned to a prisoner", + "example": "G2996UX" + }, + "gender": { + "type": "string", + "description": "Gender applied for adjudication rules", + "example": "MALE", + "enum": [ + "MALE", + "FEMALE" + ] + }, + "incidentDetails": { + "$ref": "#/components/schemas/IncidentDetailsDto" + }, + "incidentRole": { + "$ref": "#/components/schemas/IncidentRoleDto" + }, + "offenceDetails": { + "$ref": "#/components/schemas/OffenceDetailsDto" + }, + "incidentStatement": { + "$ref": "#/components/schemas/IncidentStatementDto" + }, + "startedByUserId": { + "type": "string", + "description": "The id of the user who started the adjudication" + }, + "isYouthOffender": { + "type": "boolean", + "description": "Is classified as a youth offender" + }, + "damages": { + "type": "array", + "description": "Damages related to incident", + "items": { + "$ref": "#/components/schemas/DamageDto" + } + }, + "evidence": { + "type": "array", + "description": "Evidence related to incident", + "items": { + "$ref": "#/components/schemas/EvidenceDto" + } + }, + "witnesses": { + "type": "array", + "description": "Witnesses related to incident", + "items": { + "$ref": "#/components/schemas/WitnessDto" + } + }, + "damagesSaved": { + "type": "boolean", + "description": "has the damages end point been called" + }, + "evidenceSaved": { + "type": "boolean", + "description": "has the evidence end point been called" + }, + "witnessesSaved": { + "type": "boolean", + "description": "has the witnesses end point been called" + }, + "overrideAgencyId": { + "type": "string", + "description": "optional override agency id" + }, + "originatingAgencyId": { + "type": "string", + "description": "agency id where report was created" + }, + "createdOnBehalfOfOfficer": { + "type": "string", + "description": "Name the officer the report was created on behalf of" + }, + "createdOnBehalfOfReason": { + "type": "string", + "description": "Reason why the report was created on behalf of another officer" + } + }, + "additionalProperties": false, + "description": "Draft adjudication details" + }, + "DraftAdjudicationResponse": { + "required": [ + "draftAdjudication" + ], + "type": "object", + "properties": { + "draftAdjudication": { + "$ref": "#/components/schemas/DraftAdjudicationDto" + } + }, + "additionalProperties": false, + "description": "Draft adjudication response" + }, + "EvidenceDto": { + "required": [ + "code", + "details", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The evidence code based on an enum for defined evidence", + "example": "PHOTO", + "enum": [ + "PHOTO", + "BODY_WORN_CAMERA", + "CCTV", + "BAGGED_AND_TAGGED", + "OTHER" + ] + }, + "identifier": { + "type": "string", + "description": "Evidence identifier", + "example": "Tag number or Camera number" + }, + "details": { + "type": "string", + "description": "The details of the evidence", + "example": "ie what does the photo show" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "evidence" + }, + "OffenceDetailsDto": { + "required": [ + "offenceCode", + "offenceRule", + "protectedCharacteristics" + ], + "type": "object", + "properties": { + "offenceCode": { + "type": "integer", + "description": "The offence code, This is the unique number relating to the type of offence they have been alleged to have committed", + "format": "int32", + "example": 3 + }, + "offenceRule": { + "$ref": "#/components/schemas/OffenceRuleDetailsDto" + }, + "victimPrisonersNumber": { + "type": "string", + "description": "The prison number of the victim involved in the incident, if relevant", + "example": "G2996UX" + }, + "victimStaffUsername": { + "type": "string", + "description": "The username of the member of staff who is a victim of the incident, if relevant", + "example": "ABC12D" + }, + "victimOtherPersonsName": { + "type": "string", + "description": "The name of the victim (who is not a member of staff or a prisoner) involved in the incident, if relevant", + "example": "Bob Hope" + }, + "protectedCharacteristics": { + "type": "array", + "description": "list of protected characteristics for offence, empty if non involved in offence", + "items": { + "type": "string", + "description": "list of protected characteristics for offence, empty if non involved in offence", + "enum": [ + "AGE", + "DISABILITY", + "GENDER_REASSIGN", + "MARRIAGE_AND_CP", + "PREGNANCY_AND_MAT", + "RACE", + "RELIGION", + "SEX", + "SEX_ORIENTATION" + ] + } + } + }, + "additionalProperties": false, + "description": "Details of an offence" + }, + "WitnessDto": { + "required": [ + "code", + "firstName", + "lastName", + "reporter" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The witness code based on an enum for defined witness", + "example": "PRISON_OFFICER", + "enum": [ + "OFFICER", + "STAFF", + "OTHER_PERSON", + "VICTIM", + "PRISONER" + ] + }, + "firstName": { + "type": "string", + "description": "Witness first name", + "example": "Fred" + }, + "lastName": { + "type": "string", + "description": "Witness last name", + "example": "Kruger" + }, + "reporter": { + "type": "string", + "description": "The username of the person who added this record", + "example": "ABC12D" + } + }, + "additionalProperties": false, + "description": "witness" + }, + "OffenceDetailsRequest": { + "required": [ + "offenceDetails" + ], + "type": "object", + "properties": { + "offenceDetails": { + "$ref": "#/components/schemas/OffenceDetailsRequestItem" + } + }, + "additionalProperties": false, + "description": "Request to update the list of offence details for a draft adjudication" + }, + "OffenceDetailsRequestItem": { + "required": [ + "offenceCode" + ], + "type": "object", + "properties": { + "offenceCode": { + "title": "This is the unique number relating to the type of offence they have been alleged to have committed", + "type": "integer", + "description": "The offence code", + "format": "int32", + "example": 3 + }, + "victimPrisonersNumber": { + "type": "string", + "description": "The prison number of the victim involved in the incident, if relevant", + "example": "G2996UX" + }, + "victimStaffUsername": { + "type": "string", + "description": "The username of the member of staff who is a victim of the incident, if relevant", + "example": "ABC12D" + }, + "victimOtherPersonsName": { + "type": "string", + "description": "The name of the victim (who is not a member of staff or a prisoner) involved in the incident, if relevant", + "example": "Bob Hope" + }, + "protectedCharacteristics": { + "type": "array", + "description": "optional list of protected characteristics involved in the offence", + "items": { + "type": "string", + "description": "optional list of protected characteristics involved in the offence", + "enum": [ + "AGE", + "DISABILITY", + "GENDER_REASSIGN", + "MARRIAGE_AND_CP", + "PREGNANCY_AND_MAT", + "RACE", + "RELIGION", + "SEX", + "SEX_ORIENTATION" + ] + } + } + }, + "additionalProperties": false, + "description": "Details of an offence" + }, + "IncidentStatementRequest": { + "type": "object", + "properties": { + "statement": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "The statement regarding the incident" + }, + "completed": { + "type": "boolean" + } + }, + "additionalProperties": false, + "description": "Request to add or edit the incident statement for a draft adjudication" + }, + "EditIncidentRoleRequest": { + "required": [ + "incidentRole", + "removeExistingOffences" + ], + "type": "object", + "properties": { + "incidentRole": { + "$ref": "#/components/schemas/IncidentRoleRequest" + }, + "removeExistingOffences": { + "type": "boolean", + "description": "Whether to remove all existing offences" + } + }, + "additionalProperties": false, + "description": "Request to edit incident role" + }, + "IncidentRoleRequest": { + "type": "object", + "properties": { + "roleCode": { + "title": "If not set then it is assumed they committed the offence on their own", + "type": "string", + "description": "The incident role code", + "example": "25a" + } + }, + "additionalProperties": false, + "description": "Request to update the incident role" + }, + "EditIncidentDetailsRequest": { + "required": [ + "dateTimeOfIncident", + "locationId" + ], + "type": "object", + "properties": { + "locationId": { + "type": "integer", + "description": "The id of the location the incident took place", + "format": "int64" + }, + "dateTimeOfIncident": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the incident occurred", + "example": "2021-07-05T10:35:17" + }, + "dateTimeOfDiscovery": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Optional Date time if discovery date different to incident date", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "Request to edit the incident details" + }, + "GenderRequest": { + "required": [ + "gender" + ], + "type": "object", + "properties": { + "gender": { + "title": "Gender of prisoner", + "type": "string", + "description": "The gender", + "example": "MALE", + "enum": [ + "MALE", + "FEMALE" + ] + } + }, + "additionalProperties": false, + "description": "Request to update the gender" + }, + "IncidentRoleAssociatedPrisonerRequest": { + "required": [ + "associatedPrisonersNumber" + ], + "type": "object", + "properties": { + "associatedPrisonersNumber": { + "type": "string", + "description": "The prison number of the other prisoner involved in the incident", + "example": "G2996UX" + }, + "associatedPrisonersName": { + "title": "This only applies if the associated prisoner is from outside the establishment", + "type": "string", + "description": "The name of the other prisoner involved in the incident" + } + }, + "additionalProperties": false, + "description": "Request to set the associated prisoner" + }, + "ApplicableRulesRequest": { + "required": [ + "isYouthOffenderRule", + "removeExistingOffences" + ], + "type": "object", + "properties": { + "isYouthOffenderRule": { + "type": "boolean", + "description": "Indicates whether the applicable rules are for a young offender" + }, + "removeExistingOffences": { + "type": "boolean", + "description": "Whether to remove all existing offences" + } + }, + "additionalProperties": false, + "description": "Request to set applicable rules" + }, + "CompleteRehabilitativeActivityRequest": { + "required": [ + "completed" + ], + "type": "object", + "properties": { + "completed": { + "type": "boolean", + "description": "did they complete it" + }, + "outcome": { + "type": "string", + "description": "outcome if they did not complete it", + "enum": [ + "FULL_ACTIVATE", + "PARTIAL_ACTIVATE", + "EXT_SUSPEND", + "NO_ACTION" + ] + }, + "daysToActivate": { + "type": "integer", + "description": "optional days to activate it for", + "format": "int32" + }, + "suspendedUntil": { + "type": "string", + "description": "optional new suspended until date", + "format": "date" + } + }, + "additionalProperties": false, + "description": "complete a rehabilitative activity" + }, + "ReferralDetailsRequest": { + "required": [ + "details" + ], + "type": "object", + "properties": { + "details": { + "type": "string", + "description": "details" + } + }, + "additionalProperties": false, + "description": "Request to add a police referral" + }, + "ReferralGovRequest": { + "required": [ + "details", + "referGovReason" + ], + "type": "object", + "properties": { + "referGovReason": { + "type": "string", + "description": "refer back to gov reason", + "enum": [ + "REVIEW_FOR_REFER_POLICE", + "GOV_INQUIRY", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details" + } + }, + "additionalProperties": false, + "description": "Request to add a gov referral" + }, + "QuashedRequest": { + "required": [ + "details", + "reason" + ], + "type": "object", + "properties": { + "details": { + "type": "string", + "description": "details" + }, + "reason": { + "type": "string", + "description": "reason", + "enum": [ + "FLAWED_CASE", + "JUDICIAL_REVIEW", + "APPEAL_UPHELD", + "OTHER" + ] + } + }, + "additionalProperties": false, + "description": "Request to quash charge" + }, + "NotProceedRequest": { + "required": [ + "details", + "reason" + ], + "type": "object", + "properties": { + "details": { + "type": "string", + "description": "details" + }, + "reason": { + "type": "string", + "description": "reason", + "enum": [ + "ANOTHER_WAY", + "RELEASED", + "WITNESS_NOT_ATTEND", + "UNFIT", + "FLAWED", + "EXPIRED_NOTICE", + "EXPIRED_HEARING", + "NOT_FAIR", + "OTHER" + ] + } + }, + "additionalProperties": false, + "description": "Request to add a not proceed - via referral or without hearing" + }, + "ReferralRequest": { + "required": [ + "adjudicator", + "code", + "details" + ], + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "code": { + "type": "string", + "description": "the outcome code", + "enum": [ + "COMPLETE", + "REFER_POLICE", + "REFER_INAD", + "ADJOURN", + "NOMIS", + "REFER_GOV" + ] + }, + "referGovReason": { + "type": "string", + "description": "optional refer back to gov reason", + "enum": [ + "REVIEW_FOR_REFER_POLICE", + "GOV_INQUIRY", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details" + } + }, + "additionalProperties": false, + "description": "Request to create a referral for latest hearing" + }, + "AdjournRequest": { + "required": [ + "adjudicator", + "details", + "plea", + "reason" + ], + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "reason": { + "type": "string", + "description": "the adjourn resaon", + "enum": [ + "LEGAL_ADVICE", + "LEGAL_REPRESENTATION", + "RO_ATTEND", + "HELP", + "UNFIT", + "WITNESS", + "WITNESS_SUPPORT", + "MCKENZIE", + "EVIDENCE", + "INVESTIGATION", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details" + }, + "plea": { + "type": "string", + "description": "plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + } + }, + "additionalProperties": false, + "description": "Request to create an adjourn for latest hearing" + }, + "HearingCompletedNotProceedRequest": { + "required": [ + "adjudicator", + "details", + "plea", + "reason" + ], + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "plea": { + "type": "string", + "description": "plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + }, + "reason": { + "type": "string", + "description": "reason", + "enum": [ + "ANOTHER_WAY", + "RELEASED", + "WITNESS_NOT_ATTEND", + "UNFIT", + "FLAWED", + "EXPIRED_NOTICE", + "EXPIRED_HEARING", + "NOT_FAIR", + "OTHER" + ] + }, + "details": { + "type": "string", + "description": "details" + } + }, + "additionalProperties": false, + "description": "Request to add a not proceed - hearing completed" + }, + "HearingCompletedDismissedRequest": { + "required": [ + "adjudicator", + "details", + "plea" + ], + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "plea": { + "type": "string", + "description": "plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + }, + "details": { + "type": "string", + "description": "details" + } + }, + "additionalProperties": false, + "description": "Request to add dismissed - hearing completed" + }, + "HearingCompletedChargeProvedRequest": { + "required": [ + "adjudicator", + "plea" + ], + "type": "object", + "properties": { + "adjudicator": { + "type": "string", + "description": "the name of the adjudicator" + }, + "plea": { + "type": "string", + "description": "plea", + "enum": [ + "UNFIT", + "ABSTAIN", + "GUILTY", + "NOT_GUILTY", + "NOT_ASKED" + ] + } + }, + "additionalProperties": false, + "description": "Request to add charge proved - hearing completed" + }, + "HearingAndPrisoner": { + "required": [ + "hearing", + "prisonerNumber" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "prisoner number" + }, + "hearing": { + "$ref": "#/components/schemas/HearingDto" + } + }, + "additionalProperties": false, + "description": "Hearing and prisoner" + }, + "NewAdjudicationRequest": { + "required": [ + "agencyId", + "dateTimeOfIncident", + "gender", + "locationId", + "prisonerNumber" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "Prison number assigned to a prisoner", + "example": "G2996UX" + }, + "gender": { + "type": "string", + "description": "Gender applied for adjuducation rules", + "example": "MALE", + "enum": [ + "MALE", + "FEMALE" + ] + }, + "agencyId": { + "type": "string", + "description": "The agency id (or caseload) associated with this adjudication", + "example": "MDI" + }, + "overrideAgencyId": { + "type": "string", + "description": "The optional agencyId where the prisoner now resides", + "example": "MDI" + }, + "locationId": { + "type": "integer", + "description": "The id of the location the incident took place", + "format": "int64" + }, + "dateTimeOfIncident": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the incident occurred", + "example": "2021-07-05T10:35:17" + }, + "dateTimeOfDiscovery": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Optional Date time if discovery date different to incident date", + "example": "2021-07-05T10:35:17" + }, + "offenderBookingId": { + "type": "integer", + "description": "offender book id used for api calls from dps", + "format": "int64" + } + }, + "additionalProperties": false, + "description": "Request to create a new draft adjudication" + }, + "HmppsSubjectAccessRequestContent": { + "required": [ + "content" + ], + "type": "object", + "properties": { + "content": { + "type": "object", + "description": "The content of the subject access request response" + } + }, + "additionalProperties": false + }, + "ChargeWithSuspendedPunishments": { + "required": [ + "chargeNumber", + "dateOfDiscovery", + "dateOfIncident", + "offenceDetails", + "suspendedPunishments" + ], + "type": "object", + "properties": { + "dateOfIncident": { + "type": "string", + "description": "Date the incident occurred", + "format": "date" + }, + "dateOfDiscovery": { + "type": "string", + "description": "Date of discovery if date different to incident date", + "format": "date" + }, + "chargeNumber": { + "type": "string", + "description": "charge number" + }, + "offenceDetails": { + "$ref": "#/components/schemas/OffenceDto" + }, + "suspendedPunishments": { + "type": "array", + "description": "list of suspended punishments", + "items": { + "$ref": "#/components/schemas/PunishmentDto" + } + } + }, + "additionalProperties": false, + "description": "suspended punishments on charge" + }, + "Dis5PrintSupportDto": { + "required": [ + "chargeNumber", + "chargesWithSuspendedPunishments", + "dateOfDiscovery", + "dateOfIncident", + "existingPunishments", + "previousAtCurrentEstablishmentCount", + "previousCount", + "sameOffenceCount" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "charge number" + }, + "dateOfIncident": { + "type": "string", + "description": "Date the incident occurred", + "format": "date" + }, + "dateOfDiscovery": { + "type": "string", + "description": "Date of discovery if date different to incident date", + "format": "date" + }, + "previousCount": { + "type": "integer", + "description": "total number of charge proved on current sentence", + "format": "int32" + }, + "previousAtCurrentEstablishmentCount": { + "type": "integer", + "description": "total number of charge proved on current sentence at current establishment", + "format": "int32" + }, + "sameOffenceCount": { + "type": "integer", + "description": "total number of charge proved for same offence", + "format": "int32" + }, + "lastReportedOffence": { + "$ref": "#/components/schemas/LastReportedOffence" + }, + "chargesWithSuspendedPunishments": { + "type": "array", + "description": "charges with suspended punishments that are active", + "items": { + "$ref": "#/components/schemas/ChargeWithSuspendedPunishments" + } + }, + "existingPunishments": { + "type": "array", + "description": "existing active punishments", + "items": { + "$ref": "#/components/schemas/PunishmentDto" + } + } + }, + "additionalProperties": false, + "description": "dis5 data model" + }, + "LastReportedOffence": { + "required": [ + "chargeNumber", + "dateOfDiscovery", + "dateOfIncident", + "punishments", + "statement" + ], + "type": "object", + "properties": { + "dateOfIncident": { + "type": "string", + "description": "Date the incident occurred", + "format": "date" + }, + "dateOfDiscovery": { + "type": "string", + "description": "Date of discovery if date different to incident date", + "format": "date" + }, + "chargeNumber": { + "type": "string", + "description": "last reported same offence charge number" + }, + "statement": { + "type": "string", + "description": "The statement regarding the last reported incident" + }, + "punishments": { + "type": "array", + "description": "punishments awarded on the last reported same offence", + "items": { + "$ref": "#/components/schemas/PunishmentDto" + } + } + }, + "additionalProperties": false, + "description": "optional last reported same offence charge" + }, + "Pageable": { + "type": "object", + "properties": { + "page": { + "minimum": 0, + "type": "integer", + "format": "int32" + }, + "size": { + "minimum": 1, + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "PageReportedAdjudicationDto": { + "type": "object", + "properties": { + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportedAdjudicationDto" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "empty": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "PageableObject": { + "type": "object", + "properties": { + "paged": { + "type": "boolean" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "unpaged": { + "type": "boolean" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "offset": { + "type": "integer", + "format": "int64" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + } + }, + "additionalProperties": false + }, + "SortObject": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "nullHandling": { + "type": "string" + }, + "ascending": { + "type": "boolean" + }, + "property": { + "type": "string" + }, + "ignoreCase": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "AgencyReportCountsDto": { + "required": [ + "hearingsToScheduleTotal", + "reviewTotal", + "transferOutTotal", + "transferReviewTotal" + ], + "type": "object", + "properties": { + "reviewTotal": { + "type": "integer", + "description": "total reports to review for agency", + "format": "int64" + }, + "transferReviewTotal": { + "type": "integer", + "description": "total transferable in reports to action", + "format": "int64" + }, + "transferOutTotal": { + "type": "integer", + "description": "total transferable reports to action", + "format": "int64" + }, + "transferAllTotal": { + "type": "integer", + "description": "total transfer in and out to action", + "format": "int64" + }, + "hearingsToScheduleTotal": { + "type": "integer", + "description": "hearings to schedule count", + "format": "int64" + } + }, + "additionalProperties": false, + "description": "Agency Report counts DTO" + }, + "SuspendedPunishmentDto": { + "required": [ + "chargeNumber", + "corrupted", + "punishment" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "charge number punishment from" + }, + "corrupted": { + "type": "boolean", + "description": "indicates there is something wrong with this suspended punishment, and its within the last 6 months" + }, + "punishment": { + "$ref": "#/components/schemas/PunishmentDto" + } + }, + "additionalProperties": false, + "description": "suspended punishment dto" + }, + "AdditionalDaysDto": { + "required": [ + "chargeNumber", + "chargeProvedDate", + "punishment" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "charge number punishment from" + }, + "chargeProvedDate": { + "type": "string", + "description": "date charge proved", + "format": "date" + }, + "punishment": { + "$ref": "#/components/schemas/PunishmentDto" + } + }, + "additionalProperties": false, + "description": "additional days to activate dto" + }, + "ActivePunishmentDto": { + "required": [ + "chargeNumber", + "punishmentType" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "charge number" + }, + "punishmentType": { + "type": "string", + "description": "punishment type", + "enum": [ + "PRIVILEGE", + "EARNINGS", + "CONFINEMENT", + "REMOVAL_ACTIVITY", + "EXCLUSION_WORK", + "EXTRA_WORK", + "REMOVAL_WING", + "ADDITIONAL_DAYS", + "PROSPECTIVE_DAYS", + "CAUTION", + "DAMAGES_OWED", + "PAYBACK" + ] + }, + "privilegeType": { + "type": "string", + "description": "privilege type", + "enum": [ + "CANTEEN", + "FACILITIES", + "MONEY", + "TV", + "ASSOCIATION", + "GYM", + "OTHER" + ] + }, + "otherPrivilege": { + "type": "string", + "description": "other privilege description" + }, + "duration": { + "type": "integer", + "description": "duration of punishment", + "format": "int32" + }, + "measurement": { + "type": "string", + "description": "measurement of duration", + "enum": [ + "DAYS", + "HOURS" + ] + }, + "startDate": { + "type": "string", + "description": "start date", + "format": "date" + }, + "lastDay": { + "type": "string", + "description": "last day", + "format": "date" + }, + "amount": { + "type": "number", + "description": "amount", + "format": "double" + }, + "stoppagePercentage": { + "type": "integer", + "description": "stoppage percentage", + "format": "int32" + }, + "activatedFrom": { + "type": "string", + "description": "activated from report" + } + }, + "additionalProperties": false, + "description": "active punishment dto" + }, + "HearingSummaryDto": { + "required": [ + "chargeNumber", + "dateTimeOfDiscovery", + "dateTimeOfHearing", + "locationId", + "oicHearingType", + "prisonerNumber", + "status" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the hearing", + "format": "int64" + }, + "dateTimeOfHearing": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the hearing will take place", + "example": "2021-07-05T10:35:17" + }, + "dateTimeOfDiscovery": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the incident was discovered", + "example": "2021-07-05T10:35:17" + }, + "chargeNumber": { + "type": "string", + "description": "The charge number for the reported adjudication" + }, + "prisonerNumber": { + "type": "string", + "description": "Prison number assigned to a prisoner", + "example": "G2996UX" + }, + "oicHearingType": { + "type": "string", + "description": "type of hearing", + "enum": [ + "GOV_ADULT", + "GOV_YOI", + "INAD_YOI", + "GOV", + "INAD_ADULT" + ] + }, + "status": { + "type": "string", + "description": "reported adjudication status codes", + "enum": [ + "ACCEPTED", + "REJECTED", + "AWAITING_REVIEW", + "RETURNED", + "UNSCHEDULED", + "SCHEDULED", + "REFER_POLICE", + "REFER_INAD", + "REFER_GOV", + "PROSECUTION", + "DISMISSED", + "NOT_PROCEED", + "ADJOURNED", + "CHARGE_PROVED", + "QUASHED", + "INVALID_OUTCOME", + "INVALID_SUSPENDED", + "INVALID_ADA" + ] + }, + "locationId": { + "type": "integer", + "description": "internal location id", + "format": "int64" + } + }, + "additionalProperties": false, + "description": "Hearing Summary" + }, + "HearingSummaryResponse": { + "required": [ + "hearings" + ], + "type": "object", + "properties": { + "hearings": { + "type": "array", + "description": "The hearing summaries response", + "items": { + "$ref": "#/components/schemas/HearingSummaryDto" + } + } + }, + "additionalProperties": false, + "description": "All hearings response" + }, + "PrintableAdjudicationsResponse": { + "required": [ + "reportedAdjudications" + ], + "type": "object", + "properties": { + "reportedAdjudications": { + "type": "array", + "description": "Th reported adjudications response", + "items": { + "$ref": "#/components/schemas/ReportedAdjudicationDto" + } + } + }, + "additionalProperties": false, + "description": "All adjudications for print response" + }, + "IssuableAdjudicationsResponseV2": { + "required": [ + "reportedAdjudications" + ], + "type": "object", + "properties": { + "reportedAdjudications": { + "type": "array", + "description": "Th reported adjudications response", + "items": { + "$ref": "#/components/schemas/ReportsForIssueDto" + } + } + }, + "additionalProperties": false, + "description": "All issuable adjudications response v2" + }, + "ReportsForIssueDto": { + "required": [ + "chargeNumber", + "dateTimeOfDiscovery", + "dateTimeOfIncident", + "disIssueHistory", + "prisonerNumber" + ], + "type": "object", + "properties": { + "chargeNumber": { + "type": "string", + "description": "The charge number for the reported adjudication" + }, + "prisonerNumber": { + "type": "string", + "description": "Prison number assigned to a prisoner", + "example": "G2996UX" + }, + "dateTimeOfIncident": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the incident occurred", + "example": "2021-07-05T10:35:17" + }, + "dateTimeOfDiscovery": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date time of discovery if date different to incident date", + "example": "2021-07-05T10:35:17" + }, + "issuingOfficer": { + "type": "string", + "description": "The last issuing officer" + }, + "dateTimeOfIssue": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The last date time of form issued", + "example": "2021-07-05T10:35:17" + }, + "disIssueHistory": { + "type": "array", + "description": "Previous DIS1/2 issues", + "items": { + "$ref": "#/components/schemas/DisIssueHistoryDto" + } + }, + "dateTimeOfFirstHearing": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "date time of first hearing", + "example": "2021-07-05T10:35:17" + } + }, + "additionalProperties": false, + "description": "reports for issue DTO" + }, + "DlqMessage": { + "required": [ + "body", + "messageId" + ], + "type": "object", + "properties": { + "body": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "messageId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "GetDlqResult": { + "required": [ + "messages", + "messagesFoundCount", + "messagesReturnedCount" + ], + "type": "object", + "properties": { + "messagesFoundCount": { + "type": "integer", + "format": "int32" + }, + "messagesReturnedCount": { + "type": "integer", + "format": "int32" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DlqMessage" + } + } + }, + "additionalProperties": false + }, + "PageDraftAdjudicationDto": { + "type": "object", + "properties": { + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DraftAdjudicationDto" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "empty": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "AdjudicationSummary": { + "required": [ + "adjudicationCount", + "awards", + "bookingId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Prisoner Booking Id", + "format": "int64" + }, + "adjudicationCount": { + "type": "integer", + "description": "Number of proven adjudications", + "format": "int32" + }, + "awards": { + "type": "array", + "description": "List of awards / sanctions", + "items": { + "$ref": "#/components/schemas/Award" + } + } + }, + "additionalProperties": false, + "description": "Adjudication Summary for a prisoner" + }, + "Award": { + "required": [ + "bookingId", + "effectiveDate", + "hearingId", + "hearingSequence", + "sanctionCode" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Id of booking", + "format": "int64" + }, + "sanctionCode": { + "type": "string", + "description": "Type of award" + }, + "sanctionCodeDescription": { + "type": "string", + "description": "Award type description" + }, + "months": { + "type": "integer", + "description": "Number of months duration", + "format": "int32" + }, + "days": { + "type": "integer", + "description": "Number of days duration", + "format": "int32" + }, + "limit": { + "type": "number", + "description": "Compensation amount" + }, + "comment": { + "type": "string", + "description": "Optional details" + }, + "effectiveDate": { + "type": "string", + "description": "Start of sanction", + "format": "date" + }, + "status": { + "type": "string", + "description": "Award status (ref domain OIC_SANCT_ST)" + }, + "statusDescription": { + "type": "string", + "description": "Award status description" + }, + "hearingId": { + "type": "integer", + "description": "Id of hearing", + "format": "int64" + }, + "hearingSequence": { + "type": "integer", + "description": "hearing record sequence number", + "format": "int32" + } + }, + "additionalProperties": false, + "description": "Adjudication award / sanction" + }, + "HasAdjudicationsResponse": { + "required": [ + "hasAdjudications" + ], + "type": "object", + "properties": { + "hasAdjudications": { + "type": "boolean", + "description": "flag to indicate the booking id has adjudications" + } + }, + "additionalProperties": false, + "description": "Has Adjudications Response" + } + }, + "securitySchemes": { + "bearer-jwt": { + "type": "http", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + } +} diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prison-api.json b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prison-api.json new file mode 100644 index 000000000..a722966ae --- /dev/null +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prison-api.json @@ -0,0 +1,14556 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "HMPPS Prison API Documentation", + "description": "
\n

Overview

\n

A RESTful API service for accessing NOMIS data sets.

\n

\n All times sent to the API should be sent in local time without the timezone e.g. YYYY-MM-DDTHH:MM:SS.\n All times returned in responses will be in Europe / London local time unless otherwise stated.\n

\n

\n Some endpoints are described as using the Replica database, a read-only copy of the live database which at\n time of writing lags by < 1 second up to approximately 2 seconds. These endpoints are not suitable for use\n by services reacting to events or refreshing web pages where a change has just been made.\n

\n

\n This service does provide searching capabilities, but can sometimes be slow to return results. A faster search\n is available in the\n HMPPS Prisoner Search\n service. This also augments the results from the incentives and restricted patients service. That service should\n be used in preference, with this service only then being used if the data is not available there. Furthermore, the\n Prisoner Search service also provides key prisoner view that could be suitable.\n

\n

Access restrictions

\n

\n All the API endpoints in Prison API require an access token. Clients can either use the access token from sign into\n HMPPS Auth, or obtain a token\n by making a client credentials request to HMPPS Auth (with or without an optional username associated with the token).\n

\n

Access to endpoints are then restricted in two ways:

\n
    \n
  • \n Relationship based access. The username (if present) in the token is used to determine what prisons (caseloads) the user is associated with. If there is\n no username in the token or if it doesn't correspond to a valid account in NOMIS then it will be ignored and only role based access will be used. Each\n prisoner has a current prison location, or is determined to be out of prison or on temporary transfer. If the user also has the 'INACTIVE_BOOKINGS' role\n then they can view prisoner details of prisoners that are out or on temporary transfer. Endpoints or services that restrict in this way will be\n annotated with @VerifyOffenderAccess, @VerifyBookingAccess, depending on whether an offender or booking is passed into\n the method. The @VerifyAgencyAccess is also used to restrict to allowing to see details in a particular prison e.g. for seeing all alerts.\n Sometimes the annotation can be hidden deep into multiple different levels of service so is sometimes difficult to locate. The annotation can also specify\n override roles, so even if the user doesn't have a relationship with the prisoner via a prison then they could still be allowed access via their roles.\n
  • \n
  • \n Role based access. The token will include a number of roles. An endpoint or service can have a @PreAuthorize annotation that restricts access\n to a list of roles.\n
  • \n
\n

New endpoints do try to document what access restrictions are in place, but for old endpoints it is often necessary to look at the source code for\n Prison API in github to find that out.

\n\n

\n Note also that the endpoints that write data back to NOMIS also often require a write scope in the token. User access tokens will automatically have a\n write scope, but client credentials tokens will often be read scope only unless write has been specifically requested. Write scope endpoints / services\n will either be annotated with @HasWriteScope or the @PreAuthorize will have an extra hasAuthority('SCOPE_write')\n condition.\n

\n\n

\n For an example suppose that information about alerts for a list of prisoners is required. The endpoint is '/booking/offenderNo/{agencyId}/alerts'.\n Searching the codebase for that endpoint reveals that it is in BookingResource. The resource endpoint doesn't have any annotations\n restricting access. However it then calls InmateAlertService.getInmateAlertsByOffenderNosAtAgency. This has the following annotation and\n method signature:\n

\n      @VerifyAgencyAccess(overrideRoles = {\"GLOBAL_SEARCH\", \"VIEW_PRISONER_DATA\"})\n      public List getInmateAlertsByOffenderNosAtAgency(final String agencyId, final List offenderNos) {\n  
\n which means that either the token has one of those three roles, or the user associated with the token has agencyId as one of their caseloads.\n

\n
\n", + "contact": { + "name": "HMPPS Digital Studio", + "email": "feedback@digital.justice.gov.uk" + }, + "license": { + "name": "MIT", + "url": "https://opensource.org/licenses/MIT" + }, + "version": "2024-07-23.27210.21962f6" + }, + "servers": [ + { + "url": "https://prison-api-dev.prison.service.justice.gov.uk", + "description": "Development" + }, + { + "url": "https://prison-api-preprod.prison.service.justice.gov.uk", + "description": "PreProd" + }, + { + "url": "https://prison-api.prison.service.justice.gov.uk", + "description": "Prod" + }, + { + "url": "http://localhost:8080", + "description": "Local" + } + ], + "security": [ + { + "bearer-jwt": [ + "read", + "write" + ] + } + ], + "paths": { + "/api/offenders/{offenderNo}": { + "get": { + "tags": [ + "offenders" + ], + "summary": "Full details about the current state of an offender", + "operationId": "getOffender_1", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "The offenderNo of offender", + "required": true, + "schema": { + "pattern": "^[A-Z]\\d{4}[A-Z]{2}$", + "type": "string" + }, + "example": "A1234AA" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InmateDetail" + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/offenders/{offenderNo}/addresses": { + "get": { + "tags": [ + "offenders" + ], + "summary": "Return a list of addresses for a given offender, most recent first.", + "description": "Requires offender to be in caseload, or role GLOBAL_SEARCH or VIEW_PRISONER_DATA

This endpoint uses the REPLICA database.

", + "operationId": "getAddressesByOffenderNo", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "offenderNo", + "required": true, + "schema": { + "type": "string" + }, + "example": "A1234AA" + } + ], + "responses": { + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AddressDto" + } + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/offender-sentences": { + "get": { + "tags": [ + "offender-sentences" + ], + "summary": "List of offenders (with associated sentence detail)", + "description": "

Algorithm

\n
    \n
  • If there is a confirmed release date, the offender release date is the confirmed release date.
  • \n
  • If there is no confirmed release date for the offender, the offender release date is either the actual parole date or the home detention curfew actual date.
  • \n
  • If there is no confirmed release date, actual parole date or home detention curfew actual date for the offender, the release date is the later of the nonDtoReleaseDate or midTermDate value (if either or both are present)
  • \n
\n

This endpoint uses the REPLICA database.

", + "operationId": "getOffenderSentences", + "parameters": [ + { + "name": "agencyId", + "in": "query", + "description": "agency/prison to restrict results, if none provided current active caseload will be used, unless offenderNo list is specified", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "offenderNo", + "in": "query", + "description": "a list of offender numbers to search.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderSentenceDetail" + } + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/offenders/{offenderNo}/sentences": { + "get": { + "tags": [ + "offenders" + ], + "summary": "Offender Sentence Details", + "description": "Retrieve an single offender sentence details. Requires offender to be in caseload or role GLOBAL_SEARCH or VIEW_PRISONER_DATA", + "operationId": "getOffenderSentenceDetail", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "Noms ID or Prisoner number (also called offenderNo)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OffenderSentenceDetail" + } + } + } + } + } + } + }, + "/api/offenders/{offenderNo}/booking/latest/sentence-summary": { + "get": { + "tags": [ + "offenders" + ], + "summary": "Offender Sentence Details", + "description": "Retrieve an single offender sentence details", + "operationId": "getLatestSentenceSummary", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "Noms ID or Prisoner number (also called offenderNo)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SentenceSummary" + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/offender-sentences/booking/{bookingId}/sentences-and-offences": { + "get": { + "tags": [ + "offender-sentences" + ], + "summary": "Sentence and offence details for a prisoner", + "operationId": "getSentenceAndOffenceDetails", + "parameters": [ + { + "name": "bookingId", + "in": "path", + "description": "The required booking id (mandatory)", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Sentence and offence details for a prisoner.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OffenderSentenceAndOffences" + } + } + } + } + } + } + }, + "/api/bookings/offenderNo/{offenderNo}/offenceHistory": { + "get": { + "tags": [ + "bookings" + ], + "summary": "Offence history.", + "description": "All Offences recorded for this offender.

This endpoint uses the REPLICA database.

", + "operationId": "getOffenceHistory", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "The offender number", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "convictionsOnly", + "in": "query", + "description": "include offences with convictions only", + "required": false, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenceHistoryDetail" + } + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/offenders/{offenderNo}/alerts/v2": { + "get": { + "tags": [ + "offenders" + ], + "summary": "Deprecated - Please use the alerts api for access to alerts (eg https://alerts-api-dev.hmpps.service.justice.gov.uk/swagger-ui/index.html)", + "description": "Replace with https://alerts-api-dev.hmpps.service.justice.gov.uk/swagger-ui/index.html#/prisoner-alerts-controller/retrievePrisonerAlerts", + "operationId": "getAlertsForAllBookingByOffenderNo", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "description": "Noms ID or Prisoner number", + "required": true, + "schema": { + "type": "string" + }, + "example": "A1234AA" + }, + { + "name": "alertCodes", + "in": "query", + "description": "Comma separated list of alertCodes to filter by", + "required": false, + "schema": { + "type": "string" + }, + "example": "XA,RSS" + }, + { + "name": "sort", + "in": "query", + "description": "Comma separated list of one or more Alert fields", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "direction", + "in": "query", + "description": "Sort order", + "required": false, + "schema": { + "type": "string", + "default": "ASC" + }, + "example": "DESC" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Alert" + } + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "deprecated": true + } + }, + "/api/images/offenders/{offenderNo}": { + "get": { + "tags": [ + "images" + ], + "summary": "Image details related to offender.", + "description": "Requires role VIEW_PRISONER_DATA.", + "operationId": "getImagesByOffender", + "parameters": [ + { + "name": "offenderNo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ImageDetail" + } + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/images/{imageId}/data": { + "get": { + "tags": [ + "images" + ], + "summary": "Image data (as bytes).", + "description": "Requires role VIEW_PRISONER_DATA.", + "operationId": "getImageData", + "parameters": [ + { + "name": "imageId", + "in": "path", + "description": "The image id of offender", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "fullSizeImage", + "in": "query", + "description": "Return full size image", + "required": false, + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "image/jpeg": { + "schema": { + "type": "string", + "format": "byte" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "image/jpeg": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "image/jpeg": { + "schema": { + "type": "string", + "format": "byte" + } + } + } + } + } + } + }, + "/api/bookings/{bookingId}/reasonable-adjustments": { + "get": { + "tags": [ + "bookings" + ], + "summary": "Reasonable Adjustment Information", + "description": "Reasonable Adjustment Information. Requires booking access (via caseload) or GLOBAL_SEARCH or VIEW_PRISONER_DATA role.", + "operationId": "getReasonableAdjustments", + "parameters": [ + { + "name": "bookingId", + "in": "path", + "description": "The offender booking id", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "type", + "in": "query", + "description": "a list of treatment codes to search.", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "example": "PEEP" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReasonableAdjustments" + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/api/reference-domains/domains/{domain}/codes": { + "get": { + "tags": [ + "reference-domains" + ], + "summary": "List of reference codes for reference domain.", + "description": "List of reference codes for reference domain ordered by code ascending. The list is an un-paged flat list

This endpoint uses the REPLICA database.

", + "operationId": "getReferenceCodesByDomain_1", + "parameters": [ + { + "name": "domain", + "in": "path", + "description": "The domain identifier/name.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReferenceCode" + } + } + } + } + }, + "400": { + "description": "Invalid request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Requested resource not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Unrecoverable error occurred whilst processing request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "CaseLoad": { + "required": [ + "caseLoadId", + "currentlyActive", + "description", + "type" + ], + "type": "object", + "properties": { + "caseLoadId": { + "type": "string", + "description": "Case Load ID", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Full description of the case load", + "example": "Moorland Closed (HMP & YOI)" + }, + "type": { + "type": "string", + "description": "Type of case load. Note: Reference Code CSLD_TYPE", + "example": "INST", + "enum": [ + "COMM", + "INST", + "APP" + ] + }, + "caseloadFunction": { + "type": "string", + "description": "Functional Use of the case load", + "example": "GENERAL", + "enum": [ + "GENERAL", + "ADMIN" + ] + }, + "currentlyActive": { + "type": "boolean", + "description": "Indicates that this caseload in the context of a staff member is the current active", + "example": false + } + }, + "description": "Case Load" + }, + "ErrorResponse": { + "required": [ + "status", + "userMessage" + ], + "type": "object", + "properties": { + "status": { + "type": "integer", + "description": "Response status code (will typically mirror HTTP status code).", + "format": "int32", + "example": 404 + }, + "errorCode": { + "type": "integer", + "description": "An (optional) application-specific error code.", + "format": "int32", + "example": 20002 + }, + "userMessage": { + "type": "string", + "description": "Concise error reason for end-user consumption.", + "example": "Entity Not Found" + }, + "developerMessage": { + "type": "string", + "description": "Detailed description of problem with remediation hints aimed at application developer.", + "example": "Serious error in the system" + }, + "moreInfo": { + "type": "string", + "description": "Provision for further information about the problem (e.g. a link to a FAQ or knowledge base article).", + "example": "Check out this FAQ for more information" + } + }, + "description": "General API Error Response" + }, + "CaseloadUpdate": { + "required": [ + "caseload", + "numUsersEnabled" + ], + "type": "object", + "properties": { + "caseload": { + "type": "string", + "description": "Caseload", + "example": "MDI" + }, + "numUsersEnabled": { + "type": "integer", + "description": "Number of users enabled to access API", + "format": "int32", + "example": 5 + } + }, + "description": "Caseload Update" + }, + "ReferenceCodeInfo": { + "required": [ + "activeFlag", + "description" + ], + "type": "object", + "properties": { + "description": { + "maxLength": 40, + "minLength": 0, + "type": "string", + "description": "Reference data item description.", + "example": "Some description" + }, + "parentDomain": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Parent reference data item domain.", + "example": "TASK_TYPE" + }, + "parentCode": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Parent reference data item code.", + "example": "MIGRATION" + }, + "activeFlag": { + "maxLength": 1, + "minLength": 0, + "pattern": "[N|Y]", + "type": "string", + "description": "Reference data item active indicator flag.", + "example": "Y", + "enum": [ + "Y", + "N" + ] + }, + "listSeq": { + "maximum": 999999, + "type": "integer", + "description": "List Sequence", + "format": "int32", + "example": 1 + }, + "systemDataFlag": { + "maxLength": 1, + "minLength": 0, + "pattern": "[N|Y]", + "type": "string", + "description": "System Data Flag", + "example": "Y", + "enum": [ + "Y", + "N" + ] + }, + "expiredDate": { + "type": "string", + "description": "Expired Date", + "format": "date", + "example": "2018-03-09" + } + }, + "description": "Reference Information" + }, + "ReferenceCode": { + "required": [ + "activeFlag", + "code", + "description", + "domain" + ], + "type": "object", + "properties": { + "domain": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Reference data item domain.", + "example": "TASK_TYPE" + }, + "code": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Reference data item code.", + "example": "MISC" + }, + "description": { + "maxLength": 40, + "minLength": 0, + "type": "string", + "description": "Reference data item description.", + "example": "Some description" + }, + "parentDomain": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Parent reference data item domain.", + "example": "TASK_TYPE" + }, + "parentCode": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Parent reference data item code.", + "example": "MIGRATION" + }, + "activeFlag": { + "maxLength": 1, + "minLength": 0, + "pattern": "[N|Y]", + "type": "string", + "description": "Reference data item active indicator flag.", + "example": "Y", + "enum": [ + "Y", + "N" + ] + }, + "listSeq": { + "maximum": 999999, + "type": "integer", + "description": "List Sequence", + "format": "int32", + "example": 1 + }, + "systemDataFlag": { + "maxLength": 1, + "minLength": 0, + "pattern": "[N|Y]", + "type": "string", + "description": "System Data Flag", + "example": "Y", + "enum": [ + "Y", + "N" + ] + }, + "expiredDate": { + "type": "string", + "description": "Expired Date", + "format": "date", + "example": "2018-03-09" + }, + "subCodes": { + "type": "array", + "description": "List of subordinate reference data items associated with this reference data item. Not returned by default", + "items": { + "$ref": "#/components/schemas/ReferenceCode" + } + } + }, + "description": "Reference Code" + }, + "RequestToTransferOut": { + "required": [ + "escortType", + "movementTime", + "toLocation", + "transferReasonCode" + ], + "type": "object", + "properties": { + "toLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The location to be moved to.", + "example": "PVI" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "escortType": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The escort type of the move.", + "example": "PECS" + }, + "transferReasonCode": { + "type": "string", + "description": "Reason code for the transfer, reference domain is MOVE_RSN", + "example": "NOTR" + }, + "commentText": { + "type": "string", + "description": "Additional comments about the release", + "example": "Prisoner was transferred to a new prison" + } + }, + "description": "Represents the data required for transferring a prisoner to a new location" + }, + "Alert": { + "type": "object", + "properties": { + "alertId": { + "type": "integer", + "description": "Alert Id", + "format": "int64", + "example": 1 + }, + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 14 + }, + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference", + "example": "G3878UK" + }, + "alertType": { + "type": "string", + "description": "Alert Type", + "example": "X" + }, + "alertTypeDescription": { + "type": "string", + "description": "Alert Type Description", + "example": "Security" + }, + "alertCode": { + "type": "string", + "description": "Alert Code", + "example": "XER" + }, + "alertCodeDescription": { + "type": "string", + "description": "Alert Code Description", + "example": "Escape Risk" + }, + "comment": { + "type": "string", + "description": "Alert comments", + "example": "Profession lock pick." + }, + "dateCreated": { + "type": "string", + "description": "Date of the alert, which might differ to the date it was created", + "format": "date", + "example": "2019-08-20" + }, + "dateExpires": { + "type": "string", + "description": "Date the alert expires", + "format": "date", + "example": "2020-08-20" + }, + "modifiedDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time the alert was last modified in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS. If this Alert hasn't been modified since its creation this field will be null", + "example": "2021-07-05T10:35:17" + }, + "expired": { + "type": "boolean", + "description": "True / False based on presence of expiry date", + "example": true + }, + "active": { + "type": "boolean", + "description": "True / False based on alert status", + "example": false + }, + "addedByFirstName": { + "type": "string", + "description": "First name of the user who added the alert", + "example": "John" + }, + "addedByLastName": { + "type": "string", + "description": "Last name of the user who added the alert", + "example": "Smith" + }, + "expiredByFirstName": { + "type": "string", + "description": "First name of the user who last modified the alert", + "example": "John" + }, + "expiredByLastName": { + "type": "string", + "description": "Last name of the user who last modified the alert", + "example": "Smith" + } + }, + "description": "Alert" + }, + "Alias": { + "required": [ + "offenderId" + ], + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "Title of offender alias", + "example": "Mr" + }, + "firstName": { + "type": "string", + "description": "First name of offender alias", + "example": "Mike" + }, + "middleName": { + "type": "string", + "description": "Middle names of offender alias", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last name of offender alias", + "example": "Smith" + }, + "age": { + "type": "integer", + "description": "Age of Offender", + "format": "int32", + "example": 32 + }, + "dob": { + "type": "string", + "description": "Date of Birth of Offender", + "format": "date", + "example": "1980-02-28" + }, + "gender": { + "type": "string", + "description": "Gender", + "example": "Male" + }, + "ethnicity": { + "type": "string", + "description": "Ethnicity", + "example": "Mixed: White and Black African" + }, + "nameType": { + "type": "string", + "description": "Type of Alias", + "example": "Alias Name" + }, + "createDate": { + "type": "string", + "description": "Date of creation", + "format": "date", + "example": "2019-02-15" + }, + "offenderId": { + "type": "integer", + "description": "Offender ID", + "format": "int64", + "example": 543548 + } + }, + "description": "Alias" + }, + "Assessment": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking number", + "format": "int64", + "example": 123456 + }, + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number).", + "example": "GV09876N" + }, + "classificationCode": { + "type": "string", + "description": "Classification code", + "example": "C" + }, + "classification": { + "type": "string", + "description": "Classification description", + "example": "Cat C" + }, + "assessmentCode": { + "type": "string", + "description": "Identifies the type of assessment", + "example": "CATEGORY" + }, + "assessmentDescription": { + "type": "string", + "description": "Assessment description", + "example": "Categorisation" + }, + "cellSharingAlertFlag": { + "type": "boolean", + "description": "Indicates the presence of a cell sharing alert" + }, + "assessmentDate": { + "type": "string", + "description": "Date assessment was created", + "format": "date", + "example": "2018-02-11" + }, + "nextReviewDate": { + "type": "string", + "description": "Date of next review", + "format": "date", + "example": "2018-02-11" + }, + "approvalDate": { + "type": "string", + "description": "Date of assessment approval", + "format": "date", + "example": "2018-02-11" + }, + "assessmentAgencyId": { + "type": "string", + "description": "The assessment creation agency id", + "example": "MDI" + }, + "assessmentStatus": { + "type": "string", + "description": "The status of the assessment", + "example": "A", + "enum": [ + "P", + "A", + "I" + ] + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number of assessment within booking", + "format": "int32", + "example": 1 + }, + "assessmentComment": { + "type": "string", + "description": "Comment from assessor", + "example": "Comment details" + }, + "assessorId": { + "type": "integer", + "description": "Staff member who made the assessment", + "format": "int64", + "example": 130000 + }, + "assessorUser": { + "type": "string", + "description": "Username who made the assessment", + "example": "NGK33Y" + } + }, + "description": "Assessment" + }, + "AssignedLivingUnit": { + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency Id" + }, + "locationId": { + "type": "integer", + "description": "location Id", + "format": "int64" + }, + "description": { + "type": "string", + "description": "Living Unit Desc" + }, + "agencyName": { + "type": "string", + "description": "Name of the agency where this living unit resides" + } + }, + "description": "Assigned Living Unit" + }, + "InmateDetail": { + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference", + "example": "A1234AA" + }, + "bookingId": { + "type": "integer", + "description": "Offender Booking Id", + "format": "int64", + "example": 432132 + }, + "bookingNo": { + "type": "string", + "description": "Booking Number" + }, + "offenderId": { + "type": "integer", + "description": "Internal Offender ID", + "format": "int64" + }, + "rootOffenderId": { + "type": "integer", + "description": "Internal Root Offender ID", + "format": "int64" + }, + "firstName": { + "type": "string", + "description": "First Name" + }, + "middleName": { + "type": "string", + "description": "Middle Name(s)" + }, + "lastName": { + "type": "string", + "description": "Last Name" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth of prisoner", + "format": "date", + "example": "1970-03-15" + }, + "age": { + "type": "integer", + "description": "Age of prisoner. Note: Full Details Only", + "format": "int32" + }, + "activeFlag": { + "type": "boolean", + "description": "Indicates that the person is currently in prison" + }, + "facialImageId": { + "type": "integer", + "description": "Image Id Ref of prisoner", + "format": "int64" + }, + "agencyId": { + "type": "string", + "description": "Identifier of agency to which the prisoner is associated." + }, + "assignedLivingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that prisoner is assigned to.", + "format": "int64" + }, + "religion": { + "type": "string", + "description": "Religion of the prisoner" + }, + "language": { + "type": "string", + "description": "Preferred spoken language" + }, + "interpreterRequired": { + "type": "boolean", + "description": "Interpreter required" + }, + "writtenLanguage": { + "type": "string", + "description": "Preferred written language" + }, + "alertsCodes": { + "type": "array", + "description": "List of Alerts", + "items": { + "type": "string", + "description": "List of Alerts" + } + }, + "activeAlertCount": { + "type": "integer", + "description": "number of active alerts. Note: Full Details Only", + "format": "int64" + }, + "inactiveAlertCount": { + "type": "integer", + "description": "number of inactive alerts. Note: Full Details Only", + "format": "int64" + }, + "alerts": { + "type": "array", + "description": "List of alert details", + "items": { + "$ref": "#/components/schemas/Alert" + } + }, + "assignedLivingUnit": { + "$ref": "#/components/schemas/AssignedLivingUnit" + }, + "physicalAttributes": { + "$ref": "#/components/schemas/PhysicalAttributes" + }, + "physicalCharacteristics": { + "type": "array", + "description": "List of physical characteristics", + "items": { + "$ref": "#/components/schemas/PhysicalCharacteristic" + } + }, + "profileInformation": { + "type": "array", + "description": "List of profile information", + "items": { + "$ref": "#/components/schemas/ProfileInformation" + } + }, + "physicalMarks": { + "type": "array", + "description": "List of physical marks", + "items": { + "$ref": "#/components/schemas/PhysicalMark" + } + }, + "assessments": { + "type": "array", + "description": "List of assessments", + "items": { + "$ref": "#/components/schemas/Assessment" + } + }, + "csra": { + "type": "string", + "description": "CSRA (Latest assessment with cellSharing=true from list of assessments)" + }, + "csraClassificationCode": { + "type": "string", + "description": "The CSRA classification (calculated from the list of CSRA assessments)", + "example": "STANDARD" + }, + "csraClassificationDate": { + "type": "string", + "description": "The date that the csraClassificationCode was assessed", + "format": "date" + }, + "category": { + "type": "string", + "description": "Category description (from list of assessments)" + }, + "categoryCode": { + "type": "string", + "description": "Category code (from list of assessments)" + }, + "birthPlace": { + "type": "string", + "description": "Place of birth", + "example": "WALES" + }, + "birthCountryCode": { + "type": "string", + "description": "Country of birth", + "example": "GBR" + }, + "inOutStatus": { + "type": "string", + "description": "In/Out Status", + "example": "IN, OUT, TRN" + }, + "identifiers": { + "type": "array", + "description": "Identifiers. Note: Only returned when requesting extra details", + "items": { + "$ref": "#/components/schemas/OffenderIdentifier" + } + }, + "personalCareNeeds": { + "type": "array", + "description": "Personal Care Needs. Note: Only returned when requesting extra details", + "items": { + "$ref": "#/components/schemas/PersonalCareNeed" + } + }, + "sentenceDetail": { + "$ref": "#/components/schemas/SentenceCalcDates" + }, + "offenceHistory": { + "type": "array", + "description": "Offence History. Note: Only returned when requesting extra details", + "items": { + "$ref": "#/components/schemas/OffenceHistoryDetail" + } + }, + "sentenceTerms": { + "type": "array", + "description": "Current Sentence Terms. Note: Only returned when requesting extra details", + "items": { + "$ref": "#/components/schemas/OffenderSentenceTerms" + } + }, + "aliases": { + "type": "array", + "description": "Aliases. Note: Only returned when requesting extra details", + "items": { + "$ref": "#/components/schemas/Alias" + } + }, + "status": { + "type": "string", + "description": "Status of prisoner", + "example": "ACTIVE IN, INACTIVE OUT, INACTIVE TRN" + }, + "statusReason": { + "type": "string", + "description": "Last movement status of the prison", + "example": "CRT-CA" + }, + "lastMovementTypeCode": { + "type": "string", + "description": "Last Movement Type Code of prisoner. Note: Reference Data from MOVE_TYPE Domain", + "example": "TAP, CRT, TRN, ADM, REL" + }, + "lastMovementReasonCode": { + "type": "string", + "description": "Last Movement Reason of prisoner. Note: Reference Data from MOVE_RSN Domain", + "example": "CA" + }, + "legalStatus": { + "type": "string", + "description": "Legal Status. Note: Only returned when requesting extra details", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "recall": { + "type": "boolean", + "description": "Recall. Note: Only returned when requesting extra details", + "example": true + }, + "imprisonmentStatus": { + "type": "string", + "description": "The prisoner's imprisonment status. Note: Only returned when requesting extra details", + "example": "LIFE" + }, + "imprisonmentStatusDescription": { + "type": "string", + "description": "The prisoner's imprisonment status description. Note: Only returned when requesting extra details", + "example": "Serving Life Imprisonment" + }, + "receptionDate": { + "type": "string", + "description": "Date prisoner was received into the prison.", + "format": "date", + "example": "1980-01-01" + }, + "locationDescription": { + "type": "string", + "description": "current prison or outside with last movement information.", + "example": "Outside - released from Leeds" + }, + "latestLocationId": { + "type": "string", + "description": "the current prison id or the last prison before release", + "example": "MDI" + } + }, + "description": "Inmate Detail" + }, + "OffenceHistoryDetail": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Prisoner booking id", + "format": "int64", + "example": 1123456 + }, + "offenceDate": { + "type": "string", + "description": "Date the offence took place", + "format": "date", + "example": "2018-02-10" + }, + "offenceRangeDate": { + "type": "string", + "description": "End date if range the offence was believed to have taken place", + "format": "date", + "example": "2018-03-10" + }, + "offenceDescription": { + "type": "string", + "description": "Description associated with the offence code", + "example": "Commit an act / series of acts with intent to pervert the course of public justice" + }, + "offenceCode": { + "type": "string", + "description": "Reference Code", + "example": "RR84070" + }, + "statuteCode": { + "type": "string", + "description": "Statute code", + "example": "RR84" + }, + "mostSerious": { + "type": "boolean", + "description": "Identifies the main offence per booking" + }, + "primaryResultCode": { + "type": "string", + "description": "Primary result code " + }, + "secondaryResultCode": { + "type": "string", + "description": "Secondary result code" + }, + "primaryResultDescription": { + "type": "string", + "description": "Description for Primary result" + }, + "secondaryResultDescription": { + "type": "string", + "description": "Description for Secondary result" + }, + "primaryResultConviction": { + "type": "boolean", + "description": "Conviction flag for Primary result " + }, + "secondaryResultConviction": { + "type": "boolean", + "description": "Conviction flag for Secondary result " + }, + "courtDate": { + "type": "string", + "description": "Latest court date associated with the offence", + "format": "date", + "example": "2018-02-10" + }, + "caseId": { + "type": "integer", + "description": "Court case id", + "format": "int64", + "example": 100 + }, + "offenceSeverityRanking": { + "type": "integer", + "description": "Offence Severity Ranking", + "format": "int32", + "example": 100 + } + }, + "description": "Offence History Item" + }, + "OffenderIdentifier": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of offender identifier", + "example": "PNC" + }, + "value": { + "type": "string", + "description": "The value of the offender identifier", + "example": "1231/XX/121" + }, + "offenderNo": { + "type": "string", + "description": "The offender number for this identifier", + "example": "A1234AB" + }, + "bookingId": { + "type": "integer", + "description": "The booking ID for this identifier", + "format": "int64", + "example": 1231223 + }, + "issuedAuthorityText": { + "type": "string", + "description": "Issuing Authority Information", + "example": "Important Auth" + }, + "issuedDate": { + "type": "string", + "description": "Date of issue", + "format": "date", + "example": "2018-01-21" + }, + "caseloadType": { + "type": "string", + "description": "Related caseload type", + "example": "GENERAL" + }, + "whenCreated": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Creation date and time", + "example": "2021-07-05T10:35:17" + }, + "offenderId": { + "type": "integer", + "description": "Offender ID", + "format": "int64", + "example": 234547 + }, + "rootOffenderId": { + "type": "integer", + "description": "Root Offender ID", + "format": "int64", + "example": 654321 + } + }, + "description": "Offender Identifier" + }, + "OffenderSentenceTerms": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 1132400 + }, + "sentenceSequence": { + "type": "integer", + "description": "Sentence number within booking id.", + "format": "int32", + "example": 2 + }, + "termSequence": { + "type": "integer", + "description": "Sentence term number within sentence.", + "format": "int32", + "example": 1 + }, + "consecutiveTo": { + "type": "integer", + "description": "Sentence number which this sentence follows if consecutive, otherwise concurrent.", + "format": "int32", + "example": 2 + }, + "sentenceType": { + "type": "string", + "description": "Sentence type, using reference data from table SENTENCE_CALC_TYPES.", + "example": "2" + }, + "sentenceTypeDescription": { + "type": "string", + "description": "Sentence type description.", + "example": "2" + }, + "startDate": { + "type": "string", + "description": "Start date of sentence term.", + "format": "date", + "example": "2018-12-31" + }, + "years": { + "type": "integer", + "description": "Sentence length years.", + "format": "int32", + "example": 1 + }, + "months": { + "type": "integer", + "description": "Sentence length months.", + "format": "int32", + "example": 2 + }, + "weeks": { + "type": "integer", + "description": "Sentence length weeks.", + "format": "int32", + "example": 3 + }, + "days": { + "type": "integer", + "description": "Sentence length days.", + "format": "int32", + "example": 4 + }, + "lifeSentence": { + "type": "boolean", + "description": "Whether this is a life sentence." + }, + "caseId": { + "type": "string", + "description": "Court case id" + }, + "fineAmount": { + "type": "number", + "description": "Fine amount.", + "format": "double" + }, + "sentenceTermCode": { + "type": "string", + "description": "Sentence term code.", + "example": "IMP" + }, + "lineSeq": { + "type": "integer", + "description": "Sentence line number", + "format": "int64", + "example": 1 + }, + "sentenceStartDate": { + "type": "string", + "description": "Sentence start date", + "format": "date", + "example": "2018-12-31" + } + }, + "description": "Offender Sentence terms details for booking id" + }, + "PersonalCareNeed": { + "type": "object", + "properties": { + "personalCareNeedId": { + "type": "integer", + "description": "ID", + "format": "int64", + "example": 1 + }, + "problemType": { + "type": "string", + "description": "Problem Type", + "example": "MATSTAT" + }, + "problemCode": { + "type": "string", + "description": "Problem Code", + "example": "ACCU9" + }, + "problemStatus": { + "type": "string", + "description": "Problem Status", + "example": "ON" + }, + "problemDescription": { + "type": "string", + "description": "Problem Description", + "example": "Preg, acc under 9mths" + }, + "commentText": { + "type": "string", + "description": "Comment Text", + "example": "a comment" + }, + "startDate": { + "type": "string", + "description": "Start Date", + "format": "date", + "example": "2010-06-21" + }, + "endDate": { + "type": "string", + "description": "End Date", + "format": "date", + "example": "2010-06-21" + } + }, + "description": "Personal Care Need" + }, + "PhysicalAttributes": { + "type": "object", + "properties": { + "sexCode": { + "type": "string", + "description": "Gender Code", + "example": "M" + }, + "gender": { + "type": "string", + "description": "Gender", + "example": "Male" + }, + "raceCode": { + "type": "string", + "description": "Ethnicity Code", + "example": "W1" + }, + "ethnicity": { + "type": "string", + "description": "Ethnicity", + "example": "White: Eng./Welsh/Scot./N.Irish/British" + }, + "heightFeet": { + "type": "integer", + "description": "Height in Feet", + "format": "int32", + "example": 5 + }, + "heightInches": { + "type": "integer", + "description": "Height in Inches", + "format": "int32", + "example": 60 + }, + "heightMetres": { + "type": "number", + "description": "Height in Metres (to 2dp)", + "example": 1.76 + }, + "heightCentimetres": { + "type": "integer", + "description": "Height in Centimetres", + "format": "int32", + "example": 176 + }, + "weightPounds": { + "type": "integer", + "description": "Weight in Pounds", + "format": "int32", + "example": 50 + }, + "weightKilograms": { + "type": "integer", + "description": "Weight in Kilograms", + "format": "int32", + "example": 67 + } + }, + "description": "Physical Attributes" + }, + "PhysicalCharacteristic": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type code of physical characteristic" + }, + "characteristic": { + "type": "string", + "description": "Type of physical characteristic" + }, + "detail": { + "type": "string", + "description": "Detailed information about the physical characteristic" + }, + "imageId": { + "type": "integer", + "description": "Image Id Ref", + "format": "int64" + } + }, + "description": "Physical Characteristic" + }, + "PhysicalMark": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of Mark" + }, + "side": { + "type": "string", + "description": "Left or Right Side" + }, + "bodyPart": { + "type": "string", + "description": "Where on the body" + }, + "orientation": { + "type": "string", + "description": "Image orientation" + }, + "comment": { + "type": "string", + "description": "More information" + }, + "imageId": { + "type": "integer", + "description": "Image Id Ref", + "format": "int64" + } + }, + "description": "Physical Mark" + }, + "ProfileInformation": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of profile information" + }, + "question": { + "type": "string", + "description": "Profile Question" + }, + "resultValue": { + "type": "string", + "description": "Profile Result Answer" + } + }, + "description": "Profile Information" + }, + "SentenceCalcDates": { + "type": "object", + "properties": { + "sentenceExpiryDate": { + "type": "string", + "description": "SED - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "automaticReleaseDate": { + "type": "string", + "description": "ARD - calculated automatic (unconditional) release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "CRD - calculated conditional release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleDate": { + "type": "string", + "description": "NPD - calculated non-parole date for offender (relating to the 1991 act).", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "PRRD - calculated post-recall release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryDate": { + "type": "string", + "description": "LED - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDCED - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "PED - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewActualDate": { + "type": "string", + "description": "HDCAD - the offender's actual home detention curfew date.", + "format": "date", + "example": "2020-02-03" + }, + "actualParoleDate": { + "type": "string", + "description": "APD - the offender's actual parole date.", + "format": "date", + "example": "2020-02-03" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "ROTL - the date on which offender will be released on temporary licence.", + "format": "date", + "example": "2020-02-03" + }, + "earlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "ERSED - the date on which offender will be eligible for early removal (under the Early Removal Scheme for foreign nationals).", + "format": "date", + "example": "2020-02-03" + }, + "earlyTermDate": { + "type": "string", + "description": "ETD - early term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "midTermDate": { + "type": "string", + "description": "MTD - mid term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "lateTermDate": { + "type": "string", + "description": "LTD - late term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "TUSED - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "tariffDate": { + "type": "string", + "description": "Date on which minimum term is reached for parole (indeterminate/life sentences).", + "format": "date", + "example": "2020-02-03" + }, + "dtoPostRecallReleaseDate": { + "type": "string", + "description": "DPRRD - Detention training order post recall release date", + "format": "date", + "example": "2020-02-03" + }, + "tariffEarlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "TERSED - Tariff early removal scheme eligibility date", + "format": "date", + "example": "2020-02-03" + }, + "effectiveSentenceEndDate": { + "type": "string", + "description": "Effective sentence end date", + "format": "date", + "example": "2020-02-03" + }, + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 1234123 + }, + "sentenceStartDate": { + "type": "string", + "description": "Sentence start date.", + "format": "date", + "example": "2010-02-03" + }, + "additionalDaysAwarded": { + "type": "integer", + "description": "ADA - days added to sentence term due to adjustments.", + "format": "int32", + "example": 5 + }, + "automaticReleaseOverrideDate": { + "type": "string", + "description": "ARD (override) - automatic (unconditional) release override date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseOverrideDate": { + "type": "string", + "description": "CRD (override) - conditional release override date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleOverrideDate": { + "type": "string", + "description": "NPD (override) - non-parole override date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseOverrideDate": { + "type": "string", + "description": "PRRD (override) - post-recall release override date for offender.", + "format": "date", + "example": "2020-04-01" + }, + "dtoPostRecallReleaseDateOverride": { + "type": "string", + "description": "DPRRD (override) - detention training order post-recall release override date for offender", + "format": "date", + "example": "2020-04-01" + }, + "nonDtoReleaseDate": { + "type": "string", + "description": "Release date for non-DTO sentence (if applicable). This will be based on one of ARD, CRD, NPD or PRRD.", + "format": "date", + "example": "2020-04-01" + }, + "sentenceExpiryCalculatedDate": { + "type": "string", + "description": "SED (calculated) - date on which sentence expires. (as calculated by NOMIS)", + "format": "date", + "example": "2020-02-03" + }, + "sentenceExpiryOverrideDate": { + "type": "string", + "description": "SED (override) - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryCalculatedDate": { + "type": "string", + "description": "LED (calculated) - date on which offender licence expires. (as calculated by NOMIS)", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryOverrideDate": { + "type": "string", + "description": "LED (override) - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityCalculatedDate": { + "type": "string", + "description": "PED (calculated) - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityOverrideDate": { + "type": "string", + "description": "PED (override) - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryCalculatedDate": { + "type": "string", + "description": "TUSED (calculated) - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryOverrideDate": { + "type": "string", + "description": "TUSED (override) - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewEligibilityCalculatedDate": { + "type": "string", + "description": "HDCED (calculated) - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewEligibilityOverrideDate": { + "type": "string", + "description": "HDCED (override) - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "nonDtoReleaseDateType": { + "type": "string", + "description": "Indicates which type of non-DTO release date is the effective release date. One of 'ARD', 'CRD', 'NPD' or 'PRRD'.", + "example": "CRD", + "enum": [ + "ARD", + "CRD", + "NPD", + "PRRD" + ] + }, + "confirmedReleaseDate": { + "type": "string", + "description": "Confirmed release date for offender.", + "format": "date", + "example": "2020-04-20" + }, + "releaseDate": { + "type": "string", + "description": "Confirmed, actual, approved, provisional or calculated release date for offender, according to offender release date algorithm.

Algorithm

  • If there is a confirmed release date, the offender release date is the confirmed release date.
  • If there is no confirmed release date for the offender, the offender release date is either the actual parole date or the home detention curfew actual date.
  • If there is no confirmed release date, actual parole date or home detention curfew actual date for the offender, the release date is the later of the nonDtoReleaseDate or midTermDate value (if either or both are present)
", + "format": "date", + "example": "2020-04-01" + }, + "etdOverrideDate": { + "type": "string", + "description": "ETD Override - early term date for offender override date.", + "format": "date", + "example": "2019-04-02" + }, + "etdCalculatedDate": { + "type": "string", + "description": "ETD Override - early term date for offender calculated date.", + "format": "date", + "example": "2019-04-02" + }, + "mtdOverrideDate": { + "type": "string", + "description": "MTD - mid term date for offender override date.", + "format": "date", + "example": "2019-04-02" + }, + "mtdCalculatedDate": { + "type": "string", + "description": "MTD - mid term date for offender calculated date.", + "format": "date", + "example": "2019-04-02" + }, + "ltdOverrideDate": { + "type": "string", + "description": "LTD - late term date for offender override date.", + "format": "date", + "example": "2019-04-02" + }, + "ltdCalculatedDate": { + "type": "string", + "description": "LTD - late term date for offender calculated date.", + "format": "date", + "example": "2019-04-02" + }, + "topupSupervisionStartDate": { + "type": "string", + "description": "Top-up supervision start date for offender - calculated as licence end date + 1 day or releaseDate if licence end date not set.", + "format": "date", + "example": "2019-04-01" + }, + "homeDetentionCurfewEndDate": { + "type": "string", + "description": "Offender's home detention curfew end date - calculated as one day before the releaseDate.", + "format": "date", + "example": "2019-04-01" + } + }, + "description": "Sentence Calculation Dates" + }, + "RequestToTransferIn": { + "required": [ + "receiveTime" + ], + "type": "object", + "properties": { + "receiveTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "commentText": { + "type": "string", + "description": "Additional comments about the release", + "example": "Prisoner was transferred to a new prison" + }, + "cellLocation": { + "type": "string", + "description": "Cell location", + "example": "MDI-RECP" + } + }, + "description": "Represents the data required for receiving a prisoner transfer" + }, + "RequestToTransferOutToTemporaryAbsence": { + "required": [ + "escortType", + "transferReasonCode" + ], + "type": "object", + "properties": { + "toCity": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The city to be released to. Not required if scheduleEventId is present", + "example": "18248" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "escortType": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The escort type of the move.", + "example": "PECS" + }, + "transferReasonCode": { + "type": "string", + "description": "Reason code for the transfer, reference domain is MOVE_RSN", + "example": "C3" + }, + "commentText": { + "type": "string", + "description": "Additional comments about the release", + "example": "Prisoner was transferred to a new prison" + }, + "shouldReleaseBed": { + "type": "boolean", + "description": "Flag indicate if bed should be released" + }, + "scheduleEventId": { + "type": "integer", + "description": "Optional scheduled schedule event this movement relates to", + "format": "int64" + } + }, + "description": "Represents the data required for transferring a prisoner to temporary absence" + }, + "RequestForTemporaryAbsenceArrival": { + "required": [ + "agencyId", + "dateTime" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency identifier", + "example": "MDI" + }, + "movementReasonCode": { + "type": "string", + "description": "Movement Reason Code", + "example": "CA" + }, + "commentText": { + "type": "string", + "description": "Additional comments", + "example": "Prisoner was transferred from..." + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Represents the data required for registering temporary absence arrival" + }, + "RequestToReleasePrisoner": { + "required": [ + "movementReasonCode", + "releaseTime" + ], + "type": "object", + "properties": { + "movementReasonCode": { + "type": "string", + "description": "Reason code for the release, reference domain is MOVE_RSN", + "example": "CR", + "enum": [ + "AR", + "AU", + "BD", + "BL", + "CE", + "CR", + "D1", + "D2", + "D3", + "D4", + "D5", + "D6", + "DA", + "DD", + "DE", + "DEC", + "DL", + "DS", + "ER", + "ESCP", + "ETR", + "EX", + "HC", + "HD", + "HE", + "HP", + "HR", + "HU", + "IF", + "MRG", + "NCS", + "NG", + "NP", + "PD", + "PF", + "PX", + "RE", + "RW", + "SC", + "UAL" + ] + }, + "releaseTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the release occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "commentText": { + "type": "string", + "description": "Additional comments about the release", + "example": "Prisoner was released on bail" + }, + "toLocationCode": { + "type": "string", + "description": "Agency Location code where prisoner is released to, default is OUT", + "example": "OUT" + } + }, + "description": "Request release of prisoner" + }, + "RequestToRecall": { + "required": [ + "movementReasonCode", + "prisonId", + "recallTime" + ], + "type": "object", + "properties": { + "prisonId": { + "type": "string", + "description": "Prison ID where recalled to", + "example": "MDI" + }, + "recallTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the recall occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "fromLocationId": { + "type": "string", + "description": "Where the prisoner has been recalled from (default OUT)", + "example": "SHEFCC" + }, + "movementReasonCode": { + "type": "string", + "description": "Reason for in movement (e.g. Recall from Intermittent Custody)", + "example": "24" + }, + "youthOffender": { + "type": "boolean", + "description": "Is this offender a youth", + "example": false + }, + "cellLocation": { + "type": "string", + "description": "Cell location where recalled prisoner should be housed, default will be reception", + "example": "MDI-RECP" + }, + "imprisonmentStatus": { + "type": "string", + "description": "Require imprisonment status", + "example": "CUR_ORA" + } + }, + "description": "Represents the data required for recalling a prisoner" + }, + "CellMoveResult": { + "required": [ + "agencyId", + "bookingId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Unique, numeric booking id.", + "format": "int64", + "example": 1234134 + }, + "agencyId": { + "type": "string", + "description": "Identifier of agency that offender is associated with.", + "example": "MDI" + }, + "assignedLivingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that offender is assigned to.", + "format": "int64", + "example": 123123 + }, + "assignedLivingUnitDesc": { + "type": "string", + "description": "Description of living unit (e.g. cell) that offender is assigned to.", + "example": "MDI-1-1-3" + }, + "bedAssignmentHistorySequence": { + "type": "integer", + "description": "Bed assignment sequence associated with the entry created for this cell move ", + "format": "int32", + "example": 2 + } + }, + "description": "Cell move result" + }, + "RequestToDischargePrisoner": { + "required": [ + "hospitalLocationCode" + ], + "type": "object", + "properties": { + "hospitalLocationCode": { + "type": "string", + "description": "Agency Location code for hospital, agency type is HSHOSP", + "example": "HAZLWD" + }, + "dischargeTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the release occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "supportingPrisonId": { + "type": "string", + "description": "Supporting Prison for POM, can be null if prisoner is already in a prison, for prisoners already released this field will be ignored", + "example": "MDI" + }, + "fromLocationId": { + "type": "string", + "description": "Where the prisoner has moved from e.g. court, can be null if prisoner is already in prison, for prisoners already in prison this field will be ignored", + "example": "SHEFCC" + } + }, + "description": "Request release of prisoner" + }, + "RequestToTransferOutToCourt": { + "required": [ + "escortType", + "movementTime", + "toLocation", + "transferReasonCode" + ], + "type": "object", + "properties": { + "toLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The court location to be moved to.", + "example": "LEEDYC" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + }, + "escortType": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The escort type of the move.", + "example": "PECS" + }, + "transferReasonCode": { + "type": "string", + "description": "Reason code for the transfer, reference domain is MOVE_RSN", + "example": "CRT" + }, + "commentText": { + "type": "string", + "description": "Additional comments about the release", + "example": "Prisoner was transferred to a new prison" + }, + "shouldReleaseBed": { + "type": "boolean", + "description": "Flag indicate if bed should be released" + }, + "courtEventId": { + "type": "integer", + "description": "Optional scheduled court hearing event this movement relates to", + "format": "int64" + } + }, + "description": "Represents the data required for transferring a prisoner to a court" + }, + "RequestForCourtTransferIn": { + "required": [ + "agencyId", + "dateTime" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency identifier", + "example": "MDI" + }, + "movementReasonCode": { + "type": "string", + "description": "Movement Reason Code", + "example": "CA" + }, + "commentText": { + "type": "string", + "description": "Additional comments", + "example": "Prisoner was transferred to a new prison" + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time the movement occurred, if not supplied it will be the current time. Note: Time can be in the past but not before the last movement", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Represents the data required for registering court return" + }, + "HdcChecks": { + "required": [ + "date", + "passed" + ], + "type": "object", + "properties": { + "passed": { + "type": "boolean", + "description": "HDC Checks passed flag", + "example": true + }, + "date": { + "type": "string", + "description": "HDC Checks passed date. ISO-8601 format. YYYY-MM-DD", + "format": "date", + "example": "2018-12-31" + } + }, + "description": "HDC Curfew Check" + }, + "ApprovalStatus": { + "required": [ + "approvalStatus", + "date" + ], + "type": "object", + "properties": { + "approvalStatus": { + "type": "string", + "description": "Approval status. Must be one of the 'HDC_APPROVE' reference codes", + "example": "APPROVED" + }, + "refusedReason": { + "type": "string", + "description": "Refused reason. Must be one of the 'HDC_REJ_RSN' reference codes", + "example": "UNDER_14DAYS" + }, + "date": { + "type": "string", + "description": "Approval status date. ISO-8601 format. YYYY-MM-DD", + "format": "date", + "example": "2018-12-31" + } + }, + "description": "HDC Approval Status" + }, + "CategoryRejectionDetail": { + "required": [ + "assessmentSeq", + "bookingId", + "evaluationDate", + "reviewCommitteeCode" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number", + "format": "int32" + }, + "evaluationDate": { + "type": "string", + "description": "Date of rejection", + "format": "date" + }, + "reviewCommitteeCode": { + "type": "string", + "description": "Department, reference code in domain 'ASSESS_COMM'. Normally 'REVIEW'" + }, + "committeeCommentText": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Overall comment" + } + }, + "description": "Rejection details" + }, + "CategorisationUpdateDetail": { + "required": [ + "assessmentSeq", + "bookingId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number", + "format": "int32" + }, + "category": { + "type": "string", + "description": "Category code" + }, + "committee": { + "type": "string", + "description": "The assessment committee code (reference code in domain 'ASSESS_COMM')" + }, + "nextReviewDate": { + "type": "string", + "description": "Next review date for recategorisation", + "format": "date" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Initial categorisation comment" + } + }, + "description": "Categorisation details" + }, + "CategoryApprovalDetail": { + "required": [ + "bookingId", + "category", + "evaluationDate", + "reviewCommitteeCode" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number. Only used to check consistency", + "format": "int32" + }, + "category": { + "type": "string", + "description": "Category code, reference code in domain 'SUP_LVL_TYPE'" + }, + "evaluationDate": { + "type": "string", + "description": "Date of approval", + "format": "date" + }, + "reviewCommitteeCode": { + "type": "string", + "description": "Department, reference code in domain 'ASSESS_COMM'. Normally 'REVIEW'", + "example": "REVIEW" + }, + "approvedCategoryComment": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Approved result category comment" + }, + "committeeCommentText": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Overall comment" + }, + "nextReviewDate": { + "type": "string", + "description": "Next review date (date of re-assessment, remains unchanged if not provided)", + "format": "date" + }, + "approvedPlacementAgencyId": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "Approved placement prison" + }, + "approvedPlacementText": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Approved placement prison comment" + } + }, + "description": "Approval details" + }, + "OffenceActivationDto": { + "required": [ + "activationFlag", + "offenceCode", + "statuteCode" + ], + "type": "object", + "properties": { + "offenceCode": { + "type": "string" + }, + "statuteCode": { + "type": "string" + }, + "activationFlag": { + "type": "boolean" + } + }, + "description": "Used for deactivating/reactivating an offence. A deactivated offence is not selectable in NOMIS" + }, + "HOCodeDto": { + "required": [ + "activeFlag", + "code", + "description" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "HO code", + "example": "825/99" + }, + "description": { + "type": "string", + "description": "HO code description", + "example": "Ho Code 825/99" + }, + "activeFlag": { + "type": "string", + "description": "Active Y/N", + "example": "Y" + }, + "expiryDate": { + "type": "string", + "description": "Expiry Date", + "format": "date", + "example": "2021-01-05" + } + }, + "description": "HO Code", + "example": "825/99" + }, + "OffenceDto": { + "required": [ + "activeFlag", + "code", + "description", + "severityRanking", + "statuteCode" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Reference Code", + "example": "RR84070" + }, + "description": { + "type": "string", + "description": "Description of offence" + }, + "statuteCode": { + "$ref": "#/components/schemas/StatuteDto" + }, + "hoCode": { + "$ref": "#/components/schemas/HOCodeDto" + }, + "severityRanking": { + "type": "string", + "description": "Severity Ranking", + "example": "5" + }, + "activeFlag": { + "type": "string", + "description": "Active Y/N", + "example": "Y" + }, + "listSequence": { + "type": "integer", + "description": "Sequence", + "format": "int32", + "example": 1 + }, + "expiryDate": { + "type": "string", + "description": "Expiry Date if no longer active", + "format": "date", + "example": "2021-04-01" + } + }, + "description": "Offence" + }, + "StatuteDto": { + "required": [ + "activeFlag", + "code", + "description", + "legislatingBodyCode" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Statute code", + "example": "RR84" + }, + "description": { + "type": "string", + "description": "Statute code description", + "example": "Statute RV98" + }, + "legislatingBodyCode": { + "type": "string", + "description": "Legislating Body Code", + "example": "UK" + }, + "activeFlag": { + "type": "string", + "description": "Active Y/N", + "example": "Y" + } + }, + "description": "Statute", + "example": "RR84" + }, + "PrisonMoveCancellation": { + "required": [ + "reasonCode" + ], + "type": "object", + "properties": { + "reasonCode": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The reason code for cancellation of the move.", + "enum": [ + "ADMI", + "OCI", + "TRANS" + ] + } + }, + "description": "The cancellation details." + }, + "RequestMoveToCellSwap": { + "type": "object", + "properties": { + "reasonCode": { + "type": "string", + "description": "The reason code for the move (from reason code domain CHG_HOUS_RSN) (defaults to ADM)", + "example": "ADM" + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date / time of the move (defaults to current)", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Request move offender to cell swap" + }, + "OffenderBooking": { + "required": [ + "age", + "agencyId", + "alertsCodes", + "alertsDetails", + "bookingId", + "dateOfBirth", + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Unique, numeric booking id.", + "format": "int64", + "example": 1234134 + }, + "bookingNo": { + "type": "string", + "description": "Booking number.", + "example": "A12121" + }, + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number).", + "example": "A1234AA" + }, + "firstName": { + "type": "string", + "description": "Offender first name.", + "example": "JOHN" + }, + "middleName": { + "type": "string", + "description": "Offender middle name.", + "example": "ASHLEY" + }, + "lastName": { + "type": "string", + "description": "Offender last name.", + "example": "SMITH" + }, + "dateOfBirth": { + "type": "string", + "description": "Offender date of birth.", + "format": "date", + "example": "1980-05-02" + }, + "age": { + "type": "integer", + "description": "Offender's current age.", + "format": "int32", + "example": 32 + }, + "agencyId": { + "type": "string", + "description": "Identifier of agency that offender is associated with.", + "example": "MDI" + }, + "assignedLivingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that offender is assigned to.", + "format": "int64", + "example": 123123 + }, + "assignedLivingUnitDesc": { + "type": "string", + "description": "Description of living unit (e.g. cell) that offender is assigned to.", + "example": "MDI-1-1-3" + }, + "facialImageId": { + "type": "integer", + "description": "Identifier of facial image of offender.", + "format": "int64", + "example": 1241241 + }, + "assignedOfficerUserId": { + "type": "string", + "description": "Identifier of officer (key worker) to which offender is assigned.", + "example": "354543" + }, + "aliases": { + "type": "array", + "description": "List of offender's alias names.", + "items": { + "type": "string", + "description": "List of offender's alias names." + } + }, + "categoryCode": { + "type": "string", + "description": "The Cat A/B/C/D of the offender", + "example": "C", + "enum": [ + "A", + "B", + "C", + "D", + "I", + "J" + ] + }, + "convictedStatus": { + "type": "string", + "description": "Convicted Status", + "example": "Convicted", + "enum": [ + "Convicted", + "Remand" + ] + }, + "imprisonmentStatus": { + "type": "string", + "description": "The imprisonment status of the offender", + "example": "SENT" + }, + "alertsCodes": { + "type": "array", + "description": "List of offender's current alert types.", + "items": { + "type": "string", + "description": "List of offender's current alert types." + } + }, + "alertsDetails": { + "type": "array", + "description": "List of offender's current alert codes.", + "items": { + "type": "string", + "description": "List of offender's current alert codes." + } + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + } + }, + "description": "Offender Booking Summary" + }, + "CourtHearingDateAmendment": { + "required": [ + "hearingDateTime" + ], + "type": "object", + "properties": { + "hearingDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time of the court hearing in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + } + }, + "description": "The amendments for the scheduled court hearing." + }, + "AddressDto": { + "required": [ + "mail", + "noFixedAddress", + "primary" + ], + "type": "object", + "properties": { + "addressId": { + "type": "integer", + "description": "Address Id", + "format": "int64", + "example": 543524 + }, + "addressType": { + "type": "string", + "description": "Address Type. Note: Reference domain is ADDR_TYPE", + "example": "BUS" + }, + "flat": { + "type": "string", + "description": "Flat", + "example": "3B" + }, + "premise": { + "type": "string", + "description": "Premise", + "example": "Liverpool Prison" + }, + "street": { + "type": "string", + "description": "Street", + "example": "Slinn Street" + }, + "locality": { + "type": "string", + "description": "Locality", + "example": "Brincliffe" + }, + "town": { + "type": "string", + "description": "Town/City. Note: Reference domain is CITY", + "example": "Liverpool" + }, + "postalCode": { + "type": "string", + "description": "Postal Code", + "example": "LI1 5TH" + }, + "county": { + "type": "string", + "description": "County. Note: Reference domain is COUNTY", + "example": "HEREFORD" + }, + "country": { + "type": "string", + "description": "Country. Note: Reference domain is COUNTRY", + "example": "ENG" + }, + "comment": { + "type": "string", + "description": "Comment", + "example": "This is a comment text" + }, + "primary": { + "type": "boolean", + "description": "Primary Address", + "example": false + }, + "mail": { + "type": "boolean", + "description": "Mail Address", + "example": false + }, + "noFixedAddress": { + "type": "boolean", + "description": "No Fixed Address", + "example": false + }, + "startDate": { + "type": "string", + "description": "Date Added", + "format": "date", + "example": "2005-05-12" + }, + "endDate": { + "type": "string", + "description": "Date ended", + "format": "date", + "example": "2021-02-12" + }, + "phones": { + "type": "array", + "description": "The phone number associated with the address", + "items": { + "$ref": "#/components/schemas/Telephone" + } + }, + "addressUsages": { + "type": "array", + "description": "The address usages/types", + "items": { + "$ref": "#/components/schemas/AddressUsageDto" + } + } + }, + "description": "An Address" + }, + "AddressUsageDto": { + "type": "object", + "properties": { + "addressId": { + "type": "integer", + "description": "Address ID of the associated address", + "format": "int64", + "example": 23422313 + }, + "addressUsage": { + "type": "string", + "description": "The address usages", + "example": "HDC" + }, + "addressUsageDescription": { + "type": "string", + "description": "The address usages description", + "example": "HDC Address" + }, + "activeFlag": { + "type": "boolean", + "description": "Active Flag", + "example": true + } + }, + "description": "An Offender's address usage" + }, + "Agency": { + "required": [ + "active", + "agencyId", + "agencyType", + "description" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency identifier.", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Agency description.", + "example": "Moorland (HMP & YOI)" + }, + "longDescription": { + "type": "string", + "description": "Long description of the agency", + "example": "Moorland (HMP & YOI)" + }, + "agencyType": { + "type": "string", + "description": "Agency type. Reference domain is AGY_LOC_TYPE", + "example": "INST", + "enum": [ + "CRC", + "POLSTN", + "INST", + "COMM", + "APPR", + "CRT", + "POLICE", + "IMDC", + "TRN", + "OUT", + "YOT", + "SCH", + "STC", + "HOST", + "AIRPORT", + "HSHOSP", + "HOSPITAL", + "PECS", + "PAR", + "PNP", + "PSY" + ] + }, + "active": { + "type": "boolean", + "description": "Indicates the Agency is active", + "example": true + }, + "courtType": { + "type": "string", + "description": "Court Type. Reference domain is JURISDICTION", + "example": "CC", + "enum": [ + "CACD", + "CB", + "CC", + "CO", + "DCM", + "GCM", + "IMM", + "MC", + "OTHER", + "YC" + ] + }, + "deactivationDate": { + "type": "string", + "description": "Date agency became inactive", + "format": "date", + "example": "2012-01-12" + }, + "addresses": { + "type": "array", + "description": "List of addresses associated with agency", + "items": { + "$ref": "#/components/schemas/AddressDto" + } + }, + "phones": { + "type": "array", + "description": "List of phones associated with agency", + "items": { + "$ref": "#/components/schemas/Telephone" + } + }, + "emails": { + "type": "array", + "description": "List of emails associated with agency", + "items": { + "$ref": "#/components/schemas/Email" + } + } + }, + "description": "Agency Details" + }, + "CourtHearing": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The court hearing identifier.", + "format": "int64", + "example": 123456789 + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and start time of the court hearing in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "location": { + "$ref": "#/components/schemas/Agency" + } + }, + "description": "Represents a court hearing for an offender court case." + }, + "Email": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Email" + } + }, + "description": "An Email Address" + }, + "Telephone": { + "required": [ + "number", + "type" + ], + "type": "object", + "properties": { + "phoneId": { + "type": "integer", + "description": "Phone Id", + "format": "int64", + "example": 2234232 + }, + "number": { + "type": "string", + "description": "Telephone number", + "example": "0114 2345678" + }, + "type": { + "type": "string", + "description": "Telephone type", + "example": "TEL" + }, + "ext": { + "type": "string", + "description": "Telephone extension number", + "example": "123" + } + }, + "description": "Telephone Details" + }, + "AlertChanges": { + "type": "object", + "properties": { + "expiryDate": { + "type": "string", + "description": "Date the alert became inactive", + "format": "date", + "example": "2019-02-13" + }, + "comment": { + "type": "string", + "description": "Alert comment" + }, + "removeExpiryDate": { + "type": "boolean", + "description": "Remove expiry date" + } + }, + "description": "Alert details" + }, + "UpdateAttendance": { + "required": [ + "eventOutcome" + ], + "type": "object", + "properties": { + "eventOutcome": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Attendance outcome, possible values are the codes in the 'PS_PA_OC' reference domain.", + "example": "ATT", + "enum": [ + "ABS", + "ACCAB", + "ATT", + "CANC", + "NREQ", + "SUS", + "UNACAB", + "REST" + ] + }, + "performance": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Possible values are the codes in the 'PERFORMANCE' reference domain, mandatory for eventOutcome 'ATT'.", + "example": "ACCEPT", + "enum": [ + "ACCEPT", + "GOOD", + "POOR", + "STANDARD", + "UNACCEPT" + ] + }, + "outcomeComment": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Free text comment, maximum length 240 characters.", + "example": "Turned up very late" + } + }, + "description": "Attendance details. This is used to update the attendance details of an offender" + }, + "BookingActivity": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "format": "int64" + }, + "activityId": { + "type": "integer", + "format": "int64" + } + }, + "description": "set of booking and activity ids" + }, + "UpdateAttendanceBatch": { + "required": [ + "bookingActivities", + "eventOutcome" + ], + "type": "object", + "properties": { + "eventOutcome": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Attendance outcome, possible values are the codes in the 'PS_PA_OC' reference domain.", + "example": "ATT", + "enum": [ + "ABS", + "ACCAB", + "ATT", + "CANC", + "NREQ", + "SUS", + "UNACAB", + "REST" + ] + }, + "performance": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Possible values are the codes in the 'PERFORMANCE' reference domain, mandatory for eventOutcome 'ATT'.", + "example": "ACCEPT", + "enum": [ + "ACCEPT", + "GOOD", + "POOR", + "STANDARD", + "UNACCEPT" + ] + }, + "outcomeComment": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Free text comment, maximum length 240 characters.", + "example": "Turned up very late" + }, + "bookingActivities": { + "uniqueItems": true, + "type": "array", + "description": "set of booking and activity ids", + "items": { + "$ref": "#/components/schemas/BookingActivity" + } + } + }, + "description": "Attendance details. This is used to update the attendance details of multiple bookings" + }, + "UpdateComment": { + "type": "object", + "properties": { + "comment": { + "type": "string" + }, + "commentOrNull": { + "type": "string" + } + }, + "description": "The comment. May be empty or null" + }, + "RequestToUpdateAgency": { + "required": [ + "agencyType", + "courtType", + "description" + ], + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Agency description.", + "example": "Moorland (HMP & YOI)" + }, + "longDescription": { + "type": "string", + "description": "Long description of the agency", + "example": "Moorland (HMP & YOI)" + }, + "agencyType": { + "pattern": "^[a-zA-Z0-9]+$", + "type": "string", + "description": "Agency type. Reference domain is AGY_LOC_TYPE", + "example": "INST", + "enum": [ + "CRC", + "POLSTN", + "INST", + "COMM", + "APPR", + "CRT", + "POLICE", + "IMDC", + "TRN", + "OUT", + "YOT", + "SCH", + "STC", + "HOST", + "AIRPORT", + "HSHOSP", + "HOSPITAL", + "PECS", + "PAR", + "PNP", + "PSY" + ] + }, + "active": { + "type": "boolean", + "description": "Indicates the Agency is active. Note: if set false, the current date will be the deactivation date", + "example": true + }, + "courtType": { + "pattern": "^[a-zA-Z0-9]+$", + "type": "string", + "description": "Court Type. Reference domain is JURISDICTION", + "example": "CC", + "enum": [ + "CACD", + "CB", + "CC", + "CO", + "DCM", + "GCM", + "IMM", + "MC", + "OTHER", + "YC" + ] + } + }, + "description": "Update Agency Request" + }, + "RequestToUpdateAddress": { + "required": [ + "addressType", + "noFixedAddress", + "premise", + "primary" + ], + "type": "object", + "properties": { + "addressType": { + "type": "string", + "description": "Address Type. Note: Reference domain is ADDR_TYPE", + "example": "BUS" + }, + "flat": { + "type": "string", + "description": "Flat", + "example": "3B" + }, + "premise": { + "type": "string", + "description": "Premise", + "example": "Liverpool Prison" + }, + "street": { + "type": "string", + "description": "Street", + "example": "Slinn Street" + }, + "locality": { + "type": "string", + "description": "Locality", + "example": "Brincliffe" + }, + "town": { + "type": "string", + "description": "Town/City. Note: Reference domain is CITY", + "example": "Liverpool" + }, + "postalCode": { + "type": "string", + "description": "Postal Code", + "example": "LI1 5TH" + }, + "county": { + "type": "string", + "description": "County. Note: Reference domain is COUNTY", + "example": "HEREFORD" + }, + "country": { + "type": "string", + "description": "Country. Note: Reference domain is COUNTRY", + "example": "ENG" + }, + "comment": { + "type": "string", + "description": "Comment", + "example": "This is a comment text" + }, + "primary": { + "type": "boolean", + "description": "Primary Address", + "example": false + }, + "noFixedAddress": { + "type": "boolean", + "description": "No Fixed Address", + "example": false + }, + "startDate": { + "type": "string", + "description": "Date Added", + "format": "date", + "example": "2005-05-12" + }, + "endDate": { + "type": "string", + "description": "Date ended", + "format": "date", + "example": "2021-02-12" + } + }, + "description": "Update Address Request" + }, + "RequestToUpdatePhone": { + "required": [ + "number", + "type" + ], + "type": "object", + "properties": { + "number": { + "type": "string", + "description": "Telephone number" + }, + "type": { + "type": "string", + "description": "Telephone type" + }, + "ext": { + "type": "string", + "description": "Telephone extension number" + } + }, + "description": "Update Phone Request" + }, + "CreateTransaction": { + "required": [ + "amount", + "client_transaction_id", + "client_unique_ref", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Valid transaction type for the prison_id", + "example": "CANT", + "enum": [ + "CANT,REFND,PHONE,MRPR,MTDS,DTDS,CASHD,RELA,RELS" + ] + }, + "description": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Description of the Transaction", + "example": "Canteen Purchase of £16.34" + }, + "amount": { + "type": "integer", + "description": "Amount of transaction in pence, hence 1634 is £16.34", + "format": "int64", + "example": 1634 + }, + "client_transaction_id": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Client Transaction Id", + "example": "CL123212" + }, + "client_unique_ref": { + "maxLength": 64, + "minLength": 0, + "pattern": "[a-zA-Z0-9-_]+", + "type": "string", + "description": "A reference unique to the client making the post. Maximum size 64 characters, only alphabetic, numeric, '-' and '_' are allowed", + "example": "CLIENT121131-0_11" + } + }, + "description": "Transaction Details" + }, + "Transaction": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of created transaction", + "example": "6179604-1" + } + }, + "description": "Transaction Response" + }, + "StorePaymentRequest": { + "required": [ + "amount", + "client_transaction_id", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Valid payment type for the prison", + "example": "ADJ", + "enum": [ + "A_EARN,ADJ" + ] + }, + "description": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Description of the payment", + "example": "Adjustment" + }, + "amount": { + "type": "integer", + "description": "Amount of the payment in pence, hence 1634 is £16.34", + "format": "int64", + "example": 1634 + }, + "client_transaction_id": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Client transaction identifier", + "example": "CL123212" + } + }, + "description": "Transaction Details" + }, + "PaymentResponse": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "Message returned from a payment", + "example": "Payment accepted" + } + }, + "description": "Payment Response" + }, + "CodeDescription": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Code" + }, + "desc": { + "type": "string", + "description": "Description" + } + }, + "description": "Code Description" + }, + "Transfer": { + "type": "object", + "properties": { + "transaction": { + "$ref": "#/components/schemas/Transaction" + }, + "current_location": { + "$ref": "#/components/schemas/CodeDescription" + } + }, + "description": "Transfer Response" + }, + "UserDetail": { + "required": [ + "accountStatus", + "active", + "firstName", + "lastName", + "lockDate", + "staffId", + "username" + ], + "type": "object", + "properties": { + "staffId": { + "type": "integer", + "description": "Staff Id", + "format": "int64", + "example": 231232 + }, + "username": { + "type": "string", + "description": "Username", + "example": "DEMO_USER1" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "thumbnailId": { + "type": "integer", + "description": "Image Thumbnail Id", + "format": "int64", + "example": 2342341224 + }, + "activeCaseLoadId": { + "type": "string", + "description": "Current Active Caseload", + "example": "MDI" + }, + "accountStatus": { + "type": "string", + "description": "Status of the User Account", + "example": "ACTIVE", + "enum": [ + "ACTIVE", + "INACT", + "SUS", + "CAREER", + "MAT", + "SAB", + "SICK" + ] + }, + "lockDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date the user account was locked", + "example": "2021-07-05T10:35:17" + }, + "expiryDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date the user account has expired", + "example": "2021-07-05T10:35:17" + }, + "lockedFlag": { + "type": "boolean", + "description": "The User account is locked", + "example": false + }, + "expiredFlag": { + "type": "boolean", + "description": "Indicates the user account has expired", + "example": true + }, + "active": { + "type": "boolean", + "description": "Indicate if the account is active", + "example": true + } + }, + "description": "User Details" + }, + "UpdatePrisonerDetails": { + "required": [ + "firstName", + "lastName" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "example": "John" + }, + "lastName": { + "type": "string", + "example": "Smith" + } + } + }, + "PrisonDetails": { + "required": [ + "prison", + "prisonId" + ], + "type": "object", + "properties": { + "prisonId": { + "type": "string", + "description": "ID of prison", + "example": "MDI" + }, + "prison": { + "type": "string", + "description": "Name of prison", + "example": "Moorland (HMP)" + } + }, + "description": "Prison details" + }, + "PrisonerSchedule": { + "required": [ + "cellLocation", + "comment", + "event", + "eventDescription", + "eventLocation", + "eventStatus", + "eventType", + "firstName", + "lastName", + "locationId", + "offenderNo", + "startTime" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number)" + }, + "eventId": { + "type": "integer", + "description": "Activity id if any. Used to attend or pay the event", + "format": "int64" + }, + "bookingId": { + "type": "integer", + "description": "Booking id for offender", + "format": "int64" + }, + "locationId": { + "type": "integer", + "description": "The number which (uniquely) identifies the internal location associated with the Scheduled Event (Prisoner Schedule)", + "format": "int64" + }, + "firstName": { + "type": "string", + "description": "Offender first name" + }, + "lastName": { + "type": "string", + "description": "Offender last name" + }, + "cellLocation": { + "type": "string", + "description": "Offender cell" + }, + "event": { + "type": "string", + "description": "Event code" + }, + "eventType": { + "type": "string", + "description": "Event type, e.g. VISIT, APP, PRISON_ACT" + }, + "eventDescription": { + "type": "string", + "description": "Description of event code" + }, + "eventLocation": { + "type": "string", + "description": "Location of the event" + }, + "eventLocationId": { + "type": "integer", + "description": "Id of an internal event location", + "format": "int64" + }, + "eventStatus": { + "type": "string", + "description": "The event's status. Includes 'CANC', meaning cancelled for 'VISIT'" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Comment" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event ends", + "example": "2021-07-05T10:35:17" + }, + "eventOutcome": { + "type": "string", + "description": "Attendance, possible values are the codes in the 'PS_PA_OC' reference domain" + }, + "performance": { + "type": "string", + "description": "Possible values are the codes in the 'PERFORMANCE' reference domain" + }, + "outcomeComment": { + "type": "string", + "description": "No-pay reason" + }, + "paid": { + "type": "boolean", + "description": "Activity paid flag" + }, + "payRate": { + "type": "number", + "description": "Amount paid per activity session in pounds" + }, + "excluded": { + "type": "boolean", + "description": "Activity excluded flag" + }, + "timeSlot": { + "type": "string", + "description": "Activity time slot", + "enum": [ + "AM", + "PM", + "ED" + ] + }, + "locationCode": { + "type": "string", + "description": "The code for the activity location" + }, + "suspended": { + "type": "boolean", + "description": "Event scheduled has been suspended" + } + }, + "description": "Prisoner Schedule" + }, + "PrisonerActivitiesCount": { + "required": [ + "notRecorded", + "suspended", + "total" + ], + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "int64" + }, + "suspended": { + "type": "integer", + "format": "int64" + }, + "notRecorded": { + "type": "integer", + "format": "int64" + } + } + }, + "PrisonerDetailSearchCriteria": { + "type": "object", + "properties": { + "offenderNos": { + "type": "array", + "description": "List of offender Numbers (NOMS ID)", + "items": { + "type": "string", + "description": "List of offender Numbers (NOMS ID)" + } + }, + "firstName": { + "type": "string", + "description": "The first name of the offender.", + "example": "John" + }, + "gender": { + "type": "string", + "description": "Offender's gender code (F - Female, M - Male, NK - Not Known or NS - Not Specified).", + "example": "F", + "enum": [ + "M", + "F", + "NK", + "NS", + "ALL" + ] + }, + "middleNames": { + "type": "string", + "description": "The middle name(s) of the offender.", + "example": "James" + }, + "lastName": { + "type": "string", + "description": "The last name of the offender.", + "example": "Smith" + }, + "location": { + "type": "string", + "description": "Offender's location filter (IN, OUT or ALL) - defaults to ALL.", + "example": "ALL", + "enum": [ + "IN", + "OUT", + "ALL" + ] + }, + "pncNumber": { + "type": "string", + "description": "The offender's PNC (Police National Computer) number.", + "example": "123/1231" + }, + "croNumber": { + "type": "string", + "description": "The offender's CRO (Criminal Records Office) number.", + "example": "12312312" + }, + "dob": { + "type": "string", + "description": "The offender's date of birth. Cannot be used in conjunction with dobFrom or dobTo. Must be specified using YYYY-MM-DD format.", + "format": "date", + "example": "2001-01-15" + }, + "dobFrom": { + "type": "string", + "description": "Start date for offender date of birth search. If dobTo is not specified, an implicit dobTo value of dobFrom + 10 years will be applied. If dobTo is specified, it will be adjusted, if necessary, to ensure it is not more than 10 years after dobFrom. Cannot be used in conjunction with dob. Must be specified using YYYY-MM-DD format.", + "format": "date", + "example": "1999-05-25" + }, + "dobTo": { + "type": "string", + "description": "End date for offender date of birth search. If dobFrom is not specified, an implicit dobFrom value of dobTo - 10 years will be applied. Cannot be used in conjunction with dob. Must be specified using YYYY-MM-DD format.", + "format": "date", + "example": "2005-12-31" + }, + "maxYearsRange": { + "maximum": 10, + "type": "integer", + "description": "Max Date Range, applied to dobFrom or dobTo, default is 10, max allowed is 10", + "format": "int32", + "example": 10 + }, + "includeAliases": { + "type": "boolean", + "description": "If true the result set should include a row for every matched alias. If the request includes some combination of firstName, lastName and dateOfBirth then this will be a subset of the OFFENDERS records for one or more offenders. Otherwise it will be every OFFENDERS record for each match on the other search criteria. Default is false." + }, + "partialNameMatch": { + "type": "boolean", + "description": "If true, the search will use partial, start-of-name matching of offender names (where provided). For example, if lastName criteria of 'AD' is specified, this will match an offender whose last name is 'ADAMS' but not an offender whose last name is 'HADAD'. This will typically increase the number of matching offenders found. This parameter can be used with any other search processing parameter (e.g. prioritisedMatch or anyMatch).", + "example": false + }, + "anyMatch": { + "type": "boolean", + "description": "If true, offenders that match any of the specified criteria will be returned. The default search behaviour is to only return offenders that match all of the specified criteria. If the prioritisedMatch parameter is also set true, this parameter will only impact the behaviour of searching using offender name and date of birth criteria.", + "example": false + }, + "prioritisedMatch": { + "type": "boolean", + "description": "If true, search criteria prioritisation is used and searching/matching will stop as soon as one or more matching offenders are found. The criteria priority is:

1. offenderNo
2. pncNumber
3. croNumber
4. firstName, lastName, dob
5. dobFrom, dobTo

As an example of how this works, if this parameter is set true and an offenderNo is specified and an offender having this offender number is found, searching will stop and that offender will be returned immediately. If no offender matching the specified offenderNo is found, the search will be repeated using the next priority criteria (pncNumber) and so on. Note that offender name and date of birth criteria have the same priority and will be used together to search for matching offenders.", + "example": false + } + }, + "description": "Prisoner Search Criteria" + }, + "PrisonerDetail": { + "required": [ + "currentWorkingBirthDate", + "currentWorkingFirstName", + "currentWorkingLastName", + "currentlyInPrison", + "dateOfBirth", + "firstName", + "gender", + "lastName", + "offenderNo", + "sexCode" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "The prisoner's unique offender number (aka NOMS Number in the UK).", + "example": "A0000AA" + }, + "title": { + "type": "string", + "description": "The prisoner's title.", + "example": "Earl" + }, + "suffix": { + "type": "string", + "description": "The prisoner's name suffix.", + "example": "Mac" + }, + "firstName": { + "type": "string", + "description": "The prisoner's first name.", + "example": "Thorfinn" + }, + "middleNames": { + "type": "string", + "description": "The prisoner's middle name(s).", + "example": "Skull-splitter" + }, + "lastName": { + "type": "string", + "description": "The prisoner's last name.", + "example": "Torf-Einarsson" + }, + "dateOfBirth": { + "type": "string", + "description": "The prisoner's date of birth (in YYYY-MM-DD format).", + "format": "date", + "example": "1960-02-29" + }, + "gender": { + "type": "string", + "description": "The prisoner's gender.", + "example": "Female" + }, + "sexCode": { + "type": "string", + "description": "The prisoner's gender code.", + "example": "F" + }, + "nationalities": { + "type": "string", + "description": "The prisoner's nationality.", + "example": "Scottish" + }, + "currentlyInPrison": { + "type": "string", + "description": "Flag (Y or N) to indicate if prisoner is currently in prison.", + "example": "N" + }, + "latestBookingId": { + "type": "integer", + "description": "ID of prisoner's latest booking.", + "format": "int64", + "example": 1 + }, + "latestLocationId": { + "type": "string", + "description": "Latest location ID of a prisoner (if in prison).", + "example": "WRI" + }, + "latestLocation": { + "type": "string", + "description": "Name of the prison where the prisoner resides (if in prison).", + "example": "Whitemoor (HMP)" + }, + "internalLocation": { + "type": "string", + "description": "Name of the location where the prisoner resides (if in prison)", + "example": "WRI-B-3-018" + }, + "pncNumber": { + "type": "string", + "description": "The prisoner's PNC (Police National Computer) number.", + "example": "01/000000A" + }, + "croNumber": { + "type": "string", + "description": "The prisoner's CRO (Criminal Records Office) number.", + "example": "01/0001/01A" + }, + "ethnicity": { + "type": "string", + "description": "The prisoner's ethnicity.", + "example": "White: British" + }, + "ethnicityCode": { + "type": "string", + "description": "The prisoner's ethnicity code.", + "example": "W1" + }, + "birthCountry": { + "type": "string", + "description": "The prisoner's country of birth.", + "example": "Norway" + }, + "religion": { + "type": "string", + "description": "The prisoner's religion.", + "example": "Pagan" + }, + "religionCode": { + "type": "string", + "description": "The prisoner's religion code.", + "example": "PAG" + }, + "convictedStatus": { + "type": "string", + "description": "Status code of prisoner's latest conviction.", + "example": "Convicted", + "enum": [ + "Convicted", + "Remand" + ] + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "imprisonmentStatus": { + "type": "string", + "description": "The prisoner's imprisonment status.", + "example": "LIFE" + }, + "imprisonmentStatusDesc": { + "type": "string", + "description": "The prisoner's imprisonment status description.", + "example": "Service Life Imprisonment" + }, + "receptionDate": { + "type": "string", + "description": "Date prisoner was received into the prison.", + "format": "date", + "example": "1980-01-01" + }, + "maritalStatus": { + "type": "string", + "description": "The prisoner's marital status.", + "example": "Single" + }, + "currentWorkingFirstName": { + "type": "string", + "description": "The prisoner's current working first name.", + "example": "Thorfinn" + }, + "currentWorkingLastName": { + "type": "string", + "description": "The prisoner's current working last name.", + "example": "Torf-Einarsson" + }, + "currentWorkingBirthDate": { + "type": "string", + "description": "The prisoner's current working date of birth (in YYYY-MM-DD format).", + "format": "date", + "example": "1960-02-29" + } + }, + "description": "Prisoner Details" + }, + "RequestForNewBooking": { + "required": [ + "bookingInTime", + "movementReasonCode", + "prisonId" + ], + "type": "object", + "properties": { + "prisonId": { + "type": "string", + "description": "Received Prison ID", + "example": "MDI" + }, + "bookingInTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The time the booking in occurred, if not supplied it will be the current time", + "example": "2021-07-05T10:35:17" + }, + "fromLocationId": { + "type": "string", + "description": "Where the prisoner has moved from (default OUT)", + "example": "SHEFCC" + }, + "movementReasonCode": { + "type": "string", + "description": "Reason for in movement (e.g. Unconvicted Remand)", + "example": "N" + }, + "youthOffender": { + "type": "boolean", + "description": "Is this offender a youth", + "example": false + }, + "cellLocation": { + "type": "string", + "description": "Cell location where recalled prisoner should be housed, default will be reception", + "example": "MDI-RECP" + }, + "imprisonmentStatus": { + "type": "string", + "description": "Require imprisonment status (e.g Adult Imprisonment Without Option CJA03)", + "example": "SENT03" + } + }, + "description": "Represents the data required receiving a prisoner under a new booking" + }, + "RequestToCreate": { + "required": [ + "dateOfBirth", + "firstName", + "gender", + "lastName" + ], + "type": "object", + "properties": { + "pncNumber": { + "maxLength": 20, + "minLength": 0, + "pattern": "^^([0-9]{2}|[0-9]{4})/[0-9]+[a-zA-Z]$", + "type": "string", + "description": "The offender's PNC (Police National Computer) number.", + "example": "03/11999M" + }, + "lastName": { + "maxLength": 35, + "minLength": 0, + "pattern": "^[A-Z|a-z ,.'-]+$", + "type": "string", + "description": "The offender's last name.", + "example": "Mark" + }, + "firstName": { + "maxLength": 35, + "minLength": 0, + "pattern": "^[A-Z|a-z ,.'-]+$", + "type": "string", + "description": "The offender's first name.", + "example": "John" + }, + "middleName1": { + "maxLength": 35, + "minLength": 0, + "pattern": "^[A-Z|a-z ,.'-]+$", + "type": "string", + "description": "The offender's middle name.", + "example": "Luke" + }, + "middleName2": { + "maxLength": 35, + "minLength": 0, + "pattern": "^[A-Z|a-z ,.'-]+$", + "type": "string", + "description": "An additional middle name for the offender.", + "example": "Matthew" + }, + "title": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "A code representing the offender's title (from TITLE reference domain).", + "example": "MR", + "enum": [ + "BR", + "DAME", + "DR", + "FR", + "IMAM", + "LADY", + "LORD", + "MISS", + "MR", + "MRS", + "MS", + "RABBI", + "REV", + "SIR", + "SR" + ] + }, + "suffix": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "A code representing a suffix to apply to offender's name (from SUFFIX reference domain).", + "example": "JR", + "enum": [ + "I", + "II", + "III", + "IV", + "IX", + "V", + "VI", + "VII", + "VIII", + "JR", + "SR" + ] + }, + "dateOfBirth": { + "type": "string", + "description": "The offender's date of birth. Must be specified in YYYY-MM-DD format. Range allowed is 16-110 years", + "format": "date", + "example": "1970-01-01" + }, + "gender": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "A code representing the offender's gender (from the SEX reference domain).", + "example": "M", + "enum": [ + "M", + "F", + "NK", + "NS", + "REF" + ] + }, + "ethnicity": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "A code representing the offender's ethnicity (from the ETHNICITY reference domain).", + "example": "W1", + "enum": [ + "A9", + "B1", + "B2", + "B9", + "M1", + "M2", + "M3", + "M9", + "NS", + "O1", + "O2", + "O9", + "W1", + "W2", + "W3", + "W8", + "W9" + ] + }, + "croNumber": { + "maxLength": 20, + "minLength": 0, + "type": "string", + "description": "The offender's CRO (Criminal Records Office) number." + }, + "booking": { + "$ref": "#/components/schemas/RequestForNewBooking" + } + }, + "description": "Represents the data required for creating a new prisoner" + }, + "OffenderAdjudicationHearing": { + "required": [ + "agencyId", + "hearingId", + "internalLocationId", + "offenderNo" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string" + }, + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number (UK is NOMS ID)" + }, + "hearingId": { + "type": "integer", + "description": "OIC Hearing ID", + "format": "int64", + "example": 1985937 + }, + "hearingType": { + "type": "string", + "description": "Hearing Type", + "example": "Governor's Hearing Adult" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Hearing Time", + "example": "2021-07-05T10:35:17" + }, + "internalLocationId": { + "type": "integer", + "description": "The internal location id of the hearing", + "format": "int64", + "example": 789448 + }, + "internalLocationDescription": { + "type": "string", + "description": "The internal location description of the hearing", + "example": "PVI-RES-MCASU-ADJUD" + }, + "eventStatus": { + "type": "string", + "description": "The status of the hearing, SCH, COMP or EXP", + "example": "COMP" + } + }, + "description": "Represents an adjudication hearing at the offender level." + }, + "OffenderSentenceDetail": { + "required": [ + "agencyLocationDesc", + "agencyLocationId", + "bookingId", + "dateOfBirth", + "firstName", + "internalLocationDesc", + "lastName", + "mostRecentActiveBooking", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 12341321 + }, + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference", + "example": "A1000AA" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "agencyLocationId": { + "type": "string", + "description": "Agency Id", + "example": "LEI" + }, + "mostRecentActiveBooking": { + "type": "boolean", + "description": "Is this the most recent active booking", + "example": true + }, + "sentenceDetail": { + "$ref": "#/components/schemas/SentenceCalcDates" + }, + "dateOfBirth": { + "type": "string", + "description": "Offender date of birth.", + "format": "date" + }, + "agencyLocationDesc": { + "type": "string", + "description": "Agency Description" + }, + "internalLocationDesc": { + "type": "string", + "description": "Description of the location within the prison" + }, + "facialImageId": { + "type": "integer", + "description": "Identifier of facial image of offender.", + "format": "int64" + } + }, + "description": "Offender Sentence Detail" + }, + "HomeDetentionCurfew": { + "required": [ + "approvalStatusDate" + ], + "type": "object", + "properties": { + "passed": { + "type": "boolean", + "description": "HDC Checks passed flag", + "example": true + }, + "checksPassedDate": { + "type": "string", + "description": "HDC Checks passed date. ISO-8601 format. YYYY-MM-DD", + "format": "date", + "example": "2018-12-31" + }, + "approvalStatus": { + "type": "string", + "description": "Approval status. Will be one of the 'HDC_APPROVE' reference codes", + "example": "APPROVED" + }, + "refusedReason": { + "type": "string", + "description": "Refused reason. Will be one of the 'HDC_REJ_RSN' reference codes", + "example": "UNDER_14DAYS" + }, + "approvalStatusDate": { + "type": "string", + "description": "Approval status date. ISO-8601 format. YYYY-MM-DD", + "format": "date", + "example": "2018-12-31" + }, + "bookingId": { + "type": "integer", + "description": "Offender booking ID", + "format": "int64", + "example": 123 + } + }, + "description": "Home Detention Curfew information" + }, + "OffenderKeyDates": { + "required": [ + "effectiveSentenceEndDate", + "sentenceLength" + ], + "type": "object", + "properties": { + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDCED - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "earlyTermDate": { + "type": "string", + "description": "ETD - early term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "midTermDate": { + "type": "string", + "description": "MTD - mid term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "lateTermDate": { + "type": "string", + "description": "LTD - late term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "dtoPostRecallReleaseDate": { + "type": "string", + "description": "DPRRD - Detention training order post recall release date", + "format": "date", + "example": "2020-02-03" + }, + "automaticReleaseDate": { + "type": "string", + "description": "ARD - calculated automatic (unconditional) release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "CRD - calculated conditional release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "PED - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleDate": { + "type": "string", + "description": "NPD - calculated non-parole date for offender (relating to the 1991 act).", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryDate": { + "type": "string", + "description": "LED - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "PRRD - calculated post-recall release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "sentenceExpiryDate": { + "type": "string", + "description": "SED - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "TUSED - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "earlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "ERSED - Early Removal Scheme Eligibility Date", + "format": "date", + "example": "2020-02-03" + }, + "effectiveSentenceEndDate": { + "type": "string", + "description": "Effective sentence end date.", + "format": "date", + "example": "2020-02-03" + }, + "sentenceLength": { + "type": "string", + "description": "Sentence length in the format 00 years/00 months/00 days.", + "example": "11/00/00" + }, + "homeDetentionCurfewApprovedDate": { + "type": "string", + "description": "HDCAD - Home Detention Curfew Approved date", + "format": "date", + "example": "2020-02-03" + }, + "tariffDate": { + "type": "string", + "description": "Tarrif - Tarrif date", + "format": "date", + "example": "2020-02-03" + }, + "tariffExpiredRemovalSchemeEligibilityDate": { + "type": "string", + "description": "Tarrif Expiry date", + "format": "date", + "example": "2020-02-03" + }, + "approvedParoleDate": { + "type": "string", + "description": "APD - Approved Parole date", + "format": "date", + "example": "2020-02-03" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "ROTL = Release on temporary licence date", + "format": "date", + "example": "2020-02-03" + } + }, + "description": "Offender Key Dates" + }, + "RequestToUpdateOffenderDates": { + "required": [ + "calculationUuid", + "keyDates", + "submissionUser" + ], + "type": "object", + "properties": { + "calculationUuid": { + "type": "string", + "description": "UUID of the calculation performed by CRD.", + "format": "uuid" + }, + "calculationDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Timestamp when the calculation was performed", + "example": "2021-07-05T10:35:17" + }, + "submissionUser": { + "type": "string", + "description": "DPS/NOMIS user who submitted the calculated dates." + }, + "keyDates": { + "$ref": "#/components/schemas/OffenderKeyDates" + }, + "comment": { + "type": "string", + "description": "Comment to be associated with the sentence calculation, if not set a default comment is used" + }, + "reason": { + "type": "string", + "description": "The reason the sentence calculation was performed, if not set the default reason is used" + }, + "noDates": { + "type": "boolean", + "description": "Is true, when there are no dates to be recorded in NOMIS" + } + }, + "description": "Update Offender Dates Request" + }, + "OffenderCategorise": { + "required": [ + "bookingId", + "firstName", + "lastName", + "offenderNo", + "status" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number" + }, + "bookingId": { + "type": "integer", + "format": "int64" + }, + "firstName": { + "type": "string", + "description": "Prisoner First Name" + }, + "lastName": { + "type": "string", + "description": "Prisoner Last Name" + }, + "assessmentDate": { + "type": "string", + "description": "Categorisation date if any", + "format": "date" + }, + "approvalDate": { + "type": "string", + "description": "Date categorisation was approved if any", + "format": "date" + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number within booking", + "format": "int32" + }, + "assessmentTypeId": { + "type": "integer", + "description": "assessment type", + "format": "int64" + }, + "assessStatus": { + "type": "string", + "description": "Categorisation status", + "enum": [ + "P", + "A", + "I" + ] + }, + "categoriserFirstName": { + "type": "string", + "description": "Categoriser First Name" + }, + "categoriserLastName": { + "type": "string", + "description": "Categoriser Last Name" + }, + "approverFirstName": { + "type": "string", + "description": "Approver First Name if any" + }, + "approverLastName": { + "type": "string", + "description": "Approver Last Name if any" + }, + "category": { + "type": "string", + "description": "Categorisation" + }, + "nextReviewDate": { + "type": "string", + "description": "Next Review Date - for recategorisations", + "format": "date" + }, + "status": { + "type": "string", + "description": "Where in the categorisation workflow the prisoner is", + "enum": [ + "UNCATEGORISED", + "AWAITING_APPROVAL" + ] + } + }, + "description": "Prisoner with categorisation data" + }, + "CategorisationDetail": { + "required": [ + "bookingId", + "category", + "committee", + "placementAgencyId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "category": { + "type": "string", + "description": "Category code" + }, + "committee": { + "type": "string", + "description": "The assessment committee code (reference code in domain 'ASSESS_COMM')" + }, + "nextReviewDate": { + "type": "string", + "description": "Next review date for recategorisation, defaults to current date + 6 months, if not provided", + "format": "date" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Initial categorisation comment" + }, + "placementAgencyId": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The prison to be transferred to" + } + }, + "description": "Categorisation details" + }, + "OffenceToScheduleMappingDto": { + "required": [ + "offenceCode", + "schedule" + ], + "type": "object", + "properties": { + "offenceCode": { + "type": "string", + "description": "Offence code", + "example": "COML025" + }, + "schedule": { + "type": "string", + "description": "Schedule type", + "example": "SCHEDULE_15", + "enum": [ + "SCHEDULE_13", + "SCHEDULE_15", + "SCHEDULE_15_ATTRACTS_LIFE", + "SCHEDULE_17A_PART_1", + "SCHEDULE_17A_PART_2", + "SCHEDULE_19ZA", + "PCSC_SDS", + "PCSC_SDS_PLUS", + "PCSC_SEC_250" + ] + } + }, + "description": "Maps an offence to a schedule" + }, + "CreateExternalMovement": { + "required": [ + "bookingId", + "directionCode", + "fromAgencyId", + "movementReason", + "movementTime", + "movementType", + "toAgencyId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking id", + "format": "int64", + "example": 1 + }, + "fromAgencyId": { + "type": "string", + "description": "Agency location moving from", + "example": "MDI" + }, + "toAgencyId": { + "type": "string", + "description": "Agency location moving to", + "example": "OUT" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date time of movement", + "example": "2021-07-05T10:35:17" + }, + "movementType": { + "type": "string", + "description": "Type of movement", + "example": "TRN" + }, + "movementReason": { + "type": "string", + "description": "Movement reason", + "example": "SEC" + }, + "directionCode": { + "type": "string", + "description": "Direction code", + "example": "OUT", + "enum": [ + "IN", + "OUT" + ] + } + }, + "description": "Create external movement" + }, + "OffenderMovement": { + "required": [ + "bookingId", + "dateOfBirth", + "directionCode", + "firstName", + "fromAgency", + "fromAgencyDescription", + "lastName", + "movementDate", + "movementReason", + "movementReasonDescription", + "movementTime", + "movementType", + "movementTypeDescription", + "offenderNo", + "toAgency", + "toAgencyDescription" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number (UK is NOMS ID)" + }, + "bookingId": { + "type": "integer", + "format": "int64" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "firstName": { + "type": "string" + }, + "middleName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "fromAgency": { + "type": "string", + "description": "Agency travelling from" + }, + "fromAgencyDescription": { + "type": "string", + "description": "Description for Agency travelling from" + }, + "toAgency": { + "type": "string", + "description": "Agency travelling to" + }, + "toAgencyDescription": { + "type": "string", + "description": "Description for Agency travelling to" + }, + "movementType": { + "type": "string", + "description": "ADM (admission), CRT (court), REL (release), TAP (temporary absence) or TRN (transfer)", + "example": "ADM", + "enum": [ + "ADM", + "CRT", + "REL", + "TAP", + "TRN" + ] + }, + "movementTypeDescription": { + "type": "string", + "description": "Description of the movement type" + }, + "movementReason": { + "type": "string", + "description": "Reason code for the movement" + }, + "movementReasonDescription": { + "type": "string", + "description": "Description of the movement reason" + }, + "directionCode": { + "type": "string", + "description": "IN or OUT" + }, + "movementTime": { + "type": "string", + "description": "Movement time", + "format": "partial-time" + }, + "movementDate": { + "type": "string", + "description": "Movement date", + "format": "date" + } + }, + "description": "Prisoner Movement" + }, + "Movement": { + "required": [ + "createDateTime", + "directionCode", + "movementDate", + "movementReason", + "movementReasonCode", + "movementTime", + "movementType", + "movementTypeDescription", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number (UK is NOMS ID)" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Timestamp when the external movement record was created", + "example": "2021-07-05T10:35:17" + }, + "fromAgency": { + "type": "string", + "description": "Agency travelling from" + }, + "fromAgencyDescription": { + "type": "string", + "description": "Description of the agency travelling from" + }, + "toAgency": { + "type": "string", + "description": "Agency travelling to" + }, + "toAgencyDescription": { + "type": "string", + "description": "Description of the agency travelling to" + }, + "fromCity": { + "type": "string", + "description": "City offender was received from" + }, + "toCity": { + "type": "string", + "description": "City offender was sent to" + }, + "movementType": { + "type": "string", + "description": "ADM (admission), CRT (court), REL (release), TAP (temporary absence) or TRN (transfer)", + "example": "ADM", + "enum": [ + "ADM", + "CRT", + "REL", + "TAP", + "TRN" + ] + }, + "movementTypeDescription": { + "type": "string", + "description": "Description of the movement type" + }, + "directionCode": { + "type": "string", + "description": "IN or OUT" + }, + "movementDate": { + "type": "string", + "description": "Movement date", + "format": "date" + }, + "movementTime": { + "type": "string", + "description": "Movement time", + "format": "partial-time" + }, + "movementReason": { + "type": "string", + "description": "Description of movement reason" + }, + "movementReasonCode": { + "type": "string", + "description": "Code of movement reason" + }, + "commentText": { + "type": "string", + "description": "Comment" + } + }, + "description": "Prisoner Custody Status" + }, + "KeyWorkerAllocationDetail": { + "required": [ + "agencyId", + "assigned", + "bookingId", + "firstName", + "internalLocationDesc", + "lastName", + "offenderNo", + "staffId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender Booking Id", + "format": "int64" + }, + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference" + }, + "firstName": { + "type": "string", + "description": "First Name" + }, + "middleNames": { + "type": "string", + "description": "Middle Name(s)" + }, + "lastName": { + "type": "string", + "description": "Last Name" + }, + "staffId": { + "type": "integer", + "description": "The key worker's Staff Id", + "format": "int64" + }, + "agencyId": { + "type": "string", + "description": "Agency Id" + }, + "assigned": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time of the allocation", + "example": "2021-07-05T10:35:17" + }, + "internalLocationDesc": { + "type": "string", + "description": "Description of the location within the prison" + } + }, + "description": "Key worker allocation details" + }, + "OffenderKeyWorker": { + "required": [ + "active", + "agencyId", + "assigned", + "created", + "createdBy", + "offenderNo", + "staffId", + "userId" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference" + }, + "staffId": { + "type": "integer", + "description": "The key worker's Staff Id", + "format": "int64" + }, + "agencyId": { + "type": "string", + "description": "Agency Id" + }, + "assigned": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time allocation was assigned", + "example": "2021-07-05T10:35:17" + }, + "expired": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time allocation expired", + "example": "2021-07-05T10:35:17" + }, + "userId": { + "type": "string", + "description": "Username of user who processed allocation" + }, + "active": { + "type": "string", + "description": "Y" + }, + "created": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time allocation record was created", + "example": "2021-07-05T10:35:17" + }, + "createdBy": { + "type": "string", + "description": "Username of user who created allocation record" + }, + "modified": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time allocation record was last modified", + "example": "2021-07-05T10:35:17" + }, + "modifiedBy": { + "type": "string", + "description": "Username of user who last modified allocation record" + } + }, + "description": "Offender Key Worker record representation (to facilitate data migration)" + }, + "ImageDetail": { + "required": [ + "active", + "captureDate", + "captureDateTime", + "imageId", + "imageOrientation", + "imageType", + "imageView" + ], + "type": "object", + "properties": { + "imageId": { + "type": "integer", + "description": "Image ID", + "format": "int64", + "example": 2461788 + }, + "active": { + "type": "boolean", + "description": "An active image means that it is to be used and is current for the prisoner. An inactive image means that it has been superseded by another image or the image is no longer relevant.", + "example": false + }, + "captureDate": { + "type": "string", + "description": "Date of image capture", + "format": "date", + "example": "2008-08-27" + }, + "captureDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time of image capture", + "example": "2021-07-05T10:35:17" + }, + "imageView": { + "type": "string", + "description": "Image view information. Actual values extracted 10/05/2023, with the majority of values being FACE. This doesn't appear to be mapped to any REFERENCE_CODE data, even though there is a domain called IMAGE_VIEW.", + "example": "FACE", + "enum": [ + "OIC", + "FACE", + "TAT", + "MARK", + "SCAR", + "OTH" + ] + }, + "imageOrientation": { + "type": "string", + "description": "Orientation of the image. Actual values extracted 10/05/2023, with the majority of values being FRONT. This doesn't appear to be mapped to any REFERENCE_CODE data, even though there is a domain called PART_ORIENT.", + "example": "FRONT", + "enum": [ + "NECK", + "KNEE", + "TORSO", + "FACE", + "DAMAGE", + "INJURY", + "HAND", + "HEAD", + "THIGH", + "ELBOW", + "FOOT", + "INCIDENT", + "ARM", + "SHOULDER", + "ANKLE", + "FINGER", + "EAR", + "TOE", + "FIGHT", + "FRONT", + "LEG", + "LIP", + "NOSE" + ] + }, + "imageType": { + "type": "string", + "description": "Image Type. Actual values extracted 10/05/2023, with the majority of values being OFF_BKG. This doesn't appear to be mapped to any REFERENCE_CODE data.", + "example": "OFF_BKG", + "enum": [ + "OFF_IDM", + "OFF_BKG", + "OIC" + ] + }, + "objectId": { + "type": "integer", + "description": "Object ID", + "format": "int64" + } + }, + "description": "Image Detail" + }, + "TransferTransaction": { + "required": [ + "amount", + "client_transaction_id", + "client_unique_ref", + "description" + ], + "type": "object", + "properties": { + "amount": { + "minimum": 1, + "type": "integer", + "description": "Amount of transaction in pence, hence 1634 is £16.34", + "format": "int64", + "example": 1634 + }, + "description": { + "maxLength": 240, + "minLength": 1, + "type": "string", + "description": "Description of the Transaction", + "example": "Canteen Purchase of £16.34" + }, + "client_transaction_id": { + "maxLength": 12, + "minLength": 1, + "type": "string", + "description": "Client Transaction Id", + "example": "CL123212" + }, + "client_unique_ref": { + "maxLength": 64, + "minLength": 1, + "pattern": "[a-zA-Z0-9-_]+", + "type": "string", + "description": "A reference unique to the client making the post. Maximum size 64 characters, only alphabetic, numeric, '-' and '_' are allowed", + "example": "CLIENT121131-0_11" + } + }, + "description": "Transfer to Savings Transaction" + }, + "Education": { + "required": [ + "addresses", + "bookingId", + "isSpecialEducation", + "schedule", + "startDate" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 14 + }, + "startDate": { + "type": "string", + "description": "Start date of education", + "format": "date", + "example": "2018-02-11" + }, + "endDate": { + "type": "string", + "description": "End date of education", + "format": "date", + "example": "2020-02-11" + }, + "studyArea": { + "type": "string", + "description": "The area of study for the offender while in school.", + "example": "General Studies" + }, + "educationLevel": { + "type": "string", + "description": "The highest level attained for the educational period.", + "example": "Degree Level or Higher" + }, + "numberOfYears": { + "type": "integer", + "description": "The number of educational years completed.", + "format": "int32", + "example": 2 + }, + "graduationYear": { + "type": "string", + "description": "Year of graduation.", + "example": "2021" + }, + "comment": { + "type": "string", + "description": "Comment relating to education.", + "example": "The education is going well" + }, + "school": { + "type": "string", + "description": "Name of school attended.", + "example": "School of economics" + }, + "isSpecialEducation": { + "type": "boolean", + "description": "Whether this is special education", + "example": false + }, + "schedule": { + "type": "string", + "description": "The education schedule", + "example": "Full Time" + }, + "addresses": { + "type": "array", + "description": "A list of addresses associated with the education", + "items": { + "$ref": "#/components/schemas/AddressDto" + } + } + }, + "description": "Offender Education" + }, + "CaseNoteUsageRequest": { + "required": [ + "offenderNos" + ], + "type": "object", + "properties": { + "fromDate": { + "type": "string", + "description": "Only case notes occurring on or after this date (in YYYY-MM-DD format) will be considered. If not defined then the numMonth before the current date, unless a toDate is defined when it will be numMonths before toDate", + "format": "date", + "example": "2018-11-01" + }, + "toDate": { + "type": "string", + "description": "Only case notes occurring on or before this date (in YYYY-MM-DD format) will be considered. If not defined then the current date will be used, unless a fromDate is defined when it will be numMonths after fromDate", + "format": "date", + "example": "2018-12-01" + }, + "numMonths": { + "type": "integer", + "description": "Number of month to look forward (if fromDate only defined), or back (if toDate only defined). Default is 1 month", + "format": "int32", + "example": 2 + }, + "offenderNos": { + "type": "array", + "description": "a list of offender numbers to search.", + "items": { + "type": "string", + "description": "a list of offender numbers to search." + } + }, + "staffId": { + "type": "integer", + "description": "staff Id to use in search (optional).", + "format": "int32", + "example": 223423 + }, + "type": { + "type": "string", + "description": "Case note type.", + "example": "KA" + }, + "subType": { + "type": "string", + "description": "Case note sub-type.", + "example": "KS" + }, + "agencyId": { + "type": "string", + "description": "Optional agency Id to filter by", + "example": "MDI" + } + }, + "description": "Case Note Type Usage Request" + }, + "CaseNoteUsage": { + "required": [ + "caseNoteSubType", + "caseNoteType", + "latestCaseNote", + "numCaseNotes", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender No", + "example": "ZWE12A" + }, + "caseNoteType": { + "type": "string", + "description": "Case Note Type", + "example": "KA" + }, + "caseNoteSubType": { + "type": "string", + "description": "Case Note Sub Type", + "example": "KS" + }, + "numCaseNotes": { + "type": "integer", + "description": "Number of case notes of this type/subtype", + "format": "int32", + "example": 5 + }, + "latestCaseNote": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Last case note of this type", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Case Note Type Usage" + }, + "BookingFromDatePair": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "fromDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Only case notes occurring on or after this date (in YYYY-MM-DDTHH:MM:SS format) will be considered.", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Booking Id to case note from date pair" + }, + "CaseNoteTypeSummaryRequest": { + "required": [ + "bookingFromDateSelection" + ], + "type": "object", + "properties": { + "bookingFromDateSelection": { + "type": "array", + "description": "a list of booking id to from date to search. Only case notes occurring on or after this date (in YYYY-MM-DD format) will be considered", + "items": { + "$ref": "#/components/schemas/BookingFromDatePair" + } + }, + "types": { + "type": "array", + "description": "Case note types", + "items": { + "type": "string", + "description": "Case note types" + } + } + }, + "description": "Case Note Type Usage Request by Date grouped by bookings" + }, + "CaseNoteTypeCount": { + "required": [ + "bookingId", + "caseNoteSubType", + "caseNoteType", + "numCaseNotes" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64", + "example": 12345678 + }, + "caseNoteType": { + "type": "string", + "description": "Case Note Type", + "example": "POS" + }, + "caseNoteSubType": { + "type": "string", + "description": "Case Note Sub Type", + "example": "IEP_ENC" + }, + "numCaseNotes": { + "type": "integer", + "description": "Number of case notes of this type and subtype", + "format": "int64", + "example": 5 + } + }, + "description": "Case Note Type Counts By Booking Id, type and sub type" + }, + "CaseNoteStaffUsageRequest": { + "required": [ + "staffIds" + ], + "type": "object", + "properties": { + "staffIds": { + "type": "array", + "description": "a list of staff numbers to search.", + "items": { + "type": "integer", + "description": "a list of staff numbers to search.", + "format": "int32" + } + }, + "numMonths": { + "type": "integer", + "description": "Number of month to look forward (if fromDate only defined), or back (if toDate only defined). Default is 1 month", + "format": "int32" + }, + "fromDate": { + "type": "string", + "description": "Only case notes occurring on or after this date (in YYYY-MM-DD format) will be considered. If not defined then the numMonth before the current date, unless a toDate is defined when it will be numMonths before toDate", + "format": "date" + }, + "toDate": { + "type": "string", + "description": "Only case notes occurring on or before this date (in YYYY-MM-DD format) will be considered. If not defined then the current date will be used, unless a fromDate is defined when it will be numMonths after fromDate", + "format": "date" + }, + "type": { + "type": "string", + "description": "Case note type." + }, + "subType": { + "type": "string", + "description": "Case note sub-type." + } + }, + "description": "Case Note Type Staff Usage Request" + }, + "CaseNoteStaffUsage": { + "required": [ + "caseNoteSubType", + "caseNoteType", + "latestCaseNote", + "numCaseNotes", + "staffId" + ], + "type": "object", + "properties": { + "staffId": { + "type": "integer", + "description": "Staff ID", + "format": "int32", + "example": 2341232 + }, + "caseNoteType": { + "type": "string", + "description": "Case Note Type", + "example": "KA" + }, + "caseNoteSubType": { + "type": "string", + "description": "Case Note Sub Type", + "example": "KS" + }, + "numCaseNotes": { + "type": "integer", + "description": "Number of case notes of this type/subtype", + "format": "int32", + "example": 5 + }, + "latestCaseNote": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Last case note of this type", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Case Note Type Staff Usage" + }, + "SchedulePrisonToPrisonMove": { + "required": [ + "escortType", + "fromPrisonLocation", + "scheduledMoveDateTime", + "toPrisonLocation" + ], + "type": "object", + "properties": { + "fromPrisonLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The prison (agency code) to be moved from.", + "example": "LEI" + }, + "toPrisonLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The prison (agency code) to be moved to.", + "example": "PVI" + }, + "escortType": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "The escort type of the move.", + "example": "PECS" + }, + "scheduledMoveDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time of the move in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + } + }, + "description": "The prison to prison move to be scheduled for the offender booking." + }, + "ScheduledPrisonToPrisonMove": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The identifier for the scheduled prison to prison move.", + "format": "int64", + "example": 123456789 + }, + "scheduledMoveDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and start time of the move in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "fromPrisonLocation": { + "$ref": "#/components/schemas/Agency" + }, + "toPrisonLocation": { + "$ref": "#/components/schemas/Agency" + } + }, + "description": "Represents the data for a scheduled prison to prison move." + }, + "PrisonToCourtHearing": { + "required": [ + "courtHearingDateTime", + "fromPrisonLocation", + "toCourtLocation" + ], + "type": "object", + "properties": { + "fromPrisonLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The prison (agency code) where the offender will be moved from.", + "example": "LEI" + }, + "toCourtLocation": { + "maxLength": 6, + "minLength": 0, + "type": "string", + "description": "The court (agency code) where the offender will moved to.", + "example": "LEEDCC" + }, + "courtHearingDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The future date and time of the court hearing in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "comments": { + "maxLength": 240, + "minLength": 0, + "type": "string", + "description": "Any comments related to the court case.", + "example": "Restricted access to parking level." + } + }, + "description": "The prison to court hearing to be scheduled for the offender booking." + }, + "CreatePersonalCareNeed": { + "required": [ + "commentText", + "problemCode", + "problemStatus", + "startDate" + ], + "type": "object", + "properties": { + "problemCode": { + "type": "string", + "description": "Problem Code", + "example": "ACCU9" + }, + "problemStatus": { + "type": "string", + "description": "Problem Status", + "example": "ON" + }, + "commentText": { + "type": "string", + "description": "Comment text", + "example": "Preg, acc under 9mths" + }, + "startDate": { + "type": "string", + "description": "Start Date", + "format": "date", + "example": "2010-06-21" + }, + "endDate": { + "type": "string", + "description": "End Date", + "format": "date", + "example": "2010-06-21" + } + }, + "description": "Personal Care Need" + }, + "NewAppointment": { + "required": [ + "appointmentType", + "locationId", + "startTime" + ], + "type": "object", + "properties": { + "appointmentType": { + "maxLength": 12, + "minLength": 0, + "pattern": "\\w*", + "type": "string", + "description": "Corresponds to the scheduled event subType" + }, + "locationId": { + "type": "integer", + "description": "Location at which the appointment takes place.", + "format": "int64" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event ends", + "example": "2021-07-05T10:35:17" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Details of appointment" + } + }, + "description": "Creation details for a new appointment" + }, + "ScheduledEvent": { + "required": [ + "bookingId", + "eventClass", + "eventDate", + "eventSource", + "eventStatus", + "eventSubType", + "eventSubTypeDesc", + "eventType", + "eventTypeDesc" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id", + "format": "int64" + }, + "eventClass": { + "type": "string", + "description": "Class of event" + }, + "eventId": { + "type": "integer", + "description": "Activity id if any. Used to attend or pay an activity.", + "format": "int64" + }, + "eventStatus": { + "type": "string", + "description": "Status of event" + }, + "eventType": { + "type": "string", + "description": "Type of scheduled event (as a code)" + }, + "eventTypeDesc": { + "type": "string", + "description": "Description of scheduled event type" + }, + "eventSubType": { + "type": "string", + "description": "Sub type (or reason) of scheduled event (as a code)" + }, + "eventSubTypeDesc": { + "type": "string", + "description": "Description of scheduled event sub type" + }, + "eventDate": { + "type": "string", + "description": "Date on which event occurs", + "format": "date" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event ends", + "example": "2021-07-05T10:35:17" + }, + "eventLocation": { + "type": "string", + "description": "Location at which event takes place (could be an internal location, agency or external address)." + }, + "eventLocationId": { + "type": "integer", + "description": "Id of an internal event location", + "format": "int64" + }, + "agencyId": { + "type": "string", + "description": "The agency ID for the booked internal location", + "example": "WWI" + }, + "eventSource": { + "type": "string", + "description": "Code identifying underlying source of event data" + }, + "eventSourceCode": { + "type": "string", + "description": "Source-specific code for the type or nature of the event" + }, + "eventSourceDesc": { + "type": "string", + "description": "Source-specific description for type or nature of the event" + }, + "eventOutcome": { + "type": "string", + "description": "Activity attendance, possible values are the codes in the 'PS_PA_OC' reference domain." + }, + "performance": { + "type": "string", + "description": "Activity performance, possible values are the codes in the 'PERFORMANCE' reference domain." + }, + "outcomeComment": { + "type": "string", + "description": "Activity no-pay reason." + }, + "paid": { + "type": "boolean", + "description": "Activity paid flag." + }, + "payRate": { + "type": "number", + "description": "Amount paid per activity session in pounds" + }, + "locationCode": { + "type": "string", + "description": "The code for the activity location" + }, + "createUserId": { + "type": "string", + "description": "Staff member who created the appointment" + } + }, + "description": "Scheduled Event" + }, + "CreateAlert": { + "required": [ + "alertCode", + "alertDate", + "alertType", + "comment" + ], + "type": "object", + "properties": { + "alertType": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Code identifying type of alert", + "example": "X" + }, + "alertCode": { + "maxLength": 12, + "minLength": 0, + "type": "string", + "description": "Code identifying the sub type of alert", + "example": "XEL" + }, + "comment": { + "maxLength": 1000, + "minLength": 0, + "type": "string", + "description": "Free Text Comment", + "example": "has a large poster on cell wall" + }, + "alertDate": { + "type": "string", + "description": "Date the alert became effective", + "format": "date", + "example": "2019-02-13" + }, + "expiryDate": { + "type": "string", + "description": "Date the alert should expire", + "format": "date", + "example": "2099-02-13" + } + }, + "description": "Alert details" + }, + "AlertCreated": { + "type": "object", + "properties": { + "alertId": { + "type": "integer", + "format": "int64" + } + } + }, + "InmateBasicDetails": { + "required": [ + "agencyId", + "bookingId", + "bookingNo", + "dateOfBirth", + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender Booking Id", + "format": "int64", + "example": 432132 + }, + "bookingNo": { + "type": "string", + "description": "Booking Number" + }, + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference", + "example": "A1234AA" + }, + "firstName": { + "type": "string", + "description": "First Name" + }, + "middleName": { + "type": "string", + "description": "Middle Name(s)" + }, + "lastName": { + "type": "string", + "description": "Last Name" + }, + "agencyId": { + "type": "string", + "description": "Identifier of agency to which the prisoner is associated." + }, + "assignedLivingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that prisoner is assigned to.", + "format": "int64" + }, + "assignedLivingUnitDesc": { + "type": "string", + "description": "Description of living unit (e.g. cell) that offender is assigned to.", + "example": "MDI-1-1-3" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth of prisoner", + "format": "date", + "example": "1970-03-15" + } + }, + "description": "Offender basic detail" + }, + "PersonalCareNeeds": { + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender No" + }, + "personalCareNeeds": { + "type": "array", + "description": "Personal Care Needs", + "items": { + "$ref": "#/components/schemas/PersonalCareNeed" + } + } + }, + "description": "Personal Care Needs" + }, + "PersonalCareCounterDto": { + "required": [ + "offenderNo", + "size" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number" + }, + "size": { + "type": "integer", + "description": "Number of health problems records in set time", + "format": "int32" + } + } + }, + "OffenceDetail": { + "required": [ + "bookingId", + "offenceCode", + "offenceDescription", + "statuteCode" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Prisoner booking id", + "format": "int64", + "example": 1123456 + }, + "offenceDescription": { + "type": "string", + "description": "Description of offence" + }, + "offenceCode": { + "type": "string", + "description": "Reference Code", + "example": "RR84070" + }, + "statuteCode": { + "type": "string", + "description": "Statute code", + "example": "RR84" + } + }, + "description": "Offence Details" + }, + "CourtEventOutcome": { + "required": [ + "bookingId", + "eventId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The booking id", + "format": "int64", + "example": 438934 + }, + "eventId": { + "type": "integer", + "description": "The court event identifier", + "format": "int64", + "example": 201206 + }, + "outcomeReasonCode": { + "type": "string", + "description": "The court event outcome reason code", + "example": "5500" + } + }, + "description": "Court event outcome" + }, + "AppointmentDefaults": { + "required": [ + "appointmentType", + "locationId", + "startTime" + ], + "type": "object", + "properties": { + "appointmentType": { + "maxLength": 12, + "minLength": 0, + "pattern": "\\w*", + "type": "string", + "description": "The scheduled event subType", + "example": "ACTI" + }, + "locationId": { + "type": "integer", + "description": "The identifier of the appointments' Location. The location must be situated in the requestor's case load.", + "format": "int64", + "example": 25 + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time at which the appointments start. ISO 8601 Date-time format. startTime must be in the future.", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time at which the appointments end. ISO 8601 Date-time format. endTime, if present, must be later than startTime.", + "example": "2021-07-05T10:35:17" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "A comment that applies to all the appointments in this request.", + "example": "Please provide helpful supporting text when it applies to all the appointments specified by this request." + } + }, + "description": "Default values to be applied when creating each appointment" + }, + "AppointmentDetails": { + "required": [ + "bookingId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The Booking id of the offender for whom the appointment is to be created.", + "format": "int64", + "example": 123456 + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "A replacement for the default startTime. ISO 8601 date-time format. This value, when present, must be in the future.", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "A replacement for the default endTime. ISO 8601 date-time format. This value, when present, must be later than the default startTime, or the startTime in this object if it is defined.", + "example": "2021-07-05T10:35:17" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "The Appointment's details. When present this value replaces the default comment.", + "example": "Please provide helpful supporting text relevant to this particular appointment when the default comment is not suitable." + } + }, + "description": "Detail for creating an appointment for a particular bookingId where values should differ from the defaults" + }, + "AppointmentsToCreate": { + "required": [ + "appointmentDefaults", + "appointments" + ], + "type": "object", + "properties": { + "appointmentDefaults": { + "$ref": "#/components/schemas/AppointmentDefaults" + }, + "appointments": { + "type": "array", + "description": "The details for creating each appointment. A Missing value falls back to the default value if present. Mandatory, but an empty list is accepted.", + "items": { + "$ref": "#/components/schemas/AppointmentDetails" + } + }, + "repeat": { + "$ref": "#/components/schemas/Repeat" + } + }, + "description": "Details for creating appointments in bulk" + }, + "Repeat": { + "required": [ + "count", + "repeatPeriod" + ], + "type": "object", + "properties": { + "repeatPeriod": { + "type": "string", + "description": "The period at which the appointment should repeat.", + "example": "WEEKLY", + "enum": [ + "DAILY", + "WEEKDAYS", + "WEEKLY", + "FORTNIGHTLY", + "MONTHLY" + ] + }, + "count": { + "minimum": 1, + "type": "integer", + "description": "The total number of appointments. Must be greater than 0", + "format": "int32" + } + }, + "description": "If present specifies the number of times to repeat the appointments and the period of the repeat" + }, + "CreatedAppointmentDetails": { + "required": [ + "bookingId", + "locationId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The Booking id of the offender for whom the appointment was created.", + "format": "int64", + "example": 123456 + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The start time of the appointment.", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The end time of the appointment.", + "example": "2021-07-05T10:35:17" + }, + "appointmentEventId": { + "type": "integer", + "format": "int64" + }, + "appointmentType": { + "type": "string", + "description": "The scheduled event subType", + "example": "ACTI" + }, + "locationId": { + "type": "integer", + "description": "The identifier of the appointments' Location. The location must be situated in the requestor's case load.", + "format": "int64", + "example": 25 + } + }, + "description": "The details of an appointment that has just been created" + }, + "RequestToCreateAgency": { + "required": [ + "agencyId", + "agencyType", + "courtType", + "description" + ], + "type": "object", + "properties": { + "agencyId": { + "pattern": "^[a-zA-Z0-9]+$", + "type": "string", + "description": "Agency identifier.", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Agency description.", + "example": "Moorland (HMP & YOI)" + }, + "longDescription": { + "type": "string", + "description": "Long description of the agency", + "example": "Moorland (HMP & YOI)" + }, + "agencyType": { + "pattern": "^[a-zA-Z0-9]+$", + "type": "string", + "description": "Agency type. Reference domain is AGY_LOC_TYPE", + "example": "INST", + "enum": [ + "CRC", + "POLSTN", + "INST", + "COMM", + "APPR", + "CRT", + "POLICE", + "IMDC", + "TRN", + "OUT", + "YOT", + "SCH", + "STC", + "HOST", + "AIRPORT", + "HSHOSP", + "HOSPITAL", + "PECS", + "PAR", + "PNP", + "PSY" + ] + }, + "courtType": { + "pattern": "^[a-zA-Z0-9]+$", + "type": "string", + "description": "Court Type. Reference domain is JURISDICTION", + "example": "CC", + "enum": [ + "CACD", + "CB", + "CC", + "CO", + "DCM", + "GCM", + "IMM", + "MC", + "OTHER", + "YC" + ] + }, + "active": { + "type": "boolean", + "description": "Indicates the Agency is active. Note: if set false, the current date will be the deactivation date", + "example": true + } + }, + "description": "Create Agency Request" + }, + "VisitSlotCapacity": { + "type": "object", + "properties": { + "time": { + "type": "string", + "description": "Time", + "example": "2019-01-01T13:30/16:00" + }, + "capacity": { + "type": "integer", + "description": "Capacity", + "format": "int64", + "example": 402 + }, + "max_groups": { + "type": "integer", + "description": "Max Groups", + "format": "int64", + "example": 999 + }, + "max_adults": { + "type": "integer", + "description": "Max Adults", + "format": "int64", + "example": 999 + }, + "groups_booked": { + "type": "integer", + "description": "Groups Booked", + "format": "int64", + "example": 5 + }, + "visitors_booked": { + "type": "integer", + "description": "Visitors Booked", + "format": "int64", + "example": 6 + }, + "adults_booked": { + "type": "integer", + "description": "Adults Booked", + "format": "int64", + "example": 7 + } + }, + "description": "Visit slots Details " + }, + "VisitSlots": { + "type": "object", + "properties": { + "slots": { + "type": "array", + "description": "List of visit slots with capacity", + "items": { + "$ref": "#/components/schemas/VisitSlotCapacity" + } + } + }, + "description": "Visit slots with capacity" + }, + "AccountTransaction": { + "required": [ + "amount", + "date", + "description", + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Transaction ID", + "example": "204564839-3" + }, + "type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "description": { + "type": "string", + "description": "Transaction description", + "example": "Transfer In Regular from caseload PVR" + }, + "amount": { + "type": "integer", + "description": "Amount in pence", + "format": "int64", + "example": 12345 + }, + "date": { + "type": "string", + "description": "Date of the transaction", + "format": "date", + "example": "2016-10-21" + } + }, + "description": "Account Transaction" + }, + "Hold": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Description", + "example": "Hold via API" + }, + "amount": { + "type": "integer", + "description": "Amount in pence", + "format": "int64", + "example": 150 + }, + "hold_number": { + "type": "integer", + "description": "Hold Number", + "format": "int64", + "example": 6185835 + }, + "client_unique_ref": { + "type": "string", + "description": "Client unique reference", + "example": "jerkincrocus" + }, + "reference_no": { + "type": "string", + "description": "Reference number", + "example": "TEST0075" + }, + "entry_date": { + "type": "string", + "description": "Entry date", + "format": "date", + "example": "2017-06-23" + }, + "hold_until_date": { + "type": "string", + "description": "Hold until date", + "format": "date", + "example": "2017-07-07" + } + }, + "description": "Hold Response" + }, + "AccountBalance": { + "type": "object", + "properties": { + "spends": { + "type": "integer", + "description": "Spends balance", + "format": "int64", + "example": 5678 + }, + "savings": { + "type": "integer", + "description": "Saving balance", + "format": "int64", + "example": 12344 + }, + "cash": { + "type": "integer", + "description": "Cash balance", + "format": "int64", + "example": 13565 + } + }, + "description": "Account Balance" + }, + "AccountTransactions": { + "type": "object", + "properties": { + "transactions": { + "type": "array", + "description": "List of account transactions", + "items": { + "$ref": "#/components/schemas/AccountTransaction" + } + } + }, + "description": "Account Transactions" + }, + "LiveRoll": { + "type": "object", + "properties": { + "noms_ids": { + "type": "array", + "description": "Noms Ids", + "items": { + "type": "string", + "description": "Noms Ids" + } + } + }, + "description": "Live Roll" + }, + "UnavailabilityReason": { + "type": "object", + "properties": { + "external_movement": { + "type": "boolean", + "description": "External Movement", + "example": true + }, + "existing_visits": { + "type": "array", + "description": "Existing Visits", + "items": { + "$ref": "#/components/schemas/Visit" + } + }, + "out_of_vo": { + "type": "boolean", + "description": "Out of Vo", + "example": true + }, + "banned": { + "type": "boolean", + "description": "Banned", + "example": true + } + }, + "description": "Date Unavailability Reasons" + }, + "Visit": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Id", + "format": "int64", + "example": 123456 + }, + "slot": { + "type": "string", + "description": "Slot", + "example": "2019-01-01T13:30/16:00" + } + }, + "description": "Visit Details" + }, + "ContactList": { + "type": "object", + "properties": { + "contacts": { + "type": "array", + "description": "Available Dates", + "items": { + "$ref": "#/components/schemas/ContactPerson" + } + } + }, + "description": "Contact List" + }, + "ContactPerson": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "ID", + "format": "int64", + "example": 1234567 + }, + "given_name": { + "type": "string", + "description": "Given Name", + "example": "JENNIFER" + }, + "middle_names": { + "type": "string", + "description": "Middle Names", + "example": "ESMERALADA JANE" + }, + "surname": { + "type": "string", + "description": "Last Name", + "example": "HALLIBUT" + }, + "date_of_birth": { + "type": "string", + "description": "Date of Birth", + "format": "date", + "example": "1970-01-01" + }, + "gender": { + "$ref": "#/components/schemas/CodeDescription" + }, + "relationship type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "contact type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "approved visitor": { + "type": "boolean", + "description": "Approved Visitor" + }, + "active": { + "type": "boolean", + "description": "Active" + }, + "restrictions": { + "type": "array", + "description": "Restrictions", + "items": { + "$ref": "#/components/schemas/VisitRestriction" + } + } + }, + "description": "Contact Person" + }, + "VisitRestriction": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "effective_date": { + "type": "string", + "description": "Effective Date", + "format": "date", + "example": "2019-01-01" + }, + "expiry_date": { + "type": "string", + "description": "Expiry Date", + "format": "date", + "example": "2019-01-01" + }, + "comment_text": { + "type": "string", + "description": "Comment Text" + } + }, + "description": "Visit Restriction" + }, + "AvailableDates": { + "type": "object", + "properties": { + "dates": { + "type": "array", + "description": "Available Dates", + "items": { + "type": "string", + "description": "Available Dates", + "format": "date" + } + } + }, + "description": "Available Dates" + }, + "Language": { + "type": "object", + "properties": { + "preferred_spoken": { + "$ref": "#/components/schemas/CodeDescription" + }, + "interpreter_required": { + "type": "boolean", + "description": "whether an interpreter is required", + "example": true + } + }, + "description": "Language" + }, + "Offender": { + "type": "object", + "properties": { + "given_name": { + "type": "string", + "description": "Given Name", + "example": "JENNIFER" + }, + "middle_names": { + "type": "string", + "description": "Middle Names", + "example": "ESMERALADA JANE" + }, + "surname": { + "type": "string", + "description": "Last Name", + "example": "HALLIBUT" + }, + "title": { + "type": "string", + "description": "Title", + "example": "MR" + }, + "suffix": { + "type": "string", + "description": "Suffix" + }, + "date_of_birth": { + "type": "string", + "description": "Date of Birth", + "format": "date", + "example": "1970-01-01" + }, + "aliases": { + "type": "array", + "description": "List of offender’s aliases", + "items": { + "$ref": "#/components/schemas/OffenderAlias" + } + }, + "gender": { + "$ref": "#/components/schemas/CodeDescription" + }, + "nationalities": { + "type": "string", + "description": "Nationalities" + }, + "religion": { + "$ref": "#/components/schemas/CodeDescription" + }, + "ethnicity": { + "$ref": "#/components/schemas/CodeDescription" + }, + "language": { + "$ref": "#/components/schemas/Language" + }, + "csra": { + "$ref": "#/components/schemas/CodeDescription" + }, + "convicted": { + "type": "boolean", + "description": "indicates whether the offender has been convicted or is on remand", + "example": true + }, + "pnc_number": { + "type": "string", + "description": "PNC Number", + "example": "96/346527V" + }, + "cro_number": { + "type": "string", + "description": "CRO Number", + "example": "ADF567890" + }, + "imprisonment_status": { + "$ref": "#/components/schemas/CodeDescription" + }, + "iep_level": { + "$ref": "#/components/schemas/CodeDescription" + }, + "diet": { + "$ref": "#/components/schemas/CodeDescription" + }, + "security_category": { + "$ref": "#/components/schemas/CodeDescription" + } + }, + "description": "Offender" + }, + "OffenderAlias": { + "type": "object", + "properties": { + "given_name": { + "type": "string", + "description": "Given Name", + "example": "JENNIFER" + }, + "middle_names": { + "type": "string", + "description": "Middle Names", + "example": "ESMERALADA JANE" + }, + "surname": { + "type": "string", + "description": "Surname", + "example": "HALLIBUT" + }, + "date_of_birth": { + "type": "string", + "description": "Date of Birth", + "format": "date", + "example": "1970-01-01" + } + }, + "description": "Offender Alias" + }, + "Event": { + "required": [ + "id", + "noms_id", + "prison_id", + "timestamp", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of event", + "example": "IEP_CHANGED" + }, + "id": { + "type": "integer", + "description": "Unique indentifier for event", + "format": "int64", + "example": 21 + }, + "noms_id": { + "type": "string", + "description": "Offender Noms Id", + "example": "A1417AE" + }, + "prison_id": { + "type": "string", + "description": "Prison ID", + "example": "BMI" + }, + "timestamp": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the event occurred", + "example": "2021-07-05T10:35:17" + }, + "eventData": { + "type": "string" + } + }, + "description": "Offender Event" + }, + "Location": { + "required": [ + "agencyId", + "description", + "locationId", + "locationType" + ], + "type": "object", + "properties": { + "locationId": { + "type": "integer", + "description": "Location identifier.", + "format": "int64" + }, + "locationType": { + "type": "string", + "description": "Location type." + }, + "description": { + "type": "string", + "description": "Location description." + }, + "locationUsage": { + "type": "string", + "description": "What events this room can be used for." + }, + "agencyId": { + "type": "string", + "description": "Identifier of Agency this location is associated with." + }, + "parentLocationId": { + "type": "integer", + "description": "Identifier of this location's parent location.", + "format": "int64" + }, + "currentOccupancy": { + "type": "integer", + "description": "Current occupancy of location.", + "format": "int32" + }, + "locationPrefix": { + "type": "string", + "description": "Location prefix. Defines search prefix that will constrain search to this location and its subordinate locations." + }, + "operationalCapacity": { + "type": "integer", + "description": "Operational capacity of the location.", + "format": "int32" + }, + "userDescription": { + "type": "string", + "description": "User-friendly location description." + }, + "internalLocationCode": { + "type": "string" + }, + "subLocations": { + "type": "boolean", + "description": "Indicates that sub locations exist for this location e.g. landings or cells" + } + }, + "description": "Location Details" + }, + "Image": { + "type": "object", + "properties": { + "image": { + "type": "string", + "description": "Base64 Encoded JPEG data", + "example": "" + } + }, + "description": "Prisoner Photo" + }, + "Booking": { + "required": [ + "booking_active", + "booking_no", + "booking_started" + ], + "type": "object", + "properties": { + "location": { + "$ref": "#/components/schemas/Location" + }, + "booking_no": { + "type": "string", + "description": "Bookings", + "example": "A12313" + }, + "booking_started": { + "type": "string", + "description": "Start Date of Booking", + "format": "date", + "example": "2017-02-04" + }, + "booking_ended": { + "type": "string", + "description": "End date of Booking", + "format": "date", + "example": "2019-06-04" + }, + "booking_active": { + "type": "boolean", + "description": "Booking Active?", + "example": true + }, + "release_date": { + "type": "string", + "description": "Release Date", + "format": "date", + "example": "2019-02-04" + }, + "legal_cases": { + "type": "array", + "description": "Legal Cases", + "items": { + "$ref": "#/components/schemas/LegalCase" + } + } + }, + "description": "Offender Booking" + }, + "Bookings": { + "type": "object", + "properties": { + "bookings": { + "type": "array", + "description": "Bookings", + "items": { + "$ref": "#/components/schemas/Booking" + } + } + }, + "description": "Bookings" + }, + "Charge": { + "type": "object", + "properties": { + "statute": { + "$ref": "#/components/schemas/CodeDescription" + }, + "offence": { + "$ref": "#/components/schemas/CodeDescription" + }, + "most_serious": { + "type": "boolean", + "description": "Most Serious Offence ", + "example": true + }, + "charge_active": { + "type": "boolean", + "description": "Charge Active", + "example": true + }, + "severity_ranking": { + "type": "string", + "description": "Severity Ranking", + "example": "100" + }, + "result": { + "$ref": "#/components/schemas/CodeDescription" + }, + "disposition": { + "$ref": "#/components/schemas/CodeDescription" + }, + "convicted": { + "type": "boolean", + "description": "Convicted", + "example": true + }, + "imprisonment_status": { + "$ref": "#/components/schemas/CodeDescription" + }, + "band": { + "$ref": "#/components/schemas/CodeDescription" + } + }, + "description": "Offender Charge" + }, + "LegalCase": { + "type": "object", + "properties": { + "case_info_number": { + "type": "string", + "description": "Case Information Number", + "example": "1254232" + }, + "case_active": { + "type": "boolean", + "description": "Case Active", + "example": true + }, + "case_started": { + "type": "string", + "description": "Case Started Date", + "format": "date", + "example": "2019-01-17" + }, + "court": { + "$ref": "#/components/schemas/CodeDescription" + }, + "legal_case_type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "charges": { + "type": "array", + "description": "Charges", + "items": { + "$ref": "#/components/schemas/Charge" + } + } + }, + "description": "Legal Case" + }, + "AlertV1": { + "required": [ + "alert_date", + "alert_sub_type", + "alert_type" + ], + "type": "object", + "properties": { + "alert_type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "alert_sub_type": { + "$ref": "#/components/schemas/CodeDescription" + }, + "alert_date": { + "type": "string", + "description": "Date the alert became effective", + "format": "date", + "example": "2019-02-13" + }, + "expiry_date": { + "type": "string", + "description": "Alert Type", + "format": "date", + "example": "2019-04-15" + }, + "status": { + "type": "string", + "description": "ACTIVE or INACTIVE (Inactive alerts will have a expiry date of today or earlier", + "example": "ACTIVE", + "enum": [ + "ACTIVE,INACTIVE" + ] + }, + "comment": { + "type": "string", + "description": "Free Text Comment", + "example": "has a large poster on cell wall" + } + }, + "description": "Offender Alert" + }, + "Alerts": { + "type": "object", + "properties": { + "alerts": { + "type": "array", + "description": "Alerts", + "items": { + "$ref": "#/components/schemas/AlertV1" + } + } + }, + "description": "Alerts" + }, + "Events": { + "type": "object", + "properties": { + "events": { + "type": "array", + "description": "Events", + "items": { + "$ref": "#/components/schemas/Event" + } + } + }, + "description": "Events" + }, + "ActiveOffender": { + "type": "object", + "properties": { + "found": { + "type": "boolean", + "description": "found", + "example": true + }, + "offender": { + "$ref": "#/components/schemas/OffenderId" + } + }, + "description": "Active Offender" + }, + "OffenderId": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "ID", + "format": "int64", + "example": 1234567 + } + }, + "description": "offender ID" + }, + "UserRole": { + "required": [ + "roleCode", + "roleId", + "roleName" + ], + "type": "object", + "properties": { + "roleId": { + "type": "integer", + "description": "Role Id", + "format": "int64" + }, + "roleCode": { + "type": "string", + "description": "code for this role" + }, + "roleName": { + "type": "string", + "description": "Full text description of the role type" + }, + "parentRoleCode": { + "type": "string", + "description": "role code of the parent role" + }, + "caseloadId": { + "type": "string", + "description": "caseload that this role belongs to, (NOMIS only)" + } + }, + "description": "User Role" + }, + "StaffDetail": { + "required": [ + "firstName", + "lastName", + "staffId", + "status" + ], + "type": "object", + "properties": { + "staffId": { + "type": "integer", + "description": "Unique identifier for staff member.", + "format": "int64", + "example": 423142 + }, + "firstName": { + "type": "string", + "description": "Staff member's first name.", + "example": "JOHN" + }, + "lastName": { + "type": "string", + "description": "Staff member's last name.", + "example": "SMITH" + }, + "status": { + "type": "string", + "description": "Status of staff member.", + "example": "ACTIVE", + "enum": [ + "ACTIVE", + "INACTIVE" + ] + }, + "thumbnailId": { + "type": "integer", + "description": "Identifier for staff member image.", + "format": "int64", + "example": 231232 + }, + "gender": { + "type": "string", + "description": "Gender of Staff Member", + "example": "M", + "enum": [ + "M", + "F", + "NK", + "NS", + "REF" + ] + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth of Staff Member", + "format": "date", + "example": "1970-01-02" + } + }, + "description": "Staff Details" + }, + "StaffRole": { + "required": [ + "role" + ], + "type": "object", + "properties": { + "role": { + "type": "string", + "description": "A code that defines staff member's role at agency." + }, + "roleDescription": { + "type": "string", + "description": "Description of staff member's role at agency." + } + }, + "description": "Staff Role" + }, + "StaffLocationRole": { + "required": [ + "agencyId", + "firstName", + "fromDate", + "lastName", + "position", + "role", + "staffId", + "status" + ], + "type": "object", + "properties": { + "staffId": { + "type": "integer", + "description": "Unique identifier for staff member.", + "format": "int64", + "example": 242342 + }, + "firstName": { + "type": "string", + "description": "Staff member's first name.", + "example": "JOHN" + }, + "lastName": { + "type": "string", + "description": "Staff member's last name.", + "example": "SMITH" + }, + "status": { + "type": "string", + "description": "Status of staff member.", + "example": "ACTIVE", + "enum": [ + "ACTIVE", + "INACTIVE" + ] + }, + "thumbnailId": { + "type": "integer", + "description": "Identifier for staff member image.", + "format": "int64", + "example": 2342334 + }, + "gender": { + "type": "string", + "description": "Gender of Staff Member", + "example": "M", + "enum": [ + "M", + "F", + "NK", + "NS", + "REF" + ] + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth of Staff Member", + "format": "date", + "example": "1970-01-02" + }, + "agencyId": { + "type": "string", + "description": "Agency at which staff member is performing role.", + "example": "LEI" + }, + "agencyDescription": { + "type": "string", + "description": "Agency description.", + "example": "HMP Leeds" + }, + "fromDate": { + "type": "string", + "description": "Date from which staff member is actively performing role.", + "format": "date", + "example": "2019-02-05" + }, + "toDate": { + "type": "string", + "description": "Date on which staff member stops actively performing role.", + "format": "date", + "example": "2019-03-25" + }, + "position": { + "type": "string", + "description": "A code that defines staff member's position at agency.", + "example": "PRO" + }, + "positionDescription": { + "type": "string", + "description": "Description of staff member's position at agency.", + "example": "Prison Officer" + }, + "role": { + "type": "string", + "description": "A code that defines staff member's role at agency.", + "example": "KW" + }, + "roleDescription": { + "type": "string", + "description": "Description of staff member's role at agency.", + "example": "Key Worker" + }, + "scheduleType": { + "type": "string", + "description": "A code the defines staff member's schedule type.", + "example": "FT" + }, + "scheduleTypeDescription": { + "type": "string", + "description": "Description of staff member's schedule type.", + "example": "Full Time" + }, + "hoursPerWeek": { + "type": "number", + "description": "Number of hours worked per week by staff member.", + "example": 30 + } + }, + "description": "Staff Details with position and role" + }, + "PrisonerPrisonSchedule": { + "required": [ + "comment", + "event", + "eventDescription", + "eventLocation", + "eventStatus", + "eventType", + "firstName", + "lastName", + "offenderNo", + "startTime" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number)" + }, + "firstName": { + "type": "string", + "description": "Offender first name" + }, + "lastName": { + "type": "string", + "description": "Offender last name" + }, + "event": { + "type": "string", + "description": "Event code" + }, + "eventType": { + "type": "string", + "description": "Event type, e.g. VISIT, APP, PRISON_ACT" + }, + "eventDescription": { + "type": "string", + "description": "Description of event code" + }, + "eventLocation": { + "type": "string", + "description": "Location of the event" + }, + "eventStatus": { + "type": "string", + "description": "The event's status. Includes 'CANC', meaning cancelled for 'VISIT'" + }, + "comment": { + "maxLength": 4000, + "minLength": 0, + "type": "string", + "description": "Comment" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event ends", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Prisoner Prison Schedule" + }, + "ScheduledAppointmentDto": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Appointment id", + "format": "int64" + }, + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number)" + }, + "firstName": { + "type": "string", + "description": "Offender first name" + }, + "lastName": { + "type": "string", + "description": "Offender last name" + }, + "date": { + "type": "string", + "description": "Date the appointment is scheduled", + "format": "date" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which appointment starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which appointment ends", + "example": "2021-07-05T10:35:17" + }, + "appointmentTypeDescription": { + "type": "string", + "description": "Description of appointment type" + }, + "appointmentTypeCode": { + "type": "string", + "description": "Appointment code" + }, + "locationDescription": { + "type": "string", + "description": "Description of location the appointment is held" + }, + "locationId": { + "type": "integer", + "description": "Id of location the appointment is held", + "format": "int64" + }, + "createUserId": { + "type": "string", + "description": "Staff member who created the appointment" + }, + "agencyId": { + "type": "string", + "description": "Agency the appointment belongs to" + } + }, + "description": "Scheduled appointment" + }, + "ReferenceDomain": { + "required": [ + "applnCode", + "description", + "domain", + "domainStatus", + "ownerCode" + ], + "type": "object", + "properties": { + "domain": { + "type": "string", + "description": "Reference domain name" + }, + "description": { + "type": "string", + "description": "Reference domain description." + }, + "domainStatus": { + "type": "string", + "description": "Reference domain status." + }, + "ownerCode": { + "type": "string", + "description": "Reference domain owner." + }, + "applnCode": { + "type": "string", + "description": "Application that uses reference domain." + }, + "parentDomain": { + "type": "string", + "description": "Parent domain for reference domain." + } + }, + "description": "Reference Domain" + }, + "PrisonerInformation": { + "required": [ + "bookingId", + "communityStatus", + "dateOfBirth", + "englishSpeaking", + "establishmentCode", + "establishmentName", + "gender", + "givenName1", + "lastName", + "nomsId" + ], + "type": "object", + "properties": { + "nomsId": { + "type": "string", + "description": "Offender Identifier", + "example": "A1234AA" + }, + "establishmentCode": { + "type": "string", + "description": "Establishment Code for prisoner", + "example": "MDI" + }, + "bookingId": { + "type": "integer", + "description": "Booking Id (Internal)", + "format": "int64", + "example": 1231232 + }, + "givenName1": { + "type": "string", + "description": "Given Name 1", + "example": "John" + }, + "givenName2": { + "type": "string", + "description": "Given Name 2", + "example": "Luke" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "requestedName": { + "type": "string", + "description": "Requested Name", + "example": "Dave" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth", + "format": "date", + "example": "1970-05-01" + }, + "gender": { + "type": "string", + "description": "Gender", + "example": "Male" + }, + "englishSpeaking": { + "type": "boolean", + "description": "Indicated that is English speaking", + "example": true + }, + "unitCode1": { + "type": "string", + "description": "Level 1 Location Unit Code", + "example": "A" + }, + "unitCode2": { + "type": "string", + "description": "Level 2 Location Unit Code", + "example": "2" + }, + "unitCode3": { + "type": "string", + "description": "Level 3 Location Unit Code", + "example": "003" + }, + "bookingBeginDate": { + "type": "string", + "description": "Date Prisoner booking was initial made", + "format": "date", + "example": "2017-05-01" + }, + "admissionDate": { + "type": "string", + "description": "Date of admission into this prison", + "format": "date", + "example": "2019-06-01" + }, + "releaseDate": { + "type": "string", + "description": "Confirmed, actual, approved, provisional or calculated release date for offender, according to offender release date algorithm.

Algorithm

  • If there is a confirmed release date, the offender release date is the confirmed release date.
  • If there is no confirmed release date for the offender, the offender release date is either the actual parole date or the home detention curfew actual date.
  • If there is no confirmed release date, actual parole date or home detention curfew actual date for the offender, the release date is the later of the nonDtoReleaseDate or midTermDate value (if either or both are present)
", + "format": "date", + "example": "2021-04-12" + }, + "categoryCode": { + "type": "string", + "description": "Category of this prisoner", + "example": "C" + }, + "communityStatus": { + "type": "string", + "description": "Status of prisoner in community", + "example": "ACTIVE IN", + "enum": [ + "ACTIVE IN", + "ACTIVE OUT" + ] + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "establishmentName": { + "type": "string", + "description": "Establishment Name for prisoner", + "example": "Moorland" + } + }, + "description": "Prisoner Information" + }, + "PageString": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "type": "string" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "PageableObject": { + "type": "object", + "properties": { + "offset": { + "type": "integer", + "format": "int64" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "paged": { + "type": "boolean" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "unpaged": { + "type": "boolean" + } + } + }, + "SortObject": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "nullHandling": { + "type": "string" + }, + "ascending": { + "type": "boolean" + }, + "property": { + "type": "string" + }, + "ignoreCase": { + "type": "boolean" + } + } + }, + "PrisonerSearchDetails": { + "required": [ + "dateOfBirth", + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Prisoner Number a.k.a NOMS number, offender number", + "example": "A1234AA" + }, + "offenderId": { + "type": "integer", + "description": "Offender Id", + "format": "int64", + "example": 678673 + }, + "bookingId": { + "type": "integer", + "description": "Booking Id of the active booking", + "format": "int64", + "example": 432132 + }, + "bookingNo": { + "type": "string", + "description": "Booking Number of the active booking" + }, + "title": { + "type": "string", + "description": "Title" + }, + "firstName": { + "type": "string", + "description": "First Name" + }, + "middleName": { + "type": "string", + "description": "Middle Name(s)" + }, + "lastName": { + "type": "string", + "description": "Last Name" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth of prisoner", + "format": "date", + "example": "1970-03-15" + }, + "agencyId": { + "type": "string", + "description": "Prison ID", + "example": "MDI" + }, + "alerts": { + "type": "array", + "description": "List of alert details for the active booking", + "items": { + "$ref": "#/components/schemas/Alert" + } + }, + "assignedLivingUnit": { + "$ref": "#/components/schemas/AssignedLivingUnit" + }, + "religion": { + "type": "string", + "description": "Religion of the prisoner" + }, + "physicalAttributes": { + "$ref": "#/components/schemas/PhysicalAttributes" + }, + "physicalCharacteristics": { + "type": "array", + "description": "List of physical characteristics", + "items": { + "$ref": "#/components/schemas/PhysicalCharacteristic" + } + }, + "profileInformation": { + "type": "array", + "description": "List of profile information", + "items": { + "$ref": "#/components/schemas/ProfileInformation" + } + }, + "physicalMarks": { + "type": "array", + "description": "List of physical marks", + "items": { + "$ref": "#/components/schemas/PhysicalMark" + } + }, + "csra": { + "type": "string", + "description": "CSRA (Latest assessment with cellSharing=true from list of assessments)" + }, + "categoryCode": { + "type": "string", + "description": "Category code (from list of assessments)" + }, + "inOutStatus": { + "type": "string", + "description": "In/Out Status", + "example": "IN, OUT, TRN" + }, + "identifiers": { + "type": "array", + "description": "Prisoner Identifiers", + "items": { + "$ref": "#/components/schemas/OffenderIdentifier" + } + }, + "allIdentifiers": { + "type": "array", + "description": "Prisoner Identifiers including those from aliases", + "items": { + "$ref": "#/components/schemas/OffenderIdentifier" + } + }, + "sentenceDetail": { + "$ref": "#/components/schemas/SentenceCalcDates" + }, + "mostSeriousOffence": { + "type": "string", + "description": "Most serious offence" + }, + "indeterminateSentence": { + "type": "boolean", + "description": "Currently serving an indeterminate sentence?" + }, + "aliases": { + "type": "array", + "description": "Aliases", + "items": { + "$ref": "#/components/schemas/Alias" + } + }, + "status": { + "type": "string", + "description": "Status of prisoner", + "example": "ACTIVE IN, ACTIVE OUT, INACTIVE OUT, INACTIVE TRN" + }, + "lastMovementTypeCode": { + "type": "string", + "description": "Last Movement Type Code of prisoner. Note: Reference Data from MOVE_TYPE Domain", + "example": "TAP, CRT, TRN, ADM, REL" + }, + "lastMovementReasonCode": { + "type": "string", + "description": "Last Movement Reason of prisoner. Note: Reference Data from MOVE_RSN Domain", + "example": "CA" + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "recall": { + "type": "boolean", + "description": "Recall", + "example": true + }, + "imprisonmentStatus": { + "type": "string", + "description": "The prisoner's imprisonment status", + "example": "LIFE" + }, + "imprisonmentStatusDescription": { + "type": "string", + "description": "The prisoner's imprisonment status description", + "example": "Serving Life Imprisonment" + }, + "receptionDate": { + "type": "string", + "description": "Date prisoner was received into the prison.", + "format": "date", + "example": "1980-01-01" + }, + "locationDescription": { + "type": "string", + "description": "current prison or outside with last movement information.", + "example": "Outside - released from Leeds" + }, + "latestLocationId": { + "type": "string", + "description": "the current prison id or the last prison before release", + "example": "MDI" + }, + "addresses": { + "type": "array", + "description": "Prisoner Addresses", + "items": { + "$ref": "#/components/schemas/AddressDto" + } + }, + "phones": { + "type": "array", + "description": "Prisoner Phone Numbers", + "items": { + "$ref": "#/components/schemas/Telephone" + } + }, + "emailAddresses": { + "type": "array", + "description": "Prisoner Email Addresses", + "items": { + "$ref": "#/components/schemas/Email" + } + }, + "allConvictedOffences": { + "type": "array", + "description": "Convicted offences for ALL bookings.", + "items": { + "$ref": "#/components/schemas/OffenceHistoryDetail" + } + } + }, + "description": "Prisoner details required by Prisoner Search" + }, + "BookingAdjustment": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Adjustment type", + "enum": [ + "SPECIAL_REMISSION", + "ADDITIONAL_DAYS_AWARDED", + "RESTORED_ADDITIONAL_DAYS_AWARDED", + "UNLAWFULLY_AT_LARGE", + "LAWFULLY_AT_LARGE", + "SPECIAL_REMISSION, ADDITIONAL_DAYS_AWARDED, RESTORED_ADDITIONAL_DAYS_AWARDED, UNLAWFULLY_AT_LARGE, LAWFULLY_AT_LARGE" + ] + }, + "numberOfDays": { + "type": "integer", + "description": "Number of days to adjust", + "format": "int32", + "example": 12 + }, + "fromDate": { + "type": "string", + "description": "The 'from date' of the adjustment", + "format": "date", + "example": "2022-01-01" + }, + "toDate": { + "type": "string", + "description": "The 'to date' of the adjustment", + "format": "date", + "example": "2022-01-31" + }, + "active": { + "type": "boolean", + "description": "Boolean flag showing if the adjustment is active", + "example": true + } + }, + "description": "Sentence Adjustment values" + }, + "CalculableSentenceEnvelope": { + "required": [ + "bookingAdjustments", + "bookingId", + "offenderFinePayments", + "person", + "sentenceAdjustments", + "sentenceAndOffences" + ], + "type": "object", + "properties": { + "person": { + "$ref": "#/components/schemas/Person" + }, + "bookingId": { + "type": "integer", + "description": "The booking ID", + "format": "int64" + }, + "sentenceAndOffences": { + "type": "array", + "description": "Sentence and offence details for a prisoner", + "items": { + "$ref": "#/components/schemas/OffenderSentenceAndOffences" + } + }, + "sentenceAdjustments": { + "type": "array", + "description": "Adjustments at a sentence level", + "items": { + "$ref": "#/components/schemas/SentenceAdjustmentValues" + } + }, + "bookingAdjustments": { + "type": "array", + "description": "Adjustments at a booking level", + "items": { + "$ref": "#/components/schemas/BookingAdjustment" + } + }, + "offenderFinePayments": { + "type": "array", + "description": "List of offender fine payments", + "items": { + "$ref": "#/components/schemas/OffenderFinePaymentDto" + } + }, + "fixedTermRecallDetails": { + "$ref": "#/components/schemas/FixedTermRecallDetails" + }, + "sentenceCalcDates": { + "$ref": "#/components/schemas/SentenceCalcDates" + } + }, + "description": "The active sentence envelope is a combination of the person information, the active booking and calculable sentences at a particular establishment" + }, + "FixedTermRecallDetails": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The booking id", + "format": "int64" + }, + "returnToCustodyDate": { + "type": "string", + "description": "The date the offender returned to custody", + "format": "date" + }, + "recallLength": { + "type": "integer", + "description": "The length of the fixed term recall", + "format": "int32" + } + }, + "description": "Details relating to the fixed term recall on a booking" + }, + "OffenderFinePaymentDto": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The bookingId this payment relates to", + "format": "int64" + }, + "sequence": { + "type": "integer", + "description": "Payment sequence - a unique identifier a payment on a booking", + "format": "int32" + }, + "paymentDate": { + "type": "string", + "description": "The date of the payment", + "format": "date" + }, + "paymentAmount": { + "type": "number", + "description": "The amount of the payment" + } + }, + "description": "Offender fine payments" + }, + "OffenderOffence": { + "type": "object", + "properties": { + "offenderChargeId": { + "type": "integer", + "description": "Internal ID for charge relating to offender", + "format": "int64" + }, + "offenceStartDate": { + "type": "string", + "description": "Offence Start Date", + "format": "date" + }, + "offenceEndDate": { + "type": "string", + "description": "Offence End Date", + "format": "date" + }, + "offenceStatute": { + "type": "string", + "description": "Offence statute" + }, + "offenceCode": { + "type": "string", + "description": "Offence Code" + }, + "offenceDescription": { + "type": "string", + "description": "Offence Description" + }, + "indicators": { + "type": "array", + "description": "Offence Indicators", + "items": { + "type": "string", + "description": "Offence Indicators" + } + } + }, + "description": "Offence details related to an offender" + }, + "OffenderSentenceAndOffences": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "The bookingId this sentence and offence(s) relates to", + "format": "int64" + }, + "sentenceSequence": { + "type": "integer", + "description": "Sentence sequence - a unique identifier a sentence on a booking", + "format": "int32" + }, + "consecutiveToSequence": { + "type": "integer", + "description": "This sentence is consecutive to this sequence (if populated)", + "format": "int32" + }, + "lineSequence": { + "type": "integer", + "description": "Sentence line sequence - a number representing the order", + "format": "int64" + }, + "caseSequence": { + "type": "integer", + "description": "Case sequence - a number representing the order of the case this sentence belongs to", + "format": "int32" + }, + "caseReference": { + "type": "string", + "description": "Case reference - a string identifying the case this sentence belongs to" + }, + "courtDescription": { + "type": "string", + "description": "Court description - a string describing the the court that the case was heard at" + }, + "sentenceStatus": { + "type": "string", + "description": "This sentence status: A = Active I = Inactive" + }, + "sentenceCategory": { + "type": "string", + "description": "The sentence category e.g. 2003 or Licence" + }, + "sentenceCalculationType": { + "type": "string", + "description": "The sentence calculation type e.g. R or ADIMP_ORA" + }, + "sentenceTypeDescription": { + "type": "string", + "description": "The sentence type description e.g. Standard Determinate Sentence" + }, + "sentenceDate": { + "type": "string", + "description": "The sentenced date for this sentence (aka court date)", + "format": "date" + }, + "sentenceStartDate": { + "type": "string", + "description": "Date that this sentence did or will start", + "format": "date" + }, + "sentenceEndDate": { + "type": "string", + "description": "Date that this sentence would expire", + "format": "date" + }, + "terms": { + "type": "array", + "description": "The sentence terms of the sentence", + "items": { + "$ref": "#/components/schemas/OffenderSentenceTerm" + } + }, + "offences": { + "type": "array", + "description": "The offences related to this sentence (will usually only have one offence per sentence)", + "items": { + "$ref": "#/components/schemas/OffenderOffence" + } + }, + "fineAmount": { + "type": "number", + "description": "The amount of fine related to the sentence and offence", + "format": "double" + } + }, + "description": "Offender sentence and offence details" + }, + "OffenderSentenceTerm": { + "type": "object", + "properties": { + "years": { + "type": "integer", + "description": "The term duration - years", + "format": "int32", + "example": 1 + }, + "months": { + "type": "integer", + "description": "The term duration - months", + "format": "int32", + "example": 2 + }, + "weeks": { + "type": "integer", + "description": "The term duration - weeks", + "format": "int32", + "example": 3 + }, + "days": { + "type": "integer", + "description": "The term duration - days", + "format": "int32", + "example": 4 + }, + "code": { + "type": "string", + "description": "The sentence term code, indicating if this is the term of imprisonment or license" + } + }, + "description": "Offender sentence term" + }, + "PageCalculableSentenceEnvelope": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CalculableSentenceEnvelope" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "Person": { + "required": [ + "agencyId", + "alerts", + "dateOfBirth", + "lastName", + "prisonerNumber" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "Prisoner Identifier", + "example": "A1234AA" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "lastName": { + "type": "string" + }, + "agencyId": { + "type": "string" + }, + "alerts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Alert" + } + } + }, + "description": "The identifiers of a person necessary for a calculation" + }, + "SentenceAdjustmentValues": { + "type": "object", + "properties": { + "sentenceSequence": { + "type": "integer", + "description": "Sentence sequence", + "format": "int32", + "example": 1 + }, + "type": { + "type": "string", + "description": "Adjustment type", + "enum": [ + "RECALL_SENTENCE_REMAND", + "TAGGED_BAIL", + "RECALL_SENTENCE_TAGGED_BAIL", + "REMAND", + "UNUSED_REMAND" + ] + }, + "numberOfDays": { + "type": "integer", + "description": "Number of days to adjust", + "format": "int32", + "example": 12 + }, + "fromDate": { + "type": "string", + "description": "The 'from date' of the adjustment", + "format": "date", + "example": "2022-01-01" + }, + "toDate": { + "type": "string", + "description": "The 'to date' of the adjustment", + "format": "date", + "example": "2022-01-31" + }, + "active": { + "type": "boolean", + "description": "Boolean flag showing if the adjustment is active", + "example": true + } + }, + "description": "Sentence Adjustment values" + }, + "LocationRollCount": { + "required": [ + "bedsInUse", + "currentlyInCell", + "currentlyOut", + "netVacancies", + "outOfOrder", + "workingCapacity" + ], + "type": "object", + "properties": { + "bedsInUse": { + "type": "integer", + "description": "Beds in use", + "format": "int32" + }, + "currentlyInCell": { + "type": "integer", + "description": "Currently in cell", + "format": "int32" + }, + "currentlyOut": { + "type": "integer", + "description": "Currently out", + "format": "int32" + }, + "workingCapacity": { + "type": "integer", + "description": "Working capacity", + "format": "int32" + }, + "netVacancies": { + "type": "integer", + "description": "Net vacancies", + "format": "int32" + }, + "outOfOrder": { + "type": "integer", + "description": "Out of order", + "format": "int32" + } + }, + "description": "Summary of cell usage for this level" + }, + "PrisonRollCount": { + "required": [ + "locations", + "numArrivedToday", + "numCurrentPopulation", + "numInReception", + "numNoCellAllocated", + "numOutToday", + "numStillToArrive", + "numUnlockRollToday", + "prisonId", + "totals" + ], + "type": "object", + "properties": { + "prisonId": { + "type": "string", + "description": "Prison Id" + }, + "numUnlockRollToday": { + "type": "integer", + "description": "Unlock roll today", + "format": "int32" + }, + "numCurrentPopulation": { + "type": "integer", + "description": "Current population", + "format": "int32" + }, + "numArrivedToday": { + "type": "integer", + "description": "Arrived today", + "format": "int32" + }, + "numInReception": { + "type": "integer", + "description": "In reception", + "format": "int32" + }, + "numStillToArrive": { + "type": "integer", + "description": "Still to arrive", + "format": "int32" + }, + "numOutToday": { + "type": "integer", + "description": "Out today", + "format": "int32" + }, + "numNoCellAllocated": { + "type": "integer", + "description": "No cell allocated", + "format": "int32" + }, + "totals": { + "$ref": "#/components/schemas/LocationRollCount" + }, + "locations": { + "type": "array", + "description": "Residential location roll count summary", + "items": { + "$ref": "#/components/schemas/ResidentialLocation" + } + } + }, + "description": "Establishment Roll Count" + }, + "ResidentialLocation": { + "required": [ + "certified", + "fullLocationPath", + "key", + "locationCode", + "locationId", + "locationType", + "rollCount", + "subLocations" + ], + "type": "object", + "properties": { + "locationId": { + "type": "string", + "description": "Location Id", + "example": "121212" + }, + "locationType": { + "type": "string", + "description": "Type of location", + "example": "CELL" + }, + "locationCode": { + "type": "string", + "description": "Code of this location", + "example": "002" + }, + "fullLocationPath": { + "type": "string", + "description": "Path of this location from top level", + "example": "A-1-002" + }, + "certified": { + "type": "boolean", + "description": "Certified location", + "example": true + }, + "localName": { + "type": "string", + "description": "Local name of the location", + "example": "Wing A" + }, + "rollCount": { + "$ref": "#/components/schemas/LocationRollCount" + }, + "subLocations": { + "type": "array", + "description": "List of residential locations for this summary, including wings and sub-locations such as landings and cells", + "items": { + "$ref": "#/components/schemas/ResidentialLocation" + } + }, + "key": { + "type": "string" + } + }, + "description": "Residential Roll Count Summary" + }, + "PrisonRollSummary": { + "required": [ + "numArrivedToday", + "numCurrentPopulation", + "numOutToday", + "numUnlockRollToday", + "prisonId" + ], + "type": "object", + "properties": { + "prisonId": { + "type": "string", + "description": "Prison Id" + }, + "numUnlockRollToday": { + "type": "integer", + "description": "Unlock roll today", + "format": "int32" + }, + "numArrivedToday": { + "type": "integer", + "description": "Arrived today", + "format": "int32" + }, + "numOutToday": { + "type": "integer", + "description": "Out today", + "format": "int32" + }, + "numCurrentPopulation": { + "type": "integer", + "description": "Current population", + "format": "int32" + } + }, + "description": "Prison Roll Summary" + }, + "PersonIdentifier": { + "required": [ + "identifierType", + "identifierValue" + ], + "type": "object", + "properties": { + "identifierType": { + "type": "string", + "description": "The identifier type" + }, + "identifierValue": { + "type": "string", + "description": "The most recent identifier value of that type." + } + }, + "description": "PersonIdentifier" + }, + "OffenderTransactionHistoryDto": { + "required": [ + "currency" + ], + "type": "object", + "properties": { + "offenderId": { + "type": "integer", + "description": "Offender Id", + "format": "int64", + "example": 1 + }, + "transactionId": { + "type": "integer", + "description": "Transaction Id", + "format": "int64", + "example": 1 + }, + "transactionEntrySequence": { + "type": "integer", + "description": "Transaction Sequence", + "format": "int64", + "example": 1 + }, + "entryDate": { + "type": "string", + "description": "Transaction Date", + "format": "date", + "example": "2020-12-11" + }, + "transactionType": { + "type": "string", + "description": "Transaction Type" + }, + "entryDescription": { + "type": "string", + "description": "Transaction Description", + "example": "some textual description here" + }, + "referenceNumber": { + "type": "string", + "description": "Transaction Reference Number" + }, + "currency": { + "type": "string", + "description": "Currency of these amounts.", + "example": "GBP" + }, + "penceAmount": { + "type": "integer", + "description": "Transaction Amount", + "format": "int64", + "example": 60 + }, + "accountType": { + "type": "string", + "description": "Offender Sub Account", + "example": "savings,spends,cash" + }, + "postingType": { + "type": "string", + "description": "Posting type. Denotes the direction of money moving in or out of the account", + "example": "CR,DR" + }, + "offenderNo": { + "type": "string", + "description": "Offender number", + "example": "G6123VU" + }, + "agencyId": { + "type": "string", + "description": "The place the transaction took place", + "example": "MDI" + }, + "relatedOffenderTransactions": { + "type": "array", + "description": "List of related transaction details", + "items": { + "$ref": "#/components/schemas/RelatedTransactionDetails" + } + }, + "currentBalance": { + "type": "integer", + "description": "Balance at a point in time", + "format": "int64" + }, + "holdingCleared": { + "type": "boolean", + "description": "Indicates that the amount has been cleared from holding" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Creation date time", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Offender transaction details" + }, + "RelatedTransactionDetails": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Transaction details id", + "format": "int64", + "example": 1 + }, + "transactionId": { + "type": "integer", + "description": "Transaction Id", + "format": "int64", + "example": 1 + }, + "transactionEntrySequence": { + "type": "integer", + "description": "Transaction Sequence", + "format": "int64", + "example": 1 + }, + "calendarDate": { + "type": "string", + "description": "Calendar date the payment was processed", + "format": "date", + "example": "2020-10-12" + }, + "payTypeCode": { + "type": "string", + "description": "Pay type code", + "example": "UNEMPLOYED,SESSION,LTSICK,STSICK,MATERNAL,RETIRED,HOSPITAL" + }, + "eventId": { + "type": "integer", + "description": "Event id the payment is associated with", + "format": "int64", + "example": 1 + }, + "payAmount": { + "type": "integer", + "description": "Payment amount in pence", + "format": "int64", + "example": 100 + }, + "pieceWork": { + "type": "integer", + "description": "Piece work amount in pence", + "format": "int64", + "example": 250 + }, + "bonusPay": { + "type": "integer", + "description": "Bonus payment in pence", + "format": "int64", + "example": 55 + }, + "currentBalance": { + "type": "integer", + "description": "Balance at a point in time", + "format": "int64" + }, + "paymentDescription": { + "type": "string", + "description": "Reason for payment", + "example": "Cleaner HB1 PM" + } + }, + "description": "Offender transaction drill down details" + }, + "PrisonPeriod": { + "required": [ + "bookNumber", + "bookingId", + "entryDate", + "movementDates", + "prisons", + "transfers" + ], + "type": "object", + "properties": { + "bookNumber": { + "type": "string", + "description": "The book number for this booking" + }, + "bookingId": { + "type": "integer", + "description": "The ID of this booking", + "format": "int64" + }, + "entryDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date they first entered prison in this booking", + "example": "2021-07-05T10:35:17" + }, + "releaseDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date they were last released from prison in this booking if they have been released", + "example": "2021-07-05T10:35:17" + }, + "movementDates": { + "type": "array", + "description": "List of significant period of time when in prison. The time between these periods means they person was out of prison (but not including court)", + "items": { + "$ref": "#/components/schemas/SignificantMovement" + } + }, + "transfers": { + "type": "array", + "description": "List of transfers during this period. Will be empty if there have been no transfers. Transfer via court or temporary absence are also included", + "items": { + "$ref": "#/components/schemas/TransferDetail" + } + }, + "prisons": { + "type": "array", + "description": "List of prisons the person was detained during this booking period", + "items": { + "type": "string", + "description": "List of prisons the person was detained during this booking period" + } + } + }, + "description": "A period of time in prison" + }, + "PrisonerInPrisonSummary": { + "required": [ + "prisonerNumber" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "Prisoner Identifier", + "example": "A1234AA" + }, + "prisonPeriod": { + "type": "array", + "description": "List of date when prisoner was in prison", + "items": { + "$ref": "#/components/schemas/PrisonPeriod" + } + } + }, + "description": "Prisoners time in prison summary" + }, + "SignificantMovement": { + "required": [ + "admittedIntoPrisonId", + "inwardType", + "reasonInToPrison" + ], + "type": "object", + "properties": { + "reasonInToPrison": { + "type": "string", + "description": "Reason for movement into prison", + "example": "Unconvicted Remand" + }, + "dateInToPrison": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "example": "2021-07-05T10:35:17" + }, + "inwardType": { + "type": "string", + "description": "Type of movement into prison", + "enum": [ + "ADM", + "TAP" + ] + }, + "reasonOutOfPrison": { + "type": "string", + "description": "Reason for movement out from prison", + "example": "Conditional Release (CJA91) -SH Term>1YR" + }, + "dateOutOfPrison": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date this sub-period ended - if it has ended", + "example": "2021-07-05T10:35:17" + }, + "outwardType": { + "type": "string", + "description": "Type of movement out of prison", + "enum": [ + "REL", + "TAP" + ] + }, + "admittedIntoPrisonId": { + "type": "string", + "description": "The initial prison they entered during this period", + "example": "MDI" + }, + "releaseFromPrisonId": { + "type": "string", + "description": "The final prison they left during this period - if this period has ended", + "example": "MDI" + } + }, + "description": "A movement IN and OUT range" + }, + "TransferDetail": { + "required": [ + "toPrisonId" + ], + "type": "object", + "properties": { + "dateOutOfPrison": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date prisoner left the original prison", + "example": "2021-07-05T10:35:17" + }, + "dateInToPrison": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date prisoner entered the new prison. Can be absent if they have not arrived at the prison yet", + "example": "2021-07-05T10:35:17" + }, + "transferReason": { + "type": "string", + "description": "Reason for the transfer", + "example": "Compassionate Transfer" + }, + "fromPrisonId": { + "type": "string", + "description": "The prison they were transferred from", + "example": "WWI" + }, + "toPrisonId": { + "type": "string", + "description": "The prison they were transferred to. Can be absent if they have not arrived at the prison yet", + "example": "BXI" + } + }, + "description": "A movement that is a transfer" + }, + "OffenderRestriction": { + "required": [ + "active", + "restrictionId", + "restrictionType", + "restrictionTypeDescription", + "startDate" + ], + "type": "object", + "properties": { + "restrictionId": { + "type": "integer", + "description": "restriction id", + "format": "int64" + }, + "comment": { + "type": "string", + "description": "Restriction comment text" + }, + "restrictionType": { + "type": "string", + "description": "code of restriction type" + }, + "restrictionTypeDescription": { + "type": "string", + "description": "description of restriction type" + }, + "startDate": { + "type": "string", + "description": "Date from which the restrictions applies", + "format": "date", + "example": "1980-01-01" + }, + "expiryDate": { + "type": "string", + "description": "Date restriction applies to, or indefinitely if null", + "format": "date", + "example": "1980-01-01" + }, + "active": { + "type": "boolean", + "description": "true if restriction is within the start date and optional expiry date range" + } + }, + "description": "Offender restriction" + }, + "OffenderRestrictions": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking id for offender", + "format": "int64" + }, + "offenderRestrictions": { + "type": "array", + "description": "Offender restrictions", + "items": { + "$ref": "#/components/schemas/OffenderRestriction" + } + } + }, + "description": "Offender restrictions" + }, + "MilitaryRecord": { + "required": [ + "militaryBranchCode", + "militaryBranchDescription", + "selectiveServicesFlag", + "startDate" + ], + "type": "object", + "properties": { + "warZoneCode": { + "type": "string", + "description": "War zone code", + "example": "AFG" + }, + "warZoneDescription": { + "type": "string", + "description": "War zone description", + "example": "Afghanistan" + }, + "startDate": { + "type": "string", + "description": "Start date", + "format": "date", + "example": "2000-01-01" + }, + "endDate": { + "type": "string", + "description": "End date", + "format": "date", + "example": "2020-10-17" + }, + "militaryDischargeCode": { + "type": "string", + "description": "Military discharge code", + "example": "DIS" + }, + "militaryDischargeDescription": { + "type": "string", + "description": "Military discharge description", + "example": "Dishonourable" + }, + "militaryBranchCode": { + "type": "string", + "description": "Military branch code", + "example": "ARM" + }, + "militaryBranchDescription": { + "type": "string", + "description": "Military branch description", + "example": "Army" + }, + "description": { + "type": "string", + "description": "Description", + "example": "Some description" + }, + "unitNumber": { + "type": "string", + "description": "The unit number", + "example": "255 TACP Battery" + }, + "enlistmentLocation": { + "type": "string", + "description": "Enlistment location", + "example": "Sheffield" + }, + "dischargeLocation": { + "type": "string", + "description": "Discharge location", + "example": "Manchester" + }, + "selectiveServicesFlag": { + "type": "boolean", + "description": "Selective services flag", + "example": false + }, + "militaryRankCode": { + "type": "string", + "description": "Military rank code", + "example": "LCPL_RMA" + }, + "militaryRankDescription": { + "type": "string", + "description": "Military rank description", + "example": "Lance Corporal (Royal Marines)" + }, + "serviceNumber": { + "type": "string", + "description": "Service number", + "example": "25232301" + }, + "disciplinaryActionCode": { + "type": "string", + "description": "Disciplinary action code", + "example": "CM" + }, + "disciplinaryActionDescription": { + "type": "string", + "description": "Disciplinary action description", + "example": "Court Martial" + } + }, + "description": "Military Record" + }, + "MilitaryRecords": { + "type": "object", + "properties": { + "militaryRecords": { + "type": "array", + "description": "Military Records", + "items": { + "$ref": "#/components/schemas/MilitaryRecord" + } + } + }, + "description": "Military Records" + }, + "IncidentCase": { + "required": [ + "incidentCaseId", + "incidentDate", + "incidentStatus", + "incidentTime", + "incidentTitle", + "incidentType", + "reportDate", + "reportTime", + "reportedStaffId" + ], + "type": "object", + "properties": { + "incidentCaseId": { + "type": "integer", + "description": "Incident Case ID", + "format": "int64", + "example": 2131231 + }, + "incidentTitle": { + "type": "string", + "description": "Title of the case", + "example": "Assault on staff member" + }, + "incidentType": { + "type": "string", + "description": "Type of incident", + "example": "ASSAULT", + "enum": [ + "MISC", + "ASSAULT", + "FINDS1", + "DISORDER", + "KEY_LOCK", + "ROOF_CLIMB", + "DEATH_NI", + "REL_ERROR", + "FINDS", + "FIRE", + "DAMAGE", + "FOOD_REF", + "BOMB", + "ATT_ESC_E", + "ESCAPE_ESC", + "DRONE", + "TRF3", + "ATT_ESCAPE", + "BREACH", + "ESCAPE_EST", + "FIND", + "TRF2", + "FIND1", + "BARRICADE", + "HOSTAGE", + "SELF_HARM", + "DRUGS", + "TOOL_LOSS", + "RADIO_COMP", + "FIREARM_ETC", + "CON_INDISC", + "KEY_LOCKNEW", + "CLOSE_DOWN", + "DEATH", + "ABSCOND", + "TRF", + "MOBILES" + ] + }, + "incidentDetails": { + "type": "string", + "description": "Details about the case", + "example": "There was a big fight" + }, + "incidentDate": { + "type": "string", + "description": "Date the incident took place", + "format": "date", + "example": "2018-02-10" + }, + "incidentTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Time when incident occurred", + "example": "2021-07-05T10:35:17" + }, + "reportedStaffId": { + "type": "integer", + "description": "Staff ID who created report", + "format": "int64", + "example": 2131231 + }, + "reportDate": { + "type": "string", + "description": "Date when incident reported", + "format": "date", + "example": "2018-02-11" + }, + "reportTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Time incident reported", + "example": "2021-07-05T10:35:17" + }, + "incidentStatus": { + "type": "string", + "description": "Current Status of Incident. Note:\nAWAN = Awaiting Analysis\nINAN = In Analysis\nINREQ = Information Required\nINAME =Information Amended\nCLOSE = Closed\nPIU = Post Incident Update\nIUP = Incident Updated\nDUP = Duplicate (Created In Error)", + "example": "CLOSE", + "enum": [ + "CLOSE", + "DUP", + "AWAN", + "INAN", + "INREQ", + "INAME", + "PIU", + "IUP" + ] + }, + "agencyId": { + "type": "string", + "description": "Agency where incident happened", + "example": "MDI" + }, + "responseLockedFlag": { + "type": "boolean", + "description": "Is the response completed?", + "example": true + }, + "responses": { + "uniqueItems": true, + "type": "array", + "description": "Question And Answer Responses", + "items": { + "$ref": "#/components/schemas/IncidentResponse" + } + }, + "parties": { + "uniqueItems": true, + "type": "array", + "description": "Parties Involved in case", + "items": { + "$ref": "#/components/schemas/IncidentParty" + } + } + }, + "description": "Incident Case" + }, + "IncidentParty": { + "required": [ + "bookingId", + "commentText", + "incidentCaseId", + "outcomeCode", + "participationRole", + "partySeq" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking Id of offender involved", + "format": "int64", + "example": 1241232 + }, + "partySeq": { + "type": "integer", + "description": "Sequence or each party member", + "format": "int64", + "example": 1 + }, + "staffId": { + "type": "integer", + "description": "Staff Member ID (optional)", + "format": "int64", + "example": 1534133 + }, + "personId": { + "type": "integer", + "description": "Person (non-staff) ID (optional)", + "format": "int64", + "example": 544233 + }, + "participationRole": { + "type": "string", + "description": "Role in the Incident", + "example": "ASSIAL" + }, + "outcomeCode": { + "type": "string", + "description": "Outcome Code", + "example": "POR" + }, + "commentText": { + "type": "string", + "description": "Additional Comments", + "example": "Some additional Information" + }, + "incidentCaseId": { + "type": "integer", + "description": "Incident Case ID", + "format": "int64", + "example": 12431243 + } + }, + "description": "Incident Party" + }, + "IncidentResponse": { + "required": [ + "answer", + "question", + "questionSeq", + "questionnaireAnsId", + "questionnaireQueId" + ], + "type": "object", + "properties": { + "question": { + "type": "string", + "description": "The Question", + "example": "Was it a violent assault?" + }, + "answer": { + "type": "string", + "description": "The Answer to the Question", + "example": "YES" + }, + "questionSeq": { + "type": "integer", + "description": "Sequence of presented Questions", + "format": "int32", + "example": 2131231 + }, + "questionnaireQueId": { + "type": "integer", + "description": "ID for Questionnaire Question", + "format": "int64", + "example": 983431 + }, + "questionnaireAnsId": { + "type": "integer", + "description": "ID for Questionnaire Answer", + "format": "int64", + "example": 983434 + }, + "responseDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date response was recorded", + "example": "2021-07-05T10:35:17" + }, + "responseCommentText": { + "type": "string", + "description": "Additional comments for the response to the question", + "example": "The knife was in his pocket" + }, + "recordStaffId": { + "type": "integer", + "description": "Staff Id recording comment", + "format": "int64", + "example": 123123 + } + }, + "description": "Incident Reponses" + }, + "HousingLocation": { + "required": [ + "code", + "description", + "level" + ], + "type": "object", + "properties": { + "level": { + "maximum": 4, + "minimum": 1, + "type": "integer", + "description": "The level (starting from 1) of the individual location. The highest number level will be the cell.", + "format": "int32", + "example": 1 + }, + "code": { + "type": "string", + "description": "The code for the location e.g. 010 for a cell, A for a wing", + "example": "010" + }, + "type": { + "type": "string", + "description": "The type of the location - from LIVING_UNIT reference code", + "example": "WING", + "enum": [ + "BED", + "BLK", + "CB", + "CELL", + "LAND", + "SPUR", + "TIER", + "WING" + ] + }, + "description": { + "type": "string", + "description": "Description of the location, either from the user description if set or reference code description and code", + "example": "Wing A" + } + }, + "description": "Previous permanent housing levels at the same prison without moving to a different prison inbetween" + }, + "OffenderLocation": { + "type": "object", + "properties": { + "levels": { + "type": "array", + "description": "Current housing levels or null if not currently in prison", + "items": { + "$ref": "#/components/schemas/HousingLocation" + } + }, + "lastPermanentLevels": { + "type": "array", + "description": "Previous permanent housing levels at the same prison without moving to a different prison inbetween", + "items": { + "$ref": "#/components/schemas/HousingLocation" + } + } + } + }, + "OffenderDamageObligationModel": { + "required": [ + "currency" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Identifier of damage obligation", + "format": "int64", + "example": 1 + }, + "offenderNo": { + "type": "string", + "description": "Offender number", + "example": "G4346UT" + }, + "referenceNumber": { + "type": "string", + "description": "Reference number", + "example": "841177/1, A841821/1, 842371" + }, + "startDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The start date time when the damage obligation started", + "example": "2021-07-05T10:35:17" + }, + "endDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The end date time when the damage obligation ended", + "example": "2021-07-05T10:35:17" + }, + "prisonId": { + "type": "string", + "description": "Prison the damages occurred", + "example": "MDI" + }, + "amountToPay": { + "type": "number", + "description": "Original amount to pay", + "example": 50.0 + }, + "amountPaid": { + "type": "number", + "description": "Amount paid", + "example": 10.0 + }, + "status": { + "type": "string", + "description": "Status", + "example": "ACTIVE" + }, + "comment": { + "type": "string", + "description": "Comment", + "example": "Damages to canteen furniture" + }, + "currency": { + "type": "string", + "description": "Currency of these amounts.", + "example": "GBP" + } + }, + "description": "Damage obligation for an offender" + }, + "OffenderDamageObligationResponse": { + "type": "object", + "properties": { + "damageObligations": { + "type": "array", + "description": "List of offender damage obligations", + "items": { + "$ref": "#/components/schemas/OffenderDamageObligationModel" + } + } + }, + "description": "Offender damage obligation response" + }, + "OffenderContact": { + "required": [ + "active", + "approvedVisitor", + "bookingId", + "contactType", + "emergencyContact", + "firstName", + "lastName", + "nextOfKin", + "relationshipCode" + ], + "type": "object", + "properties": { + "lastName": { + "type": "string", + "description": "Last name of the contact", + "example": "Smith" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "middleName": { + "type": "string", + "description": "Middle Names", + "example": "Mark" + }, + "dateOfBirth": { + "type": "string", + "description": "date of birth", + "format": "date", + "example": "1980-01-01" + }, + "contactType": { + "type": "string", + "description": "Contact type", + "example": "O" + }, + "contactTypeDescription": { + "type": "string", + "description": "Contact type text", + "example": "Official" + }, + "relationshipCode": { + "type": "string", + "description": "Relationship to prisoner", + "example": "RO" + }, + "relationshipDescription": { + "type": "string", + "description": "Relationship text", + "example": "Responsible Officer" + }, + "commentText": { + "type": "string", + "description": "Comments", + "example": "Some additional information" + }, + "emergencyContact": { + "type": "boolean", + "description": "Is an emergency contact", + "example": true + }, + "nextOfKin": { + "type": "boolean", + "description": "Indicates that the contact is Next of Kin Type", + "example": false + }, + "personId": { + "type": "integer", + "description": "id of the person", + "format": "int64", + "example": 5871791 + }, + "approvedVisitor": { + "type": "boolean", + "description": "Approved Visitor", + "example": true + }, + "bookingId": { + "type": "integer", + "description": "Offender Booking Id for this contact", + "format": "int64", + "example": 2468081 + }, + "emails": { + "type": "array", + "description": "List of emails associated with the contact", + "items": { + "$ref": "#/components/schemas/Email" + } + }, + "phones": { + "type": "array", + "description": "List of phone numbers associated with the contact", + "items": { + "$ref": "#/components/schemas/Telephone" + } + }, + "restrictions": { + "type": "array", + "description": "List of restrictions associated with the contact", + "items": { + "$ref": "#/components/schemas/VisitorRestriction" + } + }, + "active": { + "type": "boolean", + "description": "active contact", + "example": true + } + }, + "description": "Offender Contact" + }, + "OffenderContacts": { + "type": "object", + "properties": { + "offenderContacts": { + "type": "array", + "description": "Offender contacts", + "items": { + "$ref": "#/components/schemas/OffenderContact" + } + } + }, + "description": "Offender contacts" + }, + "VisitorRestriction": { + "required": [ + "globalRestriction", + "restrictionId", + "restrictionType", + "restrictionTypeDescription", + "startDate" + ], + "type": "object", + "properties": { + "restrictionId": { + "type": "integer", + "description": "restriction id", + "format": "int64" + }, + "comment": { + "type": "string", + "description": "Restriction comment text" + }, + "restrictionType": { + "type": "string", + "description": "code of restriction type" + }, + "restrictionTypeDescription": { + "type": "string", + "description": "description of restriction type" + }, + "startDate": { + "type": "string", + "description": "Date from which the restrictions applies", + "format": "date", + "example": "1980-01-01" + }, + "expiryDate": { + "type": "string", + "description": "Date restriction applies to, or indefinitely if null", + "format": "date", + "example": "1980-01-01" + }, + "globalRestriction": { + "type": "boolean", + "description": "true if applied globally to the contact or false if applied in the context of a visit" + } + }, + "description": "Visitor restriction" + }, + "CourtSentences": { + "type": "object", + "properties": { + "caseInfoNumber": { + "type": "string", + "description": "The case information number", + "example": "TD20177010" + }, + "id": { + "type": "integer", + "description": "The case identifier (internal)", + "format": "int64", + "example": 1 + }, + "caseSeq": { + "type": "integer", + "description": "The case sequence number for the offender", + "format": "int32", + "example": 1 + }, + "beginDate": { + "type": "string", + "description": "The begin date of the court hearings", + "format": "date", + "example": "2019-12-01" + }, + "court": { + "$ref": "#/components/schemas/Agency" + }, + "caseType": { + "type": "string", + "description": "The case type", + "example": "Adult" + }, + "caseInfoPrefix": { + "type": "string", + "description": "The prefix of the case number" + }, + "caseStatus": { + "type": "string", + "description": "The case status", + "example": "ACTIVE", + "enum": [ + "ACTIVE", + "CLOSED", + "INACTIVE" + ] + }, + "sentences": { + "type": "array", + "description": "Court sentences associated with the court case", + "items": { + "$ref": "#/components/schemas/SentencesOffencesTerms" + } + }, + "issuingCourt": { + "$ref": "#/components/schemas/Agency" + }, + "issuingCourtDate": { + "type": "string", + "description": "Issuing Court Date", + "format": "date" + } + }, + "description": "Court case details" + }, + "KeyDates": { + "required": [ + "nonDtoReleaseDateType", + "sentenceStartDate" + ], + "type": "object", + "properties": { + "sentenceStartDate": { + "type": "string", + "description": "Sentence start date.", + "format": "date", + "example": "2010-02-03" + }, + "effectiveSentenceEndDate": { + "type": "string", + "description": "Effective sentence end date", + "format": "date", + "example": "2020-02-03" + }, + "additionalDaysAwarded": { + "type": "integer", + "description": "ADA - days added to sentence term due to adjustments.", + "format": "int32", + "example": 5 + }, + "nonDtoReleaseDate": { + "type": "string", + "description": "Release date for non-DTO sentence (if applicable). This will be based on one of ARD, CRD, NPD or PRRD.", + "format": "date", + "example": "2020-04-01" + }, + "nonDtoReleaseDateType": { + "type": "string", + "description": "Indicates which type of non-DTO release date is the effective release date. One of 'ARD', 'CRD', 'NPD' or 'PRRD'.", + "example": "CRD", + "enum": [ + "ARD", + "CRD", + "NPD", + "PRRD" + ] + }, + "confirmedReleaseDate": { + "type": "string", + "description": "Confirmed release date for offender.", + "format": "date", + "example": "2020-04-20" + }, + "releaseDate": { + "type": "string", + "description": "Confirmed, actual, approved, provisional or calculated release date for offender, according to offender release date algorithm.

Algorithm

  • If there is a confirmed release date, the offender release date is the confirmed release date.
  • If there is no confirmed release date for the offender, the offender release date is either the actual parole date or the home detention curfew actual date.
  • If there is no confirmed release date, actual parole date or home detention curfew actual date for the offender, the release date is the later of the nonDtoReleaseDate or midTermDate value (if either or both are present)
", + "format": "date", + "example": "2020-04-01" + }, + "sentenceExpiryDate": { + "type": "string", + "description": "SED - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "automaticReleaseDate": { + "type": "string", + "description": "ARD - calculated automatic (unconditional) release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "CRD - calculated conditional release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleDate": { + "type": "string", + "description": "NPD - calculated non-parole date for offender (relating to the 1991 act).", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "PRRD - calculated post-recall release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryDate": { + "type": "string", + "description": "LED - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDCED - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "PED - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewActualDate": { + "type": "string", + "description": "HDCAD - the offender's actual home detention curfew date.", + "format": "date", + "example": "2020-02-03" + }, + "actualParoleDate": { + "type": "string", + "description": "APD - the offender's actual parole date.", + "format": "date", + "example": "2020-02-03" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "ROTL - the date on which offender will be released on temporary licence.", + "format": "date", + "example": "2020-02-03" + }, + "earlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "ERSED - the date on which offender will be eligible for early removal (under the Early Removal Scheme for foreign nationals).", + "format": "date", + "example": "2020-02-03" + }, + "earlyTermDate": { + "type": "string", + "description": "ETD - early term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "midTermDate": { + "type": "string", + "description": "MTD - mid term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "lateTermDate": { + "type": "string", + "description": "LTD - late term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "TUSED - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "tariffDate": { + "type": "string", + "description": "Date on which minimum term is reached for parole (indeterminate/life sentences).", + "format": "date", + "example": "2020-02-03" + }, + "dtoPostRecallReleaseDate": { + "type": "string", + "description": "DPRRD - Detention training order post recall release date", + "format": "date", + "example": "2020-02-03" + }, + "tariffEarlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "TERSED - Tariff early removal scheme eligibility date", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionStartDate": { + "type": "string", + "description": "Top-up supervision start date for offender - calculated as licence end date + 1 day or releaseDate if licence end date not set.", + "format": "date", + "example": "2019-04-01" + }, + "homeDetentionCurfewEndDate": { + "type": "string", + "description": "Offender's home detention curfew end date - calculated as one day before the releaseDate.", + "format": "date", + "example": "2019-04-01" + } + }, + "description": "Key Dates" + }, + "PrisonTerm": { + "required": [ + "bookNumber", + "bookingId" + ], + "type": "object", + "properties": { + "bookNumber": { + "type": "string", + "description": "Book Number (Prison) / Prison Number (Probation)", + "example": "B45232" + }, + "bookingId": { + "type": "integer", + "description": "Booking Identifier (internal)", + "format": "int64", + "example": 12312312 + }, + "courtSentences": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CourtSentences" + } + }, + "licenceSentences": { + "type": "array", + "description": "Licence sentences", + "items": { + "$ref": "#/components/schemas/SentencesOffencesTerms" + } + }, + "keyDates": { + "$ref": "#/components/schemas/KeyDates" + }, + "sentenceAdjustments": { + "$ref": "#/components/schemas/SentenceAdjustmentDetail" + } + }, + "description": "Prison Term" + }, + "SentenceAdjustmentDetail": { + "type": "object", + "properties": { + "additionalDaysAwarded": { + "type": "integer", + "description": "Number of additional days awarded", + "format": "int32", + "example": 12 + }, + "unlawfullyAtLarge": { + "type": "integer", + "description": "Number unlawfully at large days", + "format": "int32", + "example": 12 + }, + "lawfullyAtLarge": { + "type": "integer", + "description": "Number of lawfully at large days", + "format": "int32", + "example": 12 + }, + "restoredAdditionalDaysAwarded": { + "type": "integer", + "description": "Number of restored additional days awarded", + "format": "int32", + "example": 12 + }, + "specialRemission": { + "type": "integer", + "description": "Number of special remission days", + "format": "int32", + "example": 12 + }, + "recallSentenceRemand": { + "type": "integer", + "description": "Number of recall sentence remand days", + "format": "int32", + "example": 12 + }, + "recallSentenceTaggedBail": { + "type": "integer", + "description": "Number of recall sentence tagged bail days", + "format": "int32", + "example": 12 + }, + "remand": { + "type": "integer", + "description": "Number of remand days", + "format": "int32", + "example": 12 + }, + "taggedBail": { + "type": "integer", + "description": "Number of tagged bail days", + "format": "int32", + "example": 12 + }, + "unusedRemand": { + "type": "integer", + "description": "Number of unused remand days", + "format": "int32", + "example": 12 + } + }, + "description": "Sentence adjustments" + }, + "SentenceSummary": { + "required": [ + "prisonerNumber" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "Prisoner Identifier", + "example": "A1234AA" + }, + "latestPrisonTerm": { + "$ref": "#/components/schemas/PrisonTerm" + } + }, + "description": "Sentence Summary" + }, + "SentencesOffencesTerms": { + "required": [ + "fineAmount", + "lineSeq" + ], + "type": "object", + "properties": { + "sentenceSequence": { + "type": "integer", + "description": "Sentence sequence - a number representing the order", + "format": "int32" + }, + "consecutiveToSequence": { + "type": "integer", + "description": "This sentence is consecutive to this sequence (if populated)", + "format": "int32" + }, + "sentenceStatus": { + "type": "string", + "description": "This sentence status: A = Active I = Inactive" + }, + "sentenceCategory": { + "type": "string", + "description": "The sentence category e.g. 2003 or Licence" + }, + "sentenceCalculationType": { + "type": "string", + "description": "The sentence calculation type e.g. R or ADIMP_ORA" + }, + "sentenceTypeDescription": { + "type": "string", + "description": "The sentence type description e.g. Standard Determinate Sentence" + }, + "sentenceStartDate": { + "type": "string", + "description": "The sentence start date for this sentence (aka court date)", + "format": "date" + }, + "sentenceEndDate": { + "type": "string", + "description": "The sentence end date for this sentence", + "format": "date" + }, + "fineAmount": { + "type": "number", + "description": "Fine amount.", + "format": "double" + }, + "lineSeq": { + "type": "integer", + "description": "Sentence line number", + "format": "int64", + "example": 1 + }, + "offences": { + "type": "array", + "description": "The offences related to this sentence (will usually only have one offence per sentence)", + "items": { + "$ref": "#/components/schemas/OffenderOffence" + } + }, + "terms": { + "type": "array", + "description": "The terms related to this sentence (will usually only have one term per sentence)", + "items": { + "$ref": "#/components/schemas/Terms" + } + } + }, + "description": "Offender sentence and offence details" + }, + "Terms": { + "required": [ + "lifeSentence", + "sentenceTermCode", + "startDate", + "termSequence" + ], + "type": "object", + "properties": { + "termSequence": { + "type": "integer", + "description": "Sentence term number within sentence.", + "format": "int32", + "example": 1 + }, + "consecutiveTo": { + "type": "integer", + "description": "Sentence number which this sentence follows if consecutive, otherwise concurrent.", + "format": "int32", + "example": 2 + }, + "sentenceType": { + "type": "string", + "description": "Sentence type, using reference data from table SENTENCE_CALC_TYPES.", + "example": "2" + }, + "sentenceTermCode": { + "type": "string", + "description": "Sentence term code.", + "example": "IMP" + }, + "sentenceTypeDescription": { + "type": "string", + "description": "Sentence type description.", + "example": "2" + }, + "startDate": { + "type": "string", + "description": "Start date of sentence term.", + "format": "date", + "example": "2018-12-31" + }, + "years": { + "type": "integer", + "description": "Sentence length years.", + "format": "int32" + }, + "months": { + "type": "integer", + "description": "Sentence length months.", + "format": "int32" + }, + "weeks": { + "type": "integer", + "description": "Sentence length weeks.", + "format": "int32" + }, + "days": { + "type": "integer", + "description": "Sentence length days.", + "format": "int32" + }, + "lifeSentence": { + "type": "boolean", + "description": "Whether this is a life sentence." + } + }, + "description": "Offender Sentence terms details for booking id" + }, + "Belief": { + "required": [ + "addedByFirstName", + "addedByLastName", + "beliefCode", + "beliefDescription", + "beliefId", + "bookingId", + "startDate" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Prisoner booking id", + "format": "int64", + "example": 1123456 + }, + "beliefId": { + "type": "integer", + "description": "Offender belief id", + "format": "int64", + "example": 1123456 + }, + "beliefCode": { + "type": "string", + "description": "Belief Code", + "example": "SCIE" + }, + "beliefDescription": { + "type": "string", + "description": "Description associated with the belief code", + "example": "Scientologist" + }, + "startDate": { + "type": "string", + "description": "Date the belief started", + "format": "date", + "example": "2024-01-01" + }, + "endDate": { + "type": "string", + "description": "Date the belief ended", + "format": "date", + "example": "2024-12-12" + }, + "changeReason": { + "type": "boolean", + "description": "Was a reason given for change of belief?" + }, + "comments": { + "type": "string", + "description": "Comments describing reason for change of belief" + }, + "addedByFirstName": { + "type": "string", + "description": "First name of staff member that added belief" + }, + "addedByLastName": { + "type": "string", + "description": "Last name of staff member that added belief" + }, + "updatedByFirstName": { + "type": "string", + "description": "First name of staff member that updated belief" + }, + "updatedByLastName": { + "type": "string", + "description": "Last name of staff member that updated belief" + }, + "updatedDate": { + "type": "string", + "description": "Date belief was updated", + "format": "date" + }, + "verified": { + "type": "boolean", + "description": "Verified flag" + } + } + }, + "BaseSentenceCalcDates": { + "type": "object", + "properties": { + "sentenceExpiryDate": { + "type": "string", + "description": "SED - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "automaticReleaseDate": { + "type": "string", + "description": "ARD - calculated automatic (unconditional) release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "CRD - calculated conditional release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleDate": { + "type": "string", + "description": "NPD - calculated non-parole date for offender (relating to the 1991 act).", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "PRRD - calculated post-recall release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryDate": { + "type": "string", + "description": "LED - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDCED - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "PED - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "homeDetentionCurfewActualDate": { + "type": "string", + "description": "HDCAD - the offender's actual home detention curfew date.", + "format": "date", + "example": "2020-02-03" + }, + "actualParoleDate": { + "type": "string", + "description": "APD - the offender's actual parole date.", + "format": "date", + "example": "2020-02-03" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "ROTL - the date on which offender will be released on temporary licence.", + "format": "date", + "example": "2020-02-03" + }, + "earlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "ERSED - the date on which offender will be eligible for early removal (under the Early Removal Scheme for foreign nationals).", + "format": "date", + "example": "2020-02-03" + }, + "earlyTermDate": { + "type": "string", + "description": "ETD - early term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "midTermDate": { + "type": "string", + "description": "MTD - mid term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "lateTermDate": { + "type": "string", + "description": "LTD - late term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "TUSED - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "tariffDate": { + "type": "string", + "description": "Date on which minimum term is reached for parole (indeterminate/life sentences).", + "format": "date", + "example": "2020-02-03" + }, + "dtoPostRecallReleaseDate": { + "type": "string", + "description": "DPRRD - Detention training order post recall release date", + "format": "date", + "example": "2020-02-03" + }, + "tariffEarlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "TERSED - Tariff early removal scheme eligibility date", + "format": "date", + "example": "2020-02-03" + }, + "effectiveSentenceEndDate": { + "type": "string", + "description": "Effective sentence end date", + "format": "date", + "example": "2020-02-03" + } + }, + "description": "Base Sentence Calc Dates" + }, + "OffenderSentenceCalcBaseSentenceCalcDates": { + "required": [ + "agencyLocationId", + "bookingId", + "firstName", + "lastName", + "mostRecentActiveBooking", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id.", + "format": "int64", + "example": 12341321 + }, + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference", + "example": "A1000AA" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "agencyLocationId": { + "type": "string", + "description": "Agency Id", + "example": "LEI" + }, + "mostRecentActiveBooking": { + "type": "boolean", + "description": "Is this the most recent active booking", + "example": true + }, + "sentenceDetail": { + "$ref": "#/components/schemas/BaseSentenceCalcDates" + } + }, + "description": "Offender Sentence Calculation" + }, + "OffenderCalculatedKeyDates": { + "required": [ + "effectiveSentenceEndDate", + "sentenceLength" + ], + "type": "object", + "properties": { + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDCED - date on which offender will be eligible for home detention curfew.", + "format": "date", + "example": "2020-02-03" + }, + "earlyTermDate": { + "type": "string", + "description": "ETD - early term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "midTermDate": { + "type": "string", + "description": "MTD - mid term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "lateTermDate": { + "type": "string", + "description": "LTD - late term date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "dtoPostRecallReleaseDate": { + "type": "string", + "description": "DPRRD - Detention training order post recall release date", + "format": "date", + "example": "2020-02-03" + }, + "automaticReleaseDate": { + "type": "string", + "description": "ARD - calculated automatic (unconditional) release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "CRD - calculated conditional release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "PED - date on which offender is eligible for parole.", + "format": "date", + "example": "2020-02-03" + }, + "nonParoleDate": { + "type": "string", + "description": "NPD - calculated non-parole date for offender (relating to the 1991 act).", + "format": "date", + "example": "2020-02-03" + }, + "licenceExpiryDate": { + "type": "string", + "description": "LED - date on which offender licence expires.", + "format": "date", + "example": "2020-02-03" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "PRRD - calculated post-recall release date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "sentenceExpiryDate": { + "type": "string", + "description": "SED - date on which sentence expires.", + "format": "date", + "example": "2020-02-03" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "TUSED - top-up supervision expiry date for offender.", + "format": "date", + "example": "2020-02-03" + }, + "earlyRemovalSchemeEligibilityDate": { + "type": "string", + "description": "ERSED - Early Removal Scheme Eligibility Date", + "format": "date", + "example": "2020-02-03" + }, + "effectiveSentenceEndDate": { + "type": "string", + "description": "Effective sentence end date.", + "format": "date", + "example": "2020-02-03" + }, + "sentenceLength": { + "type": "string", + "description": "Sentence length in the format 00 years/00 months/00 days.", + "example": "11/00/00" + }, + "homeDetentionCurfewApprovedDate": { + "type": "string", + "description": "HDCAD - Home Detention Curfew Approved date", + "format": "date", + "example": "2020-02-03" + }, + "tariffDate": { + "type": "string", + "description": "Tarrif - Tarrif date", + "format": "date", + "example": "2020-02-03" + }, + "tariffExpiredRemovalSchemeEligibilityDate": { + "type": "string", + "description": "Tarrif Expiry date", + "format": "date", + "example": "2020-02-03" + }, + "approvedParoleDate": { + "type": "string", + "description": "APD - Approved Parole date", + "format": "date", + "example": "2020-02-03" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "ROTL - Release on Temporary Licence", + "format": "date", + "example": "2020-02-03" + }, + "judiciallyImposedSentenceLength": { + "type": "string", + "description": "Judicially imposed length in the format 00 years/00 months/00 days. Will default to 'sentenceLength'", + "example": "11/00/00" + }, + "comment": { + "type": "string", + "description": "Comments for the given calculation", + "example": "Calculated for new sentence" + }, + "reasonCode": { + "type": "string", + "description": "The reason code for the calculation", + "example": "NEW" + }, + "calculatedAt": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date and time the calculation was recorded", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Offender Calculated Key Dates" + }, + "LatestTusedData": { + "type": "object", + "properties": { + "latestTused": { + "type": "string", + "format": "date" + }, + "latestOverrideTused": { + "type": "string", + "format": "date" + }, + "comment": { + "type": "string" + }, + "offenderNo": { + "type": "string" + } + }, + "description": "Latest TUSED dates and associated info for offender" + }, + "SentenceCalculationSummary": { + "required": [ + "agencyDescription", + "agencyLocationId", + "bookingId", + "calculatedByUserId", + "calculationDate", + "calculationReason", + "lastName", + "offenderNo", + "offenderSentCalculationId" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "format": "int64" + }, + "offenderNo": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "agencyLocationId": { + "type": "string" + }, + "agencyDescription": { + "type": "string" + }, + "offenderSentCalculationId": { + "type": "integer", + "format": "int64" + }, + "calculationDate": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "example": "2021-07-05T10:35:17" + }, + "staffId": { + "type": "integer", + "format": "int64" + }, + "commentText": { + "type": "string" + }, + "calculationReason": { + "type": "string" + }, + "calculatedByUserId": { + "type": "string" + } + }, + "description": "Offender Sentence Calculation Summary" + }, + "AssessmentSummary": { + "required": [ + "assessmentCode", + "assessmentDate", + "assessmentSeq", + "bookingId", + "cellSharingAlertFlag", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking number", + "format": "int64", + "example": 123456 + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number of assessment within booking", + "format": "int32", + "example": 1 + }, + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number).", + "example": "GV09876N" + }, + "classificationCode": { + "type": "string", + "description": "Classification code. This will not have a value if the assessment is incomplete or pending", + "example": "STANDARD" + }, + "assessmentCode": { + "type": "string", + "description": "Identifies the type of assessment", + "example": "CSR" + }, + "cellSharingAlertFlag": { + "type": "boolean", + "description": "Indicates whether this is a CSRA assessment" + }, + "assessmentDate": { + "type": "string", + "description": "Date assessment was created", + "format": "date", + "example": "2018-02-11" + }, + "assessmentAgencyId": { + "type": "string", + "description": "The assessment creation agency id", + "example": "MDI" + }, + "assessmentComment": { + "type": "string", + "description": "Comment from assessor", + "example": "Comment details" + }, + "assessorUser": { + "type": "string", + "description": "Username who made the assessment", + "example": "NGK33Y" + }, + "nextReviewDate": { + "type": "string", + "description": "Date of next review", + "format": "date", + "example": "2018-02-11" + } + }, + "description": "AssessmentSummary" + }, + "AssessmentDetail": { + "required": [ + "assessmentCode", + "assessmentDate", + "assessmentSeq", + "bookingId", + "cellSharingAlertFlag", + "offenderNo", + "questions" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking number", + "format": "int64", + "example": 123456 + }, + "assessmentSeq": { + "type": "integer", + "description": "Sequence number of assessment within booking", + "format": "int32", + "example": 1 + }, + "offenderNo": { + "type": "string", + "description": "Offender number (e.g. NOMS Number).", + "example": "GV09876N" + }, + "classificationCode": { + "type": "string", + "description": "Classification code. This will not have a value if the assessment is incomplete or pending", + "example": "STANDARD" + }, + "assessmentCode": { + "type": "string", + "description": "Identifies the type of assessment", + "example": "CSR" + }, + "cellSharingAlertFlag": { + "type": "boolean", + "description": "Indicates whether this is a CSRA assessment" + }, + "assessmentDate": { + "type": "string", + "description": "Date assessment was created", + "format": "date", + "example": "2018-02-11" + }, + "assessmentAgencyId": { + "type": "string", + "description": "The assessment creation agency id", + "example": "MDI" + }, + "assessmentComment": { + "type": "string", + "description": "Comment from assessor", + "example": "Comment details" + }, + "assessorUser": { + "type": "string", + "description": "Username who made the assessment", + "example": "NGK33Y" + }, + "nextReviewDate": { + "type": "string", + "description": "Date of next review", + "format": "date", + "example": "2018-02-11" + }, + "assessmentCommitteeCode": { + "type": "string", + "description": "The code of the committee that conducted the assessment", + "example": "REVIEW" + }, + "assessmentCommitteeName": { + "type": "string", + "description": "The name of the committee that conducted the assessment", + "example": "REVIEW" + }, + "approvalDate": { + "type": "string", + "description": "Date of assessment approval", + "format": "date", + "example": "2018-02-11" + }, + "approvalCommitteeCode": { + "type": "string", + "description": "The code of the committee that conducted the approval", + "example": "REVIEW" + }, + "approvalCommitteeName": { + "type": "string", + "description": "The name of the committee that conducted the approval", + "example": "REVIEW" + }, + "originalClassificationCode": { + "type": "string", + "description": "Classification code before it was reviewed", + "example": "HI" + }, + "classificationReviewReason": { + "type": "string", + "description": "The reason for the review of the classification", + "example": "HI" + }, + "overridingClassificationCode": { + "type": "string", + "description": "The classification code entered to override the calculated value prior to approval", + "example": "HI" + }, + "calculatedClassificationCode": { + "type": "string", + "description": "The classification code originally calculated by NOMIS based on the answers given to the questions when carrying out the initial review", + "example": "HI" + }, + "approvedClassificationCode": { + "type": "string", + "description": "The classification code that has been approved", + "example": "HI" + }, + "approvalComment": { + "type": "string", + "description": "Comment added at approval of classification code", + "example": "Comment" + }, + "overrideReason": { + "type": "string", + "description": "The reason given for overriding the calculated classification code", + "example": "Overriding comment" + }, + "questions": { + "type": "array", + "description": "Assessment questions and answers, in the order they were asked", + "items": { + "$ref": "#/components/schemas/AssessmentQuestion" + } + } + }, + "description": "AssessmentDetail" + }, + "AssessmentQuestion": { + "required": [ + "question" + ], + "type": "object", + "properties": { + "question": { + "type": "string", + "description": "Question" + }, + "answer": { + "type": "string", + "description": "The answer given. More than one answer might have been given, in which case the other answers will be in the additionalAnswers property" + }, + "additionalAnswers": { + "type": "array", + "description": "If a question has more than one answer, all but the first answer will be in this property", + "items": { + "type": "string", + "description": "If a question has more than one answer, all but the first answer will be in this property" + } + } + }, + "description": "AssessmentQuestion" + }, + "PageOffenceDto": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenceDto" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "OffenderOutTodayDto": { + "required": [ + "dateOfBirth", + "firstName", + "lastName", + "offenderNo", + "timeOut" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender Unique Reference" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "reasonDescription": { + "type": "string", + "description": "Reason for out movement" + }, + "timeOut": { + "type": "string", + "format": "partial-time" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + } + }, + "description": "Offender out today details" + }, + "OffenderIn": { + "required": [ + "bookingId", + "dateOfBirth", + "firstName", + "fromAgencyDescription", + "fromAgencyId", + "fromCity", + "lastName", + "location", + "movementDateTime", + "movementTime", + "offenderNo", + "toAgencyDescription", + "toAgencyId", + "toCity" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number" + }, + "bookingId": { + "type": "integer", + "format": "int64" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "firstName": { + "type": "string" + }, + "middleName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "fromAgencyId": { + "type": "string", + "description": "Id for Agency travelling from" + }, + "fromAgencyDescription": { + "type": "string", + "description": "Description for Agency travelling from" + }, + "toAgencyId": { + "type": "string", + "description": "Id for Agency travelling to" + }, + "toAgencyDescription": { + "type": "string", + "description": "Description for Agency travelling to" + }, + "fromCity": { + "type": "string", + "description": "City offender was received from" + }, + "toCity": { + "type": "string", + "description": "City offender was sent to" + }, + "movementTime": { + "type": "string", + "description": "Movement time", + "format": "partial-time" + }, + "movementDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Movement date time", + "example": "2021-07-05T10:35:17" + }, + "location": { + "type": "string", + "description": "Description of the offender's (internal) location" + } + }, + "description": "Summary of an offender counted as Establishment Roll - In" + }, + "CourtEventBasic": { + "required": [ + "court", + "eventSubType", + "offenderNo", + "startTime" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (NOMS ID)", + "example": "G3878UK" + }, + "court": { + "type": "string", + "description": "The agency code of the court", + "example": "LEEDCC" + }, + "courtDescription": { + "type": "string", + "description": "The court description", + "example": "Leeds Crown Court" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The planned date and time of the start of the event in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventSubType": { + "type": "string", + "description": "The court event subtype (from MOVE_RSN reference data)", + "example": "CRT" + }, + "eventDescription": { + "type": "string", + "description": "The event description", + "example": "Court Appearance" + }, + "hold": { + "type": "boolean", + "description": "Whether hold ordered by the court at this hearing" + } + }, + "description": "Basic Summary data for a scheduled court event" + }, + "CourtEvent": { + "required": [ + "bookingActiveFlag", + "bookingInOutStatus", + "commentText", + "createDateTime", + "directionCode", + "endTime", + "eventClass", + "eventDate", + "eventId", + "eventStatus", + "eventSubType", + "eventType", + "fromAgency", + "fromAgencyDescription", + "judgeName", + "offenderNo", + "startTime", + "toAgency", + "toAgencyDescription" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (NOMS ID)", + "example": "G3878UK" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the record was created in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventId": { + "type": "integer", + "description": "The internal event ID", + "format": "int64", + "example": 12343434 + }, + "fromAgency": { + "type": "string", + "description": "The agency code ", + "example": "LEI" + }, + "fromAgencyDescription": { + "type": "string", + "description": "The from agency description", + "example": "HMP LEEDS" + }, + "toAgency": { + "type": "string", + "description": "The agency code to which the transfer will be made (if an agency)", + "example": "LEEDCC" + }, + "toAgencyDescription": { + "type": "string", + "description": "The to agency description", + "example": "Leeds Crown Court" + }, + "eventDate": { + "type": "string", + "description": "The date on which the event is scheduled to occur", + "format": "date", + "example": "2019-12-01" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The planned date and time of the start of the event in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The planned date and time of the end of the event in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventClass": { + "type": "string", + "description": "The event class (from COURT_EVENTS)", + "example": "EXT_MOV" + }, + "eventType": { + "type": "string", + "description": "The event type", + "example": "CRT" + }, + "eventSubType": { + "type": "string", + "description": "The event sub-type", + "example": "DP" + }, + "eventStatus": { + "type": "string", + "description": "The event status - either SCH (scheduled) or COMP (completed)", + "example": "SCH" + }, + "judgeName": { + "type": "string", + "description": "Judge name, where available", + "example": "Harris" + }, + "directionCode": { + "type": "string", + "description": "The direction code (IN or OUT)", + "example": "IN" + }, + "commentText": { + "type": "string", + "description": "The comment text stored against this event", + "example": "Restricted access to parking level" + }, + "bookingActiveFlag": { + "type": "boolean", + "description": "The booking active flag", + "example": true + }, + "bookingInOutStatus": { + "type": "string", + "description": "The booking in or out status - either IN or OUT", + "example": "OUT" + } + }, + "description": "Summary data for a scheduled court event" + }, + "MovementSummary": { + "required": [ + "createDateTime", + "directionCode", + "eventId", + "fromAgency", + "fromAgencyDescription", + "movementReason", + "movementTime", + "movementType", + "movementTypeDescription", + "offenderNo", + "toAgency", + "toAgencyDescription" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (NOMS ID)", + "example": "G3878UK" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Timestamp when the external movement record was created in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventId": { + "type": "integer", + "description": "The internal event ID", + "format": "int64", + "example": 1223232 + }, + "fromAgency": { + "type": "string", + "description": "Agency travelling from", + "example": "LEI" + }, + "fromAgencyDescription": { + "type": "string", + "description": "Description of the agency travelling from", + "example": "HMP LEEDS" + }, + "toAgency": { + "type": "string", + "description": "Agency travelling to", + "example": "MDI" + }, + "toAgencyDescription": { + "type": "string", + "description": "Description of the agency travelling to", + "example": "HMP MOORLANDS" + }, + "fromCity": { + "type": "string", + "description": "City offender was received from", + "example": "LEEDS" + }, + "toCity": { + "type": "string", + "description": "City offender was sent to", + "example": "DONCASTER" + }, + "arrestAgencyLocId": { + "type": "string", + "description": "The arresting agency location ID", + "example": "SYPOL" + }, + "internalScheduleType": { + "type": "string", + "description": "Internal schedule type" + }, + "internalScheduleReasonCode": { + "type": "string", + "description": "Internal schedule reason code" + }, + "toProvStatCode": { + "type": "string", + "description": "To prov stat code - from offender_external_movements" + }, + "escortCode": { + "type": "string", + "description": "The escort code", + "example": "PECS123" + }, + "escortText": { + "type": "string", + "description": "The escort text", + "example": "Secure van" + }, + "movementType": { + "type": "string", + "description": "ADM (admission), CRT (court), REL (release), TAP (temporary absence) or TRN (transfer)", + "example": "ADM", + "enum": [ + "ADM", + "CRT", + "REL", + "TAP", + "TRN" + ] + }, + "movementTypeDescription": { + "type": "string", + "description": "Description of the movement type", + "example": "Admission" + }, + "directionCode": { + "type": "string", + "description": "IN or OUT", + "example": "IN" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Movement date and time in Europe/London local time format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "movementReason": { + "type": "string", + "description": "Description of movement reason", + "example": "Convicted at court" + }, + "commentText": { + "type": "string", + "description": "Comment", + "example": "This is a free text comment" + } + }, + "description": "Summary data for a completed movement" + }, + "ReleaseEvent": { + "required": [ + "approvedReleaseDate", + "bookingActiveFlag", + "bookingInOutStatus", + "commentText", + "createDateTime", + "eventClass", + "eventId", + "eventStatus", + "fromAgency", + "fromAgencyDescription", + "movementReasonCode", + "movementReasonDescription", + "movementTypeCode", + "movementTypeDescription", + "offenderNo", + "releaseDate" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (NOMS ID)", + "example": "G3878UK" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the record was created in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventId": { + "type": "integer", + "description": "The internal event ID", + "format": "int64", + "example": 1234556 + }, + "fromAgency": { + "type": "string", + "description": "The agency code from which the release will be made", + "example": "LEI" + }, + "fromAgencyDescription": { + "type": "string", + "description": "The agency description", + "example": "HMP LEEDS" + }, + "releaseDate": { + "type": "string", + "description": "The planned release date", + "format": "date", + "example": "2019-12-01" + }, + "approvedReleaseDate": { + "type": "string", + "description": "The approved release date", + "format": "date", + "example": "2019-12-01" + }, + "eventClass": { + "type": "string", + "description": "The event class - usually EXT_MOV", + "example": "EXT_MOV" + }, + "eventStatus": { + "type": "string", + "description": "The event status - either SCH (scheduled) or COMP (completed)", + "example": "SCH" + }, + "movementTypeCode": { + "type": "string", + "description": "The movement type code - from OFFENDER_IND_SCHEDULE", + "example": "REL" + }, + "movementTypeDescription": { + "type": "string", + "description": "The movement type description from reference data", + "example": "Release at end of sentence" + }, + "movementReasonCode": { + "type": "string", + "description": "The movement reason code - from OFFENDER_IND_SCHEDULE", + "example": "DD" + }, + "movementReasonDescription": { + "type": "string", + "description": "The movement reason description from reference data", + "example": "Release" + }, + "commentText": { + "type": "string", + "description": "Any comment text entered against this event", + "example": "Notes relating to this release" + }, + "bookingActiveFlag": { + "type": "boolean", + "description": "The booking active flag", + "example": true + }, + "bookingInOutStatus": { + "type": "string", + "description": "The booking in or out status - either IN or OUT", + "example": "OUT" + } + }, + "description": "Summary data for a scheduled offender release" + }, + "TransferEvent": { + "required": [ + "bookingActiveFlag", + "bookingInOutStatus", + "createDateTime", + "directionCode", + "endTime", + "engagementCode", + "escortCode", + "eventClass", + "eventDate", + "eventId", + "eventStatus", + "eventSubType", + "eventType", + "fromAgency", + "fromAgencyDescription", + "judgeName", + "offenderNo", + "outcomeReasonCode", + "performanceCode", + "startTime", + "toAgency", + "toAgencyDescription", + "toCity" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number(NOMS ID)", + "example": "G3878UK" + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the record was created in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "eventId": { + "type": "integer", + "description": "The internal event ID", + "format": "int64", + "example": 1232323 + }, + "fromAgency": { + "type": "string", + "description": "The agency code from which the event will start", + "example": "LEI" + }, + "fromAgencyDescription": { + "type": "string", + "description": "The from agency description", + "example": "HMP LEEDS" + }, + "toAgency": { + "type": "string", + "description": "The agency code to which the transfer will be made (if an agency)", + "example": "MDI" + }, + "toAgencyDescription": { + "type": "string", + "description": "The to agency description", + "example": "HMP MOORLANDS" + }, + "toCity": { + "type": "string", + "description": "The destination city when available", + "example": "DONCASTER" + }, + "eventStatus": { + "type": "string", + "description": "The event status - either SCH or COMP", + "example": "SCH" + }, + "eventClass": { + "type": "string", + "description": "The event class - from OFFENDER_IND_SCHEDULES", + "example": "EXT_MOV" + }, + "eventType": { + "type": "string", + "description": "The event type - from OFFENDER_IND_SCHEDULES", + "example": "TRN" + }, + "eventSubType": { + "type": "string", + "description": "The event sub-type - from OFFENDER_IND_SCHEDULES", + "example": "PP" + }, + "eventDate": { + "type": "string", + "description": "The date on which the event is scheduled to occur", + "format": "date", + "example": "2019-01-01" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The planned date and time of the start of the event in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The planned date and time of the end of the event in Europe/London (ISO 8601) format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "outcomeReasonCode": { + "type": "string", + "description": "The outcome reason code - from offender_ind_schedules", + "example": "CO" + }, + "judgeName": { + "type": "string", + "description": "The name of the judge where known" + }, + "engagementCode": { + "type": "string", + "description": "Engagement code", + "example": "ENG" + }, + "escortCode": { + "type": "string", + "description": "The escort code", + "example": "DEF2" + }, + "performanceCode": { + "type": "string", + "description": "The performance code", + "example": "PERF1" + }, + "directionCode": { + "type": "string", + "description": "The direction code (IN or OUT)", + "example": "IN" + }, + "bookingActiveFlag": { + "type": "boolean", + "description": "The booking active flag", + "example": true + }, + "bookingInOutStatus": { + "type": "string", + "description": "The booking in or out status - either IN or OUT from offender bookings", + "example": "OUT" + } + }, + "description": "A scheduled offender movement event" + }, + "TransferSummary": { + "type": "object", + "properties": { + "courtEvents": { + "type": "array", + "description": "List of scheduled or completed court events", + "items": { + "$ref": "#/components/schemas/CourtEvent" + } + }, + "transferEvents": { + "type": "array", + "description": "List of scheduled or completed offender events", + "items": { + "$ref": "#/components/schemas/TransferEvent" + } + }, + "releaseEvents": { + "type": "array", + "description": "List of scheduled or completed release events", + "items": { + "$ref": "#/components/schemas/ReleaseEvent" + } + }, + "movements": { + "type": "array", + "description": "List of confirmed movements", + "items": { + "$ref": "#/components/schemas/MovementSummary" + } + } + }, + "description": "The container object for transfer and movement events" + }, + "MovementCount": { + "required": [ + "in", + "out" + ], + "type": "object", + "properties": { + "in": { + "type": "integer", + "description": "Number of prisoners arrived so far on given date", + "format": "int32" + }, + "out": { + "type": "integer", + "description": "Number of prisoners that have left so far on given date", + "format": "int32" + } + }, + "description": "Establishment roll count in and out numbers" + }, + "OffenderInReception": { + "required": [ + "bookingId", + "dateOfBirth", + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number" + }, + "bookingId": { + "type": "integer", + "description": "Booking Id", + "format": "int64" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + } + }, + "description": "Summary of an offender counted as Establishment Roll - Reception" + }, + "OffenderOut": { + "required": [ + "bookingId", + "dateOfBirth", + "firstName", + "lastName", + "location", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Display Prisoner Number" + }, + "bookingId": { + "type": "integer", + "format": "int64" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "location": { + "type": "string", + "description": "The prisoner's internal location (Cell)" + } + }, + "description": "Summary of an offender 'currently out' according to Establishment Roll" + }, + "OutOnTemporaryAbsenceSummary": { + "required": [ + "dateOfBirth", + "firstName", + "lastName", + "movementReason", + "movementReasonCode", + "movementTime", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Offender number (NOMS ID)", + "example": "G3878UK" + }, + "firstName": { + "type": "string", + "description": "Prisoner first name.", + "example": "JOHN" + }, + "lastName": { + "type": "string", + "description": "Prisoner's last name.", + "example": "SMITH" + }, + "dateOfBirth": { + "type": "string", + "description": "Prisoner's date of birth.", + "format": "date", + "example": "1980-05-02" + }, + "movementTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Movement date and time in Europe/London local time format without timezone offset e.g. YYYY-MM-DDTHH:MM:SS.", + "example": "2021-07-05T10:35:17" + }, + "toAgency": { + "type": "string", + "description": "Agency travelling to", + "example": "MDI" + }, + "toAgencyDescription": { + "type": "string", + "description": "Description of the agency travelling to", + "example": "HMP MOORLANDS" + }, + "toCity": { + "type": "string", + "description": "City offender was sent to", + "example": "DONCASTER" + }, + "movementReasonCode": { + "type": "string", + "description": "The movement reason code", + "example": "C1" + }, + "movementReason": { + "type": "string", + "description": "Description of movement reason", + "example": "Convicted at court" + }, + "commentText": { + "type": "string", + "description": "Comment", + "example": "This is a free text comment" + } + }, + "description": "Summary data for a completed movement" + }, + "Keyworker": { + "required": [ + "firstName", + "lastName", + "numberAllocated", + "staffId", + "status" + ], + "type": "object", + "properties": { + "staffId": { + "type": "integer", + "description": "Unique identifier for staff member.", + "format": "int64" + }, + "firstName": { + "type": "string", + "description": "Staff member's first name." + }, + "lastName": { + "type": "string", + "description": "Staff member's last name." + }, + "status": { + "type": "string", + "description": "Status of staff member." + }, + "thumbnailId": { + "type": "integer", + "description": "Identifier for staff member image.", + "format": "int64" + }, + "numberAllocated": { + "type": "integer", + "description": "Current number allocated", + "format": "int32" + } + }, + "description": "Keyworker Details" + }, + "GangMemberDetail": { + "required": [ + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "offenderNo": { + "type": "string", + "description": "Prisoner Number of this gang member", + "example": "A1234AA" + }, + "firstName": { + "type": "string", + "description": "First name of this gang member", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last name of this gang member", + "example": "Smith" + }, + "prisonId": { + "type": "string", + "description": "Prison ID if inside or OUT if not inside", + "example": "MDI" + }, + "Moorland": { + "type": "string", + "description": "Name of the prison or Outside if not inside" + }, + "cellLocation": { + "type": "string", + "description": "Cell location of the gang member (if inside)", + "example": "MDI-A-1-001" + } + }, + "description": "Gang Member Detail" + }, + "GangMemberSummary": { + "required": [ + "currentGangs", + "gangNonAssociations" + ], + "type": "object", + "properties": { + "member": { + "$ref": "#/components/schemas/GangMemberDetail" + }, + "currentGangs": { + "type": "array", + "description": "Current gang involvement", + "items": { + "$ref": "#/components/schemas/GangSummary" + } + }, + "gangNonAssociations": { + "type": "array", + "description": "Non associations with other gangs", + "items": { + "$ref": "#/components/schemas/GangNonAssociationSummary" + } + } + }, + "description": "Summary of Gangs for a specified prisoner" + }, + "GangNonAssociationSummary": { + "required": [ + "code", + "members", + "name", + "reason" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The code assigned for the gang", + "example": "A_GANG" + }, + "name": { + "type": "string", + "description": "The name of the gang", + "example": "A New Gang" + }, + "reason": { + "type": "string", + "description": "Reason this gang should not be associated with other gang", + "example": "Rival Gang" + }, + "members": { + "type": "array", + "description": "List of members of this gang", + "items": { + "$ref": "#/components/schemas/GangMemberDetail" + } + } + }, + "description": "Non associations Gang information" + }, + "GangSummary": { + "required": [ + "code", + "name", + "numberOfMembers" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "The code assigned for the gang", + "example": "A_GANG" + }, + "name": { + "type": "string", + "description": "The name of the gang", + "example": "A New Gang" + }, + "comment": { + "type": "string", + "description": "Information about this member within the gang", + "example": "Leader of gang" + }, + "numberOfMembers": { + "type": "integer", + "description": "Number of members in this gang", + "format": "int64", + "example": 15 + } + }, + "description": "Gang Summary" + }, + "PageEducation": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Education" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "CourtEventDetails": { + "required": [ + "courtEventType", + "courtLocation", + "eventId", + "startTime" + ], + "type": "object", + "properties": { + "eventId": { + "type": "integer", + "format": "int64" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "example": "2021-07-05T10:35:17" + }, + "courtLocation": { + "type": "string" + }, + "courtEventType": { + "type": "string" + }, + "comments": { + "type": "string" + }, + "caseReference": { + "type": "string" + } + } + }, + "CourtDateCharge": { + "type": "object", + "properties": { + "chargeId": { + "type": "integer", + "description": "The id of the charge", + "format": "int64" + }, + "offenceCode": { + "type": "string", + "description": "The offence code of the office in the court case" + }, + "offenceStatue": { + "type": "string", + "description": "The offence statute of the office in the court case" + }, + "offenceDescription": { + "type": "string", + "description": "The offence description" + }, + "offenceDate": { + "type": "string", + "description": "The date of the offence", + "format": "date" + }, + "offenceEndDate": { + "type": "string", + "description": "The offence end date", + "format": "date" + }, + "guilty": { + "type": "boolean", + "description": "Was the verdict guilty or not guilty" + }, + "courtCaseId": { + "type": "integer", + "description": "The id of the court case", + "format": "int64" + }, + "courtCaseRef": { + "type": "string", + "description": "Court case reference" + }, + "courtLocation": { + "type": "string", + "description": "Court case location" + }, + "sentenceSequence": { + "type": "integer", + "description": "The sequence of the sentence from this charge", + "format": "int32" + }, + "sentenceDate": { + "type": "string", + "description": "The sentence date", + "format": "date" + }, + "resultDescription": { + "type": "string", + "description": "The result description of the charge" + }, + "active": { + "type": "boolean", + "description": "Is this charge active in NOMIS." + } + }, + "description": "A charge linked to a court date" + }, + "CourtDateResult": { + "required": [ + "bookNumber", + "bookingId", + "charge", + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of this court date", + "format": "int64" + }, + "date": { + "type": "string", + "description": "The date of the court result", + "format": "date" + }, + "resultCode": { + "type": "string", + "description": "The result code of the court date" + }, + "resultDescription": { + "type": "string", + "description": "The result description of the court date" + }, + "resultDispositionCode": { + "type": "string", + "description": "The disposition code of the result of the court date" + }, + "charge": { + "$ref": "#/components/schemas/CourtDateCharge" + }, + "bookingId": { + "type": "integer", + "description": "The id of the booking this court date was linked to", + "format": "int64" + }, + "bookNumber": { + "type": "string", + "description": "The user readable ID for a booking" + } + }, + "description": "Represents a court date and its outcome" + }, + "CourtDateChargeAndOutcomes": { + "required": [ + "active", + "bookNumber", + "bookingId", + "guilty", + "outcomes" + ], + "type": "object", + "properties": { + "chargeId": { + "type": "integer", + "description": "The id of the charge", + "format": "int64" + }, + "offenceCode": { + "type": "string", + "description": "The offence code of the office in the court case" + }, + "offenceStatue": { + "type": "string", + "description": "The offence statute of the office in the court case" + }, + "offenceDescription": { + "type": "string", + "description": "The offence description" + }, + "offenceDate": { + "type": "string", + "description": "The date of the offence", + "format": "date" + }, + "offenceEndDate": { + "type": "string", + "description": "The offence end date", + "format": "date" + }, + "guilty": { + "type": "boolean", + "description": "Was the verdict guilty or not guilty" + }, + "courtCaseId": { + "type": "integer", + "description": "The id of the court case", + "format": "int64" + }, + "courtCaseRef": { + "type": "string", + "description": "Court case reference" + }, + "courtLocation": { + "type": "string", + "description": "Court case location" + }, + "sentenceSequence": { + "type": "integer", + "description": "The sequence of the sentence from this charge", + "format": "int32" + }, + "sentenceDate": { + "type": "string", + "description": "The sentence date", + "format": "date" + }, + "resultDescription": { + "type": "string", + "description": "The result description of the charge" + }, + "bookingId": { + "type": "integer", + "description": "The id of the booking this court date was linked to", + "format": "int64" + }, + "bookNumber": { + "type": "string", + "description": "The user readable ID for a booking" + }, + "active": { + "type": "boolean", + "description": "Is this charge active in NOMIS." + }, + "outcomes": { + "type": "array", + "description": "All the court date outcomes for this charge", + "items": { + "$ref": "#/components/schemas/CourtDateOutcome" + } + } + }, + "description": "A charge and all its court date outcomes" + }, + "CourtDateOutcome": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of this court date", + "format": "int64" + }, + "date": { + "type": "string", + "description": "The date of the court result", + "format": "date" + }, + "resultCode": { + "type": "string", + "description": "The result code of the court date" + }, + "resultDescription": { + "type": "string", + "description": "The result description of the court date" + }, + "resultDispositionCode": { + "type": "string", + "description": "The disposition code of the result of the court date" + } + }, + "description": "Represents the outcome for a court date of a given charge" + }, + "BedAssignment": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Unique, numeric booking id. Used as a primary key when combined with the bed assignment sequence", + "format": "int64", + "example": 1234134 + }, + "livingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that offender is assigned to.", + "format": "int64", + "example": 123123 + }, + "assignmentDate": { + "type": "string", + "description": "Date the offender was assigned to a living unit.", + "format": "date", + "example": "2020-10-12" + }, + "assignmentDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time the offender was moved to a living unit.", + "example": "2021-07-05T10:35:17" + }, + "assignmentReason": { + "type": "string", + "description": "Assignment reason code", + "example": "ADM" + }, + "assignmentEndDate": { + "type": "string", + "description": "Date an offender was moved out of the living unit", + "format": "date", + "example": "2020-11-12" + }, + "assignmentEndDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time an offender was moved out of the living unit", + "example": "2021-07-05T10:35:17" + }, + "agencyId": { + "type": "string", + "description": "Agency of living unit", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Description of living unit (e.g. cell) ", + "example": "MDI-1-1-2" + }, + "bedAssignmentHistorySequence": { + "type": "integer", + "description": "Bed assignment sequence. Used as a primary key when combined with the booking id", + "format": "int32", + "example": 2 + }, + "movementMadeBy": { + "type": "string", + "description": "the staff member responsible for the movement of a prisoner", + "example": "KQJ74F" + }, + "offenderNo": { + "type": "string", + "description": "Offender number", + "example": "A1234AA" + } + }, + "description": "Bed assignment history entry" + }, + "OffenderCell": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The case identifier", + "format": "int64", + "example": 1 + }, + "description": { + "type": "string", + "description": "Description", + "example": "LEI-1-1" + }, + "userDescription": { + "type": "string", + "description": "Description", + "example": "LEI-1-1" + }, + "capacity": { + "type": "integer", + "description": "Capacity", + "format": "int32", + "example": 2 + }, + "noOfOccupants": { + "type": "integer", + "description": "Number of occupants", + "format": "int32", + "example": 2 + }, + "attributes": { + "type": "array", + "description": "List of attributes", + "items": { + "$ref": "#/components/schemas/OffenderCellAttribute" + } + } + }, + "description": "Offender cell details" + }, + "OffenderCellAttribute": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Attribute code", + "example": "LC" + }, + "description": { + "type": "string", + "description": "Attribute description", + "example": "Listener Cell" + } + }, + "description": "Offender cell details" + }, + "VisitSummary": { + "required": [ + "hasVisits" + ], + "type": "object", + "properties": { + "startDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which next scheduled (i.e. not cancelled) event starts (if any)", + "example": "2021-07-05T10:35:17" + }, + "hasVisits": { + "type": "boolean", + "description": "Whether the prisoner has any visits (previous or next)" + } + }, + "description": "Visit summary" + }, + "PageVisitWithVisitors": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VisitWithVisitors" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "VisitDetails": { + "required": [ + "attended", + "completionStatus", + "eventOutcome", + "eventStatus", + "startTime", + "visitType" + ], + "type": "object", + "properties": { + "relationship": { + "type": "string", + "description": "Relationship of lead visitor to offender" + }, + "location": { + "type": "string", + "description": "Location at which event takes place (could be an internal location, agency or external address)." + }, + "prison": { + "type": "string", + "description": "Prison at which event takes place" + }, + "attended": { + "type": "boolean", + "description": "Whether the visit was attended. Translation of eventOutcome into boolean. Defaults in NOMIS to true when the visit is created" + }, + "eventStatus": { + "type": "string", + "description": "Status of event (EVENT_STS reference code)", + "enum": [ + "EXP", + "SCH", + "COMP", + "CANC" + ] + }, + "eventStatusDescription": { + "type": "string", + "description": "Description of eventStatus code" + }, + "completionStatus": { + "type": "string", + "description": "Completion status of visit (VIS_COMPLETE reference code)", + "enum": [ + "NORM", + "SCH", + "VDE", + "OFFEND", + "VISITOR", + "CANC", + "HMPOP" + ] + }, + "completionStatusDescription": { + "type": "string", + "description": "Description of completionStatus code" + }, + "visitType": { + "type": "string", + "description": "Code for social (SCON) or official (OFFI) type of visit (VISIT_TYPE reference code)", + "enum": [ + "OFFI", + "SCON" + ] + }, + "visitTypeDescription": { + "type": "string", + "description": "Description of social or official visit", + "enum": [ + "Official Visit", + "Social Contact" + ] + }, + "leadVisitor": { + "type": "string", + "description": "Name of lead visitor (blank if there was no visiting order for this visit)" + }, + "relationshipDescription": { + "type": "string", + "description": "Description of relationship code" + }, + "startTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event starts", + "example": "2021-07-05T10:35:17" + }, + "endTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date and time at which event ends", + "example": "2021-07-05T10:35:17" + }, + "eventOutcome": { + "type": "string", + "description": "Whether attended (ATT) or not (ABS) (OUTCOMES reference code)", + "enum": [ + "ATT", + "ABS" + ] + }, + "eventOutcomeDescription": { + "type": "string", + "description": "Description of eventOutcome code" + }, + "cancellationReason": { + "type": "string", + "description": "Reason for cancellation if not attended (MOVE_CANC_RS reference code)" + }, + "cancelReasonDescription": { + "type": "string", + "description": "Description of cancellationReason code" + }, + "visitors": { + "type": "array", + "description": "List of visitors on visit", + "items": { + "$ref": "#/components/schemas/Visitor" + } + }, + "searchType": { + "type": "string", + "description": "Type of search performed - mandatory if visit completed (SEARCH_LEVEL reference code)", + "example": "FULL" + }, + "searchTypeDescription": { + "type": "string", + "description": "Description of searchType code" + } + }, + "description": "Visit details" + }, + "VisitWithVisitors": { + "required": [ + "visitDetails", + "visitors" + ], + "type": "object", + "properties": { + "visitors": { + "type": "array", + "description": "List of visitors on visit", + "items": { + "$ref": "#/components/schemas/Visitor" + } + }, + "visitDetails": { + "$ref": "#/components/schemas/VisitDetails" + } + }, + "description": "List of visitors for a visit" + }, + "Visitor": { + "required": [ + "attended", + "dateOfBirth", + "firstName", + "lastName", + "leadVisitor", + "personId", + "relationship" + ], + "type": "object", + "properties": { + "relationship": { + "type": "string", + "description": "Relationship of visitor to offender" + }, + "attended": { + "type": "boolean", + "description": "Whether the visitor attended. Defaults in NOMIS to true when the visit is created so of limited value." + }, + "personId": { + "type": "integer", + "description": "Person id of visitor", + "format": "int64" + }, + "lastName": { + "type": "string", + "description": "Last name of visitor" + }, + "firstName": { + "type": "string", + "description": "First name of visitor" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of birth of visitor", + "format": "date" + }, + "leadVisitor": { + "type": "boolean", + "description": "Flag marking the visitor as lead visitor or not (only set for visit orders)", + "example": true + } + }, + "description": "Visitor" + }, + "SecondaryLanguage": { + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Booking id", + "format": "int64", + "example": 10000 + }, + "code": { + "type": "string", + "description": "Language code", + "example": "ENG" + }, + "description": { + "type": "string", + "description": "Language description", + "example": "English" + }, + "canRead": { + "type": "boolean", + "description": "Reading proficiency" + }, + "canWrite": { + "type": "boolean", + "description": "Writing proficiency" + }, + "canSpeak": { + "type": "boolean", + "description": "Speaking proficiency" + } + }, + "description": "Secondary language" + }, + "ReasonableAdjustment": { + "type": "object", + "properties": { + "treatmentCode": { + "type": "string", + "description": "Treatment Code", + "example": "WHEELCHR_ACC" + }, + "commentText": { + "type": "string", + "description": "Comment Text", + "example": "abcd" + }, + "startDate": { + "type": "string", + "description": "Start Date", + "format": "date", + "example": "2010-06-21" + }, + "endDate": { + "type": "string", + "description": "End Date", + "format": "date", + "example": "2010-06-21" + }, + "agencyId": { + "type": "string", + "description": "The agency id where the adjustment was created", + "example": "LEI" + }, + "agencyDescription": { + "type": "string", + "description": "The formatted agency description where the adjustment was created", + "example": "Moorland (HMP)" + }, + "treatmentDescription": { + "type": "string", + "description": "Treatment Description", + "example": "Wheelchair accessibility" + }, + "personalCareNeedId": { + "type": "integer", + "description": "Personal care need ID", + "format": "int64", + "example": 1 + } + }, + "description": "Reasonable Adjustment" + }, + "ReasonableAdjustments": { + "type": "object", + "properties": { + "reasonableAdjustments": { + "type": "array", + "description": "Reasonable Adjustments", + "items": { + "$ref": "#/components/schemas/ReasonableAdjustment" + } + } + }, + "description": "Reasonable Adjustments" + }, + "PropertyContainer": { + "type": "object", + "properties": { + "location": { + "$ref": "#/components/schemas/Location" + }, + "sealMark": { + "type": "string", + "description": "The case sequence number for the offender", + "example": "MDI10" + }, + "containerType": { + "type": "string", + "description": "The type of container", + "example": "Valuables" + } + }, + "description": "Offender property container details" + }, + "CourtHearings": { + "type": "object", + "properties": { + "hearings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CourtHearing" + } + } + }, + "description": "Represents court hearings for an offender booking." + }, + "CourtCase": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The case identifier", + "format": "int64", + "example": 1 + }, + "caseSeq": { + "type": "integer", + "description": "The case sequence number for the offender", + "format": "int32", + "example": 1 + }, + "beginDate": { + "type": "string", + "description": "The begin date", + "format": "date", + "example": "2019-12-01" + }, + "agency": { + "$ref": "#/components/schemas/Agency" + }, + "caseType": { + "type": "string", + "description": "The case type", + "example": "Adult" + }, + "caseInfoPrefix": { + "type": "string", + "description": "The prefix of the case number" + }, + "caseInfoNumber": { + "type": "string", + "description": "The case information number", + "example": "TD20177010" + }, + "caseStatus": { + "type": "string", + "description": "The case status", + "example": "ACTIVE", + "enum": [ + "ACTIVE", + "CLOSED", + "INACTIVE" + ] + }, + "courtHearings": { + "type": "array", + "description": "Court hearings associated with the court case", + "items": { + "$ref": "#/components/schemas/CourtHearing" + } + } + }, + "description": "Offender court case details" + }, + "Contact": { + "required": [ + "activeFlag", + "approvedVisitorFlag", + "awareOfChargesFlag", + "bookingId", + "canBeContactedFlag", + "contactType", + "createDateTime", + "emergencyContact", + "firstName", + "lastName", + "nextOfKin", + "relationship" + ], + "type": "object", + "properties": { + "lastName": { + "type": "string", + "description": "Last name of the contact", + "example": "SMITH" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "JOHN" + }, + "middleName": { + "type": "string", + "description": "Middle Names", + "example": "MARK" + }, + "contactType": { + "type": "string", + "description": "Contact type", + "example": "O" + }, + "contactTypeDescription": { + "type": "string", + "description": "Contact type text", + "example": "Official" + }, + "relationship": { + "type": "string", + "description": "Relationship to prisoner", + "example": "RO" + }, + "relationshipDescription": { + "type": "string", + "description": "Relationship text", + "example": "Responsible Officer" + }, + "commentText": { + "type": "string", + "description": "Comments", + "example": "Some additional information" + }, + "emergencyContact": { + "type": "boolean", + "description": "Is an emergency contact", + "example": true + }, + "nextOfKin": { + "type": "boolean", + "description": "Indicates that the contact is Next of Kin Type", + "example": false + }, + "relationshipId": { + "type": "integer", + "description": "ID of the relationship (internal)", + "format": "int64", + "example": 10466277 + }, + "personId": { + "type": "integer", + "description": "id of the person contact", + "format": "int64", + "example": 5871791 + }, + "activeFlag": { + "type": "boolean", + "description": "Active indicator flag.", + "example": true + }, + "expiryDate": { + "type": "string", + "description": "Date made inactive", + "format": "date", + "example": "2019-01-31" + }, + "approvedVisitorFlag": { + "type": "boolean", + "description": "Approved Visitor", + "example": true + }, + "canBeContactedFlag": { + "type": "boolean", + "description": "Can be contacted", + "example": false + }, + "awareOfChargesFlag": { + "type": "boolean", + "description": "Aware of charges against prisoner", + "example": true + }, + "contactRootOffenderId": { + "type": "integer", + "description": "Link to root offender ID", + "format": "int64", + "example": 5871791 + }, + "bookingId": { + "type": "integer", + "description": "Offender Booking Id for this contact", + "format": "int64", + "example": 2468081 + }, + "createDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date time the contact was created", + "example": "2021-07-05T10:35:17" + } + }, + "description": "Contact" + }, + "ContactDetail": { + "required": [ + "bookingId", + "nextOfKin", + "otherContacts" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "format": "int64" + }, + "nextOfKin": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Contact" + } + }, + "otherContacts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Contact" + } + } + }, + "description": "Contacts Details for offender" + }, + "PageBedAssignment": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BedAssignment" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "CaseNoteCount": { + "required": [ + "bookingId", + "count", + "subType", + "type" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Offender booking id", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Case note type." + }, + "subType": { + "type": "string", + "description": "Case note sub-type." + }, + "count": { + "type": "integer", + "description": "Number of case notes of defined type and subType for offender.", + "format": "int64" + }, + "fromDate": { + "type": "string", + "description": "Count includes case notes occurring on or after this date (in YYYY-MM-DD format).", + "format": "date" + }, + "toDate": { + "type": "string", + "description": "Count includes case notes occurring on or before this date (in YYYY-MM-DD format).", + "format": "date" + } + }, + "description": "Case Note Count Detail" + }, + "Account": { + "required": [ + "cash", + "currency", + "damageObligations", + "savings", + "spends" + ], + "type": "object", + "properties": { + "spends": { + "type": "number", + "description": "Spends sub account balance." + }, + "cash": { + "type": "number", + "description": "Cash sub account balance." + }, + "savings": { + "type": "number", + "description": "Saves sub account balance." + }, + "damageObligations": { + "type": "number", + "description": "Damage obligation balance." + }, + "currency": { + "type": "string", + "description": "Currency of these balances." + } + }, + "description": "Prisoner Account Balance" + }, + "PageAlert": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Alert" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "PagePrisonerBookingSummary": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrisonerBookingSummary" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "PrisonerBookingSummary": { + "required": [ + "age", + "agencyId", + "bookingId", + "dateOfBirth", + "firstName", + "lastName", + "offenderNo" + ], + "type": "object", + "properties": { + "bookingId": { + "type": "integer", + "description": "Unique, numeric booking id.", + "format": "int64", + "example": 1234134 + }, + "bookingNo": { + "type": "string", + "description": "Book number.", + "example": "A12121" + }, + "offenderNo": { + "type": "string", + "description": "Prisoner number (e.g. NOMS Number).", + "example": "A1234AA" + }, + "firstName": { + "type": "string", + "description": "Prisoner first name.", + "example": "JOHN" + }, + "middleName": { + "type": "string", + "description": "Prisoner's middle name.", + "example": "ASHLEY" + }, + "lastName": { + "type": "string", + "description": "Prisoner's last name.", + "example": "SMITH" + }, + "dateOfBirth": { + "type": "string", + "description": "Prisoner's date of birth.", + "format": "date", + "example": "1980-05-02" + }, + "age": { + "type": "integer", + "description": "Prisoner's current age.", + "format": "int32", + "example": 32 + }, + "agencyId": { + "type": "string", + "description": "Identifier of agency that prisoner is associated with.", + "example": "MDI" + }, + "assignedLivingUnitId": { + "type": "integer", + "description": "Identifier of living unit (e.g. cell) that prisoner is assigned to.", + "format": "int64", + "example": 123123 + }, + "facialImageId": { + "type": "integer", + "description": "Identifier of facial image of prisoner.", + "format": "int64", + "example": 1241241 + }, + "imprisonmentStatus": { + "type": "string", + "description": "The imprisonment status of the prisoner", + "example": "SENT" + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "REMAND", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "convictedStatus": { + "type": "string", + "description": "Convicted Status", + "example": "Convicted", + "enum": [ + "Convicted", + "Remand" + ] + }, + "assignedLivingUnitDesc": { + "type": "string", + "description": "Description of living unit (e.g. cell) that prisoner is assigned to.", + "example": "MDI-1-1-3" + } + }, + "description": "Prisoner Booking Summary" + }, + "VisitBalances": { + "required": [ + "remainingPvo", + "remainingVo" + ], + "type": "object", + "properties": { + "remainingVo": { + "type": "integer", + "description": "Balance of visit orders remaining", + "format": "int32" + }, + "remainingPvo": { + "type": "integer", + "description": "Balance of privilege visit orders remaining", + "format": "int32" + }, + "latestIepAdjustDate": { + "type": "string", + "description": "Date of last IEP adjustment for Visit orders", + "format": "date" + }, + "latestPrivIepAdjustDate": { + "type": "string", + "description": "Date of last IEP adjustment for Privilege Visit orders", + "format": "date" + } + }, + "description": "Balances of visit orders and privilege visit orders" + }, + "AgencyPrisonerPayProfile": { + "required": [ + "agencyId", + "autoPayFlag", + "startDate" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency identifier", + "example": "MDI" + }, + "startDate": { + "type": "string", + "description": "The start date when this pay profile took effect", + "format": "date", + "example": "2022-10-01" + }, + "endDate": { + "type": "string", + "description": "The end date when this pay profile will stop taking effect", + "format": "date", + "example": "2027-10-01" + }, + "autoPayFlag": { + "type": "boolean", + "description": "Whether automatic payments are enabled", + "example": true + }, + "payFrequency": { + "type": "integer", + "description": "The frequency that payroll runs for this agency (usually 1)", + "format": "int32", + "example": 1 + }, + "weeklyAbsenceLimit": { + "type": "integer", + "description": "The number of absences that are acceptable within one week", + "format": "int32", + "example": 5 + }, + "minHalfDayRate": { + "type": "number", + "description": "The minimum value for a half-day rate", + "example": 1.25 + }, + "maxHalfDayRate": { + "type": "number", + "description": "The maximum value for a half-day rate", + "example": 5.0 + }, + "maxPieceWorkRate": { + "type": "number", + "description": "The maximum value for piece work earnings", + "example": 6.0 + }, + "maxBonusRate": { + "type": "number", + "description": "The maximum value for a bonus award", + "example": 3.0 + }, + "backdateDays": { + "type": "integer", + "description": "The number of days allowed to backdate attendance before it locks.", + "format": "int32", + "example": 7 + }, + "defaultPayBandCode": { + "type": "string", + "description": "The default pay band to use when allocating offenders to paid activities.", + "example": "1" + } + }, + "description": "Agency prisoner pay profile" + }, + "LocationGroup": { + "required": [ + "children", + "key", + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the group" + }, + "key": { + "type": "string", + "description": "A key for the group" + }, + "children": { + "type": "array", + "description": "The child groups of this group", + "items": { + "$ref": "#/components/schemas/LocationGroup" + } + } + }, + "description": "Cell Locations are grouped for unlock lists as a 2 level tree. The two levels are referred to as Location and Sub-Location in the digital prison services UI. Each (location/sub-location) group has a name that is understood by prison officers and also serves as a key to retrieve the corresponding Cell Locations and information about their occupants." + }, + "LocationSummary": { + "required": [ + "description", + "locationId" + ], + "type": "object", + "properties": { + "locationId": { + "type": "integer", + "description": "Location identifier.", + "format": "int64" + }, + "userDescription": { + "type": "string", + "description": "User-friendly location description." + }, + "description": { + "type": "string", + "description": "Location description." + } + }, + "description": "Location Summary Details" + }, + "AgencyEstablishmentType": { + "required": [ + "code", + "description" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Code.", + "example": "IM" + }, + "description": { + "type": "string", + "description": "Description.", + "example": "Closed Young Offender Institute (Male)" + } + }, + "description": "Agency Establishment Type" + }, + "AgencyEstablishmentTypes": { + "required": [ + "agencyId" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency id", + "example": "MDI" + }, + "establishmentTypes": { + "type": "array", + "description": "The establishment types for the agency.", + "items": { + "$ref": "#/components/schemas/AgencyEstablishmentType" + } + } + }, + "description": "Agency Establishment Types" + }, + "Prison": { + "required": [ + "active", + "agencyId", + "agencyType", + "description" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Agency identifier.", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Agency description.", + "example": "Moorland (HMP & YOI)" + }, + "longDescription": { + "type": "string", + "description": "Long description of the agency", + "example": "Moorland (HMP & YOI)" + }, + "agencyType": { + "type": "string", + "description": "Agency type. Reference domain is AGY_LOC_TYPE. Will be INST for a prison.", + "example": "INST", + "enum": [ + "CRC", + "POLSTN", + "INST", + "COMM", + "APPR", + "CRT", + "POLICE", + "IMDC", + "TRN", + "OUT", + "YOT", + "SCH", + "STC", + "HOST", + "AIRPORT", + "HSHOSP", + "HOSPITAL", + "PECS", + "PAR", + "PNP", + "PSY" + ] + }, + "active": { + "type": "boolean", + "description": "Indicates the Agency is active", + "example": true + } + } + }, + "PrisonContactDetail": { + "required": [ + "addressType", + "addresses", + "agencyId", + "agencyType", + "city", + "country", + "description", + "formattedDescription", + "locality", + "phones", + "postCode", + "premise" + ], + "type": "object", + "properties": { + "agencyId": { + "type": "string", + "description": "Identifier of agency/prison.", + "example": "MDI" + }, + "description": { + "type": "string", + "description": "Agency description.", + "example": "MOORLAND (HMP & YOI)" + }, + "formattedDescription": { + "type": "string", + "description": "Formatted agency description.", + "example": "Moorland (HMP & YOI)" + }, + "agencyType": { + "type": "string", + "description": "Type of agency.", + "example": "INST" + }, + "addressType": { + "type": "string", + "description": "Type of address." + }, + "premise": { + "type": "string", + "description": "The Prison name." + }, + "locality": { + "type": "string", + "description": "Describes the geographic location." + }, + "city": { + "type": "string", + "description": "Address city." + }, + "country": { + "type": "string", + "description": "Address country." + }, + "postCode": { + "type": "string", + "description": "Address postcode." + }, + "phones": { + "type": "array", + "description": "List of Telephone details", + "items": { + "$ref": "#/components/schemas/Telephone" + } + }, + "addresses": { + "type": "array", + "description": "List of Address details", + "items": { + "$ref": "#/components/schemas/AddressDto" + } + } + }, + "description": "Contacts details for agency" + }, + "BookingAndSentenceAdjustments": { + "type": "object", + "properties": { + "sentenceAdjustments": { + "type": "array", + "description": "Adjustments associated at a sentence level (of type RECALL_SENTENCE_REMAND, TAGGED_BAIL, RECALL_SENTENCE_TAGGED_BAIL, REMAND or UNUSED_REMAND)", + "items": { + "$ref": "#/components/schemas/SentenceAdjustmentValues" + } + }, + "bookingAdjustments": { + "type": "array", + "description": "Adjustments associated at a booking level (of type SPECIAL_REMISSION, ADDITIONAL_DAYS_AWARDED, RESTORED_ADDITIONAL_DAYS_AWARDED, UNLAWFULLY_AT_LARGE, LAWFULLY_AT_LARGE)", + "items": { + "$ref": "#/components/schemas/BookingAdjustment" + } + } + }, + "description": "Adjustments associated at a booking level and a sentence level" + } + }, + "securitySchemes": { + "bearer-jwt": { + "type": "http", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + } +} diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prisoner-offender-search.json b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prisoner-offender-search.json new file mode 100644 index 000000000..31b1270e8 --- /dev/null +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/prisoner-offender-search.json @@ -0,0 +1,2484 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Prisoner Search", + "description": "
\n

Overview

\n

This service provides a number of endpoints for searching and reading prisoners that have been registered with the\n HMPPS prison service. This may be current or previous prisoners or other people that might be in secure\n hospitals.

\n

Data provided

\n

The vast majority of the data is sourced from the NOMIS system though in the future this is likely to change as\n more HMPPS prison data is held outside NOMIS.

\n

The data for a person is stored in Elastic Search and is updated after a record in NOMIS is changed. This is\n typically about a minute after the data is changed in NOMIS. In the unlikely circumstance that your service needs\n data that is 100% up to date with NOMIS then the\n prison-api\n might be a better service to use.\n One use case this might be appropriate for is if you need up-to-date data at the point a NOMIS prisoner event\n is received; this service also updates its records as a result of NOMIS prisoner events, so you might encounter a\n race\n condition if your read is triggered from the same event.\n

\n
The data returned for each prisoner record is essentially a snapshot of key prisoner data. This includes the\n following:\n
    \n
  • Identifiers from both NOMIS and those held in other systems
  • \n
  • Personal details such as name and date of birth (including aliases)
  • \n
  • Current prison status such as the current location (including cell)
  • \n
  • Latest sentence details
  • \n
  • Alerts
  • \n
\n See the schema definition for the API for full details.\n
\n

Role restrictions

\n

\n Role restrictions in this service are applied by a `@PreAuthorize` annotation at either resource or service level.\n Furthermore the annotation can be applied at individual method level or class level.\n

\n

\n Each endpoint in this API documentation should normally include what restrictions are applied. If there is any doubt\n then it is worth looking at the github repository at\n https://github.com/ministryofjustice/hmpps-prisoner-search/ and looking at the endpoint in question.\n

\n\n The following roles are currently in use in this service:\n
    \n
  • \n ROLE_PRISONER_SEARCH. This role grants access to all of the search endpoints.\n
  • \n
  • \n ROLE_PRISONER_IN_PRISON_SEARCH. This role is limited to protect the \"/prison/{prisonId}/prisoners\" endpoint for\n clients that only need access to this endpoint in prisoner offender search. For more general access the\n ROLE_PRISONER_SEARCH would be more suitable.\n
  • \n
  • \n ROLE_VIEW_PRISONER_DATA. This role is only needed at present for the \"/prisoner/{id}\" endpoint to retrieve\n detailed information about a particular prisoner, as opposed to the rest of the search endpoints in this service\n that can return multiple matches.\n
  • \n
  • \n ROLE_GLOBAL_SEARCH. This role is deprecated and replaced by the ROLE_PRISONER_SEARCH. All of the endpoints in\n this service that accept this role also accept ROLE_PRISONER_SEARCH so the latter should be used in preference.\n It was originally created for Prison API and is still in use there.\n
  • \n
  • \n ROLE_EVENTS_ADMIN. This role is only needed for the \"/events/prisoner/received/{prisonerNumber}\" endpoint\n and is only required in the event that a prisoner event wasn't raised by the service when their data in the\n service\n had changed.\n
  • \n
\n

Types of endpoints

\n

Searching for a specific prisoner based on criteria

\n

\n These are endpoints that use the core Elastic Search features to locate a prisoner record based on a set of\n criteria;\n for instance name, date of birth or unique identifier (such as the Police National Computer PNC number).\n Typically, they return many results and a summary of those results would be presented to an end user.\n

\n

Matching records

\n

\n Similar to searching but typically using a criteria from a different system; for instance, key data from a probation\n record or court record.\n These will use an algorithm that matches based on data that is likely to be most reliable for matching; for\n instance,\n PNC number or name with date of birth.\n

\n

Retrieving a specific record

\n

\n Retrieving a specific record typically by a unique identifier; for instance, prisoner number (aka NOMS number). This\n is a convenient way of viewing a summary of a prisoner record and is typically quicker than using the equivalent API\n in prison-api.\n

\n

Retrieving batches of records

\n

\n Retrieving a batch of records either by supplying a list of identifiers or a criteria that will a match many\n records;\n for instance, all people in a prison wing or people to be released on a specific date.\n

\n
\n", + "contact": { + "name": "HMPPS Digital Studio", + "email": "feedback@digital.justice.gov.uk" + }, + "version": "2024-07-12.5912.1704335" + }, + "servers": [ + { + "url": "https://prisoner-search-dev.prison.service.justice.gov.uk/", + "description": "Development" + }, + { + "url": "https://prisoner-search-preprod.prison.service.justice.gov.uk/", + "description": "Pre-Production" + }, + { + "url": "https://prisoner-search.prison.service.justice.gov.uk/", + "description": "Production" + }, + { + "url": "http://localhost:8080", + "description": "Local" + } + ], + "security": [ + { + "view-prisoner-data-role": [ + "read" + ] + }, + { + "prisoner-search-role": [ + "read" + ] + }, + { + "global-search-role": [ + "read" + ] + }, + { + "prisoner-in-prison-search-role": [ + "read" + ] + }, + { + "prisoner-search--prisoner--ro": [ + "read" + ] + } + ], + "tags": [ + { + "name": "Popular", + "description": "The most popular endpoints. Look here first when deciding which endpoint to use." + }, + { + "name": "Establishment search", + "description": "Endpoints for searching for a prisoner within a prison" + }, + { + "name": "Global search", + "description": "Endpoints for searching for a prisoner across the entire prison estate, including people that have previously been released" + }, + { + "name": "Batch", + "description": "Endpoints designed to find a large number of prisoners with a single call" + }, + { + "name": "Matching", + "description": "Endpoints designed for matching a prisoner with data from other sources" + }, + { + "name": "Deprecated", + "description": "Endpoints that should no longer be used and will be removed in a future release" + }, + { + "name": "Specific use case", + "description": "Endpoints that were designed for a specific use case and are unlikely to fit for general use" + }, + { + "name": "Experimental", + "description": "Endpoints that have not been tried and tested in a production environment" + } + ], + "paths": { + "/prisoner/{id}": { + "get": { + "tags": [ + "Popular" + ], + "summary": "Get prisoner by prisoner number (AKA NOMS number)", + "description": "Requires ROLE_PRISONER_SEARCH or ROLE_VIEW_PRISONER_DATA role or PRISONER_SEARCH__PRISONER__RO", + "operationId": "findByPrisonNumber", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Prisoner" + } + } + } + } + }, + "security": [ + { + "view-prisoner-data-role": [] + }, + { + "prisoner-search-role": [] + } + ] + } + } + }, + "components": { + "schemas": { + "RestrictedPatientSearchCriteria": { + "type": "object", + "properties": { + "prisonerIdentifier": { + "type": "string", + "description": "Prisoner identifier, one of prisoner number, book number, booking ID or PNC", + "example": "A1234AA," + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "supportingPrisonIds": { + "type": "array", + "description": "List of supporting Prison Ids to restrict the search by. Unrestricted if not supplied or null", + "example": [ + "MDI" + ], + "items": { + "type": "string", + "description": "List of supporting Prison Ids to restrict the search by. Unrestricted if not supplied or null", + "example": "[\"MDI\"]" + } + } + }, + "description": "Search Criteria for Prisoner Search" + }, + "Address": { + "required": [ + "fullAddress", + "primaryAddress" + ], + "type": "object", + "properties": { + "fullAddress": { + "type": "string", + "description": "The full address on a single line", + "example": "1 Main Street, Crookes, Sheffield, South Yorkshire, S10 1BP, England" + }, + "postalCode": { + "type": "string", + "description": "The postal code", + "example": "S10 1BP" + }, + "startDate": { + "type": "string", + "description": "The date the address became active according to NOMIS", + "format": "date", + "example": "2020-07-17" + }, + "primaryAddress": { + "type": "boolean", + "description": "Whether the address is currently marked as the primary address", + "example": true + }, + "phoneNumbers": { + "type": "array", + "description": "Phone numbers linked to the address. Note the phone number contains only numbers, no whitespace. Therefore searching on 'addresses.phoneNumbers.number' should not pass any non-numeric characters.", + "items": { + "$ref": "#/components/schemas/PhoneNumber" + } + } + }, + "description": "Addresses" + }, + "BodyPartDetail": { + "type": "object", + "properties": { + "bodyPart": { + "type": "string", + "description": "Part of the body that has the mark. From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023.", + "example": "Head", + "enum": [ + "Ankle", + "Arm", + "Ear", + "Elbow", + "Face", + "Finger", + "Foot", + "Hand", + "Head", + "Knee", + "Leg", + "Lip", + "Neck", + "Nose", + "Shoulder", + "Thigh", + "Toe", + "Torso" + ] + }, + "comment": { + "type": "string", + "description": "Optional free text comment describing the mark", + "example": "Skull and crossbones covering chest" + } + }, + "description": "List of parts of the body that have marks. This includes NOMIS physical details of type 'marks' and 'otherMarks'. If we find a comment with either 'tattoo' or 'scar' we also add to the list of tattoos or scars. From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023." + }, + "CurrentIncentive": { + "required": [ + "dateTime", + "level", + "nextReviewDate" + ], + "type": "object", + "properties": { + "level": { + "$ref": "#/components/schemas/IncentiveLevel" + }, + "dateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "Date time of the incentive", + "example": "2021-07-05T10:35:17" + }, + "nextReviewDate": { + "type": "string", + "description": "Schedule new review date", + "format": "date", + "example": "2022-11-10" + } + }, + "description": "Incentive level" + }, + "EmailAddress": { + "required": [ + "email" + ], + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "The email address", + "example": "john.smith@gmail.com" + } + }, + "description": "Email addresses" + }, + "Identifier": { + "required": [ + "createdDateTime", + "type", + "value" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of identifier", + "example": "PNC, CRO, DL, NINO" + }, + "value": { + "type": "string", + "description": "The identifier value", + "example": "12/394773H" + }, + "issuedDate": { + "type": "string", + "description": "The date the identifier was issued according to NOMIS", + "format": "date", + "example": "2020-07-17" + }, + "issuedAuthorityText": { + "type": "string", + "description": "Free text entered into NOMIS when the identifier was recorded." + }, + "createdDateTime": { + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + "type": "string", + "description": "The date/time the identifier was created in the system", + "example": "2021-07-05T10:35:17" + } + }, + "description": "All identifiers for the prisoner including those recorded against aliases. Currently supports only PNC, CRO, NINO and DL." + }, + "IncentiveLevel": { + "required": [ + "description" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "code", + "example": "STD" + }, + "description": { + "type": "string", + "description": "description", + "example": "Standard" + } + }, + "description": "Incentive level" + }, + "Offence": { + "required": [ + "latestBooking", + "offenceCode", + "offenceDescription", + "statuteCode" + ], + "type": "object", + "properties": { + "statuteCode": { + "type": "string", + "description": "The statue code", + "example": "TH68" + }, + "offenceCode": { + "type": "string", + "description": "The offence code", + "example": "TH68010" + }, + "offenceDescription": { + "type": "string", + "description": "The offence description", + "example": "Theft from a shop" + }, + "offenceDate": { + "type": "string", + "description": "The date of the offence", + "format": "date", + "example": "2024-05-23" + }, + "latestBooking": { + "type": "boolean", + "description": "Indicates this offence is for the latest NOMIS booking" + } + }, + "description": "All historical convicted offences" + }, + "PagePrisoner": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prisoner" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "PageableObject": { + "type": "object", + "properties": { + "offset": { + "type": "integer", + "format": "int64" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "paged": { + "type": "boolean" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "unpaged": { + "type": "boolean" + } + } + }, + "PhoneNumber": { + "required": [ + "number", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of the phone number", + "example": "HOME, MOB" + }, + "number": { + "type": "string", + "description": "The phone number. Numeric characters only (no whitespace).", + "example": "01141234567" + } + }, + "description": "Telephone numbers. Note that the number will contain only numeric characters [0-9] (including no break between area code and number). Therefore if searching on 'phoneNumbers.number' you should not pass any non-numeric characters." + }, + "Prisoner": { + "required": [ + "dateOfBirth", + "ethnicity", + "firstName", + "gender", + "lastName", + "maritalStatus", + "mostSeriousOffence", + "nationality", + "prisonerNumber", + "religion", + "restrictedPatient", + "status", + "youthOffender" + ], + "type": "object", + "properties": { + "prisonerNumber": { + "type": "string", + "description": "Prisoner Number", + "example": "A1234AA" + }, + "pncNumber": { + "type": "string", + "description": "PNC Number", + "example": "12/394773H" + }, + "pncNumberCanonicalShort": { + "type": "string", + "description": "PNC Number", + "example": "12/394773H" + }, + "pncNumberCanonicalLong": { + "type": "string", + "description": "PNC Number", + "example": "2012/394773H" + }, + "croNumber": { + "type": "string", + "description": "CRO Number", + "example": "29906/12J" + }, + "bookingId": { + "type": "string", + "description": "Booking No.", + "example": "0001200924" + }, + "bookNumber": { + "type": "string", + "description": "Book Number", + "example": "38412A" + }, + "title": { + "type": "string", + "description": "Title", + "example": "Ms" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "Robert" + }, + "middleNames": { + "type": "string", + "description": "Middle Names", + "example": "John James" + }, + "lastName": { + "type": "string", + "description": "Last name", + "example": "Larsen" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of Birth", + "format": "date", + "example": "1975-04-02" + }, + "gender": { + "type": "string", + "description": "Gender", + "example": "Female" + }, + "ethnicity": { + "type": "string", + "description": "Ethnicity", + "example": "White: Eng./Welsh/Scot./N.Irish/British" + }, + "youthOffender": { + "type": "boolean", + "description": "Youth Offender?", + "example": true + }, + "maritalStatus": { + "type": "string", + "description": "Marital Status", + "example": "Widowed" + }, + "religion": { + "type": "string", + "description": "Religion", + "example": "Church of England (Anglican)" + }, + "nationality": { + "type": "string", + "description": "Nationality", + "example": "Egyptian" + }, + "status": { + "type": "string", + "description": "Status of the prisoner", + "example": "ACTIVE IN" + }, + "lastMovementTypeCode": { + "type": "string", + "description": "Last Movement Type Code of prisoner", + "example": "CRT" + }, + "lastMovementReasonCode": { + "type": "string", + "description": "Last Movement Reason of prisoner", + "example": "CA" + }, + "inOutStatus": { + "type": "string", + "description": "In/Out Status", + "example": "IN", + "enum": [ + "IN", + "OUT", + "TRN" + ] + }, + "prisonId": { + "type": "string", + "description": "Prison ID", + "example": "MDI" + }, + "lastPrisonId": { + "type": "string", + "description": "The last prison for the prisoner (which is the same as the prisonId if they are still inside prison)", + "example": "MDI" + }, + "prisonName": { + "type": "string", + "description": "Prison Name", + "example": "HMP Leeds" + }, + "cellLocation": { + "type": "string", + "description": "In prison cell location", + "example": "A-1-002" + }, + "aliases": { + "type": "array", + "description": "Aliases Names and Details", + "items": { + "$ref": "#/components/schemas/PrisonerAlias" + } + }, + "alerts": { + "type": "array", + "description": "Alerts", + "items": { + "$ref": "#/components/schemas/PrisonerAlert" + } + }, + "csra": { + "type": "string", + "description": "Cell Sharing Risk Assessment", + "example": "HIGH" + }, + "category": { + "type": "string", + "description": "Prisoner Category", + "example": "C" + }, + "legalStatus": { + "type": "string", + "description": "Legal Status", + "example": "SENTENCED", + "enum": [ + "RECALL", + "DEAD", + "INDETERMINATE_SENTENCE", + "SENTENCED", + "CONVICTED_UNSENTENCED", + "CIVIL_PRISONER", + "IMMIGRATION_DETAINEE", + "REMAND", + "UNKNOWN", + "OTHER" + ] + }, + "imprisonmentStatus": { + "type": "string", + "description": "The prisoner's imprisonment status code.", + "example": "LIFE" + }, + "imprisonmentStatusDescription": { + "type": "string", + "description": "The prisoner's imprisonment status description.", + "example": "Serving Life Imprisonment" + }, + "mostSeriousOffence": { + "type": "string", + "description": "Most serious offence for this sentence", + "example": "Robbery" + }, + "recall": { + "type": "boolean", + "description": "Indicates that the prisoner has been recalled", + "example": false + }, + "indeterminateSentence": { + "type": "boolean", + "description": "Indicates that the prisoner has an indeterminate sentence", + "example": true + }, + "sentenceStartDate": { + "type": "string", + "description": "Start Date for this sentence", + "format": "date", + "example": "2020-04-03" + }, + "releaseDate": { + "type": "string", + "description": "Actual of most likely Release Date", + "format": "date", + "example": "2023-05-02" + }, + "confirmedReleaseDate": { + "type": "string", + "description": "Release Date Confirmed", + "format": "date", + "example": "2023-05-01" + }, + "sentenceExpiryDate": { + "type": "string", + "description": "Sentence Expiry Date", + "format": "date", + "example": "2023-05-01" + }, + "licenceExpiryDate": { + "type": "string", + "description": "Licence Expiry Date", + "format": "date", + "example": "2023-05-01" + }, + "homeDetentionCurfewEligibilityDate": { + "type": "string", + "description": "HDC Eligibility Date", + "format": "date", + "example": "2023-05-01" + }, + "homeDetentionCurfewActualDate": { + "type": "string", + "description": "HDC Actual Date", + "format": "date", + "example": "2023-05-01" + }, + "homeDetentionCurfewEndDate": { + "type": "string", + "description": "HDC End Date", + "format": "date", + "example": "2023-05-02" + }, + "topupSupervisionStartDate": { + "type": "string", + "description": "Top-up supervision start date", + "format": "date", + "example": "2023-04-29" + }, + "topupSupervisionExpiryDate": { + "type": "string", + "description": "Top-up supervision expiry date", + "format": "date", + "example": "2023-05-01" + }, + "additionalDaysAwarded": { + "type": "integer", + "description": "Days added to sentence term due to adjustments.", + "format": "int32", + "example": 10 + }, + "nonDtoReleaseDate": { + "type": "string", + "description": "Release date for Non determinant sentence (if applicable). This will be based on one of ARD, CRD, NPD or PRRD.", + "format": "date", + "example": "2023-05-01" + }, + "nonDtoReleaseDateType": { + "type": "string", + "description": "Indicates which type of non-DTO release date is the effective release date. One of 'ARD’, 'CRD’, ‘NPD’ or 'PRRD’.", + "example": "ARD", + "enum": [ + "ARD", + "CRD", + "NPD", + "PRRD" + ] + }, + "receptionDate": { + "type": "string", + "description": "Date prisoner was received into the prison", + "format": "date", + "example": "2023-05-01" + }, + "paroleEligibilityDate": { + "type": "string", + "description": "Parole Eligibility Date", + "format": "date", + "example": "2023-05-01" + }, + "automaticReleaseDate": { + "type": "string", + "description": "Automatic Release Date. If automaticReleaseOverrideDate is available then it will be set as automaticReleaseDate", + "format": "date", + "example": "2023-05-01" + }, + "postRecallReleaseDate": { + "type": "string", + "description": "Post Recall Release Date. if postRecallReleaseOverrideDate is available then it will be set as postRecallReleaseDate", + "format": "date", + "example": "2023-05-01" + }, + "conditionalReleaseDate": { + "type": "string", + "description": "Conditional Release Date. If conditionalReleaseOverrideDate is available then it will be set as conditionalReleaseDate", + "format": "date", + "example": "2023-05-01" + }, + "actualParoleDate": { + "type": "string", + "description": "Actual Parole Date", + "format": "date", + "example": "2023-05-01" + }, + "tariffDate": { + "type": "string", + "description": "Tariff Date", + "format": "date", + "example": "2023-05-01" + }, + "releaseOnTemporaryLicenceDate": { + "type": "string", + "description": "Release on Temporary Licence Date", + "format": "date", + "example": "2023-05-01" + }, + "locationDescription": { + "type": "string", + "description": "current prison or outside with last movement information.", + "example": "Outside - released from Leeds" + }, + "restrictedPatient": { + "type": "boolean", + "description": "Indicates a restricted patient", + "example": true + }, + "supportingPrisonId": { + "type": "string", + "description": "Supporting prison ID for POM", + "example": "LEI" + }, + "dischargedHospitalId": { + "type": "string", + "description": "Which hospital the prisoner has been discharged to", + "example": "HAZLWD" + }, + "dischargedHospitalDescription": { + "type": "string", + "description": "Hospital name to which the prisoner was discharged", + "example": "Hazelwood House" + }, + "dischargeDate": { + "type": "string", + "description": "Date of discharge", + "format": "date", + "example": "2020-05-01" + }, + "dischargeDetails": { + "type": "string", + "description": "Any additional discharge details", + "example": "Psychiatric Hospital Discharge to Hazelwood House" + }, + "currentIncentive": { + "$ref": "#/components/schemas/CurrentIncentive" + }, + "heightCentimetres": { + "type": "integer", + "description": "Height in centimetres of the prisoner", + "format": "int32", + "example": 200 + }, + "weightKilograms": { + "type": "integer", + "description": "Weight in kilograms of the prisoner", + "format": "int32", + "example": 102 + }, + "hairColour": { + "type": "string", + "description": "Hair colour. From PROFILE_CODES table where PROFILE_TYPE = HAIR. Allowable values extracted 07/02/2023.", + "example": "Blonde", + "enum": [ + "Bald", + "Balding", + "Black", + "Blonde", + "Brown", + "Brunette", + "Dark", + "Dyed", + "Ginger", + "Grey", + "Light", + "Mouse", + "Multi-coloured", + "Red", + "White" + ] + }, + "rightEyeColour": { + "type": "string", + "description": "Right eye colour. From PROFILE_CODES table where PROFILE_TYPE = R_EYE_C. Allowable values extracted 07/02/2023.", + "example": "Green", + "enum": [ + "Blue", + "Brown", + "Clouded", + "Green", + "Grey", + "Hazel", + "Missing", + "Pink", + "White" + ] + }, + "leftEyeColour": { + "type": "string", + "description": "Left eye colour. From PROFILE_CODES table where PROFILE_TYPE = L_EYE_C. Allowable values extracted 07/02/2023.", + "example": "Hazel", + "enum": [ + "Blue", + "Brown", + "Clouded", + "Green", + "Grey", + "Hazel", + "Missing", + "Pink", + "White" + ] + }, + "facialHair": { + "type": "string", + "description": "Facial hair. From PROFILE_CODES table where PROFILE_TYPE = FACIAL_HAIR. Allowable values extracted 07/02/2023.", + "example": "Clean Shaven", + "enum": [ + "Full Beard", + "Clean Shaven", + "Goatee Beard", + "Moustache Only", + "Not Applicable (Female Offender)", + "No Facial Hair", + "Sideburns" + ] + }, + "shapeOfFace": { + "type": "string", + "description": "Shape of face. From PROFILE_CODES table where PROFILE_TYPE = FACE. Allowable values extracted 07/02/2023.", + "example": "Round", + "enum": [ + "Angular", + "Bullet", + "Oval", + "Round", + "Square", + "Triangular" + ] + }, + "build": { + "type": "string", + "description": "Build. From PROFILE_CODES table where PROFILE_TYPE = BUILD. Allowable values extracted 07/02/2023.", + "example": "Muscular", + "enum": [ + "Fat", + "Frail", + "Heavy", + "Medium", + "Muscular", + "Obese", + "Proportional", + "Slight", + "Small", + "Stocky", + "Stooped", + "Thin" + ] + }, + "shoeSize": { + "type": "integer", + "description": "UK shoe size", + "format": "int32", + "example": 10 + }, + "tattoos": { + "type": "array", + "description": "List of parts of the body that have tattoos. This includes marks and other marks whose comment contains 'tattoo'. 'From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023.", + "items": { + "$ref": "#/components/schemas/BodyPartDetail" + } + }, + "scars": { + "type": "array", + "description": "List of parts of the body that have scars. This includes marks and other marks whose comment contains 'scar'. From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023.", + "items": { + "$ref": "#/components/schemas/BodyPartDetail" + } + }, + "marks": { + "type": "array", + "description": "List of parts of the body that have marks. This includes NOMIS physical details of type 'marks' and 'otherMarks'. If we find a comment with either 'tattoo' or 'scar' we also add to the list of tattoos or scars. From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023.", + "items": { + "$ref": "#/components/schemas/BodyPartDetail" + } + }, + "addresses": { + "type": "array", + "description": "Addresses", + "items": { + "$ref": "#/components/schemas/Address" + } + }, + "emailAddresses": { + "type": "array", + "description": "Email addresses", + "items": { + "$ref": "#/components/schemas/EmailAddress" + } + }, + "phoneNumbers": { + "type": "array", + "description": "Telephone numbers. Note that the number will contain only numeric characters [0-9] (including no break between area code and number). Therefore if searching on 'phoneNumbers.number' you should not pass any non-numeric characters.", + "items": { + "$ref": "#/components/schemas/PhoneNumber" + } + }, + "identifiers": { + "type": "array", + "description": "All identifiers for the prisoner including those recorded against aliases. Currently supports only PNC, CRO, NINO and DL.", + "items": { + "$ref": "#/components/schemas/Identifier" + } + }, + "allConvictedOffences": { + "type": "array", + "description": "All historical convicted offences", + "items": { + "$ref": "#/components/schemas/Offence" + } + } + } + }, + "PrisonerAlert": { + "required": [ + "active", + "alertCode", + "alertType", + "expired" + ], + "type": "object", + "properties": { + "alertType": { + "type": "string", + "description": "Alert Type", + "example": "H" + }, + "alertCode": { + "type": "string", + "description": "Alert Code", + "example": "HA" + }, + "active": { + "type": "boolean", + "description": "Active", + "example": true + }, + "expired": { + "type": "boolean", + "description": "Expired", + "example": true + } + }, + "description": "Alerts" + }, + "PrisonerAlias": { + "required": [ + "dateOfBirth", + "firstName", + "lastName" + ], + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "Title", + "example": "Ms" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "Robert" + }, + "middleNames": { + "type": "string", + "description": "Middle names", + "example": "Trevor" + }, + "lastName": { + "type": "string", + "description": "Last name", + "example": "Lorsen" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of birth", + "format": "date", + "example": "1975-04-02" + }, + "gender": { + "type": "string", + "description": "Gender", + "example": "Male" + }, + "ethnicity": { + "type": "string", + "description": "Ethnicity", + "example": "White : Irish" + } + }, + "description": "Aliases Names and Details" + }, + "SortObject": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "nullHandling": { + "type": "string" + }, + "ascending": { + "type": "boolean" + }, + "property": { + "type": "string" + }, + "ignoreCase": { + "type": "boolean" + } + } + }, + "ReleaseDateSearch": { + "required": [ + "latestReleaseDate" + ], + "type": "object", + "properties": { + "earliestReleaseDate": { + "type": "string", + "description": "The lower bound for the release date range of which to search - defaults to today if not provided", + "format": "date", + "example": "2022-04-20" + }, + "latestReleaseDate": { + "type": "string", + "description": "The upper bound for the release date range of which to search. A required field.", + "format": "date", + "example": "2022-05-20" + }, + "prisonIds": { + "uniqueItems": true, + "type": "array", + "description": "List of Prison Ids (can include OUT and TRN) to restrict the search by. Unrestricted if not supplied or null", + "example": [ + "MDI" + ], + "items": { + "type": "string", + "description": "List of Prison Ids (can include OUT and TRN) to restrict the search by. Unrestricted if not supplied or null", + "example": "[\"MDI\"]" + } + } + }, + "description": "Search Criteria for Release Date Search" + }, + "PrisonerNumbers": { + "required": [ + "prisonerNumbers" + ], + "type": "object", + "properties": { + "prisonerNumbers": { + "maxItems": 1000, + "minItems": 1, + "type": "array", + "description": "List of prisoner numbers to search by", + "example": [ + "A1234AA" + ], + "items": { + "type": "string", + "description": "List of prisoner numbers to search by", + "example": "[\"A1234AA\"]" + } + } + } + }, + "PossibleMatchCriteria": { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "Prisoner first name", + "example": "john" + }, + "lastName": { + "type": "string", + "description": "Prisoner last Name", + "example": "smith" + }, + "dateOfBirth": { + "type": "string", + "description": "Prisoner date of birth", + "format": "date", + "example": "1996-02-10" + }, + "pncNumber": { + "type": "string", + "description": "Police National Computer (PNC) number (This will match both long and short PNC formats)", + "example": "2018/0123456X" + }, + "nomsNumber": { + "type": "string", + "description": "The Prisoner NOMIS Id (aka prison number/offender no in DPS)", + "example": "A1234AB" + } + }, + "description": "Search Criteria for possible match" + }, + "PrisonSearch": { + "type": "object", + "properties": { + "prisonerIdentifier": { + "type": "string", + "description": "Prisoner identifier, one of prisoner number, book number, booking ID or PNC", + "example": "A1234AA," + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "prisonId": { + "type": "string", + "description": "Prison Id, Prison Id or OUT or TRN", + "example": "MDI" + }, + "includeAliases": { + "type": "boolean", + "description": "Include aliases in search", + "example": false, + "default": false + } + }, + "description": "Search Criteria for Prisoner Search" + }, + "SearchCriteria": { + "type": "object", + "properties": { + "prisonerIdentifier": { + "type": "string", + "description": "Prisoner identifier, one of prisoner number, book number, booking ID or PNC", + "example": "A1234AA," + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "prisonIds": { + "type": "array", + "description": "List of Prison Ids (can include OUT and TRN) to restrict the search by. Unrestricted if not supplied or null", + "example": [ + "MDI" + ], + "items": { + "type": "string", + "description": "List of Prison Ids (can include OUT and TRN) to restrict the search by. Unrestricted if not supplied or null", + "example": "[\"MDI\"]" + } + }, + "includeAliases": { + "type": "boolean", + "description": "Include aliases in search", + "example": false, + "default": false + } + }, + "description": "Search Criteria for Prisoner Search" + }, + "BookingIds": { + "required": [ + "bookingIds" + ], + "type": "object", + "properties": { + "bookingIds": { + "maxItems": 1000, + "minItems": 1, + "type": "array", + "description": "List of bookingIds to search by", + "example": [ + 1, + 2, + 3 + ], + "items": { + "type": "integer", + "description": "List of bookingIds to search by", + "format": "int64" + } + } + } + }, + "PaginationRequest": { + "required": [ + "page", + "size" + ], + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "The page number required in the paginated response", + "format": "int32", + "example": 0 + }, + "size": { + "type": "integer", + "description": "The number of results to return for paginated response", + "format": "int32", + "example": 10 + } + }, + "description": "Pagination options. Will default to the first page if omitted." + }, + "PrisonerDetailRequest": { + "required": [ + "pagination", + "prisonIds" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "Prisoner first name", + "example": "john" + }, + "lastName": { + "type": "string", + "description": "Prisoner last name", + "example": "smith" + }, + "nomsNumber": { + "type": "string", + "description": "Prisoner number (aka. offenderId, nomisId)", + "example": "A1234AA" + }, + "pncNumber": { + "type": "string", + "description": "Police National Computer (PNC) number", + "example": "2018/0123456X" + }, + "croNumber": { + "type": "string", + "description": "Criminal Records Office (CRO) number", + "example": "SF80/655108T" + }, + "fuzzyMatch": { + "type": "boolean", + "description": "Fuzzy matching. Allow a one character difference in spelling in word lengths below five and two differences above.", + "example": false + }, + "prisonIds": { + "type": "array", + "description": "List of prison codes to filter results by", + "example": "['LEI', 'MDI']", + "items": { + "type": "string", + "description": "List of prison codes to filter results by", + "example": "['LEI', 'MDI']" + } + }, + "includeAliases": { + "type": "boolean", + "description": "Include aliases in search", + "example": true, + "default": true + }, + "pagination": { + "$ref": "#/components/schemas/PaginationRequest" + } + } + }, + "PrisonerDetailResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prisoner" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "ErrorResponse": { + "required": [ + "errorCode", + "status", + "userMessage" + ], + "type": "object", + "properties": { + "status": { + "type": "integer", + "description": "Status of Error Code", + "format": "int32", + "example": 400 + }, + "developerMessage": { + "type": "string", + "description": "Developer Information message", + "example": "System is down" + }, + "errorCode": { + "type": "integer", + "description": "Internal Error Code", + "format": "int32", + "example": 20012 + }, + "userMessage": { + "type": "string", + "description": "Error message information", + "example": "Prisoner Not Found" + }, + "moreInfo": { + "type": "string", + "description": "Additional information about the error", + "example": "Hard disk failure" + } + } + }, + "BodyPart": { + "type": "object", + "properties": { + "bodyPart": { + "type": "string", + "description": "Body part that has the physical mark, searching on the description in the type BODY_PART in the REFERENCE_CODES table. Allowable values extracted 08/02/2023.", + "example": "Arm", + "enum": [ + "Ankle", + "Arm", + "Ear", + "Elbow", + "Face", + "Finger", + "Foot", + "Hand", + "Head", + "Knee", + "Leg", + "Lip", + "Neck", + "Nose", + "Shoulder", + "Thigh", + "Toe", + "Torso" + ] + }, + "comment": { + "type": "string", + "description": "Comment on the physical mark.", + "example": "dragon" + } + }, + "description": "List of body parts that have scars" + }, + "PhysicalDetailRequest": { + "required": [ + "lenient", + "pagination", + "prisonIds" + ], + "type": "object", + "properties": { + "prisonIds": { + "type": "array", + "description": "List of prison codes to filter results by", + "example": "['LEI', 'MDI']", + "items": { + "type": "string", + "description": "List of prison codes to filter results by", + "example": "['LEI', 'MDI']" + } + }, + "cellLocationPrefix": { + "type": "string", + "description": "Filter for the prisoners cell location. A block wing or cell can be specified. With prison id can be included or absent so HEI-3-1 and 3-1 are equivalent when the prison id is HEI", + "example": "3-1" + }, + "gender": { + "type": "string", + "description": "Gender, searching on the description in the domain SEX in the REFERENCE_CODES table.", + "example": "Male", + "enum": [ + "Female", + "Male", + "Not Known / Not Recorded", + "Not Specified (Indeterminate)", + "Refused" + ] + }, + "ethnicity": { + "type": "string", + "description": "Ethnicity, searching on the description in the domain ETHNICITY in the REFERENCE_CODES table.", + "example": "White : Irish", + "enum": [ + "Asian/Asian British: Indian", + "Asian/Asian British: Pakistani", + "Asian/Asian British: Bangladeshi", + "Asian/Asian British: Chinese", + "Asian/Asian British: Any other backgr'nd", + "Black/Black British: Caribbean", + "Black/Black British: African", + "Black/Black British: Any other Backgr'nd", + "Mixed: White and Black Caribbean", + "Mixed: White and Black African", + "Mixed: White and Asian", + "Mixed: Any other background", + "Needs to be confirmed following Merge", + "Prefer not to say", + "Chinese", + "Other: Arab", + "Other: Any other background", + "White: Eng./Welsh/Scot./N.Irish/British", + "White : Irish", + "White: Gypsy or Irish Traveller", + "White : Irish Traveller/Gypsy", + "White: Any other background" + ] + }, + "minHeight": { + "type": "integer", + "description": "Minimum height of the prisoner in centimetres", + "format": "int32", + "example": 170 + }, + "maxHeight": { + "type": "integer", + "description": "Maximum height of the prisoner in centimetres", + "format": "int32", + "example": 198 + }, + "minWeight": { + "type": "integer", + "description": "Minimum weight of the prisoner in kilograms", + "format": "int32", + "example": 80 + }, + "maxWeight": { + "type": "integer", + "description": "Maximum weight of the prisoner in kilograms", + "format": "int32", + "example": 90 + }, + "hairColour": { + "type": "string", + "description": "Hair colour, searching on the description in the type HAIR in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Brunette", + "enum": [ + "Bald", + "Balding", + "Black", + "Blonde", + "Brown", + "Brunette", + "Dark", + "Dyed", + "Ginger", + "Grey", + "Light", + "Mouse", + "Multi-coloured", + "Red", + "White" + ] + }, + "rightEyeColour": { + "type": "string", + "description": "Right eye colour, searching on the description in the type R_EYE_C in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Green", + "enum": [ + "Blue", + "Brown", + "Clouded", + "Green", + "Grey", + "Hazel", + "Missing", + "Pink", + "White" + ] + }, + "leftEyeColour": { + "type": "string", + "description": "Left eye colour, searching on the description in the type L_EYE_C in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Hazel", + "enum": [ + "Blue", + "Brown", + "Clouded", + "Green", + "Grey", + "Hazel", + "Missing", + "Pink", + "White" + ] + }, + "facialHair": { + "type": "string", + "description": "Facial hair, searching on the description in the type FACIAL_HAIR in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Goatee Beard", + "enum": [ + "Full Beard", + "Clean Shaven", + "Goatee Beard", + "Moustache Only", + "Not Applicable (Female Offender)", + "No Facial Hair", + "Sideburns" + ] + }, + "shapeOfFace": { + "type": "string", + "description": "Shape of face, searching on the description in the type FACE in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Bullet", + "enum": [ + "Angular", + "Bullet", + "Oval", + "Round", + "Square", + "Triangular" + ] + }, + "build": { + "type": "string", + "description": "Physical build, searching on the description in the type BUILD in the PROFILE_CODES table. Allowable values extracted 07/02/2023.", + "example": "Medium", + "enum": [ + "Fat", + "Frail", + "Heavy", + "Medium", + "Muscular", + "Obese", + "Proportional", + "Slight", + "Small", + "Stocky", + "Stooped", + "Thin" + ] + }, + "minShoeSize": { + "type": "integer", + "description": "Minimum UK shoe size of the prisoner", + "format": "int32", + "example": 5 + }, + "maxShoeSize": { + "type": "integer", + "description": "Maximum UK shoe size of the prisoner", + "format": "int32", + "example": 10 + }, + "tattoos": { + "type": "array", + "description": "List of body parts that have tattoos", + "items": { + "$ref": "#/components/schemas/BodyPart" + } + }, + "marks": { + "type": "array", + "description": "List of body parts that have marks", + "items": { + "$ref": "#/components/schemas/BodyPart" + } + }, + "scars": { + "type": "array", + "description": "List of body parts that have scars", + "items": { + "$ref": "#/components/schemas/BodyPart" + } + }, + "lenient": { + "type": "boolean", + "description": "\n Whether all terms are required to match. If set to true then only matches on all fields will return a result.\n If set to false then matches will return a higher score than non matches, but all will be returned.\n Prison and cell location will always be required to match.", + "example": false + }, + "pagination": { + "$ref": "#/components/schemas/PaginationRequest" + } + } + }, + "PhysicalDetailResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prisoner" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "MatchRequest": { + "required": [ + "lastName" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "Prisoner first name", + "example": "john" + }, + "lastName": { + "type": "string", + "description": "Prisoner last Name", + "example": "smith" + }, + "dateOfBirth": { + "type": "string", + "description": "Prisoner date of birth", + "format": "date", + "example": "1996-02-10" + }, + "pncNumber": { + "type": "string", + "description": "Police National Computer (PNC) number", + "example": "2018/0123456X" + }, + "croNumber": { + "type": "string", + "description": "Criminal Records Office (CRO) number", + "example": "SF80/655108T" + }, + "nomsNumber": { + "type": "string", + "description": "The Prisoner NOMIS Id (aka prison number/offender no in DPS)", + "example": "A1234AB" + } + } + }, + "PrisonerMatch": { + "required": [ + "prisoner" + ], + "type": "object", + "properties": { + "prisoner": { + "$ref": "#/components/schemas/Prisoner" + } + }, + "description": "List of prisoners that share the same possibility of being the match" + }, + "PrisonerMatches": { + "required": [ + "matchedBy", + "matches" + ], + "type": "object", + "properties": { + "matches": { + "type": "array", + "description": "List of prisoners that share the same possibility of being the match", + "items": { + "$ref": "#/components/schemas/PrisonerMatch" + } + }, + "matchedBy": { + "type": "string", + "description": "How the match was performed", + "enum": [ + "ALL_SUPPLIED", + "ALL_SUPPLIED_ALIAS", + "HMPPS_KEY", + "EXTERNAL_KEY", + "NAME", + "PARTIAL_NAME", + "PARTIAL_NAME_DOB_LENIENT", + "NOTHING" + ] + } + } + }, + "KeywordRequest": { + "required": [ + "pagination", + "prisonIds", + "type" + ], + "type": "object", + "properties": { + "orWords": { + "type": "string", + "description": "Match where any of the keywords are present in any text field", + "example": "smith james john" + }, + "andWords": { + "type": "string", + "description": "Match where all keywords are present in any text field", + "example": "smith james" + }, + "notWords": { + "type": "string", + "description": "Filter results where any of these words are present in any text field", + "example": "jonas" + }, + "exactPhrase": { + "type": "string", + "description": "Match only prisoners where the full phrase is present in any text field", + "example": "John Smith" + }, + "fuzzyMatch": { + "type": "boolean", + "description": "Fuzzy matching. Allow a one character difference in spelling in word lengths below five and two differences above.", + "example": false + }, + "prisonIds": { + "type": "array", + "description": "List of prison codes to filter results", + "example": [ + "LEI", + "MDI" + ], + "items": { + "type": "string", + "description": "List of prison codes to filter results", + "example": "[\"LEI\",\"MDI\"]" + } + }, + "pagination": { + "$ref": "#/components/schemas/PaginationRequest" + }, + "type": { + "type": "string", + "description": "The type of search. When set to DEFAULT (which is the default when not provided) search order is by calculated relevance (AKA score). An ESTABLISHMENT type will order results by name and is designed for using this API for a single quick search field for prisoners within a specific prison", + "enum": [ + "DEFAULT", + "ESTABLISHMENT" + ] + } + } + }, + "KeywordResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prisoner" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "empty": { + "type": "boolean" + } + } + }, + "GlobalSearchCriteria": { + "type": "object", + "properties": { + "prisonerIdentifier": { + "type": "string", + "description": "Prisoner identifier, one of prisoner number, book number, booking ID or PNC", + "example": "A1234AA" + }, + "firstName": { + "type": "string", + "description": "First Name", + "example": "John" + }, + "lastName": { + "type": "string", + "description": "Last Name", + "example": "Smith" + }, + "gender": { + "type": "string", + "description": "Gender, F - Female, M - Male, NK - Not Known / Not Recorded or NS - Not Specified (Indeterminate)", + "example": "M", + "enum": [ + "M", + "F", + "NK", + "NS", + "ALL" + ] + }, + "location": { + "type": "string", + "description": "Location, All or Inside or Outside", + "example": "IN" + }, + "dateOfBirth": { + "type": "string", + "description": "Date of birth", + "format": "date", + "example": "1970-02-28" + }, + "includeAliases": { + "type": "boolean", + "description": "Include aliases in search", + "example": false, + "default": false + } + }, + "description": "Search Criteria for Global Prisoner Search" + }, + "AttributeSearchRequest": { + "required": [ + "pagination", + "queries" + ], + "type": "object", + "properties": { + "joinType": { + "type": "string", + "description": "The type of join to use when combining matchers or subQueries. Defaults to AND if not included in the request.", + "example": "AND", + "default": "AND", + "enum": [ + "AND", + "OR" + ] + }, + "queries": { + "type": "array", + "description": "A list of queries of type Query that will be combined with the matchers in this query", + "items": { + "$ref": "#/components/schemas/Query" + } + }, + "pagination": { + "$ref": "#/components/schemas/PaginationRequest" + } + }, + "description": "A request to search for prisoners by attributes" + }, + "BooleanMatcher": { + "required": [ + "attribute", + "condition", + "type" + ], + "type": "object", + "description": "A matcher for a boolean attribute from the Prisoner record", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "attribute": { + "type": "string", + "description": "The attribute to match", + "example": "recall" + }, + "condition": { + "type": "boolean", + "description": "Whether the attribute must be true or false", + "example": true + }, + "type": { + "type": "string", + "description": "Must be Boolean", + "example": "Boolean" + } + } + } + ] + }, + "DateMatcher": { + "required": [ + "attribute", + "type" + ], + "type": "object", + "description": "A matcher for a date attribute from the Prisoner record.\n \n For a between clause use both min value and max value. By default the range is inclusive, but can be adjusted with minInclusive and maxInclusive.\n \n For <= enter only a max value, and for < set max inclusive to false.\n \n For >= enter only a min value, and for > set min inclusive to false.\n \n For equals enter the same date in both the min value and max value and leave min/max inclusive as true.\n ", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "attribute": { + "type": "string", + "description": "The attribute to match", + "example": "releaseDate" + }, + "minValue": { + "type": "string", + "description": "The minimum value to match", + "format": "date", + "example": "2024-01-01" + }, + "minInclusive": { + "type": "boolean", + "description": "Whether the minimum value is inclusive or exclusive", + "default": true + }, + "maxValue": { + "type": "string", + "description": "The maximum value to match", + "format": "date", + "example": "2024-01-31" + }, + "maxInclusive": { + "type": "boolean", + "description": "Whether the maximum value is inclusive or exclusive", + "default": true + }, + "type": { + "type": "string", + "description": "Must be Date", + "example": "Date" + } + } + } + ] + }, + "DateTimeMatcher": { + "required": [ + "attribute", + "type" + ], + "type": "object", + "description": "A matcher for a date time attribute from the Prisoner record.\n \n For a between clause use both the min and max values.\n \n For < enter only the max value.\n \n For > enter only the min value.\n", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "attribute": { + "type": "string", + "description": "The attribute to search on", + "example": "currentIncentive.dateTime" + }, + "minValue": { + "type": "string", + "description": "The minimum value to match", + "format": "date-time", + "example": "2024-01-01T09:00:00Z" + }, + "maxValue": { + "type": "string", + "description": "The maximum value to match", + "format": "date-time", + "example": "2024-01-31T21:00:00Z" + }, + "type": { + "type": "string", + "description": "Must be DateTime", + "example": "DateTime" + } + } + } + ] + }, + "IntMatcher": { + "required": [ + "attribute", + "type" + ], + "type": "object", + "description": "A matcher for an integer attribute from the Prisoner record.\n \n For a between clause use both min value and max value. By default the range is inclusive, but can be adjusted with minInclusive and maxInclusive.\n \n For <= enter only a max value, and for < set max inclusive to false.\n \n For >= enter only a min value, and for > set min inclusive to false.\n \n For equals enter the same integer in both the min value and max value and leave min/max inclusive as true.\n ", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "attribute": { + "type": "string", + "description": "The attribute to match on", + "example": "heightCentimetres" + }, + "minValue": { + "type": "integer", + "description": "The minimum value to match on", + "format": "int32", + "example": 150 + }, + "minInclusive": { + "type": "boolean", + "description": "Whether the minimum value is inclusive", + "default": true + }, + "maxValue": { + "type": "integer", + "description": "The maximum value to match on", + "format": "int32", + "example": 180 + }, + "maxInclusive": { + "type": "boolean", + "description": "Whether the maximum value is inclusive", + "default": true + }, + "type": { + "type": "string", + "description": "Must be Int", + "example": "Int" + } + } + } + ] + }, + "Matcher": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string" + } + }, + "description": "Matchers that will be applied to this query", + "discriminator": { + "propertyName": "type" + } + }, + "PncMatcher": { + "required": [ + "pncNumber", + "type" + ], + "type": "object", + "description": "A matcher for PNC numbers.\n \n This is required because PNC numbers come in various formats with 2/4 long years and with/without leading zeroes.\n \n This matcher will find the matching PNC regardless of which format is used. \n ", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "pncNumber": { + "type": "string", + "description": "The PNC number match", + "example": "24/123456H" + }, + "type": { + "type": "string", + "description": "Must be PNC", + "example": "PNC" + } + } + } + ] + }, + "Query": { + "type": "object", + "properties": { + "joinType": { + "type": "string", + "description": "The type of join to use when combining matchers or subQueries. Defaults to AND if not included in the request.", + "example": "AND", + "default": "AND", + "enum": [ + "AND", + "OR" + ] + }, + "matchers": { + "type": "array", + "description": "Matchers that will be applied to this query", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/BooleanMatcher" + }, + { + "$ref": "#/components/schemas/DateMatcher" + }, + { + "$ref": "#/components/schemas/DateTimeMatcher" + }, + { + "$ref": "#/components/schemas/IntMatcher" + }, + { + "$ref": "#/components/schemas/PncMatcher" + }, + { + "$ref": "#/components/schemas/StringMatcher" + } + ] + } + }, + "subQueries": { + "type": "array", + "description": "A list of sub-queries of type Query that will be combined with the matchers in this query", + "items": { + "$ref": "#/components/schemas/Query" + } + } + }, + "description": "A query to search for prisoners by attributes" + }, + "StringMatcher": { + "required": [ + "attribute", + "condition", + "searchTerm", + "type" + ], + "type": "object", + "description": "A matcher for a string attribute from the prisoner record", + "allOf": [ + { + "$ref": "#/components/schemas/Matcher" + }, + { + "type": "object", + "properties": { + "attribute": { + "type": "string", + "description": "The attribute to match on", + "example": "aliases.lastName" + }, + "condition": { + "type": "string", + "description": "The condition to apply to the attribute value. \n \n All String searches are case-insensitive.\n \n IS and IS_NOT require an exact match (wildcards ? and * will not work).\n \n For IS and CONTAINS some attributes support fuzzy matching e.g. they allow spelling mistakes. Call endpoint `/attribute-search/attributes` to see which attributes support fuzzy matching.\n \n CONTAINS without wildcards (? and *) for a non-fuzzy attribute looks for the exact search term anywhere in the attribute value.\n \n CONTAINS with wildcards ? (single character) and * (zero to many characters) perform a wildcard match which must match the entire attribute value.\n \n STARTSWITH checks only the prefix of the attribute value and does not support fuzzy matching or wildcards.\n \n IN checks a list of values for an exact match and does not support fuzzy matching, wildcards or case insensitive searching.\n ", + "example": "IS", + "enum": [ + "IS", + "IS_NOT", + "CONTAINS", + "STARTSWITH", + "IN" + ] + }, + "searchTerm": { + "type": "string", + "description": "The search term to apply to the attribute. Search terms are not case-sensitive.", + "example": "Smith" + }, + "type": { + "type": "string", + "description": "Must be String", + "example": "String" + } + } + } + ] + }, + "ReferenceData": { + "required": [ + "label", + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "label": { + "type": "string" + } + } + }, + "ReferenceDataResponse": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReferenceData" + } + } + } + }, + "Attribute": { + "required": [ + "fuzzySearch", + "name", + "type" + ], + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the attribute to be used when searching", + "example": "firstName" + }, + "type": { + "type": "string", + "description": "The type of the attribute (used to determine which matcher to use)", + "example": "String" + }, + "fuzzySearch": { + "type": "boolean", + "description": "Whether the attribute search will be fuzzy. Generally applicable to String attributes containing free text such as names.", + "example": true + } + }, + "description": "An attribute that can be searched for in a query" + } + }, + "securitySchemes": { + "view-prisoner-data-role": { + "type": "http", + "description": "A HMPPS Auth access token with the `ROLE_VIEW_PRISONER_DATA` role.", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + }, + "prisoner-search-role": { + "type": "http", + "description": "A HMPPS Auth access token with the `ROLE_PRISONER_SEARCH` role.", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + }, + "global-search-role": { + "type": "http", + "description": "A HMPPS Auth access token with the `ROLE_GLOBAL_SEARCH` role.", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + }, + "prisoner-in-prison-search-role": { + "type": "http", + "description": "A HMPPS Auth access token with the `ROLE_PRISONER_IN_PRISON_SEARCH` role.", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + }, + "prisoner-search--prisoner--ro": { + "type": "http", + "description": "A HMPPS Auth access token with the `PRISONER_SEARCH__PRISONER__RO` role.", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + } +} diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AddressSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AddressSmokeTest.kt index 6c3d0da7a..2b4322d9e 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AddressSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AddressSmokeTest.kt @@ -19,7 +19,6 @@ class AddressSmokeTest : DescribeSpec( it("returns addresses for a person") { val response = httpClient.performAuthorised("$basePath/$encodedHmppsId/addresses") - response.statusCode().shouldBe(HttpStatus.OK.value()) response.body().shouldEqualJson( """ { @@ -72,6 +71,7 @@ class AddressSmokeTest : DescribeSpec( } """.removeWhitespaceAndNewlines(), ) + response.statusCode().shouldBe(HttpStatus.OK.value()) } }, ) diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AdjudicationsSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AdjudicationsSmokeTest.kt index 1ede09fae..dc6a7fb10 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AdjudicationsSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/AdjudicationsSmokeTest.kt @@ -43,18 +43,18 @@ class AdjudicationsSmokeTest : DescribeSpec( "paragraphDescription": "Committed an assault" } }, - "status": "string", + "status": "ACCEPTED", "statusReason": "string", "statusDetails": "string", "hearings": [ { "dateTimeOfHearing": "2021-07-05T10:35:17", - "oicHearingType": "string", + "oicHearingType": "GOV_ADULT", "outcome": { - "code": "string", - "reason": "string", + "code": "COMPLETE", + "reason": "LEGAL_ADVICE", "details": "string", - "plea": "string" + "plea": "UNFIT" } } ], @@ -62,27 +62,27 @@ class AdjudicationsSmokeTest : DescribeSpec( { "hearing": { "dateTimeOfHearing": "2021-07-05T10:35:17", - "oicHearingType": "string", + "oicHearingType": "GOV_ADULT", "outcome": { - "code": "string", - "reason": "string", + "code": "COMPLETE", + "reason": "LEGAL_ADVICE", "details": "string", - "plea": "string" + "plea": "UNFIT" } }, "outcome": { "outcome": { - "code": "string", + "code": "REFER_POLICE", "details": "string", - "reason": "string", - "quashedReason": "string", + "reason": "ANOTHER_WAY", + "quashedReason": "FLAWED_CASE", "canRemove": true }, "referralOutcome": { - "code": "string", + "code": "REFER_POLICE", "details": "string", - "reason": "string", - "quashedReason": "string", + "reason": "ANOTHER_WAY", + "quashedReason": "FLAWED_CASE", "canRemove": true } } @@ -90,8 +90,8 @@ class AdjudicationsSmokeTest : DescribeSpec( ], "punishments": [ { - "type": "string", - "privilegeType": "string", + "type": "PRIVILEGE", + "privilegeType": "CANTEEN", "otherPrivilege": "string", "schedule": { "days": -2147483648, @@ -104,7 +104,7 @@ class AdjudicationsSmokeTest : DescribeSpec( "punishmentComments": [ { "comment": "string", - "reasonForChange": "string", + "reasonForChange": "APPEAL", "dateTime": "2021-07-05T10:35:17" } ] diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/NeedsSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/NeedsSmokeTest.kt index 228ef6ef8..1fbd9498c 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/NeedsSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/NeedsSmokeTest.kt @@ -40,7 +40,7 @@ class NeedsSmokeTest : DescribeSpec( "type": "DRUG_MISUSE", "riskOfHarm": false, "riskOfReoffending": false, - "severity": "SEVERE" + "severity": "NO_NEED" } ], "unansweredNeeds": [ diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/PersonSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/PersonSmokeTest.kt index 5937ca2cc..533f5012b 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/PersonSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/PersonSmokeTest.kt @@ -24,17 +24,56 @@ class PersonSmokeTest : DescribeSpec( val response = httpClient.performAuthorised("$basePath?$queryParams") response.statusCode().shouldBe(HttpStatus.OK.value()) - response.body().shouldContain("\"data\":[") - response.body().shouldContain( - """ - "firstName":"Robert", - "lastName":"Larsen" - """.removeWhitespaceAndNewlines(), - ) - response.body().shouldContain( + response.body().shouldBe( """ - "firstName":"string", - "lastName":"string" + { + "data": [ + { + "firstName": "string", + "lastName": "string", + "middleName": "string", + "dateOfBirth": "2019-08-24", + "gender": "string", + "ethnicity": "string", + "aliases": [ + { + "firstName": "string", + "lastName": "string", + "middleName": "string", + "dateOfBirth": "2019-08-24", + "gender": "string", + "ethnicity": null + } + ], + "identifiers": { + "nomisNumber": "G5555TT", + "croNumber": "123456/24A", + "deliusCrn": "A123456" + }, + "pncId": "2012/0052494Q", + "hmppsId": "A123456", + "contactDetails": { + "phoneNumbers": [ + { + "number": "string", + "type": "TELEPHONE" + } + ], + "emails": [ + "string" + ] + } + } + ], + "pagination": { + "isLastPage": true, + "count": 1, + "page": 1, + "perPage": 10, + "totalCount": 1, + "totalPages": 1 + } +} """.removeWhitespaceAndNewlines(), ) } @@ -100,7 +139,7 @@ class PersonSmokeTest : DescribeSpec( "phoneNumbers": [ { "number": "string", - "type": "string" + "type": "TELEPHONE" } ], "emails": [ @@ -178,7 +217,7 @@ class PersonSmokeTest : DescribeSpec( "phoneNumbers": [ { "number": "string", - "type": "string" + "type": "TELEPHONE" } ], "emails": [ diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/RisksSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/RisksSmokeTest.kt index 90bf02937..50dbcb468 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/RisksSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/RisksSmokeTest.kt @@ -77,7 +77,7 @@ class RisksSmokeTest : DescribeSpec( "assessmentDate": "2018-02-11", "nextReviewDate": "2018-02-11", "assessmentAgencyId": "MDI", - "assessmentStatus": "A", + "assessmentStatus": "P", "assessmentComment": "Comment details" } ], diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/SentencesSmokeTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/SentencesSmokeTest.kt index d4fbe9586..e70fe2696 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/SentencesSmokeTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/person/SentencesSmokeTest.kt @@ -19,7 +19,6 @@ class SentencesSmokeTest : DescribeSpec( it("returns sentences for a person") { val response = httpClient.performAuthorised(basePath) - response.statusCode().shouldBe(HttpStatus.OK.value()) response.body().shouldEqualJson( """ { @@ -73,6 +72,8 @@ class SentencesSmokeTest : DescribeSpec( } """.removeWhitespaceAndNewlines(), ) + + response.statusCode().shouldBe(HttpStatus.OK.value()) } it("returns latest sentence key dates and adjustments for a person") { From a9a2dcb041978bce1c35d465799d9a1bb700459e Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Fri, 2 Aug 2024 17:05:17 +0100 Subject: [PATCH 09/11] PI-2375 - update prism files --- Dockerfile.setup-probation-offender-search | 5 +- docker-compose.yml | 2 +- .../prismMocks/probation-offender-search.json | 1656 +++++++++++++++++ 3 files changed, 1660 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json diff --git a/Dockerfile.setup-probation-offender-search b/Dockerfile.setup-probation-offender-search index 8895c0f9c..5c07961dd 100644 --- a/Dockerfile.setup-probation-offender-search +++ b/Dockerfile.setup-probation-offender-search @@ -2,8 +2,9 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache -RUN curl https://probation-offender-search-dev.hmpps.service.justice.gov.uk/v3/api-docs > probation-offender-search.json && \ - npm install -g @stoplight/prism-cli + +COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json /probation-offender-search.json +RUN npm install -g @stoplight/prism-cli RUN adduser -D user diff --git a/docker-compose.yml b/docker-compose.yml index c0b336dd8..c001f50f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,7 +72,7 @@ services: dockerfile: Dockerfile.setup-probation-offender-search container_name: probation-offender-search healthcheck: - test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/synthetic-monitor -O /dev/null' + test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/search?crn=sit&croNumber=odio&dateOfBirth=1941-09-13&firstName=velit&includeAliases=true&nomsNumber=omnis&pncNumber=aspernatur&surname=est -O /dev/null' ports: - '4020:4010' diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json new file mode 100644 index 000000000..7c1f62ab1 --- /dev/null +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json @@ -0,0 +1,1656 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Offender search API Documentation", + "contact": { + "name": "Probation Integration Team", + "url": "https://mojdt.slack.com/archives/C02HQ4M2YQN", + "email": "probation-integration-team@digital.justice.gov.uk" + }, + "version": "1.0" + }, + "servers": [ + { + "url": "/" + } + ], + "security": [ + { + "hmpps-auth-token": [] + } + ], + "tags": [ + { + "name": "address-search", + "description": "Provides address search features for Delius elastic search" + }, + { + "name": "offender-match", + "description": "Provides offender matching features for Delius elastic search" + }, + { + "name": "offender-search", + "description": "Provides offender search features for Delius elastic search" + } + ], + "paths": { + "/search": { + "get": { + "tags": [ + "offender-search" + ], + "summary": "Search for an offender in Delius. Only offenders matching all request attributes will be returned", + "description": "Specify the request criteria to match against", + "operationId": "search", + "parameters": [ + { + "name": "searchForm", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SearchDto" + } + } + ], + "responses": { + "400": { + "description": "Invalid Request" + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderDetail" + } + } + } + } + }, + "404": { + "description": "Not found" + } + } + }, + "post": { + "tags": [ + "offender-search" + ], + "summary": "Search for an offender in Delius. Only offenders matching all request attributes will be returned", + "description": "Specify the request criteria to match against", + "operationId": "search_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchDto" + } + } + }, + "required": true + }, + "responses": { + "400": { + "description": "Invalid Request" + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderDetail" + } + } + } + } + }, + "404": { + "description": "Not found" + } + } + } + } + }, + "components": { + "schemas": { + "SearchDto": { + "type": "object", + "properties": { + "firstName": { + "type": "string" + }, + "surname": { + "type": "string" + }, + "dateOfBirth": { + "type": "string", + "format": "date", + "example": "1996-02-10" + }, + "pncNumber": { + "type": "string", + "example": "2018/0123456X" + }, + "croNumber": { + "type": "string", + "example": "SF80/655108T" + }, + "crn": { + "type": "string", + "example": "X00001" + }, + "nomsNumber": { + "type": "string", + "example": "G5555TT" + }, + "includeAliases": { + "type": "boolean", + "example": false + } + } + }, + "Address": { + "required": [ + "from", + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "from": { + "type": "string", + "format": "date" + }, + "to": { + "type": "string", + "format": "date" + }, + "noFixedAbode": { + "type": "boolean" + }, + "notes": { + "type": "string" + }, + "addressNumber": { + "type": "string" + }, + "buildingName": { + "type": "string" + }, + "streetName": { + "type": "string" + }, + "district": { + "type": "string" + }, + "town": { + "type": "string" + }, + "county": { + "type": "string" + }, + "postcode": { + "type": "string" + }, + "telephoneNumber": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/KeyValue" + }, + "type": { + "$ref": "#/components/schemas/KeyValue" + } + } + }, + "AllTeam": { + "required": [ + "providerTeamId", + "teamId" + ], + "type": "object", + "properties": { + "providerTeamId": { + "type": "integer", + "format": "int64" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + }, + "externalProvider": { + "$ref": "#/components/schemas/KeyValue" + }, + "scProvider": { + "$ref": "#/components/schemas/KeyValue" + }, + "localDeliveryUnit": { + "$ref": "#/components/schemas/KeyValue" + }, + "district": { + "$ref": "#/components/schemas/KeyValue" + }, + "borough": { + "$ref": "#/components/schemas/KeyValue" + } + } + }, + "ContactDetails": { + "type": "object", + "properties": { + "phoneNumbers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PhoneNumber" + } + }, + "emailAddresses": { + "type": "array", + "items": { + "type": "string" + } + }, + "allowSMS": { + "type": "boolean" + }, + "addresses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Address" + } + } + } + }, + "Disability": { + "type": "object", + "properties": { + "disabilityId": { + "type": "integer", + "format": "int64" + }, + "disabilityType": { + "$ref": "#/components/schemas/KeyValue" + }, + "condition": { + "$ref": "#/components/schemas/KeyValue" + }, + "startDate": { + "type": "string", + "format": "date" + }, + "endDate": { + "type": "string", + "format": "date" + }, + "notes": { + "type": "string" + } + } + }, + "Human": { + "type": "object", + "properties": { + "forenames": { + "type": "string", + "example": "Sheila Linda" + }, + "surname": { + "type": "string", + "example": "Hancock" + } + } + }, + "IDs": { + "required": [ + "crn" + ], + "type": "object", + "properties": { + "crn": { + "type": "string", + "description": "Probation Case Reference Number", + "example": "A123456" + }, + "pncNumber": { + "type": "string", + "description": "Police National Computer ID", + "example": "2012/0052494Q" + }, + "croNumber": { + "type": "string", + "description": "Criminal Records Office Number", + "example": "123456/24A" + }, + "niNumber": { + "type": "string", + "description": "National Insurance Number", + "example": "AA123456A" + }, + "nomsNumber": { + "type": "string", + "description": "Prison Offender Number", + "example": "G5555TT" + }, + "immigrationNumber": { + "type": "string" + }, + "mostRecentPrisonerNumber": { + "type": "string" + }, + "previousCrn": { + "type": "string" + } + } + }, + "Institution": { + "type": "object", + "properties": { + "institutionId": { + "type": "integer", + "format": "int64" + }, + "isEstablishment": { + "type": "boolean" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "institutionName": { + "type": "string" + }, + "establishmentType": { + "$ref": "#/components/schemas/KeyValue" + }, + "isPrivate": { + "type": "boolean" + }, + "nomsPrisonInstitutionCode": { + "type": "string" + } + } + }, + "KeyValue": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "description": "Team's borough" + }, + "MappaDetails": { + "type": "object", + "properties": { + "level": { + "type": "integer", + "format": "int32" + }, + "levelDescription": { + "type": "string" + }, + "category": { + "type": "integer", + "format": "int32" + }, + "categoryDescription": { + "type": "string" + }, + "startDate": { + "type": "string", + "format": "date" + }, + "reviewDate": { + "type": "string", + "format": "date" + }, + "team": { + "$ref": "#/components/schemas/KeyValue" + }, + "officer": { + "$ref": "#/components/schemas/StaffHuman" + }, + "probationArea": { + "$ref": "#/components/schemas/KeyValue" + }, + "notes": { + "type": "string" + } + } + }, + "OffenderAlias": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "firstName": { + "type": "string" + }, + "middleNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "surname": { + "type": "string" + }, + "gender": { + "type": "string" + } + } + }, + "OffenderDetail": { + "required": [ + "offenderId", + "otherIds" + ], + "type": "object", + "properties": { + "previousSurname": { + "type": "string" + }, + "offenderId": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "middleNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "surname": { + "type": "string" + }, + "dateOfBirth": { + "type": "string", + "format": "date" + }, + "gender": { + "type": "string" + }, + "otherIds": { + "$ref": "#/components/schemas/IDs" + }, + "contactDetails": { + "$ref": "#/components/schemas/ContactDetails" + }, + "offenderProfile": { + "$ref": "#/components/schemas/OffenderProfile" + }, + "offenderAliases": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderAlias" + } + }, + "offenderManagers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderManager" + } + }, + "softDeleted": { + "type": "boolean" + }, + "currentDisposal": { + "type": "string" + }, + "partitionArea": { + "type": "string" + }, + "currentRestriction": { + "type": "boolean" + }, + "restrictionMessage": { + "type": "string" + }, + "currentExclusion": { + "type": "boolean" + }, + "exclusionMessage": { + "type": "string" + }, + "highlight": { + "type": "object", + "additionalProperties": { + "type": "array", + "description": "map of fields which matched a search term (Only return for phrase searching)", + "example": { + "surname": [ + "Smith" + ], + "offenderAliases.surname": [ + "SMITH" + ] + }, + "items": { + "type": "string", + "description": "map of fields which matched a search term (Only return for phrase searching)", + "example": "{\"surname\":[\"Smith\"],\"offenderAliases.surname\":[\"SMITH\"]}" + } + }, + "description": "map of fields which matched a search term (Only return for phrase searching)", + "example": { + "surname": [ + "Smith" + ], + "offenderAliases.surname": [ + "SMITH" + ] + } + }, + "accessDenied": { + "type": "boolean" + }, + "currentTier": { + "type": "string" + }, + "activeProbationManagedSentence": { + "type": "boolean" + }, + "mappa": { + "$ref": "#/components/schemas/MappaDetails" + }, + "probationStatus": { + "$ref": "#/components/schemas/ProbationStatus" + }, + "age": { + "type": "integer", + "format": "int32" + } + } + }, + "OffenderLanguages": { + "type": "object", + "properties": { + "primaryLanguage": { + "type": "string" + }, + "otherLanguages": { + "type": "array", + "items": { + "type": "string" + } + }, + "languageConcerns": { + "type": "string" + }, + "requiresInterpreter": { + "type": "boolean" + } + } + }, + "OffenderManager": { + "type": "object", + "properties": { + "trustOfficer": { + "$ref": "#/components/schemas/Human" + }, + "staff": { + "$ref": "#/components/schemas/StaffHuman" + }, + "providerEmployee": { + "$ref": "#/components/schemas/Human" + }, + "partitionArea": { + "type": "string" + }, + "softDeleted": { + "type": "boolean" + }, + "team": { + "$ref": "#/components/schemas/Team" + }, + "probationArea": { + "$ref": "#/components/schemas/ProbationArea" + }, + "fromDate": { + "type": "string", + "format": "date" + }, + "toDate": { + "type": "string", + "format": "date" + }, + "active": { + "type": "boolean" + }, + "allocationReason": { + "$ref": "#/components/schemas/KeyValue" + } + } + }, + "OffenderProfile": { + "type": "object", + "properties": { + "ethnicity": { + "type": "string" + }, + "nationality": { + "type": "string" + }, + "secondaryNationality": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "immigrationStatus": { + "type": "string" + }, + "offenderLanguages": { + "$ref": "#/components/schemas/OffenderLanguages" + }, + "religion": { + "type": "string" + }, + "sexualOrientation": { + "type": "string" + }, + "offenderDetails": { + "type": "string" + }, + "remandStatus": { + "type": "string" + }, + "previousConviction": { + "$ref": "#/components/schemas/PreviousConviction" + }, + "riskColour": { + "type": "string" + }, + "disabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Disability" + } + }, + "provisions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Provision" + } + } + } + }, + "PhoneNumber": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "TELEPHONE", + "MOBILE" + ] + } + } + }, + "PreviousConviction": { + "type": "object", + "properties": { + "convictionDate": { + "type": "string", + "format": "date" + }, + "detail": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ProbationArea": { + "required": [ + "probationAreaId" + ], + "type": "object", + "properties": { + "probationAreaId": { + "type": "integer", + "format": "int64" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "nps": { + "type": "boolean" + }, + "organisation": { + "$ref": "#/components/schemas/KeyValue" + }, + "institution": { + "$ref": "#/components/schemas/Institution" + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AllTeam" + } + } + } + }, + "ProbationStatus": { + "required": [ + "awaitingPsr", + "preSentenceActivity", + "status" + ], + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "previouslyKnownTerminationDate": { + "type": "string", + "format": "date" + }, + "inBreach": { + "type": "boolean" + }, + "preSentenceActivity": { + "type": "boolean" + }, + "awaitingPsr": { + "type": "boolean" + } + } + }, + "Provision": { + "type": "object", + "properties": { + "provisionId": { + "type": "integer", + "format": "int64" + }, + "provisionType": { + "$ref": "#/components/schemas/KeyValue" + }, + "category": { + "$ref": "#/components/schemas/KeyValue" + }, + "startDate": { + "type": "string", + "format": "date" + }, + "endDate": { + "type": "string", + "format": "date" + }, + "notes": { + "type": "string" + } + } + }, + "StaffHuman": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Staff code", + "example": "AN001A" + }, + "forenames": { + "type": "string", + "description": "Given names", + "example": "Sheila Linda" + }, + "surname": { + "type": "string", + "description": "Family name", + "example": "Hancock" + }, + "unallocated": { + "type": "boolean", + "description": "When true the not allocated", + "example": false + } + } + }, + "Team": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Team code", + "example": "C01T04" + }, + "description": { + "type": "string", + "description": "Team description", + "example": "OMU A" + }, + "telephone": { + "type": "string", + "description": "Team telephone, often not populated", + "example": "OMU A" + }, + "localDeliveryUnit": { + "$ref": "#/components/schemas/KeyValue" + }, + "district": { + "$ref": "#/components/schemas/KeyValue" + }, + "borough": { + "$ref": "#/components/schemas/KeyValue" + } + } + }, + "PageObject": { + "required": [ + "number", + "size", + "totalElements", + "totalPages" + ], + "type": "object", + "properties": { + "size": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int64" + } + } + }, + "PageableObject": { + "type": "object", + "properties": { + "unpaged": { + "type": "boolean" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "paged": { + "type": "boolean" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "offset": { + "type": "integer", + "format": "int64" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + } + } + }, + "SearchPagedResults": { + "required": [ + "content", + "empty", + "first", + "last", + "number", + "numberOfElements", + "page", + "pageable", + "size", + "sort", + "total", + "totalElements", + "totalPages" + ], + "type": "object", + "properties": { + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderDetail" + } + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "total": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "numberOfElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "page": { + "$ref": "#/components/schemas/PageObject" + } + } + }, + "SortObject": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "nullHandling": { + "type": "string" + }, + "ascending": { + "type": "boolean" + }, + "property": { + "type": "string" + }, + "ignoreCase": { + "type": "boolean" + } + } + }, + "ContactSearchRequest": { + "required": [ + "crn", + "matchAllTerms", + "query" + ], + "type": "object", + "properties": { + "crn": { + "type": "string" + }, + "query": { + "type": "string" + }, + "matchAllTerms": { + "type": "boolean" + } + } + }, + "ContactSearchResponse": { + "required": [ + "page", + "results", + "size", + "totalPages", + "totalResults" + ], + "type": "object", + "properties": { + "size": { + "type": "integer", + "format": "int32" + }, + "page": { + "type": "integer", + "format": "int32" + }, + "totalResults": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int32" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContactSearchResult" + } + } + } + }, + "ContactSearchResult": { + "required": [ + "crn", + "date", + "highlights", + "id", + "lastUpdatedDateTime", + "typeCode", + "typeDescription" + ], + "type": "object", + "properties": { + "crn": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "typeCode": { + "type": "string" + }, + "typeDescription": { + "type": "string" + }, + "outcomeCode": { + "type": "string" + }, + "outcomeDescription": { + "type": "string" + }, + "description": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date" + }, + "startTime": { + "$ref": "#/components/schemas/LocalTime" + }, + "endTime": { + "$ref": "#/components/schemas/LocalTime" + }, + "lastUpdatedDateTime": { + "type": "string", + "format": "date-time" + }, + "highlights": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "LocalTime": { + "type": "object", + "properties": { + "hour": { + "type": "integer", + "format": "int32" + }, + "minute": { + "type": "integer", + "format": "int32" + }, + "second": { + "type": "integer", + "format": "int32" + }, + "nano": { + "type": "integer", + "format": "int32" + } + } + }, + "AddressSearchRequest": { + "required": [ + "boostOptions" + ], + "type": "object", + "properties": { + "buildingName": { + "type": "string" + }, + "addressNumber": { + "type": "string" + }, + "streetName": { + "type": "string" + }, + "district": { + "type": "string" + }, + "town": { + "type": "string" + }, + "county": { + "type": "string" + }, + "postcode": { + "type": "string" + }, + "telephoneNumber": { + "type": "string" + }, + "boostOptions": { + "$ref": "#/components/schemas/BoostOptions" + } + } + }, + "BoostOptions": { + "required": [ + "postcode", + "streetName", + "town" + ], + "type": "object", + "properties": { + "postcode": { + "type": "number", + "format": "float" + }, + "streetName": { + "type": "number", + "format": "float" + }, + "town": { + "type": "number", + "format": "float" + } + } + }, + "LicenceCaseloadRequest": { + "required": [ + "offset", + "pageSize", + "query", + "sortBy", + "teamCodes" + ], + "type": "object", + "properties": { + "teamCodes": { + "type": "array", + "items": { + "type": "string" + } + }, + "query": { + "type": "string" + }, + "sortBy": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortBy" + } + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "offset": { + "type": "integer", + "format": "int32" + } + } + }, + "SortBy": { + "required": [ + "direction", + "field" + ], + "type": "object", + "properties": { + "field": { + "pattern": "^identifiers\\.crn$|^name\\.forename$|^name\\.surname$|^manager\\.name\\.forename$|^manager\\.name\\.surname$", + "type": "string" + }, + "direction": { + "pattern": "^asc$|^desc$", + "type": "string" + } + } + }, + "CodedValue": { + "required": [ + "code", + "description" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string" + } + } + }, + "Identifiers": { + "required": [ + "crn" + ], + "type": "object", + "properties": { + "crn": { + "type": "string" + }, + "cro": { + "type": "string" + }, + "noms": { + "type": "string" + }, + "pnc": { + "type": "string" + } + } + }, + "LicenceCaseloadPerson": { + "required": [ + "allocationDate", + "identifiers", + "manager", + "name" + ], + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/Name" + }, + "identifiers": { + "$ref": "#/components/schemas/Identifiers" + }, + "manager": { + "$ref": "#/components/schemas/Manager" + }, + "allocationDate": { + "type": "string", + "format": "date" + } + } + }, + "Manager": { + "required": [ + "code", + "name", + "probationArea", + "team" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "name": { + "$ref": "#/components/schemas/Name" + }, + "team": { + "$ref": "#/components/schemas/Team" + }, + "probationArea": { + "$ref": "#/components/schemas/CodedValue" + } + } + }, + "Name": { + "required": [ + "forename", + "surname" + ], + "type": "object", + "properties": { + "surname": { + "type": "string" + }, + "forename": { + "type": "string" + }, + "middleName": { + "type": "string" + } + } + }, + "PageMetadata": { + "type": "object", + "properties": { + "size": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int64" + } + } + }, + "PagedModelLicenceCaseloadPerson": { + "type": "object", + "properties": { + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LicenceCaseloadPerson" + } + }, + "page": { + "$ref": "#/components/schemas/PageMetadata" + } + } + }, + "SearchPhraseFilter": { + "required": [ + "matchAllTerms", + "phrase", + "probationAreasFilter" + ], + "type": "object", + "properties": { + "phrase": { + "type": "string", + "description": "Phrase containing the terms to search for", + "example": "john smith 19/07/1965" + }, + "matchAllTerms": { + "type": "boolean", + "description": "When true, only match offenders that match all terms. Analogous to AND versus OR" + }, + "probationAreasFilter": { + "type": "array", + "description": "Filter of probation area codes. Only offenders that have an active offender manager in one of the areas will be returned", + "example": [ + "N01", + "N02" + ], + "items": { + "type": "string", + "description": "Filter of probation area codes. Only offenders that have an active offender manager in one of the areas will be returned", + "example": "[\"N01\",\"N02\"]" + } + } + } + }, + "ProbationAreaAggregation": { + "required": [ + "code", + "count" + ], + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Probation area code", + "example": "N07" + }, + "description": { + "type": "string", + "description": "Probation area description", + "example": "London" + }, + "count": { + "type": "integer", + "description": "Count of matching offenders in this area", + "format": "int64", + "example": 78 + } + }, + "description": "Counts of offenders aggregated by probation area" + }, + "SearchPhraseResults": { + "required": [ + "content", + "empty", + "first", + "last", + "number", + "numberOfElements", + "page", + "pageable", + "probationAreaAggregations", + "size", + "sort", + "total", + "totalElements", + "totalPages" + ], + "type": "object", + "properties": { + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OffenderDetail" + } + }, + "total": { + "type": "integer", + "format": "int64" + }, + "probationAreaAggregations": { + "type": "array", + "description": "Counts of offenders aggregated by probation area", + "items": { + "$ref": "#/components/schemas/ProbationAreaAggregation" + } + }, + "suggestions": { + "$ref": "#/components/schemas/Suggest" + }, + "totalPages": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "last": { + "type": "boolean" + }, + "size": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "numberOfElements": { + "type": "integer", + "format": "int64" + }, + "first": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + }, + "sort": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortObject" + } + }, + "page": { + "$ref": "#/components/schemas/PageObject" + } + } + }, + "Suggest": { + "type": "object", + "properties": { + "fragment": { + "type": "boolean" + } + }, + "description": "Alternative search phrase suggestions. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html" + }, + "MatchRequest": { + "required": [ + "activeSentence", + "surname" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "Offender first description", + "example": "john" + }, + "surname": { + "type": "string", + "description": "Offender surname", + "example": "smith" + }, + "dateOfBirth": { + "type": "string", + "description": "Offender date of birth", + "format": "date", + "example": "1996-02-10" + }, + "pncNumber": { + "type": "string", + "description": "Police National Computer (PNC) number", + "example": "2018/0123456X" + }, + "croNumber": { + "type": "string", + "description": "Criminal Records Office (CRO) number", + "example": "SF80/655108T" + }, + "nomsNumber": { + "type": "string", + "description": "The Offender NOMIS Id (aka prison number/offender no in DPS)", + "example": "G5555TT" + }, + "activeSentence": { + "type": "boolean", + "description": "Filter so only offenders on a current sentence managed by probation will be returned", + "example": true + } + } + }, + "OffenderMatch": { + "required": [ + "offender" + ], + "type": "object", + "properties": { + "offender": { + "$ref": "#/components/schemas/OffenderDetail" + } + }, + "description": "List of offenders that share the same possibility of being the match" + }, + "OffenderMatches": { + "required": [ + "matchedBy", + "matches" + ], + "type": "object", + "properties": { + "matches": { + "type": "array", + "description": "List of offenders that share the same possibility of being the match", + "items": { + "$ref": "#/components/schemas/OffenderMatch" + } + }, + "matchedBy": { + "type": "string", + "description": "How the match was performed", + "enum": [ + "ALL_SUPPLIED", + "ALL_SUPPLIED_ALIAS", + "HMPPS_KEY", + "EXTERNAL_KEY", + "NAME", + "PARTIAL_NAME", + "PARTIAL_NAME_DOB_LENIENT", + "NOTHING" + ] + } + } + } + }, + "securitySchemes": { + "hmpps-auth-token": { + "type": "http", + "name": "Authorization", + "in": "header", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + } +} From 8ef9c01e67a959003267982abe664f424525fcab Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Fri, 2 Aug 2024 17:19:52 +0100 Subject: [PATCH 10/11] PI-2375 - update health check on container --- Dockerfile.setup-probation-offender-search | 1 - docker-compose.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.setup-probation-offender-search b/Dockerfile.setup-probation-offender-search index 5c07961dd..58d57c251 100644 --- a/Dockerfile.setup-probation-offender-search +++ b/Dockerfile.setup-probation-offender-search @@ -2,7 +2,6 @@ FROM node:current-alpine3.17 RUN apk update && apk add bash curl --no-cache - COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/probation-offender-search.json /probation-offender-search.json RUN npm install -g @stoplight/prism-cli diff --git a/docker-compose.yml b/docker-compose.yml index c001f50f7..a11d697f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,7 +72,7 @@ services: dockerfile: Dockerfile.setup-probation-offender-search container_name: probation-offender-search healthcheck: - test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/search?crn=sit&croNumber=odio&dateOfBirth=1941-09-13&firstName=velit&includeAliases=true&nomsNumber=omnis&pncNumber=aspernatur&surname=est -O /dev/null' + test: 'wget --header="Authorization: Bearer abc" http://0.0.0.0:4010/search?crn=sit -O /dev/null' ports: - '4020:4010' From 66108cb1c912ad06ed3b1178757ed3cfb0e42ab5 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Mon, 5 Aug 2024 10:01:12 +0100 Subject: [PATCH 11/11] PI-2377: Remove telemetry --- .../telemetry/ClientTrackingInterceptor.kt | 36 ------------------- .../ClientTrackingInterceptorTest.kt | 21 ----------- 2 files changed, 57 deletions(-) delete mode 100644 src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt delete mode 100644 src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt deleted file mode 100644 index d835a9e11..000000000 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptor.kt +++ /dev/null @@ -1,36 +0,0 @@ -package uk.gov.justice.digital.hmpps.hmppsintegrationapi.config.telemetry - -import io.opentelemetry.api.trace.Span -import jakarta.servlet.http.HttpServletRequest -import jakarta.servlet.http.HttpServletResponse -import org.springframework.context.annotation.Configuration -import org.springframework.stereotype.Component -import org.springframework.web.servlet.HandlerInterceptor -import org.springframework.web.servlet.config.annotation.InterceptorRegistry -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer - -@Configuration -class ClientTrackingConfiguration(private val clientTrackingInterceptor: ClientTrackingInterceptor) : WebMvcConfigurer { - override fun addInterceptors(registry: InterceptorRegistry) { - registry.addInterceptor(clientTrackingInterceptor).addPathPatterns("/**") - } -} - -@Component -class ClientTrackingInterceptor : HandlerInterceptor { - override fun preHandle( - request: HttpServletRequest, - response: HttpServletResponse, - handler: Any, - ): Boolean { - val subjectDistinguishedName = request.getAttribute("clientName") as String? - subjectDistinguishedName?.let { - try { - Span.current().setAttribute("clientId", it) - } catch (ignored: Exception) { - // Do nothing - don't create client id span - } - } - return true - } -} diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt deleted file mode 100644 index b8c9e12db..000000000 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/telemetry/ClientTrackingInterceptorTest.kt +++ /dev/null @@ -1,21 +0,0 @@ -package uk.gov.justice.digital.hmpps.hmppsintegrationapi.config.telemetry - -import jakarta.servlet.http.HttpServletRequest -import jakarta.servlet.http.HttpServletResponse -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test -import org.mockito.Mockito.mock -import org.mockito.kotlin.whenever - -class ClientTrackingInterceptorTest { - private val request: HttpServletRequest = mock(HttpServletRequest::class.java) - private val response: HttpServletResponse = mock(HttpServletResponse::class.java) - private val interceptor = ClientTrackingInterceptor() - - @Test - fun `handles missing clientName attribute`() { - whenever(request.getAttribute("clientName")).thenReturn(null) - val result = interceptor.preHandle(request, response, "") - assertTrue(result) - } -}