Skip to content

Commit

Permalink
PI-1685: Add workflows to Approved Premises and Delius docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mxco86 committed Nov 24, 2023
1 parent 237439a commit 174ce7f
Show file tree
Hide file tree
Showing 11 changed files with 3,770 additions and 114 deletions.
64 changes: 52 additions & 12 deletions projects/approved-premises-and-delius/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 174ce7f

Please sign in to comment.