Skip to main content

Evidence.dev β€” NHS Quickstart

🧾 SQL-first reporting · Static builds · Auditable outputs · Easy to host
Why Evidence for the NHS

Evidence turns SQL + Markdown into a static site. That means: auditable queries, small attack surface, simple hosting (S3/CloudFront, Azure Static Web Apps, or intranet IIS). It’s perfect when analysts live in SQL and you want reports, not apps.

Great for: BI Analyst Β· Data Engineer Β· IG-friendly reporting.


βš™οΈ 10-minute install​

npm create evidence@latest nhs-evidence
cd nhs-evidence
npm install

Keep data local at first (CSV/Parquet) and switch to a managed source later.


πŸš€ β€œHello NHS” report (3 options)​

Create a Parquet file in data/kpi.parquet (see SQL or Python pages to export).
Then create src/pages/kpi.md:

---
title: NHS KPI
---

```sql kpi
SELECT practice_id, total_appointments, attendance_rate
FROM read_parquet('data/kpi.parquet')
ORDER BY total_appointments DESC
```

# Appointments by Practice

<Table data={kpi} />

Run:

npm run dev

πŸ— Project structure you’ll keep​

nhs-evidence/
data/ # CSV/Parquet or DuckDB file
src/
pages/ # Markdown + SQL pages
kpi.md
evidence.config.ts # data source config (optional)
.env # secrets for local dev (never commit)

πŸ” Secrets & data sources​

  • Start with Parquet/CSV to avoid storing DB creds in Evidence.
  • If you must connect directly to a DB, load creds from environment variables (never commit).
  • Prefer read-only roles and restricted schemas/views for reporting.

See: Secrets & .env, SQL.


🚒 Publish (static)​

Build a static site:

npm run build

You’ll get a build/ folder you can host almost anywhere:

  • AWS: S3 + CloudFront; add basic auth/WAF as needed.
  • Azure: Static Web Apps or Storage Static Website + Front Door.
  • Intranet: Serve build/ via IIS/NGINX behind Trust SSO.

Add a footer component with a β€œData last updated” timestamp (derive from your extract job) and link to KPI definitions.


🧰 Useful patterns​

  • Glossary page for metric definitions and owners.
  • Page-per-KPI with the SQL visible and a compact chart + table.
  • Evidence + DuckDB for ad-hoc QA: inline read_parquet() queries.
  • Staging file convention: data/_staging/*.parquet β†’ validate β†’ data/published/.

πŸ›‘ IG & safety checklist​

  • Use synthetic/de-identified data for demos.
  • Apply small-number suppression in SQL before rendering.
  • Keep secrets out of the repo; inject via environment.
  • Make KPI SQL read-only and document owners/refesh cadence.
  • Host behind SSO; turn on access logging at the reverse proxy.

πŸ“ Measuring impact​

  • Latency: extract finished β†’ report updated.
  • Stability: build success rate; broken pages count.
  • Adoption: unique viewers; teams using Evidence pages.
  • Auditability: % pages showing β€œSQL used” + last updated stamp.

πŸ”— See also​

See also: SQL Β· DuckDB Β· Dash Β· Python Β· Secrets & .env

What’s next?

You’ve completed the Learn β€” Evidence.dev stage. Keep momentum: