data-report
An aggregate metrics report — counts, totals, and breakdowns across a set of records (members, publications, funding, supervisions). Pinned to @unipress/data. Outputs a downloadable Excel workbook (one sheet per section) and a Word report.
Scaffold
unipress create q3-metrics --template data-report --title "Q3 Metrics" --author "Research Office"
cd q3-metrics
unipress compile . --format xlsx --out q3-metrics.xlsx
unipress compile . --format docx --out q3-metrics.docxWhat you get
q3-metrics/
├── document.yml pinned to @unipress/data@<version>
├── theme.yml colors + typography for the web preview
├── records/
│ ├── members/ three sample records (19th-century naturalists)
│ └── queries/ saved query examples for the Population dropdown
└── content/
└── report/ cover, members, publications-by-{type,journal,year},
publications-list, funding, supervisionsThe starter ships three sample members so the first compile produces a non-empty workbook. Replace the YAML files under records/members/ with your own data.
document.yml fields
| Field | Purpose |
|---|---|
name, author, year | Workbook metadata (shown in the file's properties). |
format | xlsx (default) or docx. Override on the CLI. |
index | Routes / → content/<index> (here: report). |
queries.members | The query over the records in records/members/. |
queries.members.queryable | Filterable surface — drives the FilterPanel UI. |
queries.queries | Saved views for the Population dropdown, in records/queries/. |
Add a member
# records/members/your-name.yml
name: "Jane Doe"
department: biology
rank: professor
tenured: true
start_year: 2018
publications:
- { type: article, title: "...", year: 2024, journal: "...", doi: "..." }
funding:
- { title: "...", amount: 250000, year: 2023, source: "..." }
supervisions:
- { name: "...", level: PhD, year: 2024 }The Cover section's Loom expressions ({COUNT OF members}, {totalPublications}, etc.) update automatically. The downstream sections (PublicationsByType, Funding, Supervisions, …) read from the same records.
Filter the active selection
document.yml's collections.members.queryable: block declares the filterable fields exposed in the FilterPanel UI:
enum→ multi-select dropdown.boolean→ toggle.range→ numeric range input.
The framework's transport-aware fetcher decides where the active where-object runs:
fetcher.supports: [](default; static/data/members.json) — predicates evaluated in JS, multiple sections share one cached fetch.fetcher.supports: [where]— predicate ships with the request, backend returns only matching records.
Same author code, same components, same compile output. Switching modes is one block in document.yml.
When to pick data-report over directory
- You want sections broken out by axis (publications by year, funding totals, supervision counts).
- The data has nested structure (each member has publications, funding, supervisions arrays).
- The audience expects a multi-section report rather than a flat listing.
For a flat records listing, use directory instead.
Foundation reference
@unipress/data — see the foundation's README: framework/unipress/foundations/data/README.md.