Skip to content

Job request: 9771

Workspace:
bmi_and_hba1c
ID:
nvshg6o6vcojfcl7

This page shows the technical details of what happened when authorised researcher Miriam Samuel 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: 50000

actions:

### 1.  Extract the cohort

  ## use the Measure function to allow data for different time periods to be extracted in the same study population:  --index-date-range ""yyyy-mm-dd"" --output-format feather 
  generate_study_population_1:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2015-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2015-03-01.feather  

  generate_study_population_2:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2016-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2016-03-01.feather  

  generate_study_population_3:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2017-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2017-03-01.feather  
        
  generate_study_population_4:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2018-03-01" --output-format feather 
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2018-03-01.feather  
        
        
  generate_study_population_5:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2019-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2019-03-01.feather        
        
  generate_study_population_6:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2020-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2020-03-01.feather  
   
  generate_study_population_7:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_all --output-dir=output/data --index-date-range "2021-03-01" --output-format feather
    outputs:
      highly_sensitive:
        cohort: output/data/input_all_2021-03-01.feather  
 
 

  generate_study_population_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
        
      
        
  join_ethnicity:
    run: python:latest python analysis/join_ethnicity.py --output-dir=output/data --output-format feather
    needs: [generate_study_population_1, generate_study_population_2, generate_study_population_3, generate_study_population_4, generate_study_population_5, generate_study_population_6, generate_study_population_7, generate_study_population_ethnicity]
    outputs:
      highly_sensitive:
        cohort: output/data/input*.feather

  generate_study_population_dm1:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2015-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2015-03-01.csv

  generate_study_population_dm2:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2016-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2016-03-01.csv

  generate_study_population_dm3:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2017-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2017-03-01.csv

  generate_study_population_dm4:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2018-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2018-03-01.csv

  generate_study_population_dm5:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2019-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2019-03-01.csv

  generate_study_population_dm6:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2020-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2020-03-01.csv

  generate_study_population_dm7:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_dm_meds --output-dir=output/data --index-date-range "2021-03-01" 
    outputs:
      highly_sensitive:
        cohort: output/data/input_dm_meds_2021-03-01.csv
###  Develop yearly BMI data sets to de-duplicate data and calculate median BMI each year.   Feather format to reduce data quantity.


  join_meds:
    run: r:latest analysis/add_medication.R --output-dir=output/data --output-format feather
    needs: [join_ethnicity, generate_study_population_dm1, generate_study_population_dm2, generate_study_population_dm3, generate_study_population_dm4, generate_study_population_dm5, generate_study_population_dm6, generate_study_population_dm7]
    outputs:
      highly_sensitive:
        cohort1: output/data/complete_meds_2015.feather
        cohort2: output/data/complete_meds_2016.feather
        cohort3: output/data/complete_meds_2017.feather
        cohort4: output/data/complete_meds_2018.feather
        cohort5: output/data/complete_meds_2019.feather
        cohort6: output/data/complete_meds_2020.feather
        cohort7: output/data/complete_meds_2021.feather





  generate_BMI_2015_data:
    run: r:latest analysis/BMI_2015.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2015.feather
        cohort2: output/data/BMI_complete_long_2015.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2015.csv


  generate_BMI_2016_data:
    run: r:latest analysis/BMI_2016.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2016.feather
        cohort2: output/data/BMI_complete_long_2016.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2016.csv

  
  generate_BMI_2017_data:
    run: r:latest analysis/BMI_2017.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2017.feather
        cohort2: output/data/BMI_complete_long_2017.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2017.csv
        
   
   
   
  generate_BMI_2019_data:
    run: r:latest analysis/BMI_2019.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2019.feather
        cohort2: output/data/BMI_complete_long_2019.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2019.csv


  generate_BMI_2021_data:
    run: r:latest analysis/BMI_2021.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2021.feather
        cohort2: output/data/BMI_complete_long_2021.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2021.csv


  generate_BMI_2018_data:
    run: r:latest analysis/BMI_2018.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2018.feather
        cohort2: output/data/BMI_complete_long_2018.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2018.csv


  generate_BMI_2020_data:
    run: r:latest analysis/BMI_2020.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median_2020.feather
        cohort2: output/data/BMI_complete_long_2020.feather
      moderately_sensitive:
        table1:  output/data/BMI_data_checks_2020.csv


# Append yearly data sets to produce a complete data set for analysis of change in trends

  generate_complete_median_BMI_data:
    run: r:latest analysis/BMI_median_combine_datasets.R --output-dir=output/data --output-format feather
    needs: [generate_BMI_2015_data, generate_BMI_2016_data, generate_BMI_2017_data, generate_BMI_2018_data, generate_BMI_2019_data, generate_BMI_2020_data, generate_BMI_2021_data ]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_complete_median.feather


  generate_complete_long_BMI_data:
    run: r:latest analysis/BMI_complete_long.R --output-dir=output/data --output-format feather
    needs: [generate_BMI_2015_data, generate_BMI_2016_data, generate_BMI_2017_data, generate_BMI_2018_data, generate_BMI_2019_data, generate_BMI_2020_data, generate_BMI_2021_data ]
    outputs:
      highly_sensitive:
        cohort1: output/data/all_bmi_long.feather

  generate_BMI_trajectories_data1:
    run: r:latest analysis/BMI_change_1.R --output-dir=output/data --output-format feather
    needs: [generate_complete_long_BMI_data]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_demog.feather     
        cohort2: output/data/BMI_all_long_sample.feather 

  generate_BMI_trajectories_data2:
    run: r:latest analysis/BMI_change_2.R --output-dir=output/data --output-format feather
    needs: [generate_BMI_trajectories_data1]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_trajectories.feather     

  generate_BMI_trajectories_data3:
    run: r:latest analysis/BMI_change_3.R --output-dir=output/data --output-format feather
    needs: [generate_BMI_trajectories_data2, generate_BMI_trajectories_data1]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_trajectories_final.feather 

  BMI_trajectories_demographics_correction:
    run: r:latest analysis/BMI_change_demographic_correction.R --output-dir=output/data --output-format feather
    needs: [generate_BMI_trajectories_data3, generate_complete_long_BMI_data]
    outputs:
      highly_sensitive:
        cohort1: output/data/BMI_trajectories_final_demog.feather
      moderately_sensitive:
        table1: output/data/BMI_traj_demog.html

