Skip to main content

Refer and Monitor and Delius

Service that supports creating and managing the referral of a person on probation to a CRS intervention, by providing Delius information and listening to domain events to create Contacts and NSIs in Delius.

Business Need

Refer and Monitor an Intervention has a tightly coupled relationship with Delius due to activity managed in both systems being important for workflows in the other. Refer and Monitor an Intervention depends on information managed in Delius for it’s primary function of creating and managing CRS referrals. There is also a requirement to write information back to Delius when various activities are recorded in Refer and Monitor an Intervention. Where possible the interaction between the two services is managed asynchronously via domain events but there are workflows in Refer and Monitor an Intervention that have runtime dependency on successful creation of entities in Delius. In these cases the cross-service interaction is via synchronous API calls.

Data Dependencies

Refer and Monitor an Intervention depends on Delius data for background on the relevant Person on Probation and the specific Probation Case when making CRS referral. There is also a dependency on Probation Practitioner information and Probation Estate information when making CRS session appointments

Context Map

Context Map

Workflows

CRS Referral Workflows

CRS referrals are tracked in Delius using an NSI. The request to create the Delius NSI is made as part of the referral creation process in Refer and Monitor an Intervention, and the NSI is linked to the referral by adding the Refer and Monitor an Intervention REFERRAL.ID to the NSI.EXTERNAL_REFERENCE field of the Delius database. The status of the NSI is updated as the CRS referral is progressed in Refer and Monitor an Intervention.

Context Map - Referrals

Context Map

Workflow: Create CRS Referral

Creation of the CRS referral is a synchronous integration between Refer and Monitor an Intervention and Delius. A CRS referral is created in Refer and Monitor an Intervention, which makes an API call to ‘Refer and Monitor and Delius’ to create the referral NSI in Delius. If the process fails to create the Delius NSI the creation of the CRS referral in Refer and Monitor an Intervention is aborted.

Business Event API Endpoint
Create a CRS referral PUT /probation-case/{crn}/referrals

Workflow Map

Workflow: End CRS Referral

Ending a CRS referral in Refer and Monitor an Intervention triggers activity in Delius to update the linked NSI and add contacts. The information added to the probation case in Delius inform the probation practitioner that the referral has been ended in Refer and Monitor an Intervention.

Business Event HMPPS Domain Event Type
End a CRS referral intervention.referral.ended

Workflow Map

Workflow: Action Plan Interactions

An action plan must be submitted by the CRS supplier in Refer and Monitor an Intervention for approval by the probation practitioner managing the case. On both submission and approval in Refer and Monitor an Intervention a domain event is raised and a Delius contact is added to communicate the action plan status to probation practitioners.

Business Event HMPPS Domain Event Type
Submit a CRS referral action plan intervention.action-plan.submitted
Approve a CRS referral action plan intervention.action-plan.approved

Workflow Map

CRS Appointment Workflows

Creating CRS session appointments is a core function of Refer and Monitor an Intervention, however, the primary service for managing probation appointments is Delius. Appointments are therefore created in both systems and the Delius appointment contact is linked to the Refer and Monitor an Intervention session by adding the APPOINTMENT.ID to the CONTACT.EXTERNAL_REFERENCE table of the Delius database. The status of the CRS appointments is updated in Delius as the appointment sessions are delivered and recorded in Refer and Monitor an Intervention.

Context Map - Appointments

Context Map

Workflow: Create CRS Appointment

Creating session appointments in Refer and Monitor an Intervention involves a synchronous API call to create the corresponding Delius appointment contact, with an appointment type, date, time and location. A successful API call will result in an appointment contact being created in Delius. Booking a session appointment relies on the date and time being available for the person on probation. Failure to create an appointment in Delius is a runtime exception in Refer and Monitor an Intervention and the appointment creation is aborted.

Business Event API Endpoint
Create a initial assessment appointment PUT /probation-case/{crn}/referrals/{referralId}/appointments
Create a delivery session appointment PUT /probation-case/{crn}/referrals/{referralId}/appointments

Workflow: CRS Appointment Reschedule

Rescheduling a CRS appointment in Refer and Monitor an Intervention involves updating the linked appointment in Delius with an outcome and creating a new appointment for the new date and time. This is necessary to ensure source appointment data for downstream processes in Delius are maintained and the case recording is standardised. As this process involves multiple changes to Delius database structures and it is possible for the process to fail if the date and time are not available it is achieved using a single synchronous API call to the same endpoint for appointment creation. The inclusion of the details of the appointment being replaced identifies the API calls as a reschedule rather than an initial creation.

Business Event API Endpoint
Reschedule an appointment PUT /probation-case/{crn}/referrals/{referralId}/appointments

Workflow Map

Workflow: CRS Appointment Outcome and Feedback

Session outcomes and feedback for CRS appointments are recorded in Refer and Monitor an Intervention by the CRS supplier. The session outcomes are recorded against the relevant Delius appointment contact, with the appropriate alerts to probation practitioners when activity should be brought to their attention.

Business Event HMPPS Domain Event Type
Submit initial appointment session outcome and feedback intervention.initial-assessment-appointment.session-feedback-submitted
Submit delivery session outcome and feedback intervention.session-appointment.session-feedback-submitted

Workflow Map

Interfaces

Message Formats

The service responds to various HMPPS Domain Event message via the Refer and Monitor and Delius Queue. The events are raised by the HMPPS Refer and Monitor Service to communicate important events in the CRS referrals process.

Example messages are in the development source tree.

Incoming messages are filtered on eventType by the SQS queue policy

API Access Control

API endpoints are secured by roles supplied by the HMPPS Auth client used in the requests

API Endpoint Required Role
All ROLE_CRS_REFERRAL