About A&E Live
Until you start to really dig the numbers, you don’t really appreciate the size of the NHS. It is colossal. In England 1.3m people work for the NHS, every night over 100,000 people stay in a NHS hospital bed. It’s often cited that one million people have contact with the NHS every 36 hours. By my estimation, that is underestimate.
These numbers are all big, but they are often difficult to conceptualise. What does that feel like?
One thing the NHS is good at is collecting data. The NHS Digital website is a data geek’s paradise, a seemingly never ending collection of Excel spreadsheets that have all been compiled to help analysis what is happening in our health service. I’m sure these files do have some use, but exploring it does feel like going into an attic and finding a dust-covered box with treasure inside. Does anyone else know they are there?
I was interested using this treasure-trove of information to show what the NHS looks like right now. I started with A&E data, primarily because unlike much of the rest of the data there is a lot of day-and-hour information contained within. It’s this data that the media picked up on to report that 9am on Monday is apparently the busiest time for A&E (and not Saturday night as you may have suspected).
So I combined this data with NHS England’s weekly reporting on A&E performance (which changed to monthly at the start of July 2015, far less useful for this exercise) as the basis of A&E Live. Using this data, I have created a simulation of what each trust’s Emergency Department(s) looks like, and collectively create a national picture of A&E activity.
How is it done?
The data used
The NHS England dataset contains weekly reports (up until June 2015) on how many patients have been seen across the week in each type of Urgent Care setting (A&E, Urgent Care or specialised care). It’s important to note that this is at trust level, not hospital level; so whilst many trusts only have one main A&E department, trusts like Barts cover A&E departments at Royal London and Whipps Cross. This data is referred to as weekly data and provides the weekly count towards the top of the trust pages.
This data is combined with the NHS Digital annual reporting on A&E, which contains a lot more detailed information about each trust and who it has treated, including day and hour (but not combined), time of arrival, age and gender demographic information, how each patient arrived, length of stay in A&E etc. This data is referred to as annual data, and provides the rest of the information on the trust pages.
There are two more bits of data that are part of the NHS Digital annual reporting. At a national level this contains information about the combined day and hour arrival times, giving an hour-by-hour breakdown across a week. The other bit of information that I’ve used is a breakdown of ambulance call types, which is used to generate the emergency vs non-emergency ambulance arrivals in the live data.
How the data is used
Every hour, a list is of the patients for the following hour on a trust-by-trust basis is generated. It uses trust annual day figure to get a percentage of the weekly figure, and then the trust annual hour figure to get a percentage of that day figure which gives the expected number of patients that will arrive that hour. This is the then adjusted based on the hour-day figures produced nationally, to better reflect variance across the week. (Surprisingly, the variance is actually not that significant).
Each trust is then assigned that number of patients, and the patient key characteristics (demographics, arrival mode, duration etc) are each randomly selected, weighted based on the annual data published for the trust. Where available, these are compounded, so a patient’s age will determine the likelihood of them arriving by ambulance (there is a far higher percentage of older people arriving by ambulance than younger people and children). Each patient is then randomly assigned an arrival time across the hour, and a random duration that they will remain in A&E, again weighted based on the trusts’ performance data.
If the patient is arriving by ambulance then they are assigned a type, weighted based on the published national data (Most urgent “Red 1”, Urgent “Red 2”, Non-urgent).
Limitations of the data
There are some limitations to the data that mean it isn’t an entirely accurate reflection of the real environment.
The main limitation is that the the duration is randomly assigned to each patient based on the data published about that trust, irrespective of any other information. But in reality, the length of time a patient will weight is determined by how busy the hospital is; so it is not simply a random occurrence. NHS Digital publishes an average waiting time per hour for each trust, but the data it shows doesn’t seem to have any useful value (there are huge variations for some hours). This average waiting time data is available via JSON if you want to view it.
The other primary limitation is that the data is not compounded, so that whilst there is plenty of other data that could be used (eg type of injury, initial treatment etc), it is not connected to other data, so, for example, you can not see the type of injury by arrival by ambulance etc. Without those connections simply using weighted random assignment would give you daft results such as a patient arriving by Red 1 ambulance with a broken finger; or babies having heart attacks as a regular occurrence.
Another thing that is not reflected is that there is a degree of managing ambulance arrivals so they divert to another hospital if the closest one is busy.
Finally, this is based on an interpretation of the data provided; so there could well be a misunderstanding in what the data represents or mistake in the coding!
How can I use the data?
All the data displayed on the website comes via APIs, which means that it is all available to access in JSON format.
Please note that this is an experimental service and therefore is provided as is. As provider I hold no liability for the accuracy or provision of this service. Major changes to the API will be reflected in version number changes, but the live version may be amended if to fix small bugs or make improvements. Please bear in mind this service sits on my personal hosting environment, and therefore fair usage should reflect that; please cache data wherever possible.
As explained, the two main data tables are the NHS England Weekly data, and the NHS Digital annual data. You can get information about either of these datasets via JSON calls.
The url is olib.uk/nhsnow/data/v2/?
The parameters you can use are:
- table: can either be weekly, annual or meta. The first two reflect the above, the third will give you information about a particular trust
- type: the data ID you specifically request. Please note there is no parent/child relationship here; if you require all the children of a parent you need to list all the child IDs
- trust; the trust ID. EIther the three-letter code used by the NHS, or with asUrl set to 1 the url given in the trust meta details
- asUrl: 1 to provide the trust ID as the url
- list: either trust, weekly, annual. WIll give you lookup values for each. For trusts, combine with asUrl to give you the url-safe name as the ID
There are some other parameters that are available but experimental so aren’t currently listed.
Why have I done this?
I quite like the idea of having an NHS dashboard that shows the totality of the service at any time of the day. This was an initial attempt to start turning that into a reality. I’m not sure it serves any particular purpose, but I think there is definitely some use of analysis realtime data (even if not at realtime). Check out things like Flowopoly.
I also starting building this when I wasn’t sure what was going to happen about my job. I’m always interested in talking to people about exciting potential opportunities.
If you’d like to get in touch, tweet me at @ollybenson or you can email me using the same handle at gmail.com.