########################################
## POPULATION DEMOGRAPHICS
#######################################
  demographics_analysis_pop:
    run: r:latest analysis/pop_demographics/pop_demographics_total_pop.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_study_population.csv

  demographics_had_bmi:
    run: r:latest analysis/pop_demographics/pop_demographics_had_bmi.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_had_bmi.csv

  demographics_t2dm:
    run: r:latest analysis/pop_demographics/pop_demographics_t2dm.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_study_population_t2dm.csv
        table2: output/data/demographics_had_bmi_t2dm.csv

  demographics_t1dm:
    run: r:latest analysis/pop_demographics/pop_demographics_t1dm.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_study_population_t1dm.csv
        table2: output/data/demographics_had_bmi_t1dm.csv

  demographics_hypertension:
    run: r:latest analysis/pop_demographics/pop_demographics_hypertension.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_study_population_hypertension.csv
        table2: output/data/demographics_had_bmi_hypertension.csv

  demographics_bmi_change_all:
    run: r:latest analysis/pop_demographics/pop_demographics_bmi_change_all.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_bmi_change_analysis_all.csv


  demographics_bmi_change_lowbmiexc:
    run: r:latest analysis/pop_demographics/pop_demographics_bmi_change_lowbmiexc.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_bmi_change_analysis_lowbmiexc.csv

  demographics_bmi_change_t2dm:
    run: r:latest analysis/pop_demographics/pop_demographics_bmi_change_t2dm.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_bmi_change_analysis_all_t2dm.csv
        table2: output/data/demographics_bmi_change_analysis_lowbmiexc_t2dm.csv


  demographics_bmi_change_t1dm:
    run: r:latest analysis/pop_demographics/pop_demographics_bmi_change_t1dm.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_bmi_change_analysis_all_t1dm.csv
        table2: output/data/demographics_bmi_change_analysis_lowbmiexc_t1dm.csv

  demographics_bmi_change_hypertension:
    run: r:latest analysis/pop_demographics/pop_demographics_bmi_change_hypertension.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/demographics_bmi_change_analysis_all_hypertension.csv
        table2: output/data/demographics_bmi_change_analysis_lowbmiexc_hypertension.csv

#########################################################
## TOP DECILE: BMI_ CHANGE
##########################################################
  topdecile_bmi_change_univariate:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_univariate.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_univariate_lowbmiexc.csv
        table2: output/data/change_deciles_lowbmiexc.csv
        table3: output/data/change_90th_counts_lowbmiexc.csv

  topdecile_bmi_change_counts_correction:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_counts.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_counts_lowbmiexc_corrected.csv

  topdecile_bmi_change_age_adjusted:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_age_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_age_adjusted_lowbmiexc.csv
        table2: output/data/change_90th_wald_age.csv

  topdecile_bmi_change_sex_adjusted:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_sex_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_sex_adjusted_lowbmiexc.csv
        table2: output/data/change_90th_wald_sex.csv


  topdecile_bmi_change_age_sex_adjusted:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_age_sex_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_age_sex_adjusted_lowbmiexc.csv
        table2: output/data/change_90th_wald_age_sex.csv


## hypertension
  topdecile_bmi_change_hypertension:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_hypertension.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_univariate_lowbmiexc_hypertension.csv
        table2: output/data/change_deciles_lowbmiexc_hypertension.csv
        table3: output/data/change_90th_counts_lowbmiexc_hypertension.csv
        table4: output/data/change_90th_age_adj_lowbmiexc_hypertension.csv
        table5: output/data/change_90th_sex_adj_lowbmiexc_hypertension.csv
        table6: output/data/change_90th_agesex_adj_lowbmiexc_hypertension.csv


  topdecile_bmi_change_T1DM:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_T1DM.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_univariate_lowbmiexc_T1DM.csv
        table2: output/data/change_deciles_lowbmiexc_T1DM.csv
        table3: output/data/change_90th_counts_lowbmiexc_T1DM.csv
        table4: output/data/change_90th_age_adj_lowbmiexc_T1DM.csv
        table5: output/data/change_90th_sex_adj_lowbmiexc_T1DM.csv
        table6: output/data/change_90th_agesex_adj_lowbmiexc_T1DM.csv
  

  topdecile_bmi_change_T2DM:
    run: r:latest analysis/bmi_trajectory/top_decile_change/top_decile_change_T2DM.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/change_90th_univariate_lowbmiexc_T2DM.csv
        table2: output/data/change_deciles_lowbmiexc_T2DM.csv
        table3: output/data/change_90th_counts_lowbmiexc_T2DM.csv
        table4: output/data/change_90th_age_adj_lowbmiexc_T2DM.csv
        table5: output/data/change_90th_sex_adj_lowbmiexc_T2DM.csv
        table6: output/data/change_90th_agesex_adj_lowbmiexc_T2DM.csv

##################################################################
### >> HAD_BMI ANALYSIS
######################################################################
# who had_bmi measured: 
  generate_had_bmi_proportion_2019:
    run: r:latest analysis/had_bmi_proportions_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_bmi_2019.csv
  
  generate_had_bmi_proportion_2020:
    run: r:latest analysis/had_bmi_proportions_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_bmi_2020.csv
  
  generate_had_bmi_proportion_2021:
    run: r:latest analysis/had_bmi_proportions_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_bmi_2021.csv
 
## Look at odds of having BMI across the years
  had_bmi_2019_2021_models1:
    run: r:latest analysis/had_bmi_check/had_bmi_all_years_models.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/had_bmi_2019_21_models_1.csv

  had_bmi_2019_2021_models1_counts:
    run: r:latest analysis/had_bmi_check/had_bmi_all_years_models_counts.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/had_bmi_2019_21_models_1_counts.csv
        table2: output/data/had_bmi_2019_21_models_1_demographics.csv

  had_bmi_2019_2021_models1_counts_round:
    run: r:latest analysis/had_bmi_check/had_bmi_models_counts_round.R --output-dir=output/data 
    needs: [had_bmi_2019_2021_models1_counts]
    outputs:
      moderately_sensitive:
        table1: output/data/had_bmi_2019_21_models_1_demographics_round.csv


  had_bmi_2019_2021_models_comorbidities:
    run: r:latest analysis/had_bmi_check/had_bmi_all_years_comorbidities_models.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/had_bmi_2019_21_comorbidity_models.csv
        table2: output/data/had_bmi_2019_21_comorbidity_models_counts.csv


  had_bmi_2019_2021_proportions:
    run: r:latest analysis/had_bmi_check/had_bmi_all_years_prop_chi.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_bmi_2019_2021.csv
        table2: output/data/proportion_had_bmi_2019_2021_chisquare.csv


