You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this notebook I will explain where the code looks for data and saves models and media by default, and suggest how to set up your environment. There are two README files that may be useful:
6
6
7
-
*[Repository README](https://github.com/UCL-CORU/patientflow#) in the root of the repository
8
-
*[Notebooks README](README.md) in this folder
7
+
-[Repository README](https://github.com/UCL-CORU/patientflow#) in the root of the repository
8
+
-[Notebooks README](README.md) in this folder
9
9
10
10
## Set notebook to reload functions every time a cell is fun
11
11
12
12
This is useful if you make any changes to any underlying code
13
13
14
-
15
14
```python
16
15
# Reload functions every time
17
-
%load_ext autoreload
16
+
%load_ext autoreload
18
17
%autoreload 2
19
18
```
20
19
21
20
## Check that the patientflow package has been installed
22
21
23
-
24
22
```python
25
23
try:
26
24
import patientflow
@@ -34,11 +32,9 @@ except Exception as e:
34
32
35
33
✓ patientflow 0.1.0 imported successfully
36
34
35
+
## Set project_root variable
37
36
38
-
## Set project_root variable
39
-
40
-
The variable called project_root tells the notebooks where the patientflow repository resides on your computer. All paths in the notebooks are set relative to project_root. There are various ways to set it, which are described in the notebooks [README](README.md).
41
-
37
+
The variable called project_root tells the notebooks where the patientflow repository resides on your computer. All paths in the notebooks are set relative to project_root. There are various ways to set it, which are described in the notebooks [README](README.md).
Now that you have set the project root, you can specify where the data will be loaded from, where images and models are saved, and where to load the config file from. By default, a function called `set_file_paths()` sets these as shown here.
54
-
48
+
Now that you have set the project root, you can specify where the data will be loaded from, where images and models are saved, and where to load the config file from. By default, a function called `set_file_paths()` sets these as shown here.
This repository offers predictive modelling to support the management of patient flow in hospitals.
3
+
This repository offers predictive modelling to support the management of patient flow in hospitals.
4
4
5
5
## What is patient flow?
6
6
7
-
Hospitals refer to the streams of patients arriving and leaving as ‘patient flow’. Unplanned admissions create the ‘emergency’ flow, and the hospital must accommodate that flow alongside a flow of ‘elective’ or planned admissions. Sometimes outflows are reduced because patients are waiting for care to become available in another setting.
7
+
Hospitals refer to the streams of patients arriving and leaving as ‘patient flow’. Unplanned admissions create the ‘emergency’ flow, and the hospital must accommodate that flow alongside a flow of ‘elective’ or planned admissions. Sometimes outflows are reduced because patients are waiting for care to become available in another setting.
8
8
9
-
There are various ways people are admitted to a hospital specialty:
9
+
There are various ways people are admitted to a hospital specialty:
10
10
11
11
- via the Accident & Emergency Department, which is referred to by hospitals as the ED (Emergency Department). Some patients are admitted after visiting Same Day Emergency Care (SDEC). Here, we refer to the combined flows from ED and SDEC as coming via the ED
12
-
- as planned (or elective) admissions
12
+
- as planned (or elective) admissions
13
13
- as an emergency admission via another route, like a transfer from another hospital
14
14
- as an internal transfer from another specialty in the same hospital
15
15
16
-
And various ways people leave a hospital specialty:
16
+
And various ways people leave a hospital specialty:
17
17
18
18
- as a discharge from hospital, to home or another care setting
19
19
- as an internal transfer to another specialty within the same hospital
20
20
- as a death
21
21
22
22
If patient flow works well, each patient will receive timely and appropriate care from the right specialty team, without undue delays. An example of poor patient flow is when incoming patients experience delays to admission because inpatients are not being discharged.
23
23
24
-
Due to imbalances in admissions and discharges, pressures can build up in certain parts of the hospital, while other parts remain relatively less pressured. When one specialty is under pressure, new patients may be housed in the wrong ward - ie a ward that is not dedicated to the specialty they are under. In this case they are referred to as 'outliers'. Outlying is not ideal; evidence indicates it can lead to worse clinical outcomes and longer stays in hospitals.
24
+
Due to imbalances in admissions and discharges, pressures can build up in certain parts of the hospital, while other parts remain relatively less pressured. When one specialty is under pressure, new patients may be housed in the wrong ward - ie a ward that is not dedicated to the specialty they are under. In this case they are referred to as 'outliers'. Outlying is not ideal; evidence indicates it can lead to worse clinical outcomes and longer stays in hospitals.
25
25
26
-
Hospitals strive to keep patient flow going, across all specialties, so far as they are able to.
26
+
Hospitals strive to keep patient flow going, across all specialties, so far as they are able to.
27
27
28
28
## Who is responsible for managing patient flow?
29
29
30
30
All hospital staff share responsibility for patient flow, but a team of bed managers takes primary responsibility for managing it. Bed managers are usually senior nurses with a good understanding of each patient's likely care needs. Their work involves responding to rapidly changing situations caused by delays in patient care, infection outbreaks, excess demand for beds, and other incidents.
31
31
32
32
To keep track of the changing situation, bed managers convene "flow huddles" three times a day. In these huddles, staff from the emergency department and from each ward meet with bed managers to discuss patients coming in (as either emergency or planned admissions), and review which inpatients are likely to be discharged. The flow huddles provide a picture of likely areas of pressure on beds.
33
33
34
-
If bed pressures are anticipated, bed managers can take action by trying to accelerate discharges, or opening up temporary beds and finding staff to cover them, or temporarily divert ambulances to another hospital. These decisions have consequences for patients, staff and other hospitals.
34
+
If bed pressures are anticipated, bed managers can take action by trying to accelerate discharges, or opening up temporary beds and finding staff to cover them, or temporarily divert ambulances to another hospital. These decisions have consequences for patients, staff and other hospitals.
35
35
36
-
## What information do bed managers use to manage patient flow?
36
+
## What information do bed managers use to manage patient flow?
37
37
38
-
Bed managers' decisions depend on having a clear picture of current capacity and imminent pressures. They like to know how many beds will be needed for new patients by the end of the day or shift, and how many will become available during that time. To predict how many beds will be needed today, they assume the number will be the same as yesterday. To work out how many patients will leave, they apply a simple rule based on patients' expected dates of discharge.
38
+
Bed managers' decisions depend on having a clear picture of current capacity and imminent pressures. They like to know how many beds will be needed for new patients by the end of the day or shift, and how many will become available during that time. To predict how many beds will be needed today, they assume the number will be the same as yesterday. To work out how many patients will leave, they apply a simple rule based on patients' expected dates of discharge.
39
39
40
-
These are simple rules of thumb, that are based on static information. Many hospitals have Electronic Health Records (EHRs), into which data are being entered all the time. That up-to-date information could provide a better view; bed managers' understanding of the current situation, and their projection of how it will develop, could be refreshed as new information comes into the EHR.
40
+
These are simple rules of thumb, that are based on static information. Many hospitals have Electronic Health Records (EHRs), into which data are being entered all the time. That up-to-date information could provide a better view; bed managers' understanding of the current situation, and their projection of how it will develop, could be refreshed as new information comes into the EHR.
41
41
42
-
## What modelling is useful to bed managers?
42
+
## What modelling is useful to bed managers?
43
43
44
-
I'm [Zella King](https://github.com/zmek/), a health data scientist in the Clinical Operational Research Unit (CORU) at University College London. I started working with University College London Hospital (UCLH) in 2020 because the hospital wanted to make better use of the data streaming into its EHR. My colleague Prof Sonya Crowe led a small project to create a prototype of a predictive model of emergency demand that used real-time data. Through that project, and over the subsequent years, we have come to understand the needs of bed managers from predictive modelling.
44
+
I'm [Zella King](https://github.com/zmek/), a health data scientist in the Clinical Operational Research Unit (CORU) at University College London. I started working with University College London Hospital (UCLH) in 2020 because the hospital wanted to make better use of the data streaming into its EHR. My colleague Prof Sonya Crowe led a small project to create a prototype of a predictive model of emergency demand that used real-time data. Through that project, and over the subsequent years, we have come to understand the needs of bed managers from predictive modelling.
45
45
46
-
*What bed managers want from predictive models*
46
+
_What bed managers want from predictive models_
47
47
48
48
-**Predictions issued at the times of day they need them:**
49
-
Our users have a routine where they prepare a situation report of hospital capacity five times each day, and have flow huddles three times a day. They wanted predictions of bed demand to be available to them in the preparation of the reports, and at the flow huddles.
49
+
Our users have a routine where they prepare a situation report of hospital capacity five times each day, and have flow huddles three times a day. They wanted predictions of bed demand to be available to them in the preparation of the reports, and at the flow huddles.
50
50
51
51
-**Predictions over a rolling window:**
52
-
The current heuristics used widely across the NHS rely on daily averages, which means that a patient flow meeting will focus on projections up to midnight that day. A rolling prediction of 8 to 12 hours is more useful, because it enables conversation about what needs to be done during the current day or night shift, in order to head off pressures later.
52
+
The current heuristics used widely across the NHS rely on daily averages, which means that a patient flow meeting will focus on projections up to midnight that day. A rolling prediction of 8 to 12 hours is more useful, because it enables conversation about what needs to be done during the current day or night shift, in order to head off pressures later.
53
53
54
54
-**Output at aggregate level rather than individual:**
55
55
It is common for researchers using statistics or Machine Learning to produce models that predict each patient's probability of admission. However, this is not useful for bed managers because, when managing capacity, they are mainly interested in overall numbers of beds needed, rather than whether any particular patient will be admitted.
@@ -58,20 +58,13 @@ I'm [Zella King](https://github.com/zmek/), a health data scientist in the Clini
58
58
Predictive models can be trained on historical patterns of admissions and discharges. However, if they can make use of real-time data from the EHR, bed managers will have a better sense of today's demand, rather than that of a typical day.
59
59
60
60
-**A breakdown of demand by specialty:**
61
-
Knowing that the whole hospital is going to be short of beds is somewhat useful and does give a sense of the scale of the problem. More precise information - about which specialties are most affected - makes it easier to pinpoint where action is needed.
61
+
Knowing that the whole hospital is going to be short of beds is somewhat useful and does give a sense of the scale of the problem. More precise information - about which specialties are most affected - makes it easier to pinpoint where action is needed.
62
62
63
63
-**Some sense of the uncertainty of predictions:**
64
-
Simple heuristics give bed managers a single number to work with. For example, if 50 patients were admitted yesterday, they might plan for 50 today. This doesn't show how likely the number 50 is; could it be 46 or 54? A good model will give a sense of uncertainty around the suggested number of beds. Ironically, knowing the spread of the uncertainty gives a more certain picture.
65
-
66
-
## What are the elements of patient flow?
67
-
68
-
Above, I said that bed managers want a breakdown of demand by specialty. Let's break down the sources of that demand.
69
-
70
-
71
-
I intend that this repository will show how to model all of these flows eventually.
72
-
73
-
74
-
64
+
Simple heuristics give bed managers a single number to work with. For example, if 50 patients were admitted yesterday, they might plan for 50 today. This doesn't show how likely the number 50 is; could it be 46 or 54? A good model will give a sense of uncertainty around the suggested number of beds. Ironically, knowing the spread of the uncertainty gives a more certain picture.
75
65
66
+
## What are the elements of patient flow?
76
67
68
+
Above, I said that bed managers want a breakdown of demand by specialty. Let's break down the sources of that demand.
77
69
70
+
I intend that this repository will show how to model all of these flows eventually.
0 commit comments