Build a dashboard as a single web page
In this exercise, you direct the agent to develop a standalone, interactive research dashboard packaged as a single self-contained HTML file (out/dashboard.html). Paired with a reproducible generator script, this web-based asset can be inspected in any browser without requiring external server infrastructure.
Before you start: Cleaned data and a clear specification of the analytical questions and figures the dashboard should present (Setup).
Background
Web pages authored in plain HTML, CSS, and JavaScript represent an exceptional medium for research dissemination, often replacing static slide decks and complex spreadsheet workbooks (Outputs).
A robust research dashboard embodies three design requirements:
- Self-contained execution: The HTML file embeds all necessary CSS, JavaScript, and aggregated data inline, operating entirely offline without making external CDN requests. This self-contained architecture enhances security and prevents tracking.
- Programmatic reproducibility: A dedicated Python script (
scripts/make_dashboard.py) processes the dataset and compiles the HTML output, ensuring the dashboard can be regenerated whenever data is updated (Tools). - Aggregate data privacy: Dashboards intended for dissemination must display only aggregated summary statistics, stratified rates, and cell counts, without ever embedding row-level patient or participant records (Privacy and data handling).
General methodology
Instruct the agent to write a generator script that ingests the cleaned dataset and compiles the self-contained dashboard:
Write a reproducible generator script, scripts/make_dashboard.py, that reads <clean data> and outputs out/dashboard.html. The dashboard must be a single, self-contained HTML file (making zero external network requests) featuring <specified figures or tables>. Embed aggregated summary metrics only; do not include row-level patient records. Ensure all chart axes and measurement units are explicitly labeled, and display the underlying sample sizes supporting each visualization. Provide an overview explaining your choice of visualization components and layout hierarchy.
Open the generated file in your browser to inspect visual formatting, then refine elements using conversational directives (e.g., "highlight clinic site B in contrasting blue", "add horizontal benchmark target lines").
Workshop example · Imaging: chest radiographs
Start from: the evaluated checkpoint (how to restore)
Produces: scripts/make_dashboard.py, out/dashboard.html
Prompt
Write scripts/make_dashboard.py that reads out/cohort.csv and writes out/dashboard.html: a single self-contained page (no external network requests) with (1) ROC curves for the four models with each model's published operating point marked and the pilot bar shown as a region, (2) a table of AUC with a 95% patient-level bootstrap interval, and (3) a table of sensitivity and specificity with intervals at each published operating point. Use aggregated numbers only: no patient IDs, file names or images. Label axes and units. Tell me what you chose and why.
Files used: out/cohort.csv (and the operating points in data_dictionary.md).
What you should see. A page with four ROC curves, the primary model (all) highest. Each model's published operating point is a dot, and none falls in the pilot-bar region (top left: sensitivity at least 0.85, specificity at least 0.80). An AUC table matches the evaluation:
0.78 (0.71 to 0.84), 0.72, 0.67, 0.69. A reference version is scenarios/imaging/reference/make_dashboard.py (its output is in the reported checkpoint).
Things to try
Mark the pilot bar clearly and say whether each model meets it.Add a note that this is a toy example with synthetic data problems.Add the cohort flow (258 to 203) as a small table.
Check. Open out/dashboard.html in a browser, then search the file for http to confirm it makes no external requests. Search for a file name such as img_ to confirm no patient-level information was embedded.
Verification criteria
- Zero external dependencies: The HTML file makes no outbound network connections (verified by searching file contents for external
http://orhttps://script tags). - Metric fidelity: Plotted values and table figures match empirical numbers derived from the cleaned dataset.
- Complete axis annotation: Every figure displays explicit axis labels, measurement units, and supporting sample counts.
- Privacy preservation: The underlying HTML source contains strictly aggregated metrics, with zero identifiable row-level data.
Common pitfalls
| Symptom | Underlying cause | Resolution |
|---|---|---|
| Visualizations render as blank elements | External CDN charting libraries failed to load due to offline execution | Direct the agent to use inline SVG or embed a lightweight, self-contained charting script inline |
| Dashboard numbers diverge from statistical models | The generator script accidentally ingested raw uncleaned data rather than the cleaned dataset | Update the generator script to ingest exclusively from data/clean/ |
Concepts behind this
- Outputs. Request text-based source files and compile them to presentation formats. Source files are inspectable, version-controlled, and reproducible. Go deeper →
- Tools. Turning interactive prompts into parameterized scripts creates deterministic, testable tools that run identically on every execution. Go deeper →