Tuesday, 16 May 2017

Visualising the Complete Patient Pathway

When a patient spends time in hospital, they interact with many different departments and the data related to each of these interactions can be recorded on many different electronic systems. These systems usually share a unique identifier to identify the patient, such as their hospital number or NHS number, but very rarely share spell or appointment identifiers. This can make it problematic when trying to piece together the full patient pathway.


To solve this problem, I import the records from these systems into a single simplified dataset called PatientEvents. The schema for this dataset consists of a patient identifier, an event type identifier, the date/times the event started and finished, and a freeform description field.

Event TypeStart Date/TimeEnd Date/TimeEvent Description
A & E Attendance12 Apr 2017 10:0412 Apr 2017 11:47Service point: Ambulance Triage
Primary Diagnosis: Dislocation/fracture/joint injury/amputation
Radiology Procedure12 Apr 2017 11:0012 Apr 2017 11:06Specialty: ACCIDENT & EMERGENCY
Modality: Radiology
Exam Name: XR Finger Index Rt
Spell Admission12 Apr 2017 11:4712 Apr 2017 11:47Admission Source: Usual place of Residence
Admission Method: Emergency - Local A&E
Episode12 Apr 2017 11:4712 Apr 2017 16:17Clinician transfer to Smith Z, Acute Medicine
Primary Diagnosis: S631: Dislocation of finger
Primary Procedure: W663: Primary manipulative closed
           reduction of fracture dislocation of joint NEC
Ward Stay12 Apr 2017 11:4712 Apr 2017 13:53Ward transfer to ACUTE MED ASSESS UNIT
Clinic Appointment12 Apr 2017 13:1012 Apr 2017 13:20Consultant: Jones, Z
Specialty: Fracture
Clinic: FRACTURE CLINIC
Outcome: Future Appointment
Ward Stay12 Apr 2017 13:5312 Apr 2017 15:33Ward transfer to AE ACUTE RESUS
Drug Administered12 Apr 2017 16:0012 Apr 2017 16:00Item(s): PARACETAMOL 500 mg Tablets
Spell Discharge12 Apr 2017 16:1712 Apr 2017 16:17Discharge Destination: Usual Place of residence

Arranged in date order, the PatientEvents records can be read like a narrative of the patient's journey. When mapped onto a horizontal timeline, a user can intuitively correlate and cluster events.

Presenting data on a timeline allows a user to quickly summarise the pathway and identify connections between events
A lookup table, PatientEventTypes, assigns each event type a colour and group. This means that, for example, surgical procedures, pre-op assessments and post-op electronic forms can be grouped into the same 'Theatres' row of the timeline, with each one using an individual colour to allow them to be easily distinguished.

The Theatres group combines pre-op assessments (brown), surgical procedures (dark orange) and post-op electronic forms (light orange)
Outpatient appointments are given a pale colour to indicate that they have been cancelled or DNAed
The end result, the Patient Pathway Viewer, is a browser-based application which combines the timeline and ordered narrative concepts on a single page. The timeline can be navigated by dragging with the mouse/finger and zoomed in/out using scroll wheel or pinch. Clicking an item in the timeline highlights that event in the narrative view and vice-versa.

Example of the Patient Pathway Viewer

Using the Patient Pathway Viewer, a user can quickly get an overview of a patient's hospital history, identify if they are a regular visitor, and see any future follow-up appointments they have booked in. All within a single window.

The Science Bit

I have designed the Patient Pathway Viewer to be as simple to implement as possible. I've written it using plain HTML/Javascript and it consumes data in a simple CSV format. I've set up a web service to provide this data, but it can be configured to use standard text files. This means that the software and data files can be hosted on any basic web server without the need for server side scripting.

Because the software is intellectual property of Royal Liverpool and Broadgreen University Hospitals Trust, I'm not able to publish the viewer on the web or release the source code, but I've listed the Javascript libraries used below in the hope that it will help you recreate it, should you want to. I'm happy to answer any questions in the comments section.

Library
Description
License
JQuery
Provides much of the cross-browser functionality
MIT
JQuery-CSV
JQuery plugin which handles the conversion of CSV data files
MIT
CHAPS Links Library Timeline
This drives the timeline charts
Apache 2.0
JQuery-Layout
JQuery plugin which fixes layout problems in legacy browsers
MIT
Moment.js
Handles date and time formatting
MIT

No comments:

Post a Comment