## check the output from the cohort extractor 'had_bmi'

  had_bmi_proportion_2019_check:
    run: r:latest analysis/had_bmi_check/had_bmi_check_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_bmi_check_2019.csv
        table2: output/data/had_bmi_numbers_check.csv

#########################################################
## PROPORTION OBESE ANALYSIS

  generate_obese_proportion_2019:
    run: r:latest analysis/obese_proportions_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_obese_2019.csv


  generate_obese_proportion_2020:
    run: r:latest analysis/obese_proportions_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_obese_2020.csv

  generate_obese_proportion_2021:
    run: r:latest analysis/obese_proportions_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_obese_2021.csv






 ######################################################################################
 # >> Median BMI Analysis
 
 #######################################################################################

  
  
  # generate summary stats of median BMI by exposures
  generate_median_summary_stats:
    run: r:latest analysis/BMI_median_summary_stats.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_bmi_summary_table_demographic.csv
        table2: output/data/median_bmi_summary_table_covariates.csv
        
        
        
  ## tables of median BMI and range
  generate_median_bmi_range_2015:
    run: r:latest analysis/median_range_bmi/median_range_2015.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2015.csv

  generate_median_bmi_range_2016:
    run: r:latest analysis/median_range_bmi/median_range_2016.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2016.csv

  generate_median_bmi_range_2017:
    run: r:latest analysis/median_range_bmi/median_range_2017.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2017.csv

  generate_median_bmi_range_2018:
    run: r:latest analysis/median_range_bmi/median_range_2018.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2018.csv

  generate_median_bmi_range_2019:
    run: r:latest analysis/median_range_bmi/median_range_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2019.csv

  generate_median_bmi_range_2020:
    run: r:latest analysis/median_range_bmi/median_range_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2020.csv


  generate_median_bmi_range_2021:
    run: r:latest analysis/median_range_bmi/median_range_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2021.csv



  combine_median_range_BMI:
    run: r:latest analysis/median_range_bmi/combine_median_range_BMI.R --output-dir=output/data 
    needs: [generate_median_bmi_range_2021, generate_median_bmi_range_2020, generate_median_bmi_range_2019, generate_median_bmi_range_2018, generate_median_bmi_range_2017, generate_median_bmi_range_2016, generate_median_bmi_range_2015]
    outputs:
      moderately_sensitive:
        table1: output/data/median_range_bmi_2015_2021.csv


## Proportion Obese
  proportion_obese_2015:
    run: r:latest analysis/proportion_obese/proportion_obese_2015.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2015.csv

  proportion_obese_2016:
    run: r:latest analysis/proportion_obese/proportion_obese_2016.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2016.csv


  proportion_obese_2017:
    run: r:latest analysis/proportion_obese/proportion_obese_2017.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2017.csv

  proportion_obese_2018:
    run: r:latest analysis/proportion_obese/proportion_obese_2018.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2018.csv

  proportion_obese_2019:
    run: r:latest analysis/proportion_obese/proportion_obese_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2019.csv

  proportion_obese_2020:
    run: r:latest analysis/proportion_obese/proportion_obese_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2020.csv

  proportion_obese_2021:
    run: r:latest analysis/proportion_obese/proportion_obese_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2021.csv



## Proportion Obese
  proportion_weight_categories_2015:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2015.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2015.csv

  proportion_weight_categories_2016:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2016.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2016.csv


  proportion_weight_categories_2017:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2017.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2017.csv

  proportion_weight_categories_2018:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2018.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2018.csv

  proportion_weight_categories_2019:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2019.csv

  proportion_weight_categories_2020:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2020.csv

  proportion_weight_categories_2021:
    run: r:latest analysis/proportion_weight_categories/proportion_weight_categories_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/weight_categories_2021.csv


  proportion_obese_2019_2021:
    run: r:latest analysis/proportion_weight_categories/proportion_obese_models.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2019_21_models_1.csv


  proportion_obese_2019_2021_comorbidities:
    run: r:latest analysis/proportion_weight_categories/proportion_obese_comorbidities_models.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_2019_21_comorbidity_models.csv


########## BMI_trajectory_data

  proportion_complete_bmi_trajectory:
    run: r:latest analysis/proportion_complete_BMI_trajectory.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        table1: output/data/complete_bmi_trajectories_proportions.csv

  bmi_change_plots:
    run: r:latest analysis/BMI_change_plot.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        table1: output/data/short_bmi_change_summary.csv
        chart1: output/bmi_change_plot.png
        chart2: output/bmi_change_plot_age.png
        chart3: output/bmi_change_plot_counts.png
        chart4: output/bmi_change_plot_age_precovid_counts.png
        chart5: output/bmi_change_plot_age_postcovid_counts.png


  bmi_change_extremes:
    run: r:latest analysis/BMI_change_check_extremes.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        table1: output/data/short_bmi_change_extremes.csv


  bmi_timeinterval_check:
    run: r:latest analysis/check_timeintervals_BMI_change.R --output-dir=output/data 
    needs: [generate_BMI_trajectories_data3]
    outputs:
      moderately_sensitive:
        table1: output/data/bmi_timeinterval_check.csv
        table2: output/data/time1_error.csv


  pandemic_bmi_changes:
    run: r:latest analysis/BMI_change_pandemic.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        table1: output/data/prepandemic_bmi_change_per_year.csv
        table2: output/data/postpandemic_bmi_change_per_year.csv
  

  pandemic_bmi_trajectory_plots:
    run: r:latest analysis/BMI_change_postcovid_plots.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      highly_sensitive:
        table1: output/data/BMI_trajectory_data.feather
        table2: output/data/BMI_trajectory_data_filtered.feather
      moderately_sensitive:
        chart1: output/precovid_stable_bmi.png
        chart2: output/precovid_slow_inc_bmi.png
        chart3: output/precovid_mod_inc_bmi.png
        chart4: output/precovid_rapid_inc_bmi.png


