SmartCane/10_run_kpi_report.sh
Timon d5fd4bb463 Add KPI reporting system and deployment documentation
Major Changes:
- NEW: Scripts 09 & 10 for KPI calculation and enhanced reporting
- NEW: Shell script wrappers (01-10) for easier execution
- NEW: R packages flextable and officer for enhanced Word reports
- NEW: DEPLOYMENT_README.md with complete deployment guide
- RENAMED: Numbered R scripts (02, 03, 04) for clarity
- REMOVED: Old package management scripts (using renv only)
- UPDATED: Workflow now uses scripts 09->10 instead of 05

Files Changed: 90+ files
New Packages: flextable, officer
New Scripts: 09_run_calculate_kpis.sh, 10_run_kpi_report.sh
Documentation: DEPLOYMENT_README.md, EMAIL_TO_ADMIN.txt

See DEPLOYMENT_README.md for full deployment instructions.
2025-10-14 11:49:30 +02:00

57 lines
2 KiB
Bash

#!/bin/bash
# Run CI report with KPIs (10_CI_report_with_kpis_simple.Rmd)
# Usage: ./10_run_kpi_report.sh --filename=<output.docx> --report_date=<YYYY-MM-DD> --mail_day=<day> --data_dir=<project> --borders=<TRUE|FALSE> --ci_plot_type=<both|absolute|cumulative> --colorblind_friendly=<TRUE|FALSE> --facet_by_season=<TRUE|FALSE> --x_axis_unit=<days|weeks>
filename="CI_report_with_kpis.docx"
report_date="$(date +%Y-%m-%d)"
mail_day="Monday"
data_dir="aura"
borders="FALSE"
ci_plot_type="both"
colorblind_friendly="TRUE"
facet_by_season="FALSE"
x_axis_unit="days"
for arg in "$@"; do
case $arg in
--filename=*)
filename="${arg#*=}"
;;
--report_date=*)
report_date="${arg#*=}"
;;
--mail_day=*)
mail_day="${arg#*=}"
;;
--data_dir=*)
data_dir="${arg#*=}"
;;
--borders=*)
borders="${arg#*=}"
;;
--ci_plot_type=*)
ci_plot_type="${arg#*=}"
;;
--colorblind_friendly=*)
colorblind_friendly="${arg#*=}"
;;
--facet_by_season=*)
facet_by_season="${arg#*=}"
;;
--x_axis_unit=*)
x_axis_unit="${arg#*=}"
;;
*)
echo "Unknown option: $arg"
exit 1
;;
esac
shift
done
echo "Running CI report with KPIs for $data_dir, report date $report_date, mail day $mail_day."
echo "Parameters: borders=$borders, ci_plot_type=$ci_plot_type, colorblind=$colorblind_friendly, facet_by_season=$facet_by_season, x_axis_unit=$x_axis_unit"
cd r_app
Rscript -e "rmarkdown::render('10_CI_report_with_kpis_simple.Rmd', output_file='$filename', params=list(report_date='$report_date', mail_day='$mail_day', data_dir='$data_dir', borders='$borders', ci_plot_type='$ci_plot_type', colorblind_friendly='$colorblind_friendly', facet_by_season='$facet_by_season', x_axis_unit='$x_axis_unit'))"
cd ..