Skip to content

Job request: 7490

Organisation:
Bennett Institute
Workspace:
antidepressant-prescribing-lda
ID:
4eobt2taqd7ufwq7

This page shows the technical details of what happened when the authorised researcher Christine Cunningham requested one or more actions to be run against real patient data in the project, within a secure environment.

By cross-referencing the list of jobs with the pipeline section below, you can infer what security level various outputs were written to. Researchers can never directly view outputs marked as highly_sensitive ; they can only request that code runs against them. Outputs marked as moderately_sensitive can be viewed by an approved researcher by logging into a highly secure environment. Only outputs marked as moderately_sensitive can be requested for release to the public, via a controlled output review service.

Jobs

Pipeline

Show project.yaml
version: '3.0'

expectations:
  population_size: 10000

actions:

  # TODO: switch statement for which stud(y/ies) to run?

  ####################
  # Cohort Generation
  ####################

  # Since this runs on everyone, we can reuse for both studies 
  generate_study_population_ethnicity:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_ethnicity --output-dir=output --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/input_ethnicity.csv.gz

  # Generate depression register variable among the total population by month
  generate_study_population_register:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_register --index-date-range "2019-01-01 to 2022-01-01 by month" --output-dir=output/qof --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/qof/input_register_*.csv.gz

  # Generate QOF variables for those on the depression register by month
  generate_study_population_dep003:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dep003 --index-date-range "2019-01-01 to 2022-01-01 by month" --output-dir=output/qof --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/qof/input_dep003_*.csv.gz

  # Generate depression and prescription variables (including QOF) for those with LD&A by month
  generate_study_population:
    run: cohortextractor:latest generate_cohort --study-definition study_definition --index-date-range "2019-01-01 to 2022-01-01 by month" --output-dir=output/lda --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/lda/input_*.csv.gz

  ####################
  # Join ethnicity to all generated input files
  # Efficiency fix https://github.com/opensafely/research-template
  # BUT BEWARE STALE DATA
  ###################

  join_qof_cohorts:
    run: >
      cohort-joiner:v0.0.18
        --lhs output/qof/input_*.csv.gz
        --rhs output/input_ethnicity.csv.gz
        --output-dir output/qof/joined
    needs: [generate_study_population_ethnicity, generate_study_population_register, generate_study_population_dep003]
    outputs:
      highly_sensitive:
        cohort: output/qof/joined/input_*.csv.gz

  join_lda_cohorts:
    run: >
      cohort-joiner:v0.0.18
        --lhs output/lda/input_*.csv.gz
        --rhs output/input_ethnicity.csv.gz
        --output-dir output/lda/joined
    needs: [generate_study_population_ethnicity, generate_study_population]
    outputs:
      highly_sensitive:
        cohort: output/lda/joined/input_*.csv.gz

  ####################
  # Measures 
  ####################

  # Output summary register value by date
  generate_measures_register:
      run: cohortextractor:latest generate_measures --study-definition study_definition_register --output-dir=output/qof/joined
      needs: [join_qof_cohorts]
      outputs:
        moderately_sensitive:
          # Only output the single summary file
          measure_csv: output/qof/joined/measure_register_*_rate.csv

  # Output the summary QOF values by date
  generate_measures_dep003:
      run: cohortextractor:latest generate_measures --study-definition study_definition_dep003 --output-dir=output/qof/joined
      needs: [join_qof_cohorts, generate_study_population_dep003]
      outputs:
        moderately_sensitive:
          # Only output the single summary file
          measure_csv: output/qof/joined/measure_dep003_*_rate.csv

  # Output the summary LD&A values by date
  generate_measures:
      run: cohortextractor:latest generate_measures --study-definition study_definition --output-dir=output/lda/joined
      needs: [join_lda_cohorts, generate_study_population]
      outputs:
        moderately_sensitive:
          # Only output the single summary file
          measure_csv: output/lda/joined/measure_*_rate.csv

  #############################
  # Plotting
  #############################
  generate_qof_deciles_charts:
    run: >
            deciles-charts:v0.0.15
            --input-files output/qof/joined/measure_*_practice_rate.csv
            --output-dir output/qof/joined
    config:
      show_outer_percentiles: false
      tables:
        output: true
      charts:
        output: true
    needs: [generate_measures_register, generate_measures_dep003]
    outputs:
      moderately_sensitive:
        cohort: output/qof/joined/deciles_*_*.*

  generate_qof_groups:
    run: >
            python:latest python analysis/group_charts.py
            --input-files output/qof/joined/measure_*.csv
            --output-dir output/qof/joined
            --date-lines "2019-03-31" "2020-03-31" "2021-03-31"
    needs: [generate_measures_register, generate_measures_dep003]
    outputs:
      moderately_sensitive:
        cohort: output/qof/joined/group_chart_*.png

  generate_lda_table1:
    run: >
            python:latest python analysis/table1.py
            --input-dir output/lda/joined
            --output-dir output/lda/joined
            --measure-attribute "antidepressant_any"
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        cohort: output/lda/joined/table1.csv

  generate_lda_groups:
    run: >
            python:latest python analysis/group_charts.py
            --input-files output/lda/joined/measure_*.csv
            --output-dir output/lda/joined
            --date-lines "2020-03-16" "2020-12-02"
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        cohort: output/lda/joined/group_chart_*.png

  #############################
  # Display
  #############################
  generate_report:
    run: >
            python:latest python analysis/report.py
            --input-dir output/qof/joined
            --output-dir output/qof/joined
            --resource-dir analysis/resources
    needs: [generate_qof_deciles_charts, generate_qof_groups]
    outputs:
      moderately_sensitive:
        cohort: output/qof/joined/report.html

Timeline

  • Created:

  • Started:

  • Finished:

  • Runtime: 21:12:52

These timestamps are generated and stored using the UTC timezone on the TPP backend.

Job information

Status
Failed
Backend
TPP
Requested by
Christine Cunningham
Branch
main
Force run dependencies
No
Git commit hash
f6ca3e1
Requested actions
  • generate_study_population
  • join_lda_cohorts
  • generate_measures

Code comparison

Compare the code used in this Job Request