Skip to content

Job request: 10281

Workspace:
service_eval_work
ID:
gfyzg6redoquwbtv

This page shows the technical details of what happened when authorised researcher Billy Zhong 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: 1000

actions:

  generate_study_population:
    run: cohortextractor:latest generate_cohort --study-definition study_definition --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_*.csv.gz

  generate_study_population_broad_comparison:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_broad_comparison --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_broad_*.csv.gz
  
  generate_study_population_covidcheck:
      run: cohortextractor:latest generate_cohort --study-definition study_definition_covidcheck_2 
        --output-format=csv.gz
      outputs:
        highly_sensitive:
          cohort: output/input_covidcheck_2.csv.gz

  generate_study_population_samedayab:
      run: cohortextractor:latest generate_cohort --study-definition study_definition_sameday_ab 
        --output-format=csv.gz
      outputs:
        highly_sensitive:
          cohort: output/input_sameday_ab.csv.gz

  generate_study_population_withab:
      run: cohortextractor:latest generate_cohort --study-definition study_definition_withab_cohort 
        --output-format=csv.gz
      outputs:
        highly_sensitive:
          cohort: output/input_withab_cohort.csv.gz

  generate_study_population_infection:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_infection --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_infection_*.csv.gz
  
  generate_study_population_indication:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_indication --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_indication_*.csv.gz

  generate_study_population_elderly:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_elderly 
      --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/input_elderly.csv.gz

  generate_measures:
    run: cohortextractor:latest generate_measures --study-definition study_definition --skip-existing --output-dir=output/measures
    needs: [generate_study_population]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_*.csv
  
  generate_measures_infection:
    run: cohortextractor:latest generate_measures --study-definition study_definition_infection --skip-existing --output-dir=output/measures
    needs: [generate_study_population_infection]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_infection_*.csv
  
  generate_measures_indication:
    run: cohortextractor:latest generate_measures --study-definition study_definition_indication --skip-existing --output-dir=output/measures
    needs: [generate_study_population_indication]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_indication_*.csv

  generate_measures_broad:
    run: cohortextractor:latest generate_measures --study-definition study_definition_broad_comparison --skip-existing --output-dir=output/measures
    needs: [generate_study_population_broad_comparison]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_broad_*.csv

