|
29 | 29 | [pypi-version]: https://img.shields.io/pypi/v/patientflow --> |
30 | 30 | <!-- prettier-ignore-end --> |
31 | 31 |
|
32 | | -Welcome to the PatientFlow repository, which provides predictive modelling for hospital bed management. I'm [Zella King](https://github.com/zmek/), a health data scientist in the Clinical Operational Research Unit (CORU) at University College London. Since 2020, I have worked with University College London Hospital (UCLH) on practical tools to improve patient flow through the hospital. |
| 32 | +## Summary |
33 | 33 |
|
34 | | -With a team from UCLH, I developed a predictive tool that is now in daily use by bed managers at the hospital. The tool generates predictions of emergency demand for beds, using real-time data from the hospital's patient record system. |
| 34 | +patientflow, a Python package, converts patient-level predictions into output that is useful for bed managers in hospitals. |
35 | 35 |
|
36 | | -I am sharing the code I wrote for UCLH as a reusable resource because I want to make it easier for researchers to convert patient-level predictions into output that is useful for bed managers in hospitals. This repository includes a Python package, called patientflow, which converts patient-level predictions into output that is useful for bed managers. If you have a predictive model of some outcome for a patient, like admission or discharge from hospital, you can use patientflow to create bed count distributions for a cohort of patients. |
| 36 | +We developed this code originally for University College London Hospitals (UCLH) NHS Trust to predict the number of emergency admissions within the next eight hours. The methods generalise to other aspects of patient flow in hospitals, including predictions of discharge numbers, within a group of patients. It can be applied to any problem where it is useful to convert patient-level predictions into outcomes for a whole cohort of patients at a point in time. |
37 | 37 |
|
38 | | -The methods generalise to any problem where it is useful to convert patient-level predictions into outcomes for a whole cohort of patients at a point in time. The repository includes a synthetic dataset and a series of notebooks demonstrating the use of the package. |
| 38 | +If you have a predictive model of some outcome for a patient, like admission or discharge from hospital, you can use patientflow to create bed count distributions for a cohort of patients. We show how to prepare your data and train models for these kinds of problems. The repository includes a synthetic dataset and a series of notebooks demonstrating the use of the package. |
39 | 39 |
|
40 | | -## Main features of my modelling approach |
| 40 | +## What patientflow is for: |
41 | 41 |
|
42 | | -- **Led by what users need:** My work is the result of close collaboration with operations directors and bed managers in the Coordination Centre, University College London Hospital (UCLH), since 2020. What is modelled directly reflects how they work and what is most useful to them. |
43 | | -- **Focused on short-term predictions:** The modelling is designed for predicting demand within a short time horizon eg 8 or 12 hours. I show how to use my code to predict how many beds will be needed emergency patients. (Later I plan to add modules that for elective demand, discharge and transfers between specialties.) |
44 | | -- **Assumes real-time data is available:** Hospital bed managers have to deal with rapidly changing situations. My focus is on the use of real-time data (or near to real-time) to help them make informed decisions. |
| 42 | +- Managing patient flow in hospitals: The package can be used to predict numbers of emergency admissions, discharges or transfers between units |
| 43 | +- Short-term operational planning: The predictions produced by this package are designed for bed managers who need to make decisions within an 4-16 hour timeframe. |
| 44 | +- Working with real-time data: The design assumes that data from an electronic health record (EHR) is available in real-time, or near to real-time |
| 45 | +- Point-in-time analysis: The packages works by taking "snapshots" of groups of patients at a particular moment, and making projections from those specific moments. |
45 | 46 |
|
46 | | -## Main Features of this repository |
| 47 | +## What patientflow is NOT for: |
47 | 48 |
|
48 | | -- **Reproducible** - I follow the principles of [Reproducible Analytical Pipelines](https://analysisfunction.civilservice.gov.uk/support/reproducible-analytical-pipelines/). The repository can be installed as a Python package, and imported into your own code. |
49 | | -- **Accessible** - All the elements are based on simple techniques and methods in Health Data Science and Operational Research. I intend that anyone with some knowledge of Python could understand and adapt the code for their use. |
50 | | -- **Practical:** - I believe that it is easier to follow the steps I took if you have access to the same data I have. UCLH have released an anonymised version of real patient data, which you can request access on [Zenodo](https://zenodo.org/records/14866057), or you can use the synthetic dataset, derived from real patient data, in the `data-synthetic` folder. (Note that, if you use the synthetic dataset, you will observe articifically inflated model performance.) |
51 | | -- **Interactive:** The repository includes a set of notebooks with code written on Python and commentary. If you clone the repo into your own workspace and have an environment for running Jupyter notebooks, you will be able to interact with the code and see it running. |
| 49 | +- Long-term capacity planning: The package focuses on immediate operational needs (hours ahead), not strategic planning over weeks or months. |
| 50 | +- Making decisions about individual patients: The package is not designed for clinical decision-making about specific patients. It relies on data entered into the EHR by clinical staff looking after patients, but cannot and should not be use to influence their decision-making |
| 51 | +- General hospital analytics: It is specifically focused on short-term bed management, not broader hospital analytics like long-term demand and capacity planning. |
| 52 | +- Finished/historical patient analysis: While historical data might train underlying models, the package itself focuses on patients currently in the hospital or soon to arrive |
| 53 | +- Replacing human judgment: It augments the information available to bed managers, but isn't meant to automate bed management decisions completely. |
| 54 | + |
| 55 | +## This package will help you if you want to: |
| 56 | + |
| 57 | +- Convert individual patient predictions to cohort-level insights: Its core purpose is the creation of aggregate bed count distributions, because bed numbers are the currencly used by bed managers. |
| 58 | +- Make predictions for unfinished patient visits: It is designed for making predictions when outcome at the end of the visit are as yet unknown. |
| 59 | +- Develop your own predictive models of emergency demand: The package includes a fully worked example of how to convert data from A&E visits into the right structure, and use that data to train models that predict numbers of emergency beds. |
| 60 | + |
| 61 | +## This package will not help you if: |
| 62 | + |
| 63 | +- You work with time series data: patientflow works with snapshots of a hospital visit summarising what is in the patient record up to that point in time |
| 64 | +- Your focus is on predicting clinical outcomes: the approach is designed |
| 65 | + |
| 66 | +## Mathematical assumptions underlying the conversion from individual to cohort predictions: |
| 67 | + |
| 68 | +- Independence of patient outcomes: The package assumes that individual patient outcomes are conditionally independent given the features used in prediction. |
| 69 | +- Symbolic probability generation: The conversion uses symbolic mathematics (via SymPy) to construct a probability generating function that represents the exact distribution of possible cohort outcomes. |
| 70 | +- Bernoulli outcome model: Each patient outcome is modeled as a Bernoulli trial with its own probability, and the package computes the exact probability distribution for the sum of these independent trials. |
| 71 | +- Coefficient extraction approach: The method works by expanding a symbolic expression and extracting coefficients corresponding to each possible cohort outcome count. |
| 72 | +- Optional weighted aggregation: When converting individual probabilities to cohort-level predictions, the package allows for weighted importance of individual predictions, modifying the contribution of each patient to the overall distribution in specific contexts (eg admissions to different specialties). |
| 73 | +- Discrete outcome space: The package assumes outcomes can be represented as discrete counts (e.g., number of admissions) rather than continuous values. |
52 | 74 |
|
53 | 75 | ## Getting started |
54 | 76 |
|
55 | | -- Exploration: Start with the [notebooks README](notebooks/README.md) to get an outline of the notebooks, and read the [patientflow README](src/patientflow/README.md) to understand my intentions for the Python package |
| 77 | +- Exploration: Start with the [notebooks README](notebooks/README.md) to get an outline of what is included in the notebooks, and read the [patientflow README](src/patientflow/README.md) for an overview of the Python package |
56 | 78 | - Installation: Follow the instructions below to set up the environment and install necessary dependencies in your own environment |
57 | 79 | - Configuration: Repurpose config.yaml to configure the package to your own data and user requirements |
58 | 80 |
|
|
0 commit comments