raw.tpp schema🔗
Available on backends: TPP
This schema defines the data (both primary care and externally linked) available in the OpenSAFELY-TPP backend. For more information about this backend, see "SystmOne Primary Care".
The data provided by this schema are minimally transformed. They are very close to the data provided by the underlying database tables. They are provided for data development and data curation purposes.
from ehrql.tables.raw.tpp import (
apcs_cost_historical,
apcs_historical,
isaric,
medications,
ons_deaths,
repeat_medications,
wl_clockstops,
wl_openpathways,
)
many rows per patient
apcs_cost_historical🔗
This table contains some historical APCS cost data.
It has been exposed to users for data exploration, and may be removed in future.
many rows per patient
apcs_historical🔗
This table contains some historical APCS data.
It has been exposed to users for data exploration, and may be removed in future.
many rows per patient
isaric🔗
Access to this table requires the isaric permission
Access to ISARIC data is usually agreed at the project application stage. If you're unsure as to whether you do or should have access please speak to your co-pilot or to OpenSAFELY support.
ISARIC is a dataset of COVID-19-related hospital admissions, with coverage across the majority of hospitals across the UK, including much richer clinical information than collected in national Hospital Episode Statistics datasets.
The data in this table covers a subset of the ISARIC data columns available in TPP, sourced from the ISARIC COVID-19 Clinical Database.
All columns included have deliberately been taken as strings while in a preliminary phase.
Descriptions taken from CCP_REDCap_ISARIC_data_dictionary_codebook.pdf which also has information on the data expected for each column.
Warning
ISARIC data can only be used in collaboration with ISARIC researchers who must be involved in working on the study and writing it up.
Refer to the OpenSAFELY database build report to see when this data was last updated.
-
Calculated age (comparing date of birth with date of enrolment). May be inaccurate if a date of February 29 is used.
-
Has the patient received a Covid-19 vaccine (open label licenced product)?
-
Proven or high likelihood of infection with pathogen of public health interest.
-
Adult or child who meets case definition for inflammatory multi-system syndrome (MIS-C/MIS-A).
-
Chronic cardiac disease, including congenital heart disease (not hypertension).
- Possible values:
YES,NO,Unknown
- Possible values:
-
Chronic pulmonary disease (not asthma).
- Possible values:
YES,NO,Unknown
- Possible values:
many rows per patient
medications🔗
This table is an extension of the tpp.medications table.
It contains additional fields whose contents are not yet well understood, with the aim of facilitating exploratory analysis for data development and data curation purposes.
-
Medication status. The values might map to the descriptions below from the data dictionary. Note that this still needs to be confirmed.
- 0 - Normal
- 4 - Historical
- 5 - Blue script
- 6 - Private
- 7 - Not in possession
- 8 - Repeat dispensed
- 9 - In possession
- 10 - Dental
- 11 - Hospital
- 12 - Problem substance
- 13 - From patient group direction
- 14 - To take out
- 15 - On admission
- 16 - Regular medication
- 17 - As required medication
- 18 - Variable dose medication
- 19 - Rate-controlled single regular
- 20 - Only once
- 21 - Outpatient
- 22 - Rate-controlled multiple regular
- 23 - Rate-controlled multiple only once
- 24 - Rate-controlled single only once
- 25 - Placeholder
- 26 - Unconfirmed
- 27 - Infusion
-
28 - Reducing dose blue script
-
Always >= 0 and <= 28
-
Quantity as structured text. The precise structure is yet to be determined and it may be that historical records are less well structured than more recent ones. Examples of the kinds of value you might find are:
10ml - 0.5% 100 mililitres 1 pack of 28 capsule(s) 63 tablet 21 tablet(s) - 400mg 1 op - 8.75 cm x 1 m (e)
many rows per patient
ons_deaths🔗
Registered deaths
Date and cause of death based on information recorded when deaths are certified and registered in England and Wales from February 2019 onwards. The data provider is the Office for National Statistics (ONS). This table is updated approximately weekly in OpenSAFELY.
This table includes the underlying cause of death, place of death, and up to
15 medical conditions mentioned on the death certificate.
These codes (cause_of_death_01 to cause_of_death_15) are not ordered meaningfully.
More information about this table can be found in following documents provided by the ONS:
- Information collected at death registration
- User guide to mortality statistics
- How death registrations are recorded and stored by ONS
In the associated database table ONS_Deaths,
a small number of patients have multiple registered deaths.
This table contains all registered deaths.
The ehrql.tables.ons_deaths table contains the earliest registered death.
Tip
To return one row per patient from ehrql.tables.raw.tpp.ons_deaths,
for example the latest registered death, you can use:
ons_deaths.sort_by(ons_deaths.date).last_for_patient()
-
Patient's place of death.
- Possible values:
Care Home,Elsewhere,Home,Hospice,Hospital,Other communal establishment
- Possible values:
-
underlying_cause_of_death 🔗
ICD-10 code -
cause_of_death_01 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_02 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_03 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_04 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_05 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_06 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_07 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_08 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_09 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_10 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_11 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_12 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_13 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_14 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
-
cause_of_death_15 🔗
ICD-10 code -
Medical condition mentioned on the death certificate.
many rows per patient
repeat_medications🔗
This table is exposed for data development and data curation purposes. Its contents and not yet well understood and so it should not yet be used for research.
-
Medication status. The values might map to the descriptions below from the data dictionary. Note that this still needs to be confirmed.
- 0 - Normal
- 4 - Historical
- 5 - Blue script
- 6 - Private
- 7 - Not in possession
- 8 - Repeat dispensed
- 9 - In possession
- 10 - Dental
- 11 - Hospital
- 12 - Problem substance
- 13 - From patient group direction
- 14 - To take out
- 15 - On admission
- 16 - Regular medication
- 17 - As required medication
- 18 - Variable dose medication
- 19 - Rate-controlled single regular
- 20 - Only once
- 21 - Outpatient
- 22 - Rate-controlled multiple regular
- 23 - Rate-controlled multiple only once
- 24 - Rate-controlled single only once
- 25 - Placeholder
- 26 - Unconfirmed
- 27 - Infusion
-
28 - Reducing dose blue script
-
Always >= 0 and <= 28
-
Quantity as structured text. The precise structure is yet to be determined and it may be that historical records are less well structured than more recent ones. Examples of the kinds of value you might find are:
10ml - 0.5% 100 mililitres 1 pack of 28 capsule(s) 63 tablet 21 tablet(s) - 400mg 1 op - 8.75 cm x 1 m (e)
many rows per patient
wl_clockstops🔗
National Waiting List Clock Stops
Access to this table requires the waiting_list permission
Access to Waiting List data is usually agreed at the project application stage. If you're unsure as to whether you do or should have access please speak to your co-pilot or to OpenSAFELY support.
The columns in this table have the same data types as the columns in the associated database table. The three "pseudo" columns are small exceptions, as they are converted from binary columns to string columns.
many rows per patient
wl_openpathways🔗
National Waiting List Open Pathways
Access to this table requires the waiting_list permission
Access to Waiting List data is usually agreed at the project application stage. If you're unsure as to whether you do or should have access please speak to your co-pilot or to OpenSAFELY support.
The columns in this table have the same data types as the columns in the associated database table. The three "pseudo" columns are small exceptions, as they are converted from binary columns to string columns.