## for appropriateness of antibiotic prescribing 
  # generate_study_population_repeat_antibiotics: 
  #   run: cohortextractor:latest generate_cohort --study-definition study_definition_ab_repeat --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
  #   outputs:
  #     highly_sensitive:
  #       cohort: output/measures/input_ab_repeat_*.csv.gz

  # describe_repeat_ab_process:
  #   run: r:latest analysis/process/ab_repeat_transform.R
  #   needs: [generate_study_population_repeat_antibiotics]
  #   outputs:
  #      moderately_sensitive:
  #       rds1: output/measures/repeatab_uti.rds
  #       rds2: output/measures/repeatab_lrti.rds
  #       rds3: output/measures/repeatab_urti.rds


        
  # describe_elderly_agedis:
  #   run: r:latest analysis/tables/gen_csv_age_check.R
  #   needs: [generate_study_population_elderly]
  #   outputs:
  #     moderately_sensitive:
  #       agetable: output/age_quant.csv

  # describe:
  #   run: r:latest analysis/plot/overall_ab_prescribing.R
  #   needs: [generate_measures]
  #   outputs:
  #     moderately_sensitive:
  #       cohort: output/overall.png
  #       boxplot: output/overallbox.png

  describe_percentile:
    run: r:latest analysis/plot/overall_ab_prescribing_2575percentile.R
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        percentile: output/overall_25th_75th_percentile.jpeg
        table_total: output/total_number_antibacterial_prescriptions.csv

  describe_percentile_starpu:
    run: r:latest analysis/plot/starpu_ab_percentile.R
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        percentile_STARPU: output/overall_25th_75th_percentile_STARPU.jpeg
        percentile_csv_STARPU: output/monthly_quantile_ab_STARPU.csv
  
  # generate_notebook_starpu:
  #   run: jupyter:latest jupyter nbconvert /workspace/analysis/starpu.ipynb --execute --to html --output-dir=/workspace/output --ExecutePreprocessor.timeout=86400
  #   needs: [generate_measures]
  #   outputs:
  #     moderately_sensitive:
  #       notebook: output/starpu.html 
  #       figures: output/*
  #       #tables: output/tables/*
  #       #csvs: output/*/* # two possible subfolders
  #       #text: output/text/*
  
  describe_service_eval_baseline_table:
    run: r:latest analysis/tables/baseline_table.R
    needs: [generate_study_population]
    outputs:
      moderately_sensitive:
        baseline_overall: output/overall_counts_blt.csv
        baseline_table: output/blt_one_random_obs_perpat.csv

  describe_baseline_table_split_2019:
    run: r:latest analysis/tables/baseline_table_2019.R
    needs: [describe_basic_record_process]
    outputs:
      moderately_sensitive:
        baseline_overall_2019: output/overall_counts_blt_2019.csv
        baseline_table_2019: output/blt_one_random_obs_perpat_2019.csv

  describe_baseline_table_split_2020:
    run: r:latest analysis/tables/baseline_table_2020.R
    needs: [describe_basic_record_process]
    outputs:
      moderately_sensitive:
        baseline_overall_2020: output/overall_counts_blt_2020.csv
        baseline_table_2020: output/blt_one_random_obs_perpat_2020.csv

  describe_baseline_table_split_2021:
    run: r:latest analysis/tables/baseline_table_2021.R
    needs: [describe_basic_record_process]
    outputs:
      moderately_sensitive:
        baseline_overall_2021: output/overall_counts_blt_2021.csv
        baseline_table_2021: output/blt_one_random_obs_perpat_2021.csv
    
  describe_baseline_table_split_2022:
    run: r:latest analysis/tables/baseline_table_2022.R
    needs: [describe_basic_record_process]
    outputs:
      moderately_sensitive:
        baseline_overall_2022: output/overall_counts_blt_2022.csv
        baseline_table_2022: output/blt_one_random_obs_perpat_2022.csv

  describe_service_eval_covid_check:
    run: r:latest analysis/tables/baseline_table_covid_check.R
    needs: [generate_study_population_covidcheck]
    outputs:
      moderately_sensitive:
        baseline_covidcheck: output/overall_covid.csv
        blt_covidcheck: output/blt_covid_check.csv

  # describe_consultation_rate:
  #   run: r:latest analysis/plot/incident_consultation_age_stacked_barchart.R
  #   needs: [generate_measures]
  #   outputs:
  #      moderately_sensitive:
  #       bar1: output/consult_age_UTI.png
  #       bar2: output/consult_age_LRTI.png
  #       bar3: output/consult_age_URTI.png
  #       bar4: output/consult_age_sinusitis.png
  #       bar5: output/consult_age_ot_externa.png
  #       bar6: output/consult_age_otmedia.png
  #       bar7: output/consult_age_repeatedUTI.png
       


  # describe_consultation_prescribed:
  #   run: r:latest analysis/plot/consultation_prescibed_percentage.R
  #   needs: [generate_study_population]
  #   outputs:
  #      moderately_sensitive:
  #       bar1: output/prescribed_percentage_UTI.png
  #       csvs: output/uti_prescrib_check.csv
     

  #generate_notebook_starpu:
  #  run: jupyter:latest jupyter nbconvert /workspace/analysis/starpu.ipynb --execute --to html --output-dir=/workspace/output/hospitalisation_risk --ExecutePreprocessor.timeout=86400
  #  needs: [generate_measures]
  #  outputs:
  #    moderately_sensitive:
  #      notebook: output/hospitalisation_risk/starpu.html 
  #      figures: output/hospitalisation_risk/*
        #tables: output/tables/*
        #csvs: output/*/* # two possible subfolders
        #text: output/text/*

  # generate_notebook_hospitalisation_analysis:
  #   run: jupyter:latest jupyter nbconvert /workspace/analysis/hospitalisation_analysis.ipynb --execute --to html --output-dir=/workspace/output/hospitalisation_risk --ExecutePreprocessor.timeout=86400
  #   needs: [generate_study_population]
  #   outputs:
  #   moderately_sensitive:
  #       notebook: output/hospitalisation_risk/hospitalisation_analysis.html 
  #       figures: output/hospitalisation_risk/*
    
  # generate_notebook_hospitalisation_analysis:
  #   run: jupyter:latest jupyter nbconvert /workspace/analysis/hospitalisation_analysis.ipynb --execute --to html --output-dir=/workspace/output/hospitalisation_risk --ExecutePreprocessor.timeout=86400
  #   needs: [generate_study_population]
  #   outputs:
  #     moderately_sensitive:
  #       notebook: output/hospitalisation_risk/hospitalisation_analysis.html 
  #       figures: output/hospitalisation_risk/*

  describe_prior_ab_12mb4:
    run: r:latest analysis/plot/ab_1yb4_stackedbar_2.R
    needs: [generate_study_population]
    outputs:
       moderately_sensitive:
        plot: output/AB_1yb4_line.jpeg
        plot_sex: output/AB_1yb4_SEX.jpeg
        #count_table: output/prior_ab_by_month.csv      


  describe_consultation_rate_all_incident:
    run: r:latest analysis/plot/consultation_by_age_infection_incident.R
    needs: [generate_measures_infection]
    outputs:
       moderately_sensitive:
        plot1.1: output/consult_age_incident_UTI.jpeg
        plot1.2: output/consult_age_incident_URTI.jpeg
        plot1.3: output/consult_age_incident_LRTI.jpeg
        plot1.4: output/consult_age_incident_sinusitis.jpeg
        plot1.5: output/consult_age_incident_otmedia.jpeg
        plot1.6: output/consult_age_incident_ot_externa.jpeg
        plot2: output/consult_all_incident.jpeg
        csv1: output/consultation_rate_incident.csv
        csv2: output/consultation_GP_rate_incident.csv
  
  describe_consultation_rate_all_prevalent:
    run: r:latest analysis/plot/consultation_by_age_infection_prevalent.R
    needs: [generate_measures_infection]
    outputs:
       moderately_sensitive:
        plot1.1: output/consult_age_prevalent_UTI.jpeg
        plot1.2: output/consult_age_prevalent_URTI.jpeg
        plot1.3: output/consult_age_prevalent_LRTI.jpeg
        plot1.4: output/consult_age_prevalent_sinusitis.jpeg
        plot1.5: output/consult_age_prevalent_otmedia.jpeg
        plot1.6: output/consult_age_prevalent_ot_externa.jpeg
        plot2: output/consult_all_prevalent.jpeg
        csv1: output/consultation_rate_prevalent.csv
        csv2: output/consultation_GP_rate_prevalent.csv
  
  describe_consultation_rate_all_incident_redacted:
    run: r:latest analysis/redaction/consultation_by_age_infection_incident.R
    needs: [generate_measures_infection,generate_measures_indication]
    outputs:
       moderately_sensitive:
        plot1.1: output/redacted/consult_age_incident_UTI.jpeg
        plot1.2: output/redacted/consult_age_incident_URTI.jpeg
        plot1.3: output/redacted/consult_age_incident_LRTI.jpeg
        plot1.4: output/redacted/consult_age_incident_sinusitis.jpeg
        plot1.5: output/redacted/consult_age_incident_otmedia.jpeg
        plot1.6: output/redacted/consult_age_incident_ot_externa.jpeg
        plot1.7: output/redacted/consult_age_incident_all.jpeg
        csv1: output/redacted/consultation_rate_incident_check.csv
        csv2: output/redacted/consultation_rate_incident.csv
        csv3:  output/redacted/consultation_rate_incident_year.csv


  describe_consultation_rate_all_prevalent_redacted:
    run: r:latest analysis/redaction/consultation_by_age_infection_prevalent.R
    needs: [generate_measures_infection,generate_measures_indication]
    outputs:
       moderately_sensitive: 
        plot1.1: output/redacted/consult_age_prevalent_UTI.jpeg
        plot1.2: output/redacted/consult_age_prevalent_URTI.jpeg
        plot1.3: output/redacted/consult_age_prevalent_LRTI.jpeg
        plot1.4: output/redacted/consult_age_prevalent_sinusitis.jpeg
        plot1.5: output/redacted/consult_age_prevalent_otmedia.jpeg
        plot1.6: output/redacted/consult_age_prevalent_ot_externa.jpeg
        plot1.7: output/redacted/consult_age_prevalent_all.jpeg        
        csv1: output/redacted/consultation_rate_prevalent_check.csv
        csv2: output/redacted/consultation_rate_prevalent.csv
        csv3:  output/redacted/consultation_rate_prevalent_year.csv

  describe_consultation_rate_all_GP_redacted:
    run: r:latest analysis/redaction/consultation_by_age_infection_GP.R
    needs: [generate_measures_infection]
    outputs:
       moderately_sensitive: 
        plot1: output/redacted/consult_all_prevalent.jpeg
        plot2: output/redacted/consult_all_incident.jpeg
        plot3: output/redacted/consult_all.jpeg
        csv1: output/redacted/consultation_rate_GP_check.csv
        csv1.2: output/redacted/consultation_all_GP_check.csv
        csv2: output/redacted/consultation_GP_rate_prevalent.csv
        csv3: output/redacted/consultation_GP_rate_incident.csv
        csv4: output/redacted/consultation_GP_rate_all.csv
        table: output/redacted/consultation_GP_rate_yr.csv


  describe_consultation_model_process_1:
    run: r:latest analysis/process/consultation_variables_1.R
    needs: [generate_measures_indication,generate_measures_infection, describe_basic_record_process]
    outputs:
       moderately_sensitive:
        rds1: output/measures/consult_UTI.rds
        rds2: output/measures/consult_LRTI.rds
        rds3: output/measures/consult_URTI.rds
        rds4: output/measures/consult_sinusitis.rds
        rds5: output/measures/consult_otmedia.rds
        rds6: output/measures/consult_ot_externa.rds
        rds7: output/measures/consult_indications.rds


  describe_consultation_model_process_2:
    run: r:latest analysis/process/consultation_variables_2.R
    needs: [describe_consultation_model_process_1]
    outputs:
       moderately_sensitive:
        rds1: output/measures/monthly_consult_UTI.rds
        rds2: output/measures/monthly_consult_LRTI.rds
        rds3: output/measures/monthly_consult_URTI.rds
        rds4: output/measures/monthly_consult_sinusitis.rds
        rds5: output/measures/monthly_consult_otmedia.rds
        rds6: output/measures/monthly_consult_ot_externa.rds
  
  # # # # describe_consultation_model_1:
  # # # #   run: r:latest analysis/model/consult_model_1.R
  # # # #   needs: [describe_consultation_model_process_2]
  # # # #   outputs:
  # # # #      moderately_sensitive:
  # # # #       jpeg: output/consult_model1.jpeg
  # # # #       rds: output/consult_model1.rds

  # # # # describe_consultation_model_2:
  # # # #   run: r:latest analysis/model/consult_model_2.R
  # # # #   needs: [describe_consultation_model_process_2]
  # # # #   outputs:
  # # # #      moderately_sensitive:
  # # # #       jpeg: output/consult_model2.jpeg
  # # # #       rds: output/consult_model2.rds
  
  # describe_consultation_model_3:
  #   run: r:latest analysis/model/consult_model_3.R
  #   needs: [describe_consultation_model_process_2]
  #   outputs:
  #      moderately_sensitive:
  #       jpeg: output/consult_model3.jpeg
  #       rds: output/consult_model3.rds

  # # # # check_consultation_model: #Poisson vs. NBR  
  # # # #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model.Rmd", output_dir = "output/report")'
  # # # #   needs: [describe_consultation_model_process_2]
  # # # #   outputs:
  # # # #     moderately_sensitive:
  # # # #       html: output/report/check_consultation_model.html

  # # # # consultation_model: # compare modeling1 &2
  # # # #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model.rmd", output_dir = "output/report")'
  # # # #   needs: [describe_consultation_model_process_1]
  # # # #   outputs:
  # # # #     moderately_sensitive:
  # # # #       html: output/report/consultation_model.html


  consultation_model_ITS2: # compare modeling1 &2
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2.rmd", output_dir = "output/report")'
    needs: [describe_consultation_model_process_1]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2.html

  consultation_model_ITS2_incident: 
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_incident.Rmd", output_dir = "output/report")'
    needs: [describe_consultation_rate_all_incident_redacted]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2_incident.html

  consultation_model_ITS2_prevalent: 
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_prevalent.Rmd", output_dir = "output/report")'
    needs: [describe_consultation_rate_all_prevalent_redacted]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2_prevalent.html
  
  consultation_model_ITS2_combined: # overall, incident, prevalent
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_combined.rmd", output_dir = "output/report")'
    needs: [describe_consultation_model_process_1,describe_consultation_rate_all_incident_redacted,describe_consultation_rate_all_prevalent_redacted]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2_combined.html
  
  consultation_model_ITS2_combined_plot: # overall, incident, prevalent
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_combined_plot.rmd", output_dir = "output/report")'
    needs: [describe_consultation_model_process_1,describe_consultation_rate_all_incident_redacted,describe_consultation_rate_all_prevalent_redacted]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2_combined_plot.html
        csv: output/report/consultation_ITS_plot_indicetnt.csv

  
  consultation_model_ITS2_combined_recovery: # overall, incident, prevalent
    run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_combined_recovery.rmd", output_dir = "output/report")'
    needs: [describe_consultation_model_process_1,describe_consultation_rate_all_incident_redacted,describe_consultation_rate_all_prevalent_redacted]
    outputs:
      moderately_sensitive:
        html: output/report/consultation_model_ITS2_combined_recovery.html

  # # # # consultation_model_ITS2_harmonic_month: #sine,cosine harmonic month
  # # # #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_harmonic_month.Rmd", output_dir = "output/report")'
  # # # #   needs: [describe_consultation_model_process_1]
  # # # #   outputs:
  # # # #     moderately_sensitive:
  # # # #       html: output/report/consultation_model_ITS2_harmonic_month.html

  # # # # consultation_model_ITS2_harmonic_month_incident: 
  # # # #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_harmonic_month_incident.Rmd", output_dir = "output/report")'
  # # # #   needs: [describe_consultation_rate_all_incident_redacted]
  # # # #   outputs:
  # # # #     moderately_sensitive:
  # # # #       html: output/report/consultation_model_ITS2_harmonic_month_incident.html

  # # # # consultation_model_ITS2_harmonic_month_prevalent: 
  # # # #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_ITS2_harmonic_month_prevalent.Rmd", output_dir = "output/report")'
  # # # #   needs: [describe_consultation_rate_all_prevalent_redacted]
  # # # #   outputs:
  # # # #     moderately_sensitive:
  # # # #       html: output/report/consultation_model_ITS2_harmonic_month_prevalent.html

  # consultation_model_zero_truncated: # zero-truncated negative binomial
  #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_zero_truncated.rmd", output_dir = "output/report")'
  #   needs: [describe_consultation_model_process_1]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/consultation_model_zero_truncated.html

  # consultation_model_3: # model 3 for adjusting autocorrelation
  #   run: r:latest -e 'rmarkdown::render("analysis/model/consultation_model_3.rmd", output_dir = "output/report")'
  #   needs: [describe_consultation_model_process_1]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/consultation_model_3.html

  # check_consultation_model_urti: #  
  #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model_urti.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures_infection, describe_basic_record_process]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/check_consultation_model_urti.html

  # check_consultation_model_lrti: #  
  #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model_lrti.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures_infection, describe_basic_record_process]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/check_consultation_model_lrti.html

  # check_consultation_model_sinusitis: #  
  #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model_sinusitis.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures_infection, describe_basic_record_process]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/check_consultation_model_sinusitis.html

  # check_consultation_model_ot_externa: #  
  #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model_ot_externa.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures_infection, describe_basic_record_process]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/check_consultation_model_ot_externa.html

  # check_consultation_model_otmedia: #  
  #   run: r:latest -e 'rmarkdown::render("analysis/process/report/check_consultation_model_otmedia.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures_infection, describe_basic_record_process]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/check_consultation_model_otmedia.html


  # # describe_infection_prescribed_percent:
  # #   run: r:latest analysis/plot/infection_prescibed_percent.R
  # #   needs: [generate_measures_infection]
  # #   outputs:
  # #      moderately_sensitive:
  # #       plot1: output/infection_ab_precent_p1.jpeg
  # #       plot2: output/infection_ab_precent_p2.jpeg
  # #       plot3: output/infection_ab_precent_i1.jpeg
  # #       plot4: output/infection_ab_precent_i2.jpeg
  # #       plot5: output/infection_ab_precent_all.jpeg
  # #       csv1: output/prescribed_infection_prevalent.csv
  # #       csv2: output/prescribed_infection_incident.csv

  # # describe_top10ABtypes_byInfection:
  # #   run: r:latest analysis/plot/abtypes_top10.R
  # #   needs: [generate_measures_infection]
  # #   outputs:
  # #      moderately_sensitive:
  # #       plot1: output/abtype_UTI.jpeg
  # #       plot2: output/abtype_URTI.jpeg
  # #       plot3: output/abtype_LRTI.jpeg
  # #       plot4: output/abtype_sinusitis.jpeg
  # #       plot5: output/abtype_ot_externa.jpeg
  # #       plot6: output/abtype_otmedia.jpeg
  # #       plot7: output/abtype_percent_UTI.jpeg
  # #       plot8: output/abtype_percent_URTI.jpeg
  # #       plot9: output/abtype_percent_LRTI.jpeg
  # #       plot10: output/abtype_percent_sinusitis.jpeg
  # #       plot11: output/abtype_percent_ot_externa.jpeg
  # #       plot12: output/abtype_percent_otmedia.jpeg
  # #       csv: output/abtype_top10_by_infection.csv
  
  # # describe_top10ABtypes_byInfection_line:
  # #   run: r:latest analysis/plot/abtypes_top10_line.R
  # #   needs: [generate_measures_infection]
  # #   outputs:
  # #      moderately_sensitive:
  # #       plot13: output/abtype_UTI_line.jpeg
  # #       plot14: output/abtype_URTI_line.jpeg
  # #       plot15: output/abtype_LRTI_line.jpeg
  # #       plot16: output/abtype_sinusitis_line.jpeg
  # #       plot17: output/abtype_ot_externa_line.jpeg
  # #       plot18: output/abtype_otmedia_line.jpeg
  # #       plot19: output/abtype_percent_UTI_line.jpeg
  # #       plot20: output/abtype_percent_URTI_line.jpeg
  # #       plot21: output/abtype_percent_LRTI_line.jpeg
  # #       plot22: output/abtype_percent_sinusitis_line.jpeg
  # #       plot23: output/abtype_percent_ot_externa_line.jpeg
  # #       plot24: output/abtype_percent_otmedia_line.jpeg
  # #       csv: output/abtype_top10_by_infection_line.csv
  
  # describe_top10ABtypes_total:
  #   run: r:latest analysis/plot/types_ab_prescriptions.R
  #   needs: [generate_study_population]
  #   outputs:
  #      moderately_sensitive:
  #       plot1: output/abtype_all_Rx.jpeg
  #       plot2: output/abtype_all_Rx_percent.jpeg

  describe_same_day_ab:
    run: r:latest analysis/plot/same_day_covid_ab.R
    needs: [generate_study_population_samedayab]
    outputs:
       moderately_sensitive:
        table1: output/sameday_positive_1_sgss.csv
        table2: output/sameday_positive_2_sgss.csv
        table3: output/sameday_ab_1_sgss.csv
        table4: output/sameday_ab_2_sgss.csv
        table5: output/sameday_positive_1_gp.csv
        table6: output/sameday_positive_2_gp.csv
        table7: output/sameday_ab_1_gp.csv
        table8: output/sameday_ab_2_gp.csv
        table9: output/same_day_ab_prop_line_sgss_table.csv
        table10: output/same_day_ab_prop_line_gp_table.csv
        plot1: output/same_day_ab_prop_line_sgss.jpeg
        plot2: output/same_day_ab_prop_line_gp.jpeg

  describe_broad_by_region:
    run: r:latest analysis/plot/broad_percentage_by_region.R
    needs: [generate_study_population_withab,describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        plot1: output/broad_prescriptions_by_region.jpeg
        plot2: output/broad_proportion_by_region.jpeg

  describe_broad_by_age:
    run: r:latest analysis/plot/broad_percentage_by_age.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        plot1: output/broad_prescriptions_by_age.jpeg
        plot2: output/broad_proportion_by_age.jpeg

  describe_broad_by_region_noA:
    run: r:latest analysis/plot/broad_percentage_by_region_noA.R
    needs: [generate_study_population_withab,describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        plot1: output/broad_prescriptions_by_region_noA.jpeg
        plot2: output/broad_proportion_by_region_noA.jpeg

  describe_broad_by_age_noA:
    run: r:latest analysis/plot/broad_percentage_by_age_noA.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        plot1: output/broad_prescriptions_by_age_noA.jpeg
        plot2: output/broad_proportion_by_age_noA.jpeg

  describe_amoxicillin_by_age:
    run: r:latest analysis/plot/amoxicillin_percentage_by_age.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        plot1: output/amoxicillin_prescriptions_by_age.jpeg
        plot2: output/amoxicillin_proportion_by_age.jpeg

  # describe_same_day_ab_gp:
  #   run: r:latest analysis/plot/same_day_covid_ab_gp.R
  #   needs: [generate_measures]
  #   outputs:
  #      moderately_sensitive:
  #       plot: output/same_day_ab_prop_line_gp.jpeg

  generate_study_population_antibiotics: #  Antibiotics_recorded_01
    run: cohortextractor:latest generate_cohort --study-definition study_definition_antibiotics --index-date-range "2019-01-01 to today" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_antibiotics_*.csv.gz

### generate study cohort with the date of each prescriptions
  generate_study_population_antibiotics_tpye: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_antibiotics_type --index-date-range "2019-01-01 to today" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_antibiotics_type_*.csv.gz

### generate study cohort three months before 2019-01-01 to get the incident infection information
  generate_study_population_antibiotics_tpye_pre: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_antibiotics_type_pre --index-date-range "2018-01-01 to 2018-12-31" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_antibiotics_type_pre_*.csv.gz

### generate study cohort with the date of each infection
  generate_study_population_infection_all: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_infection_all --index-date-range "2019-01-01 to today" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_infection_all_*.csv.gz

### generate study cohort three months before 2019-01-01 to get the incident infection information
  generate_study_population_infection_all_pre: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_infection_all_pre --index-date-range "2018-10-01 to 2018-12-31" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_infection_all_pre_*.csv.gz

  generate_study_population_antibiotics_covid: #  Ab for covid
    run: cohortextractor:latest generate_cohort --study-definition study_definition_antibiotics_covid --index-date-range "2019-01-01 to today" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_antibiotics_covid_*.csv.gz

  describe_ab_recoded_covid_process:
    run: r:latest analysis/process/ab_covid_transform.R
    needs: [generate_study_population_antibiotics_covid]
    outputs:
       highly_sensitive:
        rds1: output/measures/recorded_ab_covid_2019.rds
        rds2: output/measures/recorded_ab_covid_2020.rds
        rds3: output/measures/recorded_ab_covid_2021.rds
       # rds4: output/measures/recorded_ab_covid_2022.rds

# used describe_ab_recoded_broad_process instead
  # describe_ab_recoded_indication_process: #  Antibiotics_recorded_02: generate prescription-level dataset 
  #   run: r:latest analysis/process/ab_recorded_indication_transform.R
  #   needs: [generate_study_population_antibiotics_antibiotics]
  #   outputs:
  #      highly_sensitive:
  #       rds1: output/measures/recorded_ab_2019.rds
  #       rds2: output/measures/recorded_ab_2020.rds
  #       rds3: output/measures/recorded_ab_2021.rds
  #       rds4: output/measures/recorded_ab_2022.rds

  describe_ab_recoded_indication_plot_incident: 
    run: r:latest analysis/plot/ab_recorded_indication_plot_incident.R
    needs: [describe_ab_recoded_broad_process] # transfrom & define all variables
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_incident_bar.jpeg
        plot2: output/ab_recorded_incident_line.jpeg
        plot3: output/ab_recorded_incident_bar_2.jpeg
        csv: output/ab_recorded_incident.csv

  describe_ab_recoded_indication_plot_prevalent: 
    run: r:latest analysis/plot/ab_recorded_indication_plot_prevalent.R
    needs: [describe_ab_recoded_broad_process]
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_prevalent_bar.jpeg
        plot2: output/ab_recorded_prevalent_line.jpeg
        plot3: output/ab_recorded_prevalent_bar_2.jpeg
        csv: output/ab_recorded_prevalent.csv

  ab_recoded_indication_ITS2_plot: # overall, incident, prevalent
    run: r:latest -e 'rmarkdown::render("analysis/model/ab_recoded_indication_ITS2_plot.rmd", output_dir = "output/report")'
    needs: [describe_ab_recoded_indication_plot_prevalent,describe_ab_recoded_indication_plot_incident]
    outputs:
      moderately_sensitive:
        html: output/report/ab_recoded_indication_ITS2_plot.html

  describe_ab_recoded_covid_plot_incident: # ab prescription on covid infection date
    run: r:latest analysis/plot/ab_recorded_covid_plot_incident.R
    needs: [describe_ab_recoded_covid_process] 
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_covid_incident_bar.jpeg
        plot2: output/ab_recorded_covid_incident_line.jpeg
        csv: output/ab_recorded_covid_incident.csv

  describe_ab_recoded_covid_plot_prevalent: 
    run: r:latest analysis/plot/ab_recorded_covid_plot_prevalent.R
    needs: [describe_ab_recoded_covid_process]
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_covid_prevalent_bar.jpeg
        plot2: output/ab_recorded_covid_prevalent_line.jpeg
        csv: output/ab_recorded_covid_prevalent.csv
  
  describe_ab_recoded_covid_all_plot_incident: # combind all indication and covid
    run: r:latest analysis/plot/ab_recorded_indic_plus_covid_plot_incident.R
    needs: [describe_ab_recoded_covid_plot_incident,describe_ab_recoded_indication_plot_incident] 
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_covid_indication_incident_bar.jpeg
        plot2: output/ab_recorded_covid_indication_incident_line.jpeg
        csv: output/ab_recorded_covid_indication_incident.csv
  
  describe_ab_recoded_covid_all_plot_prevalent: 
    run: r:latest analysis/plot/ab_recorded_indic_plus_covid_plot_prevalent.R
    needs: [describe_ab_recoded_covid_plot_prevalent,describe_ab_recoded_indication_plot_prevalent] 
    outputs:
       moderately_sensitive:
        plot1: output/ab_recorded_covid_indication_prevalent_bar.jpeg
        plot2: output/ab_recorded_covid_indication_prevalent_line.jpeg
        csv: output/ab_recorded_covid_indication_prevalent.csv

  describe_ab_recoded_broad_process:
    run: r:latest analysis/process/broad_transform.R
    needs: [generate_study_population_antibiotics]
    outputs:
       highly_sensitive:
        rds1: output/measures/recorded_ab_broad_2019.rds
        rds2: output/measures/recorded_ab_broad_2020.rds
        rds3: output/measures/recorded_ab_broad_2021.rds
        rds4: output/measures/recorded_ab_broad_2022.rds

###### ab record transform process ######

  describe_ab_type_process_1:
    run: r:latest analysis/process/ab_type_transform_1.R
    needs: [generate_study_population_antibiotics_tpye]
    outputs:
       highly_sensitive:
        rds1: output/measures/ab_type_2019.rds
        rds2: output/measures/ab_type_2020.rds

  describe_ab_type_process_2:
    run: r:latest analysis/process/ab_type_transform_2.R
    needs: [generate_study_population_antibiotics_tpye]
    outputs:
       highly_sensitive:
        rds1: output/measures/ab_type_2021.rds
        # rds2: output/measures/ab_type_2022.rds

  describe_ab_type_process_3:
    run: r:latest analysis/process/ab_type_transform_3.R
    needs: [generate_study_population_antibiotics_tpye]
    outputs:
       highly_sensitive:
        rds1: output/measures/ab_type_2022.rds

  describe_ab_type_process_pre:
    run: r:latest analysis/process/ab_type_transform_pre.R
    needs: [generate_study_population_antibiotics_tpye_pre]
    outputs:
       highly_sensitive:
        rds1: output/measures/ab_type_pre.rds

###### infection record transform process ######

  describe_infection_all_process_1:
    run: r:latest analysis/process/ab_infection_all_transform_1.R
    needs: [generate_study_population_infection_all]
    outputs:
       highly_sensitive:
        rds1: output/measures/infect_all_2019.rds
        rds2: output/measures/infect_all_2020.rds
        rds3: output/measures/infect_all_2021.rds

  describe_infection_all_process_2:
    run: r:latest analysis/process/ab_infection_all_transform_2.R
    needs: [generate_study_population_infection_all]
    outputs:
       highly_sensitive:
        rds1: output/measures/infect_all_2022.rds

  describe_infection_all_process_pre:
    run: r:latest analysis/process/ab_infection_all_transform_pre.R
    needs: [generate_study_population_infection_all_pre]
    outputs:
       highly_sensitive:
        rds1: output/measures/infect_all_pre.rds

#############################################################################

  describe_cleaning_process:
    run: r:latest analysis/process/cleaning_process.R
    needs: [describe_infection_all_process_1,describe_infection_all_process_2,describe_infection_all_process_pre,
    describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       highly_sensitive:
        rds1: output/measures/cleaned_ab_infection.rds

  describe_cleaning_process_2:
    run: r:latest analysis/process/cleaning_process_2.R
    needs: [describe_cleaning_process]
    outputs:
       highly_sensitive:
        rds1: output/measures/cleaned_indication_ab.rds

  describe_cleaning_process_3:
    run: r:latest analysis/process/cleaning_id_extraction.R
    needs: [describe_cleaning_process_2]
    outputs:
       highly_sensitive:
        talbe1: output/ab_id_date.csv

  describe_cleaning_process_2019:
    run: r:latest analysis/process/cleaning_id_extraction_2019.R
    needs: [describe_cleaning_process_2]
    outputs:
       highly_sensitive:
        talbe1: output/ab_id_date_2019.csv
       moderately_sensitive:
        table1: output/num_pats_count.csv

  describe_cleaning_process_2020:
    run: r:latest analysis/process/cleaning_id_extraction_2020.R
    needs: [describe_cleaning_process_2]
    outputs:
       highly_sensitive:
        talbe1: output/ab_id_date_2020.csv
       moderately_sensitive:
        table1: output/num_pats_count_2020.csv

  describe_cleaning_process_2021:
    run: r:latest analysis/process/cleaning_id_extraction_2021.R
    needs: [describe_cleaning_process_2]
    outputs:
       highly_sensitive:
        talbe1: output/ab_id_date_2021.csv
       moderately_sensitive:
        table1: output/num_pats_count_2021.csv

  describe_ab_table:
    run: r:latest analysis/tables/repeat_ab_all_record.R
    needs: [describe_cleaning_process]
    outputs:
       moderately_sensitive:
        table1: output/same_day_ab_by_infection.csv
        table2: output/incidental_repeat_ab_table.csv

#############################################################################

  describe_ITS_var_process:
    run: r:latest analysis/process/ITS_var.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.model_asthma.csv
        table2: output/df.model_cold.csv
        table3: output/df.model_cough.csv
        table4: output/df.model_copd.csv
        table5: output/df.model_pneumonia.csv
        table6: output/df.model_renal.csv
        table7: output/df.model_sepsis.csv
        table8: output/df.model_throat.csv
        table9: output/df.model_uti.csv
        table10: output/df.model_lrti.csv
        table11: output/df.model_urti.csv
        table12: output/df.model_sinusitis.csv
        table13: output/df.model_ot_media.csv
        table14: output/df.model_ot_externa.csv

#############################################################################


  describe_ITS_model:
    run: r:latest analysis/model/ITS_broad_model.R
    needs: [describe_ITS_var_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data.csv
        plot1: output/forest_plot_broad.jpeg
        plot2: output/predicted_plot.jpeg
        table2: output/its_main_ORs.csv

#############################################################################

  describe_ITS_var_process_2:
    run: r:latest analysis/process/ITS_var_2.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.2.model_asthma.csv
        table2: output/df.2.model_cold.csv
        table3: output/df.2.model_cough.csv
        table4: output/df.2.model_copd.csv
        table5: output/df.2.model_pneumonia.csv
        table6: output/df.2.model_renal.csv
        table7: output/df.2.model_sepsis.csv
        table8: output/df.2.model_throat.csv
        table9: output/df.2.model_uti.csv
        table10: output/df.2.model_lrti.csv
        table11: output/df.2.model_urti.csv
        table12: output/df.2.model_sinusitis.csv
        table13: output/df.2.model_ot_media.csv
        table14: output/df.2.model_ot_externa.csv

#############################################################################


  describe_ITS_model_2:
    run: r:latest analysis/model/ITS_broad_model_2.R
    needs: [describe_ITS_var_process_2]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_2.csv
        plot1: output/forest_plot_broad_2.jpeg
        plot2: output/predicted_plot_2.jpeg
        table2: output/its_main_ORs_2.csv

#############################################################################

  describe_ITS_var_without_A_process:
    run: r:latest analysis/process/ITS_var_without_Amoxicillin.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df2.model_asthma.csv
        table2: output/df2.model_cold.csv
        table3: output/df2.model_cough.csv
        table4: output/df2.model_copd.csv
        table5: output/df2.model_pneumonia.csv
        table6: output/df2.model_renal.csv
        table7: output/df2.model_sepsis.csv
        table8: output/df2.model_throat.csv
        table9: output/df2.model_uti.csv
        table10: output/df2.model_lrti.csv
        table11: output/df2.model_urti.csv
        table12: output/df2.model_sinusitis.csv
        table13: output/df2.model_ot_media.csv
        table14: output/df2.model_ot_externa.csv

#############################################################################


  describe_ITS_model_without_Amoxicillin:
    run: r:latest analysis/model/ITS_broad_model_without_Amoxicillin.R
    needs: [describe_ITS_var_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_noA.csv
        plot1: output/forest_plot_broad_noA.jpeg
        plot2: output/predicted_plot_noA.jpeg
        table2: output/its_main_ORs_noA.csv

#############################################################################

  describe_ITS_var_monthly_process:
    run: r:latest analysis/process/ITS_var_monthly.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.m.model_asthma.csv
        table2: output/df.m.model_cold.csv
        table3: output/df.m.model_cough.csv
        table4: output/df.m.model_copd.csv
        table5: output/df.m.model_pneumonia.csv
        table6: output/df.m.model_renal.csv
        table7: output/df.m.model_sepsis.csv
        table8: output/df.m.model_throat.csv
        table9: output/df.m.model_uti.csv
        table10: output/df.m.model_lrti.csv
        table11: output/df.m.model_urti.csv
        table12: output/df.m.model_sinusitis.csv
        table13: output/df.m.model_ot_media.csv
        table14: output/df.m.model_ot_externa.csv
        table15: output/df.m.model_uncoded.csv

#############################################################################

  describe_ITS_var_monthly_2_process:
    run: r:latest analysis/process/ITS_var_monthly_2.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.m2.model_asthma.csv
        table2: output/df.m2.model_cold.csv
        table3: output/df.m2.model_cough.csv
        table4: output/df.m2.model_copd.csv
        table5: output/df.m2.model_pneumonia.csv
        table6: output/df.m2.model_renal.csv
        table7: output/df.m2.model_sepsis.csv
        table8: output/df.m2.model_throat.csv
        table9: output/df.m2.model_uti.csv
        table10: output/df.m2.model_lrti.csv
        table11: output/df.m2.model_urti.csv
        table12: output/df.m2.model_sinusitis.csv
        table13: output/df.m2.model_ot_media.csv
        table14: output/df.m2.model_ot_externa.csv
        table15: output/df.m2.model_uncoded.csv

#############################################################################


  describe_ITS_model_monthly_2:
    run: r:latest analysis/model/ITS_broad_model_monthly_2.R
    needs: [describe_ITS_var_monthly_2_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_monthly_2.csv
        plot1: output/forest_plot_broad_monthly_2.jpeg
        plot2: output/predicted_plot_monthly_2.jpeg
        table2: output/its_main_ORs_monthly_2.csv


#############################################################################

  describe_ITS_model_monthly:
    run: r:latest analysis/model/ITS_broad_model_monthly.R
    needs: [describe_ITS_var_monthly_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_monthly.csv
        plot1: output/forest_plot_broad_monthly.jpeg
        plot2: output/predicted_plot_monthly.jpeg
        table2: output/its_main_ORs_monthly.csv


#############################################################################

  describe_ITS_var_uncoded_process:
    run: r:latest analysis/process/ITS_var_uncoded.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.model_added_asthma.csv
        table2: output/df.model_added_cold.csv
        table3: output/df.model_added_cough.csv
        table4: output/df.model_added_copd.csv
        table5: output/df.model_added_pneumonia.csv
        table6: output/df.model_added_renal.csv
        table7: output/df.model_added_sepsis.csv
        table8: output/df.model_added_throat.csv
        table9: output/df.model_added_uti.csv
        table10: output/df.model_added_lrti.csv
        table11: output/df.model_added_urti.csv
        table12: output/df.model_added_sinusitis.csv
        table13: output/df.model_added_ot_media.csv
        table14: output/df.model_added_ot_externa.csv
        table15: output/df.model_added_uncoded.csv

#############################################################################


  describe_ITS_model_uncoded:
    run: r:latest analysis/model/ITS_broad_model_uncoded.R
    needs: [describe_ITS_var_uncoded_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_uncoded.csv
        plot1: output/forest_plot_broad_uncoded.jpeg
        plot2: output/predicted_plot_uncoded.jpeg
        table2: output/its_main_ORs_uncoded.csv

#############################################################################

  describe_ITS_var_uncoded_without_A_process:
    run: r:latest analysis/process/ITS_var_uncoded_without_A.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df2.model_added_asthma.csv
        table2: output/df2.model_added_cold.csv
        table3: output/df2.model_added_cough.csv
        table4: output/df2.model_added_copd.csv
        table5: output/df2.model_added_pneumonia.csv
        table6: output/df2.model_added_renal.csv
        table7: output/df2.model_added_sepsis.csv
        table8: output/df2.model_added_throat.csv
        table9: output/df2.model_added_uti.csv
        table10: output/df2.model_added_lrti.csv
        table11: output/df2.model_added_urti.csv
        table12: output/df2.model_added_sinusitis.csv
        table13: output/df2.model_added_ot_media.csv
        table14: output/df2.model_added_ot_externa.csv
        table15: output/df2.model_added_uncoded.csv

#############################################################################


  describe_ITS_model_uncoded_without_A:
    run: r:latest analysis/model/ITS_broad_model_uncoded_without_A.R
    needs: [describe_ITS_var_uncoded_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_uncoded_without_A.csv
        plot1: output/forest_plot_broad_uncoded_without_A.jpeg
        plot2: output/predicted_plot_uncoded_without_A.jpeg
        table2: output/its_main_ORs_uncoded_without_A.csv

#############################################################################


  describe_repeat_ab_table:
    run: r:latest analysis/tables/repeat_ab_table.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        table1: output/blt_repeat_ab.csv
        table2: output/throat_ab.csv
        table3: output/throat_ab_type.csv

  describe_repeat_ab_table_2:
    run: r:latest analysis/tables/repeat_ab_table_2.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3,describe_ab_type_process_pre]
    outputs:
       moderately_sensitive:
        table1: output/asthma_ab.csv
        table2: output/asthma_ab_type.csv
        table3: output/cold_ab.csv
        table4: output/cold_ab_type.csv
        table5: output/cough_ab.csv
        table6: output/cough_ab_type.csv
        table7: output/copd_ab.csv
        table8: output/copd_ab_type.csv
        table9: output/pneumonia_ab.csv
        table10: output/pneumonia_ab_type.csv
        table11: output/renal_ab.csv
        table12: output/renal_ab_type.csv
        table13: output/sepsis_ab.csv
        table14: output/sepsis_ab_type.csv
        table15: output/uti_ab.csv
        table16: output/uti_ab_type.csv
        table17: output/lrti_ab.csv
        table18: output/lrti_ab_type.csv
        table19: output/urti_ab.csv
        table20: output/urti_ab_type.csv
        table21: output/sinusitis_ab.csv
        table22: output/sinusitis_ab_type.csv
        table23: output/otmedia_ab.csv
        table24: output/otmedia_ab_type.csv
        table25: output/ot_externa_ab.csv
        table26: output/ot_externa_ab_type.csv

  describe_ab_throat:
    run: r:latest analysis/plot/throat_ab.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table: output/ab_throat.csv


  describe_broad_proportion:
    run: r:latest analysis/plot/broad_proportion.R
    needs: [describe_ab_recoded_broad_process]
    outputs:
       moderately_sensitive:
        plot: output/broad_proportions_line.jpeg
        table: output/broad_proportions.csv

  describe_basic_record_process:
    run: r:latest analysis/process/baseline_variables_transform.R
    needs: [generate_study_population]
    outputs:
       highly_sensitive:
        rds1: output/measures/basic_record_2019.rds
        rds2: output/measures/basic_record_2020.rds
        rds3: output/measures/basic_record_2021.rds
        rds4: output/measures/basic_record_2022.rds

  describe_check_broad_model_variable_2019:
    run: r:latest analysis/model/broad_variable_transform_2019.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        rds1: output/measures/model_variable_broad_2019_1.rds

  describe_check_broad_model_variable_2019_2:
    run: r:latest analysis/model/charlson_transform_2019.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        talbe1: output/model_varibale_table_charlson_2019.csv
        rds1: output/measures/model_variable_broad_2019_2.rds

  describe_check_broad_model_variable_2020:
    run: r:latest analysis/model/broad_variable_transform_2020.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        rds1: output/measures/model_variable_broad_2020_1.rds

  describe_check_broad_model_variable_2020_2:
    run: r:latest analysis/model/charlson_transform_2020.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        talbe1: output/model_varibale_table_charlson_2020.csv
        rds1: output/measures/model_variable_broad_2020_2.rds

  describe_check_broad_model_variable_2021:
    run: r:latest analysis/model/broad_variable_transform_2021.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        rds1: output/measures/model_variable_broad_2021_1.rds

  describe_check_broad_model_variable_2021_2:
    run: r:latest analysis/model/charlson_transform_2021.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        talbe1: output/model_varibale_table_charlson_2021.csv
        rds1: output/measures/model_variable_broad_2021_2.rds

  describe_check_broad_model_variable_2022:
    run: r:latest analysis/model/broad_variable_transform_2022.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        rds1: output/measures/model_variable_broad_2022_1.rds

  describe_check_broad_model_variable_2022_2:
    run: r:latest analysis/model/charlson_transform_2022.R
    needs: [describe_basic_record_process]
    outputs:
       highly_sensitive:
        talbe1: output/model_varibale_table_charlson_2022.csv
        rds1: output/measures/model_variable_broad_2022_2.rds

  describe_broad_model_2019:   
    run: r:latest -e 'rmarkdown::render("analysis/model/broad_model_2019.Rmd", output_dir = "output/report")'
    needs: [describe_check_broad_model_variable_2019, describe_check_broad_model_variable_2019_2, describe_ab_recoded_broad_process]
    outputs:
      moderately_sensitive:
        html: output/report/broad_model_2019.html

  describe_broad_model_covid:   
    run: r:latest -e 'rmarkdown::render("analysis/model/broad_model_covid.Rmd", output_dir = "output/report")'
    needs: [describe_check_broad_model_variable_2020, describe_check_broad_model_variable_2020_2,
    describe_check_broad_model_variable_2021, describe_check_broad_model_variable_2021_2,
    describe_check_broad_model_variable_2022, describe_check_broad_model_variable_2022_2,
    describe_ab_recoded_broad_process]
    outputs:
      moderately_sensitive:
        html: output/report/broad_model_covid.html

  # describe_descriptive_ab_broad:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/descriptive_ab_broad.Rmd", output_dir = "output/report")'
  #   needs: [generate_measures]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/descriptive_ab_broad.html

  # describe_baseline_tb:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/baseline_table_pat_one.Rmd", output_dir = "output/report")'
  #   needs: [describe_check_broad_model_variable_2019, describe_check_broad_model_variable_2019_2,
  #   describe_check_broad_model_variable_2020, describe_check_broad_model_variable_2020_2,
  #   describe_check_broad_model_variable_2021, describe_check_broad_model_variable_2021_2,
  #   describe_check_broad_model_variable_2022, describe_check_broad_model_variable_2022_2]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/baseline_table_pat_one.html
  
  # describe_baseline_tb_2019:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/baseline_table_pat_one_2019.Rmd", output_dir = "output/report")'
  #   needs: [describe_check_broad_model_variable_2019, describe_check_broad_model_variable_2019_2]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/baseline_table_pat_one_2019.html

  # describe_baseline_tb_2020:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/baseline_table_pat_one_2020.Rmd", output_dir = "output/report")'
  #   needs: [describe_check_broad_model_variable_2020, describe_check_broad_model_variable_2020_2]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/baseline_table_pat_one_2020.html

  # describe_baseline_tb_2021:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/baseline_table_pat_one_2021.Rmd", output_dir = "output/report")'
  #   needs: [describe_check_broad_model_variable_2021, describe_check_broad_model_variable_2021_2]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/baseline_table_pat_one_2021.html

  # describe_baseline_tb_2022:   
  #   run: r:latest -e 'rmarkdown::render("analysis/model/baseline_table_pat_one_2022.Rmd", output_dir = "output/report")'
  #   needs: [describe_check_broad_model_variable_2022, describe_check_broad_model_variable_2022_2]
  #   outputs:
  #     moderately_sensitive:
  #       html: output/report/baseline_table_pat_one_2022.html


  # describe_ab_recoded_indication_process_plot: #  Antibiotics_recorded_02: only indication/row
  #   run: r:latest analysis/process/ab_recorded_indication_transform_plot.R
  #   needs: [generate_study_population_antibiotics]
  #   outputs:
  #      highly_sensitive:
  #       rds1: output/measures/recorded_ab_indication_2019.rds
  #       rds2: output/measures/recorded_ab_indication_2020.rds
  #       rds3: output/measures/recorded_ab_indication_2021.rds
  #       rds4: output/measures/recorded_ab_indication_2022.rds

  # describe_ab_recoded_indication_plot: 
  #   run: r:latest analysis/plot/ab_recorded_indication_plot.R
  #   needs: [describe_ab_recoded_indication_process_plot]
  #   outputs:
  #      highly_sensitive:
  #       plot1: output/ab_recorded_indication_bar.jpeg
  #       plot2: output/ab_recorded_indication_line.jpeg
  #       csv: output/ab_recorded_indication.csv

  generate_study_population_infection_abtype: # for ab types plot
    run: cohortextractor:latest generate_cohort --study-definition study_definition_infection_abtype --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_infection_abtype_*.csv.gz
  
  describe_infection_abtype_process: #  infection/row
    run: r:latest analysis/process/infection_abtype_transform.R
    needs: [generate_study_population_infection_abtype]
    outputs:
       highly_sensitive:
        rds1: output/measures/abtype_uti.rds
        rds2: output/measures/abtype_lrti.rds
        rds3: output/measures/abtype_urti.rds
        rds4: output/measures/abtype_sinusitis.rds
        rds5: output/measures/abtype_ot_externa.rds
        rds6: output/measures/abtype_otmedia.rds

  describe_infection_abtype_plot: #  incident+prevalent
    run: r:latest analysis/plot/infection_abtype.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/abtype_uti.jpeg
        plot2: output/abtype_lrti.jpeg
        plot3: output/abtype_urti.jpeg
        plot4: output/abtype_sinusitis.jpeg
        plot5: output/abtype_ot_externa.jpeg
        plot6: output/abtype_otmedia.jpeg
        csv1: output/abtype_uti.csv
        csv2: output/abtype_lrti.csv
        csv3: output/abtype_urti.csv
        csv4: output/abtype_sinusitis.csv
        csv5: output/abtype_ot_externa.csv
        csv6: output/abtype_otmedia.csv
       
  describe_infection_abtype_plot_redacted: #  incident+prevalent
    run: r:latest analysis/redaction/infection_abtype.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted/abtype_uti.jpeg
        plot2: output/redacted/abtype_lrti.jpeg
        plot3: output/redacted/abtype_urti.jpeg
        plot4: output/redacted/abtype_sinusitis.jpeg
        plot5: output/redacted/abtype_ot_externa.jpeg
        plot6: output/redacted/abtype_otmedia.jpeg
        csv1: output/redacted/abtype_uti_check.csv
        csv2: output/redacted/abtype_lrti_check.csv
        csv3: output/redacted/abtype_urti_check.csv
        csv4: output/redacted/abtype_sinusitis_check.csv
        csv5: output/redacted/abtype_ot_externa_check.csv
        csv6: output/redacted/abtype_otmedia_check.csv
        csv7: output/redacted/abtype_uti.csv
        csv8: output/redacted/abtype_lrti.csv
        csv9: output/redacted/abtype_urti.csv
        csv10: output/redacted/abtype_sinusitis.csv
        csv11: output/redacted/abtype_ot_externa.csv
        csv12: output/redacted/abtype_otmedia.csv

  describe_infection_abtype_plot_count: #  output raw counts
    run: r:latest analysis/redaction/infection_abtype_counts.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted/count_abtype_uti.jpeg
        plot2: output/redacted/count_abtype_lrti.jpeg
        plot3: output/redacted/count_abtype_urti.jpeg
        plot4: output/redacted/count_abtype_sinusitis.jpeg
        plot5: output/redacted/count_abtype_ot_externa.jpeg
        plot6: output/redacted/count_abtype_otmedia.jpeg
        csv1: output/redacted/count_abtype_uti_check.csv
        csv2: output/redacted/count_abtype_lrti_check.csv
        csv3: output/redacted/count_abtype_urti_check.csv
        csv4: output/redacted/count_abtype_sinusitis_check.csv
        csv5: output/redacted/count_abtype_ot_externa_check.csv
        csv6: output/redacted/count_abtype_otmedia_check.csv
        csv7: output/redacted/count_abtype_uti.csv
        csv8: output/redacted/count_abtype_lrti.csv
        csv9: output/redacted/count_abtype_urti.csv
        csv10: output/redacted/count_abtype_sinusitis.csv
        csv11: output/redacted/count_abtype_ot_externa.csv
        csv12: output/redacted/count_abtype_otmedia.csv

  describe_infection_noAB_plot: #  percentage
    run: r:latest analysis/redaction/infection_v2_noAB.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted_v2/noAB_uti.jpeg
        plot2: output/redacted_v2/noAB_lrti.jpeg
        plot3: output/redacted_v2/noAB_urti.jpeg
        plot4: output/redacted_v2/noAB_sinusitis.jpeg
        plot5: output/redacted_v2/noAB_ot_externa.jpeg
        plot6: output/redacted_v2/noAB_otmedia.jpeg
        csv1: output/redacted_v2/noAB_uti_check.csv
        csv2: output/redacted_v2/noAB_lrti_check.csv
        csv3: output/redacted_v2/noAB_urti_check.csv
        csv4: output/redacted_v2/noAB_sinusitis_check.csv
        csv5: output/redacted_v2/noAB_ot_externa_check.csv
        csv6: output/redacted_v2/noAB_otmedia_check.csv
        csv7: output/redacted_v2/noAB.csv

  describe_infection_AB_plot: #  percentage
    run: r:latest analysis/redaction/infection_v2_AB.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted_v2/AB_uti.jpeg
        plot2: output/redacted_v2/AB_lrti.jpeg
        plot3: output/redacted_v2/AB_urti.jpeg
        plot4: output/redacted_v2/AB_sinusitis.jpeg
        plot5: output/redacted_v2/AB_ot_externa.jpeg
        plot6: output/redacted_v2/AB_otmedia.jpeg
        csv1: output/redacted_v2/AB_uti_check.csv
        csv2: output/redacted_v2/AB_lrti_check.csv
        csv3: output/redacted_v2/AB_urti_check.csv
        csv4: output/redacted_v2/AB_sinusitis_check.csv
        csv5: output/redacted_v2/AB_ot_externa_check.csv
        csv6: output/redacted_v2/AB_otmedia_check.csv
        csv7: output/redacted_v2/AB.csv

  infection_ab_ITS2_plot: 
    run: r:latest -e 'rmarkdown::render("analysis/model/infection_ab_ITS2_plot.rmd", output_dir = "output/report")'
    needs: [describe_infection_noAB_plot]
    outputs:
      moderately_sensitive:
        html: output/report/infection_ab_ITS2_plot.html

  describe_infection_AB_plot_top3: #  percentage
    run: r:latest analysis/redaction/infection_v2_AB_top3.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted_v2/AB_uti_top3.jpeg
        plot2: output/redacted_v2/AB_lrti_top3.jpeg
        plot3: output/redacted_v2/AB_urti_top3.jpeg
        plot4: output/redacted_v2/AB_sinusitis_top3.jpeg
        plot5: output/redacted_v2/AB_ot_externa_top3.jpeg
        plot6: output/redacted_v2/AB_otmedia_top3.jpeg
        csv1: output/redacted_v2/AB_uti_check_top3.csv
        csv2: output/redacted_v2/AB_lrti_check_top3.csv
        csv3: output/redacted_v2/AB_urti_check_top3.csv
        csv4: output/redacted_v2/AB_sinusitis_check_top3.csv
        csv5: output/redacted_v2/AB_ot_externa_check_top3.csv
        csv6: output/redacted_v2/AB_otmedia_check_top3.csv
        csv7: output/redacted_v2/AB_top3.csv

  describe_infection_AB_plot_top5: #  percentage
    run: r:latest analysis/redaction/infection_v2_AB_top5.R
    needs: [describe_infection_abtype_process]
    outputs:
       moderately_sensitive:
        plot1: output/redacted_v2/AB_uti_top5.jpeg
        plot2: output/redacted_v2/AB_lrti_top5.jpeg
        plot3: output/redacted_v2/AB_urti_top5.jpeg
        plot4: output/redacted_v2/AB_sinusitis_top5.jpeg
        plot5: output/redacted_v2/AB_ot_externa_top5.jpeg
        plot6: output/redacted_v2/AB_otmedia_top5.jpeg
        csv1: output/redacted_v2/AB_uti_check_top5.csv
        csv2: output/redacted_v2/AB_lrti_check_top5.csv
        csv3: output/redacted_v2/AB_urti_check_top5.csv
        csv4: output/redacted_v2/AB_sinusitis_check_top5.csv
        csv5: output/redacted_v2/AB_ot_externa_check_top5.csv
        csv6: output/redacted_v2/AB_otmedia_check_top5.csv
        csv7: output/redacted_v2/AB_top5.csv

  describe_broad_proportion_measure:   
    run: r:latest -e 'rmarkdown::render("analysis/model/descriptive_ab_broad_2.Rmd", output_dir = "output/report")'
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        html: output/report/descriptive_ab_broad_2.html

  describe_broad_type_analysis:   
    run: r:latest -e 'rmarkdown::render("analysis/model/broad_type.Rmd", output_dir = "output/report")'
    needs: [generate_measures]
    outputs:
      moderately_sensitive:
        html: output/report/broad_type.html

  describe_broad_percentage_op:
    run: r:latest analysis/plot/broad_percentage_op.R
    needs: [generate_measures_broad]
    outputs:
       moderately_sensitive:
        plot1: output/broad_percentage_op.jpeg



  # describe_broad_proportion_measure:
  #   run: r:latest analysis/plot/broad_proportion_measure.R
  #   needs: [generate_measures]
  #   outputs:
  #      moderately_sensitive:
  #       plot1: output/broad_proportions_overall.jpeg
  #       plot2: output/broad_proportions_practice.jpeg


  describe_ab_check_2020: 
    run: r:latest -e 'rmarkdown::render("analysis/process/ab_check_2020.rmd", output_dir = "output/report")'
    needs: [generate_study_population_antibiotics]
    outputs:
      moderately_sensitive:
        html: output/report/ab_check_2020.html

#############################################################################

  describe_ITS_var_monthly_without_A_process:
    run: r:latest analysis/process/ITS_var_monthly_without_A.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.m.noA.model_asthma.csv
        table2: output/df.m.noA.model_cold.csv
        table3: output/df.m.noA.model_cough.csv
        table4: output/df.m.noA.model_copd.csv
        table5: output/df.m.noA.model_pneumonia.csv
        table6: output/df.m.noA.model_renal.csv
        table7: output/df.m.noA.model_sepsis.csv
        table8: output/df.m.noA.model_throat.csv
        table9: output/df.m.noA.model_uti.csv
        table10: output/df.m.noA.model_lrti.csv
        table11: output/df.m.noA.model_urti.csv
        table12: output/df.m.noA.model_sinusitis.csv
        table13: output/df.m.noA.model_ot_media.csv
        table14: output/df.m.noA.model_ot_externa.csv
        table15: output/df.m.noA.model_uncoded.csv

#############################################################################

  describe_ITS_var_monthly_2_without_A_process:
    run: r:latest analysis/process/ITS_var_monthly_2_without_A.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df.m2.noA.model_asthma.csv
        table2: output/df.m2.noA.model_cold.csv
        table3: output/df.m2.noA.model_cough.csv
        table4: output/df.m2.noA.model_copd.csv
        table5: output/df.m2.noA.model_pneumonia.csv
        table6: output/df.m2.noA.model_renal.csv
        table7: output/df.m2.noA.model_sepsis.csv
        table8: output/df.m2.noA.model_throat.csv
        table9: output/df.m2.noA.model_uti.csv
        table10: output/df.m2.noA.model_lrti.csv
        table11: output/df.m2.noA.model_urti.csv
        table12: output/df.m2.noA.model_sinusitis.csv
        table13: output/df.m2.noA.model_ot_media.csv
        table14: output/df.m2.noA.model_ot_externa.csv
        table15: output/df.m2.noA.model_uncoded.csv

#############################################################################


  describe_ITS_model_monthly_2_without_A:
    run: r:latest analysis/model/ITS_broad_model_monthly_2_without_A.R
    needs: [describe_ITS_var_monthly_2_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_monthly_2_without_A.csv
        plot1: output/forest_plot_broad_monthly_2_without_A.jpeg
        plot2: output/predicted_plot_monthly_2_without_A.jpeg
        table2: output/its_main_ORs_monthly_2_without_A.csv


#############################################################################

  describe_ITS_model_monthly_without_A:
    run: r:latest analysis/model/ITS_broad_model_monthly_without_A.R
    needs: [describe_ITS_var_monthly_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_monthly_without_A.csv
        plot1: output/forest_plot_broad_monthly_without_A.jpeg
        plot2: output/predicted_plot_monthly_without_A.jpeg
        table2: output/its_main_ORs_monthly_without_A.csv


#############################################################################

  describe_ITS_var_overall_process:
    run: r:latest analysis/process/ITS_var_overall.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df_model_overall.csv
        table2: output/df_model_overall_18.csv

#############################################################################

  describe_ITS_model_overall:
    run: r:latest analysis/itsmodel/ITS_broad_model_overall.R
    needs: [describe_ITS_var_overall_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_overall.csv
        plot1: output/forest_plot_broad_overall_A.jpeg
        plot2: output/forest_plot_broad_overall_B.jpeg
        plot3: output/predicted_plot_overall.jpeg
        table2: output/its_main_ORs_overall.csv
        table3: output/its_main_INTORs_overall.csv

#############################################################################

  describe_ITS_var_overall_without_A_process:
    run: r:latest analysis/process/ITS_var_overall_without_A.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df_noA_model_overall.csv
        table2: output/df_noA_model_overall_18.csv

#############################################################################

  describe_ITS_model_overall_without_A:
    run: r:latest analysis/itsmodel/ITS_broad_model_overall_without_A.R
    needs: [describe_ITS_var_overall_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/noA_its_main_plot_data_overall.csv
        plot1: output/noA_forest_plot_broad_overall_A.jpeg
        plot2: output/noA_forest_plot_broad_overall_B.jpeg
        plot3: output/noA_predicted_plot_overall.jpeg
        table2: output/noA_its_main_ORs_overall.csv
        table3: output/noA_its_main_INTORs_overall.csv
        plot4: output/noA_all_plot.jpeg

#############################################################################
############################# monthly  ######################################
#############################################################################
  describe_ITS_var_overall_monthly_process:
    run: r:latest analysis/process/ITS_var_overall_monthly.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df_mon_model_overall.csv
        table2: output/df_mon_model_overall_18.csv

#############################################################################

  describe_ITS_model_overall_monthly:
    run: r:latest analysis/itsmodel/ITS_broad_model_overall_monthly.R
    needs: [describe_ITS_var_overall_monthly_process]
    outputs:
       moderately_sensitive:
        table1: output/its_main_plot_data_overall_monthly.csv
        plot1: output/forest_plot_broad_overall_monthly_A.jpeg
        plot2: output/forest_plot_broad_overall_monthly_B.jpeg
        plot3: output/predicted_plot_overall_monthly.jpeg
        table2: output/its_main_ORs_overall_monthly.csv
        table3: output/its_main_INTORs_overall_monthly.csv
        plot4: output/all_plot_monthly.jpeg

#############################################################################
  describe_ITS_var_overall_monthly_without_A_process:
    run: r:latest analysis/process/ITS_var_overall_monthly_without_A.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3]
    outputs:
       moderately_sensitive:
        table1: output/df_noA_mon_model_overall.csv
        table2: output/df_noA_mon_model_overall_18.csv

#############################################################################

  describe_ITS_model_overall_monthly_without_A:
    run: r:latest analysis/itsmodel/ITS_broad_model_overall_monthly_without_A.R
    needs: [describe_ITS_var_overall_monthly_without_A_process]
    outputs:
       moderately_sensitive:
        table1: output/noA_its_main_plot_data_overall_monthly.csv
        plot1: output/noA_forest_plot_broad_overall_monthly_A.jpeg
        plot2: output/noA_forest_plot_broad_overall_monthly_B.jpeg
        plot3: output/noA_predicted_plot_overall_monthly.jpeg
        table2: output/noA_its_main_ORs_overall_monthly.csv
        table3: output/noA_its_main_INTORs_overall_monthly.csv
        plot4: output/noA_all_plot_monthly.jpeg

#############################################################################
  describe_ITS_var_stratified_process:
    run: r:latest analysis/process/ITS_stratified_var.R
    needs: [describe_cleaning_process_2]
    outputs:
       moderately_sensitive:
        table1: output/mon_stratified_broad.csv
        table2: output/mon_stratified_repeat.csv

#############################################################################
  describe_plot_by_coded:
    run: r:latest analysis/itsmodel/plot_by_coded.R
    needs: [describe_ITS_var_stratified_process]
    outputs:
       moderately_sensitive:
        plot1: output/broad_all_group.jpeg
        plot2: output/broad_incidental_group.jpeg
        plot3: output/repeat_all_group.jpeg
        plot4: output/repeat_incidental_group.jpeg
        table1: output/broad_all_group_table.csv
        table2: output/broad_incidental_group_table.csv
        table3: output/repeat_all_group_table.csv
        talbe4: output/repeat_incidental_group_table.csv

#############################################################################

  describe_ITS_var_stratified_process_2:
    run: r:latest analysis/process/ITS_stratified_var_2.R
    needs: [describe_cleaning_process_2]
    outputs:
       moderately_sensitive:
        table2: output/dt_incidental_cold.csv
        table3: output/dt_incidental_cough.csv
        table4: output/dt_incidental_copd.csv
        table8: output/dt_incidental_throat.csv
        table9: output/dt_incidental_uti.csv
        table10: output/dt_incidental_lrti.csv
        table11: output/dt_incidental_urti.csv
        table12: output/dt_incidental_sinusitis.csv
        table13: output/dt_incidental_ot_media.csv
        table14: output/dt_incidental_ot_externa.csv
        table16: output/dt_prevalent_cold.csv
        table17: output/dt_prevalent_cough.csv
        table18: output/dt_prevalent_copd.csv
        table22: output/dt_prevalent_throat.csv
        table23: output/dt_prevalent_uti.csv
        table24: output/dt_prevalent_lrti.csv
        table25: output/dt_prevalent_urti.csv
        table26: output/dt_prevalent_sinusitis.csv
        table27: output/dt_prevalent_ot_media.csv
        table28: output/dt_prevalent_ot_externa.csv

#############################################################################

  describe_ITS_var_stratified_process_3:
    run: r:latest analysis/process/ITS_stratified_var_3.R
    needs: [describe_cleaning_process_2]
    outputs:
       moderately_sensitive:
        table2: output/repeat_incidental_cold.csv
        table3: output/repeat_incidental_cough.csv
        table4: output/repeat_incidental_copd.csv
        table8: output/repeat_incidental_throat.csv
        table9: output/repeat_incidental_uti.csv
        table10: output/repeat_incidental_lrti.csv
        table11: output/repeat_incidental_urti.csv
        table12: output/repeat_incidental_sinusitis.csv
        table13: output/repeat_incidental_ot_media.csv
        table14: output/repeat_incidental_ot_externa.csv

#############################################################################

  describe_ITS_repeat_incident:
    run: r:latest analysis/itsmodel/ITS_repeat_incident.R
    needs: [describe_ITS_var_stratified_process_3]
    outputs:
       moderately_sensitive:
        table1: output/its_repeat_incident_predicted_data_table.csv
        plot1: output/forest_repeat_incident_A.jpeg
        plot2: output/forest_repeat_incident_B.jpeg
        plot3: output/its_repeat_incident_predicted.jpeg
        table2: output/its_repeat_incident_recovery_data_table.csv
        table3: output/its_repeat_incident_changes_data_table.csv
        plot4: output/conbined_repeat_incident.jpeg

#############################################################################
  describe_ITS_var_broad_mon_overall_process:
    run: r:latest analysis/process/ITS_stratified_var_4.R
    needs: [describe_cleaning_process_2]
    outputs:
       moderately_sensitive:
        table1: output/mon_overall_all_prescription.csv
        table2: output/mon_overall_cold.csv
        table3: output/mon_overall_cough.csv
        #table4: output/mon_overall_copd.csv
        #table5: output/mon_overall_throat.csv
        table6: output/mon_overall_uti.csv
        table7: output/mon_overall_lrti.csv
        #table8: output/mon_overall_urti.csv
        #table9: output/mon_overall_sinusitis.csv
        table10: output/mon_overall_ot_media.csv
        #table11: output/mon_overall_ot_externa.csv

  describe_ITS_model_broad_mon_overall:
    run: r:latest analysis/itsmodel/ITS_broad_mon_overall.R
    needs: [describe_ITS_var_broad_mon_overall_process]
    outputs:
       moderately_sensitive:
        plot1: output/mon_overall_predicted_plot.jpeg
        plot2: output/mon_overall_forest_C.jpeg
        plot3: output/mon_overall_forest_B.jpeg
        plot4: output/mon_overall_combined.jpeg
        table1: output/mon_overall_predicted_table.csv
        table2: output/mon_overall_forest_B_table.csv
        table3: output/mon_overall_forest_C_table.csv

  extract_variables_extra_2019: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_extra_2019
    needs: [describe_cleaning_process_2019]
    outputs:
      highly_sensitive:
        cohort: output/input_extra_2019.csv

  extract_variables_extra_2020: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_extra_2020
    needs: [describe_cleaning_process_2020]
    outputs:
      highly_sensitive:
        cohort: output/input_extra_2020.csv

  extract_variables_extra_2021: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_extra_2021
    needs: [describe_cleaning_process_2021]
    outputs:
      highly_sensitive:
        cohort: output/input_extra_2021.csv

  extract_variables_2019: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_demographic_2019
    needs: [describe_cleaning_process_2019]
    outputs:
      highly_sensitive:
        cohort: output/input_demographic_2019.csv

  extract_test: 
    run: r:latest analysis/process/cleaning_id_extraction_test.R
    needs: [extract_variables_2019,describe_cleaning_process_2019]
    outputs:
       moderately_sensitive:
        plot1: output/extraction_test.csv

  extract_variables_2020: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_demographic_2020
    needs: [describe_cleaning_process_2020]
    outputs:
      highly_sensitive:
        cohort: output/input_demographic_2020.csv

  extract_variables_2021: 
    run: cohortextractor:latest generate_cohort --study-definition study_definition_demographic_2021
    needs: [describe_cleaning_process_2021]
    outputs:
      highly_sensitive:
        cohort: output/input_demographic_2021.csv

  describe_prepare_var_2019_process: 
    run: r:latest analysis/multinomial/prepare_var_2019.R
    needs: [extract_variables_2019]
    outputs:
      moderately_sensitive:
        table1: output/prepare_var_count_2019.csv
        table2: output/blt_var_2019.csv
      highly_sensitive:
        cohort: output/prepared_var_2019.csv

  describe_prepare_var_2020_process: 
    run: r:latest analysis/multinomial/prepare_var_2020.R
    needs: [extract_variables_2020]
    outputs:
      moderately_sensitive:
        table1: output/prepare_var_count_2020.csv
        table2: output/blt_var_2020.csv
      highly_sensitive:
        cohort: output/prepared_var_2020.csv

  describe_prepare_var_2021_process: 
    run: r:latest analysis/multinomial/prepare_var_2021.R
    needs: [extract_variables_2021]
    outputs:
      moderately_sensitive:
        table1: output/prepare_var_count_2021.csv
        table2: output/blt_var_2021.csv
      highly_sensitive:
        cohort: output/prepared_var_2021.csv


######## multinomial #########

  describe_predict_model_var_process: 
    run: r:latest analysis/multinomial/predict_model_var.R
    needs: [describe_prepare_var_2019_process,describe_prepare_var_2020_process,
    describe_prepare_var_2021_process,describe_cleaning_process_2]
    outputs:
      moderately_sensitive:
        table1: output/throat_count.csv
        table2: output/urti_count.csv
        table3: output/sinusitis_count.csv
        table4: output/ot_externa_count.csv
        table5: output/otmedia_count.csv
        table6: output/copd_count.csv
        table7: output/cough_count.csv
        table8: output/pneumonia_count.csv
        table9: output/lrti_count.csv
        table10: output/uti_count.csv
      highly_sensitive:
        cohort1: output/throat_outcome.csv
        cohort2: output/urti_outcome.csv
        cohort3: output/sinusitis_outcome.csv
        cohort4: output/ot_externa_outcome.csv
        cohort5: output/otmedia_outcome.csv
        cohort6: output/copd_outcome.csv
        cohort7: output/cough_outcome.csv
        cohort8: output/pneumonia_outcome.csv
        cohort9: output/lrti_outcome.csv
        cohort10: output/uti_outcome.csv

  throat_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/throat_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/throat_appro_model.html

  urti_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/urti_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/urti_appro_model.html

  sinusitis_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/sinusitis_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/sinusitis_appro_model.html

  ot_externa_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/ot_externa_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/ot_externa_appro_model.html

  otmedia_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/otmedia_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/otmedia_appro_model.html

  copd_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/copd_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/copd_appro_model.html

  cough_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/cough_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/cough_appro_model.html

  pneumonia_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/pneumonia_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/pneumonia_appro_model.html

  uti_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/uti_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/uti_appro_model.html

  lrti_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/lrti_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/lrti_appro_model.html

  describe_cohort_3_var_process: 
    run: r:latest analysis/multinomial/cohort_3_var.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        table1: output/repeat_overall_tab.csv
        table2: output/repeat_incident_tab.csv
        table3: output/cohort_2_count.csv
        table4: output/cohort_3_count.csv
        table5: output/cohort_2_pat_one.csv
        table6: output/cohort_3_pat_one.csv


  describe_cohort_1_var_process: 
    run: r:latest analysis/itsmodel/cohort_1_var.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        table7: output/cohort_1_count.csv
        table1: output/cohort_1_overall_blt_2019.csv
        table2: output/cohort_1_blt_2019.csv
        table3: output/cohort_1_overall_blt_2020.csv
        table4: output/cohort_1_blt_2020.csv
        table5: output/cohort_1_overall_blt_2021.csv
        table6: output/cohort_1_blt_2021.csv

  describe_cohort_1_rds:
    run: r:latest analysis/description/var_rds_prepare.R
    needs: [describe_prepare_var_2019_process,describe_prepare_var_2020_process,
    describe_prepare_var_2021_process,describe_cleaning_process_2]
    outputs:
       highly_sensitive:
        rds1: output/measures/cohort_1.rds

  describe_descriptive_figure_process: 
    run: r:latest analysis/description/figure.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/figure_age_strata.jpeg
        figure2: output/figure_sex_strata.jpeg
        figure3: output/figure_region_strata.jpeg
        table1: output/figure_age_strata_table.csv
        table2: output/figure_sex_strata_table.csv
        table3: output/figure_region_strata_table.csv

  describe_descriptive_repeat_figure_process: 
    run: r:latest analysis/description/repeat_figure.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/figure_2_age_strata.jpeg
        figure2: output/figure_2_sex_strata.jpeg
        figure3: output/figure_2_region_strata.jpeg
        table1: output/figure_2_age_strata_table.csv
        table2: output/figure_2_sex_strata_table.csv
        table3: output/figure_2_region_strata_table.csv

  describe_descriptive_cold_figure_process: 
    run: r:latest analysis/description/cold_figure.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/figure_cold_repeat.jpeg
        table1: output/figure_cold_repeat_table.csv

  describe_its_repeat_var_process: 
    run: r:latest analysis/description/its_repeat_var.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        table1: output/dt_repeat_overall.csv
        table2: output/dt_repeat_incidental.csv

  describe_ITS_repeat_compare:
    run: r:latest analysis/itsmodel/ITS_repeat_compare.R
    needs: [describe_its_repeat_var_process]
    outputs:
       moderately_sensitive:
        table1: output/its_repeat_compare_predicted_table.csv
        plot1: output/forest_repeat_compare_B.jpeg
        plot2: output/forest_repeat_compare_C.jpeg
        plot3: output/its_repeat_compare_predicted.jpeg
        table2: output/its_repeat_compare_changes_table.csv
        table3: output/its_repeat_compare_recovery_table.csv
        plot4: output/forest_repeat_compare_BC.jpeg

  describe_prepare_var_2019_extra_process: 
    run: r:latest analysis/multinomial/prepare_var_2019_extra.R
    needs: [extract_variables_extra_2019]
    outputs:
      moderately_sensitive:
        table2: output/var_extra_blt_2019.csv
      highly_sensitive:
        cohort: output/prepared_var_extra_2019.csv

  describe_prepare_var_2020_extra_process: 
    run: r:latest analysis/multinomial/prepare_var_2020_extra.R
    needs: [extract_variables_extra_2020]
    outputs:
      moderately_sensitive:
        table2: output/var_extra_blt_2020.csv
      highly_sensitive:
        cohort: output/prepared_var_extra_2020.csv

  describe_prepare_var_2021_extra_process: 
    run: r:latest analysis/multinomial/prepare_var_2021_extra.R
    needs: [extract_variables_extra_2021]
    outputs:
      moderately_sensitive:
        table2: output/var_extra_blt_2021.csv
      highly_sensitive:
        cohort: output/prepared_var_extra_2021.csv

  describe_descriptive_figure_for_se_process: 
    run: r:latest analysis/description/figure_for_se.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/figure_broad_1.jpeg
        figure2: output/figure_broad_2.jpeg
        figure3: output/figure_broad_3.jpeg
        table1: output/figure_broad_1_table.csv
        table2: output/figure_broad_2_table.csv
        table3: output/figure_broad_3_table.csv

  describe_descriptive_figure_for_se_65_process: 
    run: r:latest analysis/description/figure_for_se_65.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/figure_broad_65_1.jpeg
        figure2: output/figure_broad_65_2.jpeg
        figure3: output/figure_broad_65_3.jpeg
        table1: output/figure_broad_65_1_table.csv
        table2: output/figure_broad_65_2_table.csv
        table3: output/figure_broad_65_3_table.csv

  describe_predict_model_overall_var_process: 
    run: r:latest analysis/multinomial/predict_model_overall_var.R
    needs: [describe_cohort_1_rds]
    outputs:
      highly_sensitive:
        cohort1: output/ten_infection_outcome.csv

  overall_appro_model:  
    run: r:latest -e 'rmarkdown::render("analysis/multinomial/overall_appro_model.Rmd", output_dir = "output/report")'
    needs: [describe_predict_model_overall_var_process]
    outputs:
      moderately_sensitive:
        html: output/report/overall_appro_model.html

##### check trimethoprim/nitrofurantonin


  generate_study_population_uti_ab_check:
    run: cohortextractor:latest generate_cohort --study-definition study_definition_uti_ab_check --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_uti_ab_check_*.csv.gz

  generate_measures_uti_ab_check:
    run: cohortextractor:latest generate_measures --study-definition study_definition_uti_ab_check --skip-existing --output-dir=output/measures
    needs: [generate_study_population_uti_ab_check]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_ratio_*.csv

  describe_uti_ab_check: 
    run: r:latest analysis/plot/uti_ab_check.R
    needs: [describe_ab_type_process_1,describe_ab_type_process_2,describe_ab_type_process_3] # transfrom & define all variables
    outputs:
       moderately_sensitive:
        plot1: output/uti_ab_check_bar.jpeg
        plot2: output/uti_ab_check_line.jpeg
        plot3: output/uti_ab_check_bar_2.jpeg
        csv: output/uti_ab_check.csv


  describe_uti_ab_check_2: 
    run: r:latest analysis/plot/uti_ab_check_2.R
    needs: [generate_measures_uti_ab_check] # transfrom & define all variables
    outputs:
       moderately_sensitive:
        plot1: output/uti_ab_ratio_check_line.jpeg
        plot2: output/uti_ab_ratio_check_line2.jpeg
        plot3: output/uti_ab_ratio_check_line3.jpeg
        csv: output/uti_ab_ratio_check.csv

  generate_study_population_uti_ab_check_op:  #open prescribing
    run: cohortextractor:latest generate_cohort --study-definition study_definition_uti_ab_check_op --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_uti_ab_check_op_*.csv.gz

  generate_measures_uti_ab_check_op:
    run: cohortextractor:latest generate_measures --study-definition study_definition_uti_ab_check_op --skip-existing --output-dir=output/measures
    needs: [generate_study_population_uti_ab_check_op]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_ratio_op_*.csv

  describe_uti_ab_check_2_op: 
    run: r:latest analysis/plot/uti_ab_check_2_op.R
    needs: [generate_measures_uti_ab_check_op] # transfrom & define all variables
    outputs:
       moderately_sensitive:
        plot1: output/uti_ab_ratio_check_line_op.jpeg
        plot2: output/uti_ab_ratio_check_line2_op.jpeg
        plot3: output/uti_ab_ratio_check_line3_op.jpeg
        csv: output/uti_ab_ratio_check_op.csv

  describe_region: # check region & age
    run: r:latest -e 'rmarkdown::render("analysis/region.Rmd", knit_root_dir = "/workspace", output_dir="/workspace/output")'
    needs: [generate_study_population]
    outputs:
      moderately_sensitive:
        html: output/region.html

  describe_age: # check region & age
    run: r:latest -e 'rmarkdown::render("analysis/age.Rmd", knit_root_dir = "/workspace", output_dir="/workspace/output")'
    needs: [generate_study_population]
    outputs:
      moderately_sensitive:
        html: output/age.html

  generate_study_population_uti_ab_check_oc:  #openCodelit
    run: cohortextractor:latest generate_cohort --study-definition study_definition_uti_ab_check_oc --index-date-range "2019-01-01 to today by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_uti_ab_check_oc_*.csv.gz

  generate_measures_uti_ab_check_oc:
    run: cohortextractor:latest generate_measures --study-definition study_definition_uti_ab_check_oc --skip-existing --output-dir=output/measures
    needs: [generate_study_population_uti_ab_check_oc]
    outputs:
      moderately_sensitive:
        measure_csv: output/measures/measure_ratio_oc_*.csv

  describe_uti_ab_check_2_oc: 
    run: r:latest analysis/plot/uti_ab_check_2_oc.R
    needs: [generate_measures_uti_ab_check_oc] # transfrom & define all variables
    outputs:
       moderately_sensitive:
        plot1: output/uti_ab_ratio_check_line_oc.jpeg
        plot2: output/uti_ab_ratio_check_line2_oc.jpeg
        plot3: output/uti_ab_ratio_check_line3_oc.jpeg
        csv: output/uti_ab_ratio_check_oc.csv


  generate_study_population_uti_ab_check_19:  # 2019-01
    run: cohortextractor:latest generate_cohort --study-definition study_definition_uti_ab_check_19  --index-date-range "2019-01-01 to 2019-02-01 by month" --skip-existing --output-dir=output/measures --output-format=csv.gz
    outputs:
      highly_sensitive:
        cohort: output/measures/input_uti_ab_check_19_*.csv.gz

  generate_measures_uti_ab_check_19:
    run: cohortextractor:latest generate_measures --study-definition study_definition_uti_ab_check_19 --skip-existing --output-dir=output/measures
    needs: [generate_study_population_uti_ab_check_19]
    outputs:
      moderately_sensitive:
        measure_csv1: output/measures/measure_uti_ab_check_19_*.csv

  describe_cohort_1_repeat_check_process: 
    run: r:latest analysis/description/cohort_1_repeat_check.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        table1: output/all_record_count.csv
        table2: output/cohort_1_all_record.csv
        table3: output/cohort_1_record_2019.csv
        table4: output/count_record_2019.csv
        table5: output/cohort_1_record_2020.csv
        table6: output/count_record_2020.csv
        table7: output/cohort_1_record_2021.csv
        table8: output/count_record_2021.csv

  describe_age_sex_ab_check_process: 
    run: r:latest analysis/description/age_sex_ab_check.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        table1: output/age_sex_ab_check.csv
        table2: output/age_sex_ab_check_2019.csv
        table3: output/age_sex_ab_check_2020.csv
        table4: output/age_sex_ab_check_2021.csv

  describe_cohort_1_indication_strata_figure_process: 
    run: r:latest analysis/description/cohort_1_indication_strata_repeat.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/cohort_1_indication_strata.jpeg
        table1: output/cohort_1_indication_strata_table.csv

  describe_cohort_2_incident_strata_figure_process: 
    run: r:latest analysis/description/cohort_2_incident_strata_repeat.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/cohort_2_incident_strata.jpeg
        table1: output/cohort_2_incident_strata_table.csv

  describe_cohort_2_strata_figure_process: 
    run: r:latest analysis/description/cohort_2_strata_repeat.R
    needs: [describe_cohort_1_rds]
    outputs:
      moderately_sensitive:
        figure1: output/cohort_2_age_strata.jpeg
        figure2: output/cohort_2_sex_strata.jpeg
        figure3: output/cohort_2_region_strata.jpeg
        table1: output/cohort_2_age_strata_table.csv
        table2: output/cohort_2_sex_strata_table.csv
        table3: output/cohort_2_region_strata_table.csv

  describe_TPP_ab_frequency_table: 
    run: r:latest analysis/xiaomin_ab/TPP_ab_frequency_table.R
    needs: [generate_measures_broad]
    outputs:
      moderately_sensitive:
        table1: output/TPP_ab_frequency_table.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
service_eval_work
Requested by
Billy Zhong
Branch
main
Force run dependencies
No
Git commit hash
48bfb08
Requested actions
  • describe_TPP_ab_frequency_table