Scripts to process, summarise, and render the results from the 2026 RELECOV Dry-Lab EQA.
This repository currently has three top-level Python entry points:
create_merged_json.py: builds one merged JSON per laboratory from the processed lab folders.general_report.py: aggregates all laboratory JSONs intogeneral.jsonand generates the network and individual figures.render_reports.py: fills the markdown Jinja template and optionally exports the resulting reports to PDF.
Use this script to generate one consolidated JSON file per laboratory from the processed results folders.
Example:
python3 create_merged_json.py \
--root_folder /path/to/root_folder \
--expected_data expected_data.json \
--output_folder /path/to/root_folder/merged_json_resultsImportant arguments:
--root_folder: folder containing all processed lab folders such asCOD-XXXX,COD-YYYY, etc.--expected_data: path toexpected_data.json.--output_folder: destination directory for the generatedlab_*.jsonfiles.--lab_cod: optional, restrict processing to a single laboratory.--lab_name: optional, override the full laboratory name.
Expected lab folder structure:
COD-XXXX/
RESULTS/
validated_metadata.json
consolidated_json_reports.json
...
Output:
- one
lab_<LAB>.jsonfile per processed laboratory
Use this script to generate the network-level summary JSON and all figures used by the report template.
Example:
python3 general_report.py \
--expected-data expected_data.json \
--labs-dir merged_results_per_lab/ \
--output general.jsonImportant arguments:
--expected-data: path toexpected_data.json--labs-dir: directory containing the per-lab merged JSON files--output: output path for the generatedgeneral.json--figures-dir: optional, root folder for generated figures. Default:./figures
Output:
general.json- network figures under
figures/<COMPONENT>/andfigures/network/ - individual figures under
figures/labs/<LAB>/<COMPONENT>/
Use this script to render the markdown Jinja template into a general report and, optionally, individual laboratory reports. It can also export the rendered reports to PDF using the custom stylesheet in report_pdf.css.
Example: general report only
python3 render_reports.py \
--template report_template.md \
--general-json general.jsonExample: general report plus individual lab reports
python3 render_reports.py \
--template report_template.md \
--general-json general.json \
--labs-dir merged_json_results/Example: markdown only
python3 render_reports.py \
--template report_template.md \
--general-json general.json \
--labs-dir merged_json_results/ \
--figures-dir figures/ \
--markdown-onlyExample: PDF only
python3 render_reports.py \
--template report_template.md \
--general-json general.json \
--labs-dir merged_json_results/ \
--figures-dir figures/ \
--pdf-onlyExample: PDF generation from already rendered markdown files
python3 render_reports.py \
--input-markdown-dir rendered_reports/markdown \
--output-dir rendered_reports_from_existing_md \
--figures-dir figures/ \
--pdf-onlyExample: rendering in an external reports directory where figures live outside rendered_reports
python3 render_reports.py \
--template /path/to/report_template.md \
--general-json general.json \
--labs-dir /path/to/merged_results_per_lab/ \
--output-dir /path/to/reports_and_figures/rendered_reports/ \
--markdown-only \
--css /path/to/report_pdf.css \
--figures-dir /path/to/reports_and_figures/figures/python3 render_reports.py \
--template /path/to/report_template.md \
--general-json general.json \
--labs-dir /path/to/merged_results_per_lab/ \
--output-dir /path/to/reports_and_figures/rendered_reports/ \
--input-markdown-dir /path/to/reports_and_figures/rendered_reports/markdown/ \
--pdf-only \
--css /path/to/report_pdf.css \
--figures-dir /path/to/reports_and_figures/figures/Important arguments:
--template: markdown Jinja template to render--general-json: path togeneral.json--labs-dir: optional directory containing compatiblelab_*.jsonfiles--output-dir: optional output directory. Default:rendered_reports--css: optional stylesheet path. Default:report_pdf.css--figures-dir: optional path to the figures root directory. Use this when image paths in the markdown start withfigures/...but the actual figures are stored outside the rendered report directory tree--markdown-only: render only markdown files--pdf-only: render only PDF files--keep-html: keep the intermediate HTML files used to create the PDFs--input-markdown-dir: optional directory containing pre-rendered markdown files. If provided, the script skips Jinja rendering and generates PDFs directly from the existing markdown files
Output:
- markdown files under
rendered_reports/markdown/ - PDF files under
rendered_reports/pdf/ - optional intermediate HTML files under
rendered_reports/html/
If you want to generate the full reporting output from processed lab folders, the usual order is:
- Run
create_merged_json.pyto build the individuallab_*.jsonfiles. - Run
general_report.pyto generategeneral.jsonand all figures. - Run
render_reports.pyto render the markdown and PDF reports.
render_reports.pyexpects individual report JSONs compatible with the template, that is, files with top-levellab,metadata, andcomponentssections.- If
--input-markdown-diris used,render_reports.pycan generate PDFs directly from existing markdown files without needing--templateor--general-json. - If figures are stored outside the repository or outside the
rendered_reportstree, pass--figures-dirboth when rendering markdown and when generating PDFs. This is also needed so thatpath_exists(...)conditions inside the Jinja template can correctly detect external figure files. - PDF generation currently uses a Chrome/Chromium executable available in
PATH. - The report template is
report_template.mdand the PDF stylesheet isreport_pdf.css.