## violin plots to see distribution before filtering
  postcovid_BMI_change_plots: 
    run: r:latest analysis/bmi_change_postcovid_distribution_plots.R --output-dir=output/data 
    needs: [pandemic_bmi_trajectory_plots]
    outputs:
      moderately_sensitive:
        chart1: output/SMI_postcovid_trajectory.png
        chart2: output/region_postcovid_trajectory.png
        chart3: output/precovid_traj_postcovid_trajectory.png
        chart4: output/bmi_postcovid_trajectory.png
        chart5: output/LD_postcovid_trajectory.png
        chart6: output/imd_postcovid_trajectory.png
        chart7: output/hypertension_postcovid_trajectory.png
        chart8: output/ethnic_postcovid_trajectory.png
        chart9: output/diabetes2_postcovid_trajectory.png
        chart10: output/diabetes1_postcovid_trajectory.png
        chart11: output/depression_postcovid_trajectory.png
        chart12: output/age_postcovid_trajectory.png

## stacked column charts showing proportion in different BMI change categories
  bmi_change_category_proportion_plots: 
    run: r:latest analysis/BMI_change_category_prop_plots.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      highly_sensitive: 
        table1: output/data/BMI_trajectory_data_long.feather
      moderately_sensitive:
        chart1: output/category_bmi_change_depression.png
        chart2: output/category_bmi_change_ethnicity.png
        chart3: output/category_bmi_change_learning_diff.png
        chart4: output/category_bmi_change_region.png
        chart5: output/category_bmi_change_sex.png
        chart6: output/category_bmi_change_serious_mental.png
        chart7: output/category_bmi_change_t1dm.png
        chart8: output/category_bmi_change_t2dm.png
        chart9: output/category_bmi_change_imd.png
        chart10: output/category_bmi_change_hypertension.png

## description proportions in each change group
  bmi_change_groups_description: 
    run: r:latest analysis/bmi_trajectory/BMI_change_category_description.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/precovid_bmichange_description.csv
        table2: output/data/postcovid_bmichange_description.csv


## logistic regression predictors of rapid bmi change in pre and post covid period
  bmi_change_univariate: 
    run: r:latest analysis/BMI_change_rapid_univariate.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_univariate.csv
        table2: output/data/rapid_bmi_change_popcharac.csv

  bmi_change_age_adjusted: 
    run: r:latest analysis/BMI_change_rapid_age_model.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_age_adjusted.csv

## Predictors of rapid bmi change with cancer and low pre pandemic weight removed. 
  bmi_change_univariate_lowbmiexcluded: 
    run: r:latest analysis/BMI_change_rapid_lowbmi_excluded_univariate.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_univariate.csv
        table2: output/data/rapid_bmi_change_cancerandlowbmi_removed_popcharac.csv

  bmi_change_age_adjusted_lowbmiexcluded: 
    run: r:latest analysis/BMI_change_rapid_lowbmi_excluded_age_models.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_age_adjusted.csv

### RAPID CHANGE BMI - ADJUSTED MODELS
  bmi_rapid_change_sex_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiexc_sex_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_sex_adjusted.csv


  bmi_rapid_change_imd_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiexc_imd_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_imd_adjusted.csv

  bmi_rapid_change_ethnic_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiexc_ethnic_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_ethnic_adjusted.csv


  bmi_rapid_change_sexage_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiec_sexage_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_sexage_adjusted.csv

  bmi_rapid_change_imdsexage_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiexc_imdsexage_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_imdsexage_adjusted.csv

  bmi_rapid_change_imdsexageethnic_adjusted_lowbmiexcluded: 
    run: r:latest analysis/bmi_trajectory/rapid_bmi_change/rapid_change_cancerlowbmiexc_imdsexageethnic_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/rapid_bmi_change_cancerandlowbmi_removed_imdsexageethnic_adjusted.csv

## Top decile weight gain all
## TOP decile weight gain
  bmi_gain_top_decile_univariate.R: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_univariate.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_popcharac.csv
        table2: output/data/weightgain_90th_univariate.csv
        table3: output/data/yearly_bmi_change_deciles.csv

  bmi_gain_top_decile_age: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_age_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_age_adj.csv

  bmi_gain_top_decile_sex: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_sex_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_sex_adj.csv

  bmi_gain_top_decile_imd: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_imd_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_imd_adj.csv

  bmi_gain_top_decile_eth: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_ethnicity_adj.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_ethnicity_adj.csv

  bmi_gain_top_decile_agesex: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_agesex.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_90th_agesex_adj.csv


## top decile lowbmi excluded

  bmi_gain_top_decile_lowbmiexc_univariate: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_lowbmiexc_univariate.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      highly_sensitive:
        table1: output/data/weightgain_lowbmiexc_90th_data.csv
      moderately_sensitive: 
        table1: output/data/weightgain_lowbmiexc_90th_popcharac.csv
        table2: output/data/weightgain_lowbmiexc_90th_univariate.csv
        table3: output/data/yearly_lowbmiexc_bmi_change_deciles.csv

  bmi_gain_top_decile_lowbmiexc_age: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_lowbmiexc_age.R --output-dir=output/data 
    needs: [bmi_gain_top_decile_lowbmiexc_univariate]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_lowbmiexc_90th_age_adj.csv


  bmi_gain_top_decile_lowbmiexc_sex: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_lowbmiexc_sex.R --output-dir=output/data 
    needs: [bmi_gain_top_decile_lowbmiexc_univariate]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_lowbmiexc_90th_sex_adj.csv


  bmi_gain_top_decile_lowbmiexc_agesex: 
    run: r:latest analysis/bmi_trajectory/top_decile/top_decile_weightgain_lowbmiexc_agesex.R --output-dir=output/data 
    needs: [bmi_gain_top_decile_lowbmiexc_univariate]
    outputs:
      moderately_sensitive: 
        table1: output/data/weightgain_lowbmiexc_90th_agesex_adj.csv

