Skip to content

OpenSAFELY Contracts reference🔗

Danger

This page discusses the new OpenSAFELY Data Builder for accessing OpenSAFELY data sources.

Use OpenSAFELY cohort-extractor, unless you are specifically involved in the development or testing of Data Builder.

OpenSAFELY Data Builder and its documentation are still undergoing extensive development. We will announce when Data Builder is ready for general use on the Platform News page.

This page will be a reference for OpenSAFELY Contracts.

It is likely that much or all of this content will be automatically generated from the Data Builder contracts code via a MkDocs plugin.

Universal/patients🔗

Column name Description Type Constraints
date_of_birth Patient's year and month of birth, provided in format YYYY-MM-01. The day will always be the first of the month. date Must be the first day of a month, must have a value.
sex Patient's sex as defined by the options: male, female, intersex, unknown. str Must have a value, female, male, intersex, unknown.
date_of_death Patient's year and month of death, provided in format YYYY-MM-01. The day will always be the first of the month. date Must be the first day of a month.

Wip/clinical_events🔗

TODO.

Column name Description Type Constraints
code str .
system str .
date date .
numeric_value float .

Wip/covid_test_results🔗

TODO.

Column name Description Type Constraints
date date .
positive_result bool .

Wip/hospital_admissions🔗

TODO.

Column name Description Type Constraints
admission_date date .
primary_diagnosis str .
admission_method int .
episode_is_finished bool .
spell_id int .

Wip/hospitalisations🔗

TODO.

Column name Description Type Constraints
date date .
code str .
system str .

Wip/hospitalisations_without_system🔗

TODO.

Column name Description Type Constraints
code str .

Wip/patient_address🔗

TODO.

Column name Description Type Constraints
patientaddress_id int .
date_start date .
date_end date .
index_of_multiple_deprivation_rounded int .
has_postcode bool .

Wip/patients🔗

TODO.

Column name Description Type Constraints
date_of_birth date .

Wip/practice_registrations🔗

TODO.

Column name Description Type Constraints
pseudo_id int .
nuts1_region_name str .
date_start date .
date_end date .

Wip/prescriptions🔗

TODO.

Column name Description Type Constraints
prescribed_dmd_code str .
processing_date date .