Skip to content

Job request: 10466

Workspace:
antidepressant-prescribing-lda-test
ID:
hwds5sqqh3fodfzl

This page shows the technical details of what happened when 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 indicated Requested Actions with the Pipeline section below, you can infer what security level various outputs were written to. Outputs marked as highly_sensitive can never be viewed directly by a researcher; 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:

  ####################
  # Depression events
  ####################

  generate_study_population_depression_events:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_depression_events --index-date-range "2020-01-01 to 2020-04-01 by month" --output-format=csv.gz --output-dir output/qof/events
    outputs:
      highly_sensitive:
        cohort: output/qof/events/input_depression_events_*.csv.gz

  find_first_or_latest:
    run: >
      python:latest python analysis/depression_date.py
        --input-files output/qof/events/input_depression_events_*.csv.gz
        --output-dir output/qof/events
    needs: [generate_study_population_depression_events]
    outputs:
      highly_sensitive:
        cohort: output/qof/events/depression_events_*.csv

  ####################
  # 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-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/input_ethnicity.csv.gz

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

  # Generate dep003 by month
  generate_study_population_dep003:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dep003 --index-date-range "2020-01-01 to 2020-04-01 by month" --output-format=csv.gz --output-dir output/qof
    needs: [find_first_or_latest]
    outputs:
      highly_sensitive:
        cohort: output/qof/input_dep003_*.csv.gz

  # Generate prescription variables by month
  generate_study_population_lda:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_lda --index-date-range "2020-01-01 to 2020-04-01 by month" --output-format=csv.gz --output-dir output/lda
    needs: [find_first_or_latest]
    outputs:
      highly_sensitive:
        cohort: output/lda/input_lda_*.csv.gz

  # Generate dataset report
  generate_dataset_report:
    run: >
      dataset-report:v0.0.19
        --input-files output/qof/input_*.csv.gz
        --output-dir output/qof/
    needs: [generate_study_population_register, generate_study_population_dep003]
    outputs:
      moderately_sensitive:
        dataset_report: output/qof/input_*.html

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

  join_cohorts_qof:
    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_cohorts_lda:
    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_lda]
    outputs:
      highly_sensitive:
        cohort: output/lda/joined/input_*.csv.gz

  ####################
  # Python testing
  ####################
  test_input:
    run: >
            python:latest python analysis/test_input.py
            --input-files output/qof/joined/input_*.csv.gz
            --output-dir output/qof/joined/python
    needs: [join_cohorts_qof]
    outputs:
      moderately_sensitive:
        cohort: output/qof/joined/python/test_*.*

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

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

  join_measures_register:
      run: python:latest python analysis/join_and_round.py
           --input-list output/qof/joined/measure_register_total_rate.csv
           --input-list output/qof/joined/measure_register_age_band_rate.csv
           --input-list output/qof/joined/measure_register_carehome_rate.csv
           --input-list output/qof/joined/measure_register_ethnicity_rate.csv
           --input-list output/qof/joined/measure_register_imd_rate.csv
           --input-list output/qof/joined/measure_register_learning_disability_rate.csv
           --input-list output/qof/joined/measure_register_region_rate.csv
           --input-list output/qof/joined/measure_register_sex_rate.csv
           --output-dir output/qof/joined/summary
           --output-name "measure_register.csv"
      needs: [generate_measures_register]
      outputs:
        moderately_sensitive:
          # Only output the single summary file
          measure_csv: output/qof/joined/summary/measure_register.csv

  generate_measures_dep003:
      run: cohortextractor:latest generate_measures --study-definition study_definition_dep003 --output-dir=output/qof/joined
      needs: [find_first_or_latest, join_cohorts_qof]
      outputs:
        moderately_sensitive:
          # Only output the single summary file
          measure_csv: output/qof/joined/measure_dep003_*_rate.csv

  generate_measures_lda:
      run: cohortextractor:latest generate_measures --study-definition study_definition_lda --output-dir=output/lda/joined
      needs: [find_first_or_latest, join_cohorts_lda]
      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"
            --scale "percentage"
    needs: [generate_measures_register, generate_measures_dep003]
    outputs:
      moderately_sensitive:
        cohort: output/qof/joined/group_chart_*.png

  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"
            --scale "rate"
    needs: [generate_measures_lda]
    outputs:
      moderately_sensitive:
        cohort: output/lda/joined/group_chart_*.png

  generate_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_lda]
    outputs:
      moderately_sensitive:
        cohort: output/lda/joined/table1.csv

  #############################
  # 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:

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

Job information

Status
Succeeded
Backend
TPP
Requested by
Christine Cunningham
Branch
test
Force run dependencies
No
Git commit hash
be5369e
Requested actions
  • generate_study_population_depression_events
  • find_first_or_latest
  • generate_study_population_dep003
  • join_cohorts_qof
  • test_input
  • generate_measures_dep003