diff --git a/projects/approved-premises-and-delius/README.md b/projects/approved-premises-and-delius/README.md index 817d994ee3..4f89221cd5 100644 --- a/projects/approved-premises-and-delius/README.md +++ b/projects/approved-premises-and-delius/README.md @@ -13,10 +13,61 @@ to make an Approved Premises application and ensuring the Probation Practitioner has an up-to-date view of activity in the Approved Premises service when interacting with the probation case via Delius. -## Context Map +## Data Dependencies + +_Approved Premises (CAS1)_ depends on _Delius_ data for background on the relevant **Person on Probation** and the specific **Probation Case** when making an approved premises referral. There is also a dependency on **Probation Practitioner** information and **Probation Documents** used in the referral process. + +### Context Map ![Context Map](./tech-docs/source/img/approved-premises-and-delius-context-map.svg) +## Workflows + +Approved Premises domain events are raised in real time as approved premises +referrals are processed. The progressive stages of a referral are raised as +separate events. + +### Approved Premises Referral Application Workflows + +_Approved Premises (CAS1)_ referral activity is reflected in _Delius_ via simple notification contacts, intended to log updates to the case and inform probation practitioners of changes. + +| Business Event | HMPPS Domain Event Type | +|-------------------------------------------------------|-----------------------------------------| +| A referral to an approved premises has been assessed | approved-premises.application.assessed | +| A referral to an approved premises has been submitted | approved-premises.application.submitted | +| A referral to an approved premises has been withdrawn | approved-premises.application.withdrawn | + +![Workflow Map](./tech-docs/source/img/approved-premises-and-delius-workflow-application.svg) + + +### Approved Premises Booking Workflows + +_Approved Premises (CAS1)_ bookings are reflected in _Delius_ via the entries in the `APPROVED_PREMISES` database table, which appear in the _Delius_ UI as the **Approved Premises Diary** and **Approved Premises Referrals** screens. The information held in Delius is kept up-to-date with the activity in the _Approved Premises CAS1_ service via processing of specific domain events. The information is duplicated in _Delius_ for the purposes of maintaining MIS reports that depend on certain aspects of the data related to arrival and departure dates. + +#### Booking Made Workflow + +| Business Event | HMPPS Domain Event Type | +|-------------------------------------------------|-------------------------------------| +| An approved premises booking has been completed | approved-premises.booking.made | + +![Workflow Map](./tech-docs/source/img/approved-premises-and-delius-workflow-booking-made.svg) + +#### Booking Changed Workflow + +| Business Event | HMPPS Domain Event Type | +|-------------------------------------------------|-------------------------------------| +| An approved premises booking has been changed | approved-premises.booking.changed | + +![Workflow Map](./tech-docs/source/img/approved-premises-and-delius-workflow-booking-changed.svg) + +#### Booking Cancelled Workflow + +| Business Event | HMPPS Domain Event Type | +|-------------------------------------------------|-------------------------------------| +| An approved premises booking has been cancelled | approved-premises.booking.cancelled | + +![Workflow Map](./tech-docs/source/img/approved-premises-and-delius-workflow-booking-cancelled.svg) + ## Interfaces ### Message Formats @@ -30,17 +81,6 @@ Example [messages](./src/dev/resources/messages/) are in the development source Incoming messages are filtered on `eventType` by the [SQS queue policy](https://github.com/ministryofjustice/cloud-platform-environments/blob/cc44e15d883b04d1caf5663eec6025674dc10eb5/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-prod/resources/approved-premises-and-delius-queue.tf#L5-L14) -## Event Triggers - -Approved Premises domain events are raised in real time as approved premises -referrals are processed. The progressive stages of a referral are raised as -separate events - -| Business Event | Message Class | Message Event Type / Filter | -|-------------------------------------------------------|--------------------|-------------------------------------------| -| A referral to an approved premises has been assessed | HMPPS Domain Event | "approved-premises.application.assessed" | -| A referral to an approved premises has been submitted | HMPPS Domain Event | "approved-premises.application.submitted" | - ## Authorisation API endpoints are secured by roles supplied by the HMPPS Auth client used in diff --git a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-context-map.d2 b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-context-map.d2 index 7a63e5cbeb..0d1a2e5d31 100644 --- a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-context-map.d2 +++ b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-context-map.d2 @@ -27,6 +27,7 @@ context-delius: Delius Context { lao: Limited Access\ Offender contact: Contact referral: Approved Premises\n Referral + documents: Probation Documents } interface: Approved Premises and Delius { type: Anti-Corruption Layer diff --git a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-application.d2 b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-application.d2 new file mode 100644 index 0000000000..7be4895c0d --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-application.d2 @@ -0,0 +1,64 @@ +# Approved Premises Workflow: Referral Application + +direction: right + +style { + fill: "#ffffff" +} + +# What triggers the workflow? +approved_premises: Approved Premises (CAS1) { + style.font-size: 24 + + explanation: |md + ## Referral Application Workflow + Referral application actions raise domain events + | + + application_submitted: Application Submitted + application_assessed: Application Assessed + application_withdrawn: Application Withdrawn + + application_submitted -> application_assessed + application_submitted -> application_withdrawn + application_assessed -> application_withdrawn +} + +domain_event_1: "approved-premises\n.application.submitted" { + style.font-size: 12 + shape: queue +} +domain_event_2: "approved-premises\n.application.assessed" { + style.font-size: 12 + shape: queue +} +domain_event_3: "approved-premises\n.application.withdrawn" { + style.font-size: 12 + shape: queue +} + +# What happens in Delius? +delius: Delius { + style.font-size: 24 + + explanation: |md + ## Delius Workflow + Contacts of a specific type are added to Delius\ + for each referral application action + | + + d_contact: Create Contact +} + +approved_premises -> domain_event_1 +approved_premises -> domain_event_2 +approved_premises -> domain_event_3 + +domain_event_1 -> delius +domain_event_2 -> delius +domain_event_3 -> delius + +*.style.border-radius: 10 +*.*.style.border-radius: 10 +*.*.style.stroke-width: 2 +*.*.style.font-size: 12 diff --git a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-cancelled.d2 b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-cancelled.d2 new file mode 100644 index 0000000000..86b30e3a2e --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-cancelled.d2 @@ -0,0 +1,46 @@ +# Approved Premises Workflow: Booking Cancelled + +direction: right + +style { + fill: "#ffffff" +} + +# What triggers the workflow? +approved_premises: Approved Premises (CAS1) { + style.font-size: 24 + + explanation: |md + ## Booking Workflow + Cancel an Approved Premises booking + | + + booking_cancelled: Cancel Booking +} + +domain_event: "approved-premises\n.booking.cancelled" { + style.font-size: 12 + shape: queue +} + +# What happens in Delius? +delius: Delius { + style.font-size: 24 + + explanation: |md + ## AP Referral Workflow + Update Delius AP referral to be soft deleted + | + + d_referral: Delete Delius\nAP Referral + d_contact: Create Contact + + d_referral -> d_contact +} + +approved_premises -> domain_event -> delius + +*.style.border-radius: 10 +*.*.style.border-radius: 10 +*.*.style.stroke-width: 2 +*.*.style.font-size: 12 diff --git a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-changed.d2 b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-changed.d2 new file mode 100644 index 0000000000..6903365efa --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-changed.d2 @@ -0,0 +1,43 @@ +# Approved Premises Workflow: Booking Changed + +direction: right + +style { + fill: "#ffffff" +} + +# What triggers the workflow? +approved_premises: Approved Premises (CAS1) { + style.font-size: 24 + + explanation: |md + ## Booking Workflow + Update an Approved Premises Booking + | + + booking_changed: Update Booking +} + +domain_event: "approved-premises\n.booking.changed" { + style.font-size: 12 + shape: queue +} + +# What happens in Delius? +delius: Delius { + style.font-size: 24 + + explanation: |md + ## AP Referral Workflow + Update Delius AP referral to match + | + + d_referral: Update Delius\nAP Referral +} + +approved_premises -> domain_event -> delius + +*.style.border-radius: 10 +*.*.style.border-radius: 10 +*.*.style.stroke-width: 2 +*.*.style.font-size: 12 diff --git a/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-made.d2 b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-made.d2 new file mode 100644 index 0000000000..0c11579bab --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/diag/approved-premises-and-delius-workflow-booking-made.d2 @@ -0,0 +1,46 @@ +# Approved Premises Workflow: Booking Made + +direction: right + +style { + fill: "#ffffff" +} + +# What triggers the workflow? +approved_premises: Approved Premises (CAS1) { + style.font-size: 24 + + explanation: |md + ## Booking Workflow + Complete an Approved Premises Booking + | + + booking_made: Complete Booking +} + +domain_event: "approved-premises\n.booking.made" { + style.font-size: 12 + shape: queue +} + +# What happens in Delius? +delius: Delius { + style.font-size: 24 + + explanation: |md + ## AP Referral Workflow + Initiate Delius AP referral + | + + d_referral: Create Delius\nAP Referral + d_contact: Create Contact + + d_referral -> d_contact +} + +approved_premises -> domain_event -> delius + +*.style.border-radius: 10 +*.*.style.border-radius: 10 +*.*.style.stroke-width: 2 +*.*.style.font-size: 12 diff --git a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-context-map.svg b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-context-map.svg index bd36f31343..52633d16e9 100644 --- a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-context-map.svg +++ b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-context-map.svg @@ -1,26 +1,26 @@ -Approved Premises ContextDelius ContextEntitiesEntitiesApproved Premises and DeliusApproved Premises ReferralApproved Premises ApplicationApproved Premises BookingPerson on ProbationPerson IdentifiersStaffTeamOffender ManagerLimited Access OffenderContactApproved Premises ReferralAnti-Corruption LayerUpstream Downstream + .d2-1581730613 .fill-N1{fill:#0A0F25;} + .d2-1581730613 .fill-N2{fill:#676C7E;} + .d2-1581730613 .fill-N3{fill:#9499AB;} + .d2-1581730613 .fill-N4{fill:#CFD2DD;} + .d2-1581730613 .fill-N5{fill:#DEE1EB;} + .d2-1581730613 .fill-N6{fill:#EEF1F8;} + .d2-1581730613 .fill-N7{fill:#FFFFFF;} + .d2-1581730613 .fill-B1{fill:#010E31;} + .d2-1581730613 .fill-B2{fill:#173688;} + .d2-1581730613 .fill-B3{fill:#5679D4;} + .d2-1581730613 .fill-B4{fill:#84A1EC;} + .d2-1581730613 .fill-B5{fill:#C8D6F9;} + .d2-1581730613 .fill-B6{fill:#E5EDFF;} + .d2-1581730613 .fill-AA2{fill:#048E63;} + .d2-1581730613 .fill-AA4{fill:#A6E2D0;} + .d2-1581730613 .fill-AA5{fill:#CAF2E6;} + .d2-1581730613 .fill-AB4{fill:#FFDA90;} + .d2-1581730613 .fill-AB5{fill:#FFF0D1;} + .d2-1581730613 .stroke-N1{stroke:#0A0F25;} + .d2-1581730613 .stroke-N2{stroke:#676C7E;} + .d2-1581730613 .stroke-N3{stroke:#9499AB;} + .d2-1581730613 .stroke-N4{stroke:#CFD2DD;} + .d2-1581730613 .stroke-N5{stroke:#DEE1EB;} + .d2-1581730613 .stroke-N6{stroke:#EEF1F8;} + .d2-1581730613 .stroke-N7{stroke:#FFFFFF;} + .d2-1581730613 .stroke-B1{stroke:#010E31;} + .d2-1581730613 .stroke-B2{stroke:#173688;} + .d2-1581730613 .stroke-B3{stroke:#5679D4;} + .d2-1581730613 .stroke-B4{stroke:#84A1EC;} + .d2-1581730613 .stroke-B5{stroke:#C8D6F9;} + .d2-1581730613 .stroke-B6{stroke:#E5EDFF;} + .d2-1581730613 .stroke-AA2{stroke:#048E63;} + .d2-1581730613 .stroke-AA4{stroke:#A6E2D0;} + .d2-1581730613 .stroke-AA5{stroke:#CAF2E6;} + .d2-1581730613 .stroke-AB4{stroke:#FFDA90;} + .d2-1581730613 .stroke-AB5{stroke:#FFF0D1;} + .d2-1581730613 .background-color-N1{background-color:#0A0F25;} + .d2-1581730613 .background-color-N2{background-color:#676C7E;} + .d2-1581730613 .background-color-N3{background-color:#9499AB;} + .d2-1581730613 .background-color-N4{background-color:#CFD2DD;} + .d2-1581730613 .background-color-N5{background-color:#DEE1EB;} + .d2-1581730613 .background-color-N6{background-color:#EEF1F8;} + .d2-1581730613 .background-color-N7{background-color:#FFFFFF;} + .d2-1581730613 .background-color-B1{background-color:#010E31;} + .d2-1581730613 .background-color-B2{background-color:#173688;} + .d2-1581730613 .background-color-B3{background-color:#5679D4;} + .d2-1581730613 .background-color-B4{background-color:#84A1EC;} + .d2-1581730613 .background-color-B5{background-color:#C8D6F9;} + .d2-1581730613 .background-color-B6{background-color:#E5EDFF;} + .d2-1581730613 .background-color-AA2{background-color:#048E63;} + .d2-1581730613 .background-color-AA4{background-color:#A6E2D0;} + .d2-1581730613 .background-color-AA5{background-color:#CAF2E6;} + .d2-1581730613 .background-color-AB4{background-color:#FFDA90;} + .d2-1581730613 .background-color-AB5{background-color:#FFF0D1;} + .d2-1581730613 .color-N1{color:#0A0F25;} + .d2-1581730613 .color-N2{color:#676C7E;} + .d2-1581730613 .color-N3{color:#9499AB;} + .d2-1581730613 .color-N4{color:#CFD2DD;} + .d2-1581730613 .color-N5{color:#DEE1EB;} + .d2-1581730613 .color-N6{color:#EEF1F8;} + .d2-1581730613 .color-N7{color:#FFFFFF;} + .d2-1581730613 .color-B1{color:#010E31;} + .d2-1581730613 .color-B2{color:#173688;} + .d2-1581730613 .color-B3{color:#5679D4;} + .d2-1581730613 .color-B4{color:#84A1EC;} + .d2-1581730613 .color-B5{color:#C8D6F9;} + .d2-1581730613 .color-B6{color:#E5EDFF;} + .d2-1581730613 .color-AA2{color:#048E63;} + .d2-1581730613 .color-AA4{color:#A6E2D0;} + .d2-1581730613 .color-AA5{color:#CAF2E6;} + .d2-1581730613 .color-AB4{color:#FFDA90;} + .d2-1581730613 .color-AB5{color:#FFF0D1;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#010E31;--color-border-muted:#173688;--color-neutral-muted:#EEF1F8;--color-accent-fg:#173688;--color-accent-emphasis:#173688;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-B4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>Approved Premises ContextDelius ContextEntitiesEntitiesApproved Premises and DeliusApproved Premises ReferralApproved Premises ApplicationApproved Premises BookingPerson on ProbationPerson IdentifiersStaffTeamOffender ManagerLimited Access OffenderContactApproved Premises ReferralProbation DocumentsAnti-Corruption LayerUpstream Downstream @@ -118,24 +118,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-application.svg b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-application.svg new file mode 100644 index 0000000000..f63df7c9eb --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-application.svg @@ -0,0 +1,857 @@ +Approved Premises (CAS1)approved-premises.application.submittedapproved-premises.application.assessedapproved-premises.application.withdrawnDelius

