gen3-metadata-templates
Turn a Gen3 schema into friendly Excel submission templates, then validate the filled-in workbooks — with every error pinned to the exact sheet, row, and column, in plain English.
Documentation
- Quickstart — the shortest path from a schema to a validated workbook.
- Concepts — nodes, links, paths, and
submitter_id, for readers new to Gen3. - Generating templates — path selection, node/column filtering, and what every part of the workbook means.
- Filling in a template — how linking, one-to-many, and multi-value cells work.
- Validating — the error types, the annotated copy, and exit codes.
- CLI reference — every command and flag.
- Library API — using the core from Python.
- Troubleshooting — common problems and fixes.
Install
pipx install gen3-metadata-templates # installs the `g3mt` command
# everything of one kind (e.g. all your clinical data) in one workbook
g3mt generate schema.json --category clinical -o clinical_template.xlsx
# ...or a single node
g3mt generate schema.json sample -o sample_template.xlsx
# ...fill sample_template.xlsx in Excel...
g3mt validate sample_template.xlsx --schema schema.json --annotate checked.xlsx
The schema can be a local file or an http(s):// URL — e.g. a bundle published
on GitHub:
g3mt generate \
https://raw.githubusercontent.com/AustralianBioCommons/acdc-schema-json/refs/tags/v1.2.0/dictionary/prod_dict/acdc_schema.json \
lipidomics_file -o lipidomics_file_template.xlsx
Why this exists
Submitting metadata to a Gen3 data commons means producing records that conform to a graph-shaped data model: nodes (subject, sample, file, …) linked parent-to-child, each with typed, sometimes-controlled properties. That is hard for people who aren't fluent in linked data — and mistakes are usually only discovered late, as opaque errors.
g3mt closes that gap from both ends:
- Generation produces a workbook a non-specialist can fill in confidently — parent links and controlled values are dropdowns, so most errors can't be made in the first place.
- Validation catches whatever still slips through and reports it as "Sheet subject, cell C4: 'ten' isn't a whole number" rather than a stack trace.
Input and output
| Input (generate) | A Gen3 JSON schema bundle — a single .json file or an http(s):// URL — plus what you want to submit: a node, several nodes, or a whole category. |
| Output (generate) | An .xlsx workbook: one sheet per node on the path to your target, with dropdowns, guidance, and reference sheets. |
| Input (validate) | Your filled .xlsx workbook + the same schema. |
| Output (validate) | A console report grouped by sheet (and optionally a highlighted copy of the workbook or a JSON report). Exit code 0 = clean, 1 = problems found, 2 = usage error. |
Key features
- Whole-category templates —
--category clinicalgives a researcher every clinical sheet in one workbook, in the right fill order, without having to know the node names. - One sheet per node, in fill order — parents before children, so links always resolve.
- Cross-sheet link dropdowns — a
subject.submitter_idcolumn on the sample sheet is a dropdown of the IDs you entered on the subject sheet. Reusing a parent ID across child rows is all "one-to-many" requires — no theory needed. - Controlled-value dropdowns — enum and boolean fields become dropdowns.
- Self-documenting workbooks — required vs optional headers, a type/required hint row, per-column description comments, plus an Instructions sheet and a full Dictionary sheet.
- Path selection — when a node is reachable by more than one chain of parents, you choose which one the template covers.
- Precise, plain-English validation — errors located to the cell, rephrased
for non-developers, with an optional highlighted copy of your file and a
--json-outreport artifact for pipelines. - Paste-friendly protection — the header rows can't be edited, but pasting,
formatting, sorting and row insert/delete all work (
--no-protectfor fully editable sheets). Validation warns when pasting removed dropdowns, when data ran past the provisioned rows, and when Excel mangled IDs or dates. - Use it as a CLI or a Python library — the CLI is a thin shell over an importable core.
Requirements
- Python ≥ 3.9.5
gen3-validator≥ 2.1 (installed automatically)
Development
git clone https://github.com/AustralianBioCommons/gen3-metadata-templates.git
cd gen3-metadata-templates
pip install poetry
poetry install
poetry run pytest -vv
Before pushing, run the same checks CI does:
poetry run ruff check . # lint
poetry run ruff format --check . # formatting
poetry run pytest -vv # tests
To preview the documentation site locally:
poetry install --with docs
poetry run mkdocs serve # then open http://127.0.0.1:8000
Continuous integration & releases
- CI (
.github/workflows/build.yml) runs on every push and pull request tomain: Ruff lint + format check, the test suite on Python 3.9–3.12, ag3mt --helpsmoke test, and a strict docs build. - Publishing (
.github/workflows/publish_pypi.yml) runs when a GitHub Release is published: it verifies the release tag matches the package version, then builds and publishes to PyPI. It needs aPYPI_API_KEYrepository secret. - TestPyPI (
.github/workflows/publish_testpypi.yml) can be triggered manually from the Actions tab to publish a pre-release; it needs aTESTPYPI_API_KEYsecret.
To cut a release:
poetry version <major|minor|patch> # bump the version in pyproject.toml
git commit -am "chore: release vX.Y.Z"
git tag vX.Y.Z && git push --tags
gh release create vX.Y.Z --generate-notes # publishing the release runs the workflow
A note on 2.0
Version 2.0 is a full rewrite. The old Python API
(generate_xlsx_template, make_node_template_pd, PropExtractor) has been
replaced by the library and g3mt CLI documented here.
License
Apache 2.0 — see LICENSE.
Metadata
Release files for gen3_metadata_templates 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gen3_metadata_templates-2.4.0.tar.gz | 52.7 kB | Without provenance | Details for gen3_metadata_templates-2.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gen3_metadata_templates-2.4.0-py3-none-any.whl | Python 3 | none | any | Details for gen3_metadata_templates-2.4.0-py3-none-any.whl |
Total release size: 114.2 kB
Release files / gen3_metadata_templates-2.4.0.tar.gz
| Download URL | gen3_metadata_templates-2.4.0.tar.gz |
|---|---|
| Size | 52.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e09f8b447e5466a9f6a658a9cacc5267b74d6e6822eabe90e477c2ec99d51332
|
|
BLAKE2b-256 checksum How to use checksums |
05405b94943279eafa30e5b9bbfe0f1537d5f6176c2f57bcaa459be0ac75e7ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.14 Linux/6.17.0-1022-azure
|
Release files / gen3_metadata_templates-2.4.0-py3-none-any.whl
| Download URL | gen3_metadata_templates-2.4.0-py3-none-any.whl |
|---|---|
| Size | 61.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1733fc731cf06c102c8c74604b43eca8c0c7cd5de3aa0df55235db71069c4e71
|
|
BLAKE2b-256 checksum How to use checksums |
c24d2f2415de7e220026f82df2ab6030aaa0b3ac6734d991000a366967f43a1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.14 Linux/6.17.0-1022-azure
|
Security for gen3_metadata_templates 2.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.