Skip to content

opensafely/polypharmacy-deprescribing-dementia

Repository files navigation

polypharmacy-deprescribing-dementia

View on OpenSAFELY

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.

File details

Deatils of the purpose for each file in this repository are outlined below

  • The most recent version of the protocol can be found in the protocols folder.

  • The codelists folder contains codelists/codelists.txt, a full list of all codelists used in this project. Each of the .CSV for those codelists can also be found in this folder.

  • The following scripts are in the analysis directory:

    • The dataset_definition directory contains the scripts for generating the initial raw dataset for the project.
      • codelists.py loads each codelist that is needed.
      • [create_variables.py] contains functions for creating variables for the inclusion / exclusion criteria, covariates and outcome variables
      • The dataset_definition_*.py files define the study population and analysis variables for different stages of the pipeline. Each script generates a specific dataset using ehrQL, in some cases building on outputs from earlier data generation or cleaning steps.
      • [variable_helper_functions.py] contains various functions to help facilitate other scripts in this directory.
      • [`study_dates.py] is a file where we define the study dates to be loaded and used at various points in the repository.
    • The dataset_clean directory contains the scripts for cleaning the raw dataset into an analysis ready dataset.
      • The dataset_clean_*.R scripts clean and process the datasets generated by the dataset_definition_*.py files at different stages of the pipeline. These scripts apply consistent data cleaning, derive additional variables, and produce analysis-ready datasets and flow outputs, often passing cleaned data forward to later steps (e.g. matching or final analysis).
      • The function in fn-modify_dummy.R is called first and is used to alter the dummy data generated by opensafely to something close to what we expect the population dataset to look like.
      • fn-preprocess.R is the function carrying out initial preprocessing, formatting columns correctly
      • fn-qa.R is the quality assurance function
      • The function in fn-inex.R applies the inclusion and excusion criteria for the study.
      • fn-ref.R is the function that sets the reference levels for factors.
  • [utility.R] contains miscellaneous functions used in the analysis.

  • The project.yaml file lists all actions to be run in OpenSAFELY and their run order

  • create_table1.R generates a csv file for table one for the study. This uses the output of dataset_clean.R to describe the patient characteristics, displaying the proportion of study population in each variable category.

  • Suffixes used in dataset scripts
    The dataset_definition_*.py and dataset_clean_*.R files use consistent suffixes to indicate the dataset or stage they relate to:

    • _inex* - dataset containing inclusion/exclusion and QA variables.
    • _hist - dataset containing variables for generating medication gap histograms.
    • _match - dataset prepared for matching.
    • _matched* - dataset after matching.

    These suffixes help track the flow of data through the pipeline, showing which datasets are inputs to later cleaning, matching, or analysis steps.

About the OpenSAFELY framework

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.

Licences

As standard, research projects have a MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •