This project contains three OpenSAFELY pipelines for generating and analysing measures of pressure.
Each pipeline stratifies measures by different characteristics and includes support for testing and configuration.
There are two main pipelines:
- Practice-level measures - Extracts all measures described in original protocol
- Patient-level subgroup measures - Extracts only good-candidate measures (determined as those with high usage across practices and potential seasonality)
Note - Prior versions had dedicated national demographic and comorbidity pipelines containing intersectional subgroups e.g. age X sex. These were removed as practice-level univariate subgroup breakdowns were deemed to be more useful for pressure management than national level multivariate breakdowns.
To choose which pipeline to run, add the corresponding flag when calling the script:
--practice_measures--practice_subgroup_measures
Use the --test flag with any script to run the lightweight test pipeline (useful in Codespaces, since the default dummy data is sparse).
There are currently three sets of measures:
--set appts_table- runs appts_table measures--set sro- runs sro measures (+ secondary referral measures)--set resp- runs respiratory illness measures (rsv/flu/covid)
- Configuration
config.jsonandwp_config_setup.py: pipeline flags, dates, filetypes, and parameterscodelist_definition.py: defines codelists
- Testing
- Measure definitions copied to
dataset.py. Note - this requires manual copying, the definitions indataset.pycan lag behind the cuurent definitions inmeasures_definition.py. - Dummy test data defined in
test_dataset.py - ehrQL assurance test then run on
dataset.py
- Measure definitions copied to
- Utilities
- Helper functions:
utils.randutils.py
- Helper functions:
- Action generation
generate_yaml.pyautomatically creates the GitHub Actions YAML workflow
-
Generate measures
- Measures are split by year.
- Example:
This runs
opensafely run generate_practice_measures_2016-04-11
wp_measures.py. - Specific measure queries are defined in
queries.py.
-
OUT OF DATE - Generate frequency table (Table 1)
- Available only for the demographics pipeline.
- Example:
Runs
opensafely run generate_freq_table_demograph
freq_table.py.
-
Pre-process and round measures into a single file
-
Example:
opensafely run generate_pre_processing_practice
Runs
pre_processing.py. -
From rounded measures, you can generate decile tables and charts for local visualisation:
opensafely run generate_deciles_charts→decile_charts.r- For subgroup pipelines, line plots are generated via
table_generation.r(action not yet available)
-
-
Generate practice-level seasonal rates
- Example:
Runs
opensafely run generate_normalization_practice
normalization.py.
- Example:
-
Conduct statistical analysis and calculate rate ratios
- Runs
stat_test.r.
- Runs
- The pipeline is modular: you can rerun individual steps as needed.
- Test mode (
--test) is intended for development environments, not production runs.
Details of the purpose and any published outputs from this project can be found at the link above.
The contents of this repository MUST NOT be considered an accurate or valid representation of the study or its purpose. This repository may reflect an incomplete or incorrect analysis with no further ongoing work. The content has ONLY been made public to support the OpenSAFELY open science and transparency principles and to support the sharing of re-usable code for other subsequent users. No clinical, policy or safety conclusions must be drawn from the contents of this repository.
The OpenSAFELY framework is a Trusted Research Environment (TRE) for electronic health records research in the NHS, with a focus on public accountability and research quality.
Read more at OpenSAFELY.org.
As standard, research projects have a MIT license.