Referral Application Workflow

+

Referral application actions raise domain events

+
Application SubmittedApplication AssessedApplication Withdrawn

Delius Workflow

+

Contacts of a specific type are added to Delius
+for each referral application action

+
Create Contact + + + + + + + + + + + + +
diff --git a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-cancelled.svg b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-cancelled.svg new file mode 100644 index 0000000000..616935f3b7 --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-cancelled.svg @@ -0,0 +1,853 @@ +Approved Premises (CAS1)approved-premises.booking.cancelledDelius

Booking Workflow

+

Cancel an Approved Premises booking

+
Cancel Booking

AP Referral Workflow

+

Update Delius AP referral to be soft deleted

+
Delete DeliusAP ReferralCreate Contact + + + + + + + + + +
diff --git a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-changed.svg b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-changed.svg new file mode 100644 index 0000000000..1ea76e1dd6 --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-changed.svg @@ -0,0 +1,852 @@ +Approved Premises (CAS1)approved-premises.booking.changedDelius

Booking Workflow

+

Update an Approved Premises Booking

+
Update Booking

AP Referral Workflow

+

Update Delius AP referral to match

+
Update DeliusAP Referral + + + + + + + + +
diff --git a/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-made.svg b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-made.svg new file mode 100644 index 0000000000..4b023d9dea --- /dev/null +++ b/projects/approved-premises-and-delius/tech-docs/source/img/approved-premises-and-delius-workflow-booking-made.svg @@ -0,0 +1,853 @@ +Approved Premises (CAS1)approved-premises.booking.madeDelius

Booking Workflow

+

Complete an Approved Premises Booking

+
Complete Booking

AP Referral Workflow

+

Initiate Delius AP referral

+
Create DeliusAP ReferralCreate Contact + + + + + + + + + +