## change in BMI trajectory pre and post covid
  bmi_trajectory_change_summary: 
    run: r:latest analysis/BMI_change_diff_trajectories_summary.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      highly_sensitive: 
        cohort1: output/data/BMI_trajectory_models_data.feather
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change.csv
        chart1: output/change_bmi_trajectories.png
        chart2: output/change_bmi_trajectories_counts.png

  bmi_positive_trajectory_change_proportion: 
    run: r:latest analysis/bmi_trajectory/bmi_trajectory_positive_change_prop.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/bmi_trajectory_positive_change_proportions.csv
 

  bmi_positive_trajectory_change_chi: 
    run: r:latest analysis/bmi_trajectory/bmi_trajectory_positive_change_chi.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/bmi_trajectory_positive_change_chi.csv



  bmi_trajectory_change_summary_DWMP:
    run: r:latest analysis/BMI_change_diff_traj_summ_DWMP_groups.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change_hypertension.csv
        table2: output/data/mean_bmi_traj_change_t2dm.csv
        table3: output/data/mean_bmi_traj_change_t1dm.csv


  bmi_trajectory_change_summary_mentalhealth_2:
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_change_traj_summ_mentalhealthLD_groups.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change_depression.csv
        table2: output/data/mean_bmi_traj_change_learning_disability.csv
        table3: output/data/mean_bmi_traj_change_psychosis_schiz_bipolar.csv




  bmi_trajectory_change_model_univariate: 
    run: r:latest analysis/BMI_change_diff_trajectories_univariate.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/univariate_bmi_trajectory_change.csv
        table2: output/data/univariate_bmi_trajectory_change_hypertension.csv
        table3: output/data/univariate_bmi_trajectory_change_T1DM.csv
        table4: output/data/univariate_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_model_age: 
    run: r:latest analysis/BMI_change_diff_trajectories_age_model.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/age_adjusted_bmi_trajectory_change.csv
        table2: output/data/age_adjusted_bmi_trajectory_change_hypertension.csv
        table3: output/data/age_adjusted_bmi_trajectory_change_T1DM.csv
        table4: output/data/age_adjusted_bmi_trajectory_change_T2DM.csv


  redact_bmi_trajectory_change_T1DM:
    run: r:latest analysis/redact_bmi_trajectory_change_T1DM.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary_DWMP, bmi_trajectory_change_model_univariate, bmi_trajectory_change_model_age]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change_t1dm_redacted.csv
        table2: output/data/univariate_bmi_traj_change_t1dm_redacted.csv
        table3: output/data/age_adj_bmi_traj_change_t1dm_redacted.csv

  bmi_trajectory_change_pop_with_depression: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_lowbmi_exc_depression_models.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/depression_lowbmi_excluded_bmi_trajectory_change_univariate.csv
        table2: output/data/depression_lowbmi_excluded_bmi_trajectory_change_sex_adj.csv
        table3: output/data/depression_lowbmi_excluded_bmi_trajectory_change_age_adj.csv
        table4: output/data/depression_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj.csv
        table5: output/data/depression_lowbmi_excluded_bmi_trajectory_change_imd_adj.csv
        table6: output/data/depression_lowbmi_excluded_bmi_trajectory_change_sexage_adj.csv
        table7: output/data/depression_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj.csv
        table8: output/data/depression_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj.csv
        table9: output/data/depression_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj.csv



  bmi_trajectory_change_pop_with_learning_diff: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_lowbmi_exc_learning_diff_models.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_univariate.csv
        table2: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_sex_adj.csv
        table3: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_age_adj.csv
        table4: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj.csv
        table5: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_imd_adj.csv
        table6: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_sexage_adj.csv
        table7: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj.csv
        table8: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj.csv
        table9: output/data/learning_diff_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj.csv

  bmi_trajectory_change_pop_with_SMI: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_lowbmi_exc_SMI_models.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_univariate.csv
        table2: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sex_adj.csv
        table3: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_age_adj.csv
        table4: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj.csv
        table5: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_imd_adj.csv
        table6: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexage_adj.csv
        table7: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj.csv
        table8: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj.csv
        table9: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj.csv

  bmi_trajectory_change_pop_with_SMI_redact: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/redact_SMI_traj_change.R --output-dir=output/data 
    needs: [bmi_trajectory_change_pop_with_SMI, bmi_trajectory_change_summary_mentalhealth_2]
    outputs:
      moderately_sensitive: 
        table1: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_univariate_redact.csv
        table2: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sex_adj_redact.csv
        table3: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_age_adj_redact.csv
        table4: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj_redact.csv
        table5: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_imd_adj_redact.csv
        table6: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexage_adj_redact.csv
        table7: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj_redact.csv
        table8: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj_redact.csv
        table9: output/data/SMI_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj_redact.csv
        table10: output/data/mean_bmi_traj_change_psychosis_schiz_bipolar_redact.csv

  bmi_trajectory_change_precovid_change_lowbmiexc: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_precovid_change_lowbmiexc.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_traj_change_by_precovid_change_lowbmiexc.csv
        table2: output/data/models_traj_change_by_precovid_change_lowbmiexc.csv


  bmi_trajectory_change_precovid_change: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_precovid_change.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_traj_change_by_precovid_change.csv
        table2: output/data/models_traj_change_by_precovid_change.csv


## trajectory change calculations - with prepandemic underweight and cancer excluded
  bmi_trajectory_change_summary_lowbmi_excluded:
    run: r:latest analysis/BMI_change_diff_traj_summ_cancerandlowbmi_removed.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change_cancerandlowbmi_removed_hypertension.csv
        table2: output/data/mean_bmi_traj_change_cancerandlowbmi_removed_t2dm.csv
        table3: output/data/mean_bmi_traj_change_cancerandlowbmi_removed_t1dm.csv
        table4: output/data/mean_bmi_traj_change_cancerandlowbmi_removed.csv

  bmi_trajectory_change_lowbmi_excluded_univariate: 
    run: r:latest analysis/BMI_trajectory_change_lowbmi_excluded_univariate.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/univariate_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/univariate_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/univariate_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/univariate_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_age_adjusted: 
    run: r:latest analysis/BMI_trajectory_change_lowbmi_excluded_age_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/age_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/age_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/age_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/age_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

