Files
semprini-data-product-templ…/README.md
T
2026-09-18 08:56:37 +12:00

94 lines
5.5 KiB
Markdown

# semprini-data-product-templates
Data product templates for the semprini-data domain platform, one folder per class of data
product, owned by the **data product engineering teams**.
A template is the answer to "what does a deployable product of this class look like on this
platform": the directory layout, naming, type mapping, and every file the platform needs, as
`{{placeholders}}` that a generation agent fills in from one MD-DDL data product declaration.
The canonical template started in
[semprini-blog-dataproducts](https://git.semprini.me/paul/semprini-blog-dataproducts), where it
shared a repository with its platform, model and products.
## Catalogue
| Template | Product class | MD-DDL `class` | Status |
|---|---|---|---|
| [canonical_data_product/](canonical_data_product/README.md) | Canonical: a slice of the domain's canonical model, published as modelled through GraphQL, Kafka and Trino | `domain-aligned` | Available, with generic unit tests. Example verified 2026-09-18 on the domain platform (9 checks, 12 unit tests); Canonical Party generated from it passes 65 checks and 100 unit tests |
| `source_aligned_data_product/` | Source aligned: one source system's data in its own shape, for audit, replay and debugging | `source-aligned` | Planned |
| `experience_<class>_data_product/` | Experience: shaped for an audience. Several classes, e.g. lake tables built by scheduled dbt models | `consumer-aligned` | Planned |
## Where templates sit between the teams
```
modelling team engineering teams data platform team
───────────── ───────────────── ──────────────────
semprini-domain-<d>-datamodel semprini-data-product-templates semprini-data-domain
data_products/*.md ───────▶ <class>_data_product/ ◀── product contract ── data-domain CLI
handoffs/<slug>.md .claude/agents/agent-<class>-product.md compose.domain.yml
│ │
└──────── generate ──────┴──▶ product repository (semprini-domain-cdp-<d>/<slug>/)
── deploy, test, unit, register ──▶ domain stack + management zone
```
- **From the modelling team:** a product declaration and the entities and enums it names,
plus a handoff note for decisions the model cannot carry. The declaration's MD-DDL `class`
picks the template.
- **To the data platform team:** every template produces directories that meet the
domain platform's *product contract* (semprini-data-domain `README.md`): the `product.yaml`
manifest the `data-domain` CLI reads, and the SQL, schema, job and smoke-test files it
applies. A template that needs something the contract does not offer asks the platform team
first.
- **Products** are generated into the domain engineering team's product repository (or the
domain repository), and deployed, tested and registered from the domain repository that runs
them.
All teams work on semprini-core, the enterprise landing zone: Keycloak for identity, and Gitea
(git.semprini.me) for these repositories.
## Generating a product
From a checkout of this repository, with the model repository and the domain repository at
hand:
```
/agent-canonical-product Generate Canonical Party for the digital-core domain
```
The agent reads the declaration and any pending handoff, writes the product directory
(including `tests/expectations.yaml`), runs `uv run data-domain deploy`, `test`, `unit` and
`register` from the domain repository, and reports the model and template versions it
generated from. Commit the product, in its product repository or the domain repository, with
both versions in the message. Digital Core's canonical products live in
semprini-domain-cdp-digital-core.
## Versioning
- Tag a release of this repository when a template changes (`v0.1.0`, ...). Domain repositories
record the tag they generated from and regenerate deliberately, not on every commit here.
- A template change that alters what a product directory contains may need a platform
change first. Check the product contract, and agree the change with the data platform team.
- Every template keeps a worked `example/` that deploys and passes `data-domain test` and
`data-domain unit` on the current domain platform. That example is the template's test, and the platform team's
smoke test for the domain template.
## Adding a template
1. Create `<class>_data_product/` with a `README.md` contract (what the product is, the
mapping to platform interfaces, layout, naming, placeholders, type mapping, the generation
input table, prerequisites and known gaps) and the template files.
2. Add a worked `example/`, with a seed and `tests/` (generic test modules plus
`expectations.yaml`), and verify it on a domain stack with `data-domain deploy`, `test` and
`unit`.
3. Add its generation agent as `.claude/agents/agent-<class>-product.md`, with a command
wrapper in `.claude/commands/`.
4. Add it to the catalogue above.
## Repository layout during setup
While the systems are being set up, this repository is a submodule of
[semprini-data](https://git.semprini.me/paul/semprini-data), beside the domain platform and the
Digital Core model, so all of it can be read and changed together. Most organisations keep
these repositories apart, each owned and released by its own team, and link them only by
version.