Deferred Visits Enhancements
1. Purpose and Audience
Section titled “1. Purpose and Audience”This document provides reporting and data teams with an overview of how the Deferred Visits enhancements in EMIS Web are reflected in the underlying data model and how the associated data can be leveraged for reporting in Explorer Insights.
2. Business Purpose
Section titled “2. Business Purpose”The enhancement addresses deferred patient assignment workflows in Appointments by:
- Making deferral reason capture structured and configurable (rather than free-text only at point of use).
- Ensuring community/non-GP workflows cannot defer without a valid configured reason.
- Improving auditability of both configuration actions and operational slot deferrals.
- Preserving historical integrity when reasons are edited or deleted after use.
3. What Changed Functionally
Section titled “3. What Changed Functionally”3.1 New configurable deferral reasons
Section titled “3.1 New configurable deferral reasons”Appointments Configuration now supports managing Deferral Reasons (add, edit, delete) for eligible organisations.
Key behaviour:
- Deferral reasons are organisation-specific.
- Duplicate active descriptions are prevented.
- Deletion is soft-delete (historical references remain valid).
- If a reason is already used, editing can create a new reason record while retaining historical reason integrity.
3.2 Defer assignment flow changes
Section titled “3.2 Defer assignment flow changes”In the defer assignment workflow (community/non-GP path):
- Reason is mandatory and selected from configured values.
- Deferred date is mandatory and must differ from assignment date.
- Deferral action stores both selected reason text and deferral reason identifier.
3.3 Audit coverage expansion
Section titled “3.3 Audit coverage expansion”Audit now includes:
- Deferral reason configuration activity (add/edit/delete).
- Slot deferred activity when a scheduled slot is deferred.
- Assignment schedule audit output includes deferred target date and reason.
4. Data Model Changes
Section titled “4. Data Model Changes”4.1 New table
Section titled “4.1 New table”Appointment.DeferralReason
Introduced as configuration/reference data for deferral reasons.
- DeferralReasonId (int, Primary key)
- Description (varchar(150))
- OrganisationId (int)
- IsDeleted (bit)
- LastUpdatedDateTime (datetime2)
- DeferralReasonGuid (uniqueidentifier)
4.2 Extended table
Section titled “4.2 Extended table”Appointment.AssignmentListPatientSchedule
New column:
- DeferralReasonId (int, nullable, FK to Appointment.DeferralReason.DeferralReasonId)
Usage:
- Populated when a schedule is deferred through the enhanced deferral flow.
- Null for non-deferred/cancel-only records or legacy rows.
4.3 Audit reference data additions
Section titled “4.3 Audit reference data additions”New audit classification metadata:
Audit.ItemType- 383 = Appointments Configuration
Audit.ActivityContext- 436 = Deferral Reasons Manage
- 437 = Slot Deferred
4.4 Relationship view
Section titled “4.4 Relationship view”erDiagram
Organisation ||--o{ DeferralReason : owns
DeferralReason ||--o{ AssignmentListPatientSchedule : selected_on_deferral
AssignmentList ||--o{ AssignmentListPatientSchedule : contains
AssignmentListPatientSchedule ||--o| AssignmentListPatientSchedule : deferred_to
DeferralReason {
int DeferralReasonId PK
string Description
int OrganisationId FK
bit IsDeleted
datetime2 LastUpdatedDateTime
guid DeferralReasonGuid
}
AssignmentListPatientSchedule {
int AssignmentListPatientScheduleId PK
int AssignmentListId FK
int PatientScheduleId
bit IsCancelled
int DeferralReasonId FK
int AssignmentListPatientScheduleDeferredTo
}
5. UI Field to Data Mapping
Section titled “5. UI Field to Data Mapping”| EMIS Web field/action | Source/entry point | Database representation |
|---|---|---|
| Deferral reason list in configuration | Configuration > Reasons > Deferral Reasons | Appointment.DeferralReason (active rows where IsDeleted = 0) |
| Add reason | Add/Edit Deferral Reason dialog | Insert via Appointment.UpdateDeferralReason |
| Edit reason (unused reason) | Edit dialog | Update Appointment.DeferralReason.Description |
| Edit reason (reason already in use, user confirms) | Edit creates new logical value | Old reason soft-deleted, new row inserted; historical assignment rows remain linked to old DeferralReasonId |
| Delete reason | Configuration delete action | Soft-delete via Appointment.DeleteDeferralReason (IsDeleted = 1) |
| Defer assignment reason dropdown | Defer assignment form | DeferralReasonId written to Appointment.AssignmentListPatientSchedule.DeferralReasonId |
| Defer date | Defer assignment form | Existing deferred chain via AssignmentListPatientScheduleDeferredTo and AssignmentList relationships |
| Slot deferred audit text | Defer action with slot | Audit event with ActivityContextId = 437 |
6. Definitions and Expected Usage
Section titled “6. Definitions and Expected Usage”-
Deferral reason:
- Organisation-defined reference value used to classify why an assignment was deferred.
-
Active deferral reason:
- A row in Appointment.DeferralReason where IsDeleted = 0.
-
Historical reason integrity:
- Used reasons remain referentially valid even if the reason is changed/deleted later.
- Reporting on historical periods should join by stored DeferralReasonId, not current UI list only.
-
Deferred assignment:
- AssignmentListPatientSchedule row marked cancelled and linked to a deferred target assignment instance via existing deferred chain fields.
7. Example Reporting Scenarios and SQL
Section titled “7. Example Reporting Scenarios and SQL”7.1 Deferred assignments by reason and month
Section titled “7.1 Deferred assignments by reason and month”SELECT Format(al.[Date], 'yyyy-MM') AS assignmentmonth, dr.description AS deferralreason, Count(*) AS deferredcountFROM appointment.assignmentlistpatientschedule alpsJOIN appointment.assignmentlist al ON al.assignmentlistid = alps.assignmentlistidLEFT JOIN appointment.deferralreason dr ON dr.deferralreasonid = alps.deferralreasonidWHERE alps.iscancelled = 1 AND alps.assignmentlistpatientscheduledeferredto IS NOT NULLGROUP BY Format(al.[Date], 'yyyy-MM'), dr.descriptionORDER BY assignmentmonth, deferralreason;7.2 Active configured deferral reasons by organisation
Section titled “7.2 Active configured deferral reasons by organisation”SELECT dr.organisationid, dr.deferralreasonid, dr.description, dr.lastupdateddatetimeFROM appointment.deferralreason drWHERE dr.isdeleted = 0ORDER BY dr.organisationid, dr.description;7.3 Deferred chain view with original and deferred-to dates
Section titled “7.3 Deferred chain view with original and deferred-to dates”SELECT alps.assignmentlistpatientscheduleid, al_original.[Date] AS OriginalAssignmentDate, al_target.[Date] AS DeferredToDate, dr.description AS DeferralReason, alps.iscancelledFROM appointment.assignmentlistpatientschedule alpsJOIN appointment.assignmentlist al_original ON al_original.assignmentlistid = alps.assignmentlistidLEFT JOIN appointment.assignmentlistpatientschedule alps_target ON alps_target.assignmentlistpatientscheduleid = alps.assignmentlistpatientscheduledeferredtoLEFT JOIN appointment.assignmentlist al_target ON al_target.assignmentlistid = alps_target.assignmentlistidLEFT JOIN appointment.deferralreason dr ON dr.deferralreasonid = alps.deferralreasonidWHERE alps.assignmentlistpatientscheduledeferredto IS NOT NULL;7.4 Reason lifecycle monitoring (active vs deleted)
Section titled “7.4 Reason lifecycle monitoring (active vs deleted)”select OrganisationId, sum(case when IsDeleted = 0 then 1 else 0 end) as ActiveReasons, sum(case when IsDeleted = 1 then 1 else 0 end) as DeletedReasonsfrom Appointment.DeferralReasongroup by OrganisationId;