## adjusted models
  bmi_trajectory_change_lowbmi_excluded_sex_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_sex_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/sex_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/sex_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/sex_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/sex_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_imd_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_imd_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/imd_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/imd_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/imd_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/imd_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_ethnic_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_ethnic_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/ethnic_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/ethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/ethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/ethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv





  bmi_trajectory_change_lowbmi_excluded_sexage_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_sexage_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/sexage_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/sexage_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/sexage_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/sexage_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_sexageimd_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_sexageimd_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/sexageimd_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/sexageimd_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/sexageimd_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/sexageimd_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_sexageethnic_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_sexageethnic_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/sexageethnic_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/sexageethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/sexageethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/sexageethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv



  bmi_trajectory_change_lowbmi_excluded_sexageimdethnic_adjusted: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_trajectory_change_lowbmi_excluded_sexageimdethnic_adjusted.R --output-dir=output/data 
    needs: [bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive: 
        table1: output/data/sexageimdethnic_adjusted_lowbmi_excluded_bmi_trajectory_change.csv
        table2: output/data/sexageimdethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_hypertension.csv
        table3: output/data/sexageimdethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM.csv
        table4: output/data/sexageimdethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T2DM.csv

  bmi_trajectory_change_lowbmi_excluded_T1DM_redact: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/redact_T1DM_traj_change.R --output-dir=output/data 
    needs: [bmi_trajectory_change_lowbmi_excluded_sexageimdethnic_adjusted,  bmi_trajectory_change_lowbmi_excluded_sexageethnic_adjusted, bmi_trajectory_change_lowbmi_excluded_sexageimd_adjusted, bmi_trajectory_change_lowbmi_excluded_sexage_adjusted, bmi_trajectory_change_lowbmi_excluded_ethnic_adjusted, bmi_trajectory_change_lowbmi_excluded_imd_adjusted, bmi_trajectory_change_lowbmi_excluded_sex_adjusted, bmi_trajectory_change_lowbmi_excluded_age_adjusted, bmi_trajectory_change_lowbmi_excluded_univariate, bmi_trajectory_change_summary_lowbmi_excluded ]
    outputs:
      moderately_sensitive: 
        table1: output/data/mean_bmi_traj_change_cancerandlowbmi_removed_T1DM_redact.csv
        table2: output/data/univariate_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table3: output/data/ethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table4: output/data/sex_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table5: output/data/sexageimdethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table6: output/data/sexageethnic_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv 
        table7: output/data/sexageimd_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table8: output/data/sexage_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table9: output/data/imd_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv
        table10: output/data/age_adjusted_lowbmi_excluded_bmi_trajectory_change_T1DM_redact.csv


  bmi_trajectory_change_lowbmi_excluded_complete_data_proportions: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_complete_case_counts.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/complete_traj_data_proportions.csv


  bmi_trajectory_change_lowbmi_excluded_complete_data_chi: 
    run: r:latest analysis/bmi_trajectory/trajectory_change/BMI_traj_change_complete_cases_chi.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive: 
        table1: output/data/complete_traj_data_prop_chi.csv






## box plots with filtered data (excluding extreme changes
  bmi_change_boxplots: 
    run: r:latest analysis/bmi_change_boxplots.R --output-dir=output/data 
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        chart1: output/covid_bmi_change_cardiac.png
        chart2: output/covid_bmi_change_depression.png
        chart3: output/covid_bmi_change_ethnicity.png
        chart4: output/covid_bmi_change_learning_diff.png
        chart5: output/covid_bmi_change_region.png
        chart6: output/covid_bmi_change_sex.png
        chart7: output/covid_bmi_change_serious_mental.png
        chart8: output/covid_bmi_change_t1dm.png
        chart9: output/covid_bmi_change_t2dm.png
        chart10: output/covid_bmi_change_imd.png
        chart11: output/covid_bmi_change_hypertension.png

## Tables of BMI change categories
  bmi_change_category_tables: 
    run: r:latest analysis/BMI_change_trajectories_table.R --output-dir=output/data 
    needs: [bmi_change_category_proportion_plots]
    outputs:
      moderately_sensitive:
        table1: output/data/postcovid_bmi_trajectories.csv
        table2: output/data/precovid_bmi_trajectories.csv

### Transition between BMI categories
  generate_bmi_category_data: 
    run: r:latest analysis/BMI_cat_change_data.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      highly_sensitive:
        table1: output/data/BMI_category_transition.feather
      
## univariate models of transition between categories
  bmi_category_transitions: 
    run: r:latest analysis/BMI_category_transitions_univariate.R --output-dir=output/data 
    needs: [generate_bmi_category_data]
    outputs:
      moderately_sensitive:
        table1: output/data/bmi_category_transitions.csv
        table2: output/data/healthy_transition_weightgain_univariate.csv
        table3: output/data/healthy_transition_weightgain_2017_univariate.csv
        table4: output/data/healthy_transition_weightgain_2019_univariate.csv
        table5: output/data/overweight_transition_weightgain_univariate.csv 
        table6: output/data/overweight_transition_weightgain_2017_univariate.csv 
        table7: output/data/overweight_transition_weightgain_2019_univariate.csv 
        table8: output/data/overweight_transition_weightloss_univariate.csv 
        table9: output/data/overweight_transition_weightloss_2017_univariate.csv 
        table10: output/data/overweight_transition_weightloss_2019_univariate.csv 
        table11: output/data/obese_transition_weightloss_univariate.csv 
        table12: output/data/obese_transition_weightloss_2017_univariate.csv 
        table13: output/data/obese_transition_weightloss_2019_univariate.csv 


## age adjusted models of transition between categories
  bmi_category_transitions_age_adjusted: 
    run: r:latest analysis/BMI_category_transitions_age_adj.R --output-dir=output/data 
    needs: [generate_bmi_category_data]
    outputs:
      moderately_sensitive:
        table1: output/data/bmi_category_transitions_round.csv
        table2: output/data/healthy_transition_weightgain_age_adj.csv
        table3: output/data/healthy_transition_weightgain_2017_age_adj.csv
        table4: output/data/healthy_transition_weightgain_2019_age_adj.csv
        table5: output/data/overweight_transition_weightgain_age_adj.csv 
        table6: output/data/overweight_transition_weightgain_2017_age_adj.csv 
        table7: output/data/overweight_transition_weightgain_2019_age_adj.csv 
        table8: output/data/overweight_transition_weightloss_age_adj.csv 
        table9: output/data/overweight_transition_weightloss_2017_age_adj.csv 
        table10: output/data/overweight_transition_weightloss_2019_age_adj.csv 
        table11: output/data/obese_transition_weightloss_age_adj.csv 
        table12: output/data/obese_transition_weightloss_2017_age_adj.csv 
        table13: output/data/obese_transition_weightloss_2019_age_adj.csv 

  bmi_category_transitions_admin:
    run: r:latest analysis/admin_round_bmi_category_transitions.R --output-dir=output/data 
    needs: [bmi_category_transitions_age_adjusted]
    outputs:
      moderately_sensitive:
        table1: output/data/bmi_category_transitions_round_2.csv


  bmi_category_transitions_counts: 
    run: r:latest analysis/BMI_category_transitions_counts.R --output-dir=output/data 
    needs: [generate_bmi_category_data]
    outputs:
      moderately_sensitive:
        table1: output/data/healthy_transition_weightgain_counts.csv
        table2: output/data/overweight_transition_weightgain_counts.csv
        table3: output/data/overweight_transition_weightloss_counts.csv
        table4: output/data/obese_transition_weightloss_counts.csv





###########################  
###########################  
## DWMP Eligible



  generate_DWMP_proportion:
    run: r:latest analysis/DWMP_proportion.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_DWMP_eligible_2019.csv
        table2: output/data/proportion_DWMP_eligible_2020.csv
        table3: output/data/proportion_DWMP_eligible_2021.csv

  generate_DWMP_hypertension_proportion:
    run: r:latest analysis/DWMP_proportion_hypertension.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_DWMP_hypertension_2019.csv
        table2: output/data/proportion_DWMP_hypertension_2020.csv
        table3: output/data/proportion_DWMP_hypertension_2021.csv

  generate_DWMP_t2dm_proportion:
    run: r:latest analysis/DWMP_proportion_t2dm.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_DWMP_T2DM_2019.csv
        table2: output/data/proportion_DWMP_T2DM_2020.csv
        table3: output/data/proportion_DWMP_T2DM_2021.csv


  generate_DWMP_t1dm_proportion:
    run: r:latest analysis/DWMP_proportion_t1dm.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_DWMP_T1DM_2019.csv
        table2: output/data/proportion_DWMP_T1DM_2020.csv
        table3: output/data/proportion_DWMP_T1DM_2021.csv

  DWMP_2017_2021_counts:
    run: r:latest analysis/DWMP_counts.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/DWMP_counts_total_pop.csv
        table2: output/data/DWMP_counts_all_eligible.csv
        table3: output/data/DWMP_counts_hypertension.csv
        table4: output/data/DWMP_counts_T1DM.csv
        table5: output/data/DWMP_counts_T2DM.csv

  DWMP_2017_2021_models:
    run: r:latest analysis/DWMP_counts_models.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/univariate_DWMP_hypertension.csv
        table2: output/data/univariate_DWMP_T2DM.csv
        table3: output/data/univariate_DWMP_T1DM.csv
        table4: output/data/age_adjusted_DWMP_hypertension.csv
        table5: output/data/age_adjusted_DWMP_T2DM.csv
        table6: output/data/age_adjusted_DWMP_T1DM.csv


## TOTAL ELIGIBLE USING ALL BMI DATA FROM LAST 5 YEARS
  DWMP_eligible_5yr_data:
    run: r:latest analysis/DWMP_eligibility/DWMP_eligible.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/DWMP_eligible_5yr_data_all.csv
        table2: output/data/DWMP_eligible_5yr_data_hypertension.csv
        table3: output/data/DWMP_eligible_5yr_data_T1DM.csv
        table4: output/data/DWMP_eligible_5yr_data_T2DM.csv
        table5: output/data/DWMP_eligible_5yr_data_years.csv

  DWMP_eligible_5yr_data_2019:
    run: r:latest analysis/DWMP_eligibility/DWMP_eligible_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/DWMP_eligible_5yr_data_all_2019.csv
        table2: output/data/DWMP_eligible_5yr_data_hypertension_2019.csv
        table3: output/data/DWMP_eligible_5yr_data_T1DM_2019.csv
        table4: output/data/DWMP_eligible_5yr_data_T2DM_2019.csv
        table5: output/data/DWMP_eligible_5yr_data_years_2019.csv

  obese_eligible_5yr_data:
    run: r:latest analysis/DWMP_eligibility/Obese_5yr.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_5yr_data_all.csv
        table2: output/data/obese_5yr_data_hypertension.csv
        table3: output/data/obese_5yr_data_T1DM.csv
        table4: output/data/obese_5yr_data_T2DM.csv
        table5: output/data/obese_5yr_data_years.csv

  obese_eligible_5yr_data_2019:
    run: r:latest analysis/DWMP_eligibility/Obese_5yr_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/obese_5yr_data_all_2019.csv
        table2: output/data/obese_5yr_data_hypertension_2019.csv
        table3: output/data/obese_5yr_data_T1DM_2019.csv
        table4: output/data/obese_5yr_data_T2DM_2019.csv
        table5: output/data/obese_5yr_data_years_2019.csv

##################################################################
### >> HAD_SBP ANALYSIS
######################################################################
# who had_bmi measured: 
  generate_had_sbp_proportion_2019:
    run: r:latest analysis/had_sbp_proportions_2019.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_sbp_2019.csv


  generate_had_sbp_proportion_2020:
    run: r:latest analysis/had_sbp_proportions_2020.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_sbp_2020.csv


  generate_had_sbp_proportion_2021:
    run: r:latest analysis/had_sbp_proportions_2021.R --output-dir=output/data 
    needs: [generate_complete_median_BMI_data]
    outputs:
      moderately_sensitive:
        table1: output/data/proportion_had_sbp_2021.csv


############################################################
## Hba1c
##############################################################

  generate_hba1c_2018_2019_data:
    run: r:latest analysis/hba1c_2018_2019.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/hba1c_2019_summary.feather
        cohort2: output/data/hba1c_2018_summary.feather
        cohort3: output/data/hba1c_2019_long.feather
        cohort4: output/data/hba1c_2018_long.feather
        cohort5: output/data/precovid_hba1c_control.feather
       
  generate_hba1c_2020_2021_data:
    run: r:latest analysis/hba1c_2020_2021.R --output-dir=output/data --output-format feather
    needs: [join_meds]
    outputs:
      highly_sensitive:
        cohort1: output/data/hba1c_2020_summary.feather
        cohort2: output/data/hba1c_2021_summary.feather
        cohort3: output/data/hba1c_2021_long.feather
        cohort4: output/data/hba1c_2020_long.feather




  T2DM_hba1c_proportions_2019:
    run: r:latest analysis/hba1c_had_proportion_2019_t2dm.R --output-dir=output/data --output-format feather
    needs: [generate_hba1c_2018_2019_data]
    outputs:
      moderately_sensitive:
        table1: output/data/T2DM_proportion_hba1c_2019.csv

  T2DM_hba1c_proportions_2020:
    run: r:latest analysis/hba1c_had_proportion_2020_t2dm.R --output-dir=output/data --output-format feather
    needs: [generate_hba1c_2018_2019_data, generate_hba1c_2020_2021_data]
    outputs:
      moderately_sensitive:
        table1: output/data/T2DM_proportion_hba1c_2020.csv

  T2DM_hba1c_proportions_2021:
    run: r:latest analysis/hba1c_had_proportion_2021_t2dm.R --output-dir=output/data --output-format feather
    needs: [generate_hba1c_2018_2019_data, generate_hba1c_2020_2021_data]
    outputs:
      moderately_sensitive:
        table1: output/data/T2DM_proportion_hba1c_2021.csv


  check_hba1c:
    run: r:latest analysis/check_hba1c.R --output-dir=output/data --output-format feather
    needs: [generate_study_population_1]
    outputs:
      moderately_sensitive:
        table1: output/data/check_hba1c.csv


  merge_tables:
    run: r:latest analysis/combine_proportions.R --output-dir=output/data --output-format feather
    needs: [generate_median_bmi_range_2019, generate_median_bmi_range_2020, generate_median_bmi_range_2021, generate_DWMP_proportion, generate_DWMP_hypertension_proportion, generate_DWMP_t2dm_proportion, generate_DWMP_t1dm_proportion, generate_had_bmi_proportion_2019, generate_had_bmi_proportion_2020, generate_had_bmi_proportion_2021, generate_obese_proportion_2019, generate_obese_proportion_2020, generate_obese_proportion_2021, generate_had_sbp_proportion_2019, generate_had_sbp_proportion_2020, generate_had_sbp_proportion_2021]
    outputs:
      moderately_sensitive:
        table1: output/data/had_bmi_all.csv
        table2: output/data/proportion_obese_all.csv
        table3: output/data/had_sbp_all.csv
        table4: output/data/DWMP_all.csv
        table5: output/data/DWMP_hypertension_all.csv
        table6: output/data/DWMP_T2DM_all.csv
        table7: output/data/DWMP_T1DM_all.csv
        table8: output/data/BMI_median_range_all.csv
        
  round_tables:
    run: r:latest analysis/admin_round_redact_table.R --output-dir=output/data --output-format feather
    needs: [bmi_change_univariate, bmi_change_category_tables, bmi_trajectory_change_summary]
    outputs:
      moderately_sensitive:
        table1: output/data/rapid_bmi_change_popcharac_round.csv
        table2: output/data/precovid_bmi_trajectories.round.csv
        table3: output/data/postcovid_bmi_trajectories.round.csv
        table4: output/data/mean_bmi_traj_change_round.csv

  round_tables_2:
    run: r:latest analysis/admin_round_2.R --output-dir=output/data --output-format feather
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      moderately_sensitive:
        table1: output/data/complete_bmi_trajectory_data.csv

###########
## SENSITIVITY ANALYSIS
###########

## Prepare for MICS

  MICE_data_1:
    run: r:latest analysis/sensitivity_analyses/MICE_data_prep1.R --output-dir=output/data --output-format feather
    needs: [BMI_trajectories_demographics_correction]
    outputs:
      highly_sensitive:
        table1: output/data/imputation_data_long.csv
  
  MICE_data_2:
    run: r:latest analysis/sensitivity_analyses/MICE_data_prep2.R --output-dir=output/data --output-format feather
    needs: [MICE_data_1]
    outputs:
      highly_sensitive:
        table1: output/data/imputation_dataframe.csv
        table2: output/data/imputation_DF_for_impute.csv
        table3: output/data/imputation_sample_missing.csv


  MICE_sample_data:
    run: r:latest analysis/sensitivity_analyses/MICE_sample_pop_demog.R --output-dir=output/data --output-format feather
    needs: [MICE_data_2]
    outputs:
      moderately_sensitive:
        table1: output/data/imputation_sample_pop_demographics.csv
        table2: output/data/imputation_sample_missing_data.csv


  MICE_model_check:
    run: r:latest analysis/sensitivity_analyses/MICE_model_check.R --output-dir=output/data --output-format feather
    needs: [MICE_data_1]
    outputs:
      highly_sensitive:
        table1: output/data/imputation_dataframe_check.csv
        table2: output/data/imputation_DF_for_impute_check.csv

  MICE_models_age:
    run: r:latest analysis/sensitivity_analyses/MICE_models_age_adj.R --output-dir=output/data --output-format feather
    needs: [MICE_data_2]
    outputs:
      moderately_sensitive:
        table1: output/data/imputation_age_adj.csv

  MICE_models_sex:
    run: r:latest analysis/sensitivity_analyses/MICE_models_sex.R --output-dir=output/data --output-format feather
    needs: [MICE_data_2]
    outputs:
      moderately_sensitive:
        table1: output/data/imputation_sex_adj.csv

  MICE_models_age_sex:
    run: r:latest analysis/sensitivity_analyses/MICE_models_age_sex.R --output-dir=output/data --output-format feather
    needs: [MICE_data_2]
    outputs:
      moderately_sensitive:
        table1: output/data/imputation_age_sex_adj.csv

  MICE_data_3:
    run: r:latest analysis/sensitivity_analyses/MICE_data_prep3.R --output-dir=output/data --output-format feather
    needs: [MICE_data_2, MICE_sample_data]
    outputs:
      moderately_sensitive:
        table1: output/data/imputation_univariate.csv
        table2: output/data/imputation_sample_pop_demographic_round.csv

Timeline

  • Created:

  • Started:

  • Finished:

  • Runtime:

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

Job information

Status
Succeeded
Backend
TPP
Workspace
bmi_and_hba1c
Requested by
Miriam Samuel
Branch
main
Force run dependencies
No
Git commit hash
4ccfda3
Requested actions
  • bmi_gain_top_decile_lowbmiexc_univariate
  • bmi_gain_top_decile_lowbmiexc_age
  • bmi_gain_top_decile_lowbmiexc_sex
  • bmi_gain_top_decile_lowbmiexc_agesex
  • bmi_positive_trajectory_change_proportion
  • bmi_positive_trajectory_change_chi
  • bmi_trajectory_change_precovid_change_lowbmiexc
  • bmi_trajectory_change_precovid_change
  • bmi_trajectory_change_lowbmi_excluded_complete_data_chi
  • DWMP_eligible_5yr_data_2019
  • obese_eligible_5yr_data_2019