diff --git a/Snakefile b/Snakefile index 5bcef3e8..60e408d3 100644 --- a/Snakefile +++ b/Snakefile @@ -37,6 +37,7 @@ rule all: expand("reports/figures/{pid}/{sensor}_heatmap_rows.html", pid=config["PIDS"], sensor=config["SENSORS"]), expand("reports/figures/{pid}/compliance_heatmap.html", pid=config["PIDS"]), expand("reports/figures/{pid}/battery_consumption_rates_barchart.html", pid=config["PIDS"]), + expand("reports/compliance/{pid}/compliance_report.html", pid=config["PIDS"]), rule clean: shell: diff --git a/rules/reports.snakefile b/rules/reports.snakefile index 707d99f5..9142f393 100644 --- a/rules/reports.snakefile +++ b/rules/reports.snakefile @@ -29,3 +29,12 @@ rule battery_consumption_rates_barchart: "reports/figures/{pid}/battery_consumption_rates_barchart.html" script: "../src/visualization/battery_consumption_rates_barchart.py" + +rule compliance_report: + input: + sensor_heatmaps = expand("reports/figures/{{pid}}/{sensor}_heatmap_rows.html", sensor=config["SENSORS"]), + compliance_heatmap = rules.compliance_heatmap.output + output: + "reports/compliance/{pid}/compliance_report.html", + script: + "../src/visualization/compliance_report.Rmd" \ No newline at end of file diff --git a/src/visualization/compliance_report.Rmd b/src/visualization/compliance_report.Rmd new file mode 100644 index 00000000..928d55c8 --- /dev/null +++ b/src/visualization/compliance_report.Rmd @@ -0,0 +1,39 @@ +--- +title: "Compliance Report" +author: + - "MoSHI Pipeline" +date: "`r format(Sys.time(), '%d %B, %Y')`" +params: + rmd: "compliance_report.Rmd" +output: + html_document: + highlight: tango + number_sections: no + theme: default + toc: yes + toc_depth: 3 + toc_float: + collapsed: no + smooth_scroll: yes +--- + +```{r include=FALSE} +source("packrat/init.R") +``` + +## Overall phone compliance + +```{r, echo=FALSE} +htmltools::includeHTML(snakemake@input[["compliance_heatmap"]]) +``` + +## Per sensor compliance +```{r, echo=FALSE} +heatmaps <- snakemake@input[["sensor_heatmaps"]] +heatmaps.html <- vector(mode="list", length(heatmaps)) + +for(sensor_id in 1:length(heatmaps)){ + heatmaps.html[[sensor_id]] <- htmltools::includeHTML(heatmaps[sensor_id]) +} +htmltools::tagList(heatmaps.html) +```