generated from opensafely/research-template
/
project.yaml
121 lines (94 loc) · 3.6 KB
/
project.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
######################################
# This script defines the project pipeline - it specifys the execution orders for all the code in this
# repo using a series of actions.
######################################
version: '3.0'
expectations:
population_size: 100000
actions:
# Extract data ----
## Cohort data
extract_data:
run: cohortextractor:latest generate_cohort --study-definition study_definition --index-date-range "2019-01-01 to 2021-04-01 by month" --output-dir=output/data --output-format=feather
outputs:
highly_sensitive:
cohort: output/data/input_*.feather
## Ethnicity
extract_ethnicity:
run: cohortextractor:latest generate_cohort --study-definition study_definition_ethnicity --output-dir=output/data --output-format=feather
outputs:
highly_sensitive:
cohort: output/data/input_ethnicity.feather
## Patient to practice lookup
patient_practice_lookup:
run: cohortextractor:latest generate_cohort --study-definition study_definition_practice_count --output-dir=output/data --output-format=feather
outputs:
highly_sensitive:
cohort: output/data/input_practice_count.feather
# Data processing ----
## Patient counts
get_patient_count:
run: python:latest python analysis/get_patient_counts.py --output-dir=output/data
needs: [extract_data]
outputs:
moderately_sensitive:
text: output/data/patient_count.json
## Practice count
get_practice_count:
run: python:latest python analysis/get_practice_count.py --output-dir=output/data
needs: [patient_practice_lookup]
outputs:
moderately_sensitive:
text: output/data/practice_count.json
## Add ethnicity
join_ethnicity:
run: python:latest python analysis/join_ethnicity.py
needs: [extract_data, extract_ethnicity]
outputs:
highly_sensitive:
cohort: output/data/input*.feather
## Process data
data_process:
run: r:latest analysis/process_data.R
needs: [join_ethnicity]
outputs:
moderately_sensitive:
data: output/data/data_*.rds
tables: output/data/custom_measures_*.csv
## Generate measures
generate_measures:
run: cohortextractor:latest generate_measures --study-definition study_definition --output-dir=output/data
needs: [join_ethnicity]
outputs:
moderately_sensitive:
measure_csv: output/data/measure_*.csv
# ### Generate measures, by group
# generate_measures_demographics:
# run: python:latest python analysis/calculate_measures.py
# needs: [join_ethnicity]
# outputs:
# moderately_sensitive:
# measure: output/combined_measure_*.csv
#
# ### Generate measures, by group and demographic
# generate_measures_demographics:
# run: python:latest python analysis/calculate_measures.py
# needs: [join_ethnicity]
# outputs:
# moderately_sensitive:
# measure: output/combined_measure_*.csv
# Results ----
## Figures
summary_figures:
run: r:latest analysis/summary_plots.R
needs: [data_process]
outputs:
moderately_sensitive:
plots: output/figures/plot*.svg
## Whole population notebook
generate_notebook:
run: jupyter:latest jupyter nbconvert /workspace/notebooks/antipsychotic_measures.ipynb --execute --to html --template basic --output-dir=/workspace/output --ExecutePreprocessor.timeout=86400 --no-input
needs: [generate_measures, get_practice_count, get_patient_count]
outputs:
moderately_sensitive:
notebook: output/antipsychotic_measures.html