Skip to content

feat: add HDR UK Gateway publish workflow - #81

Open
AndyRae wants to merge 10 commits into
mainfrom
feat/gateway-publish
Open

AndyRae wants to merge 10 commits into
mainfrom
feat/gateway-publish

Conversation

@AndyRae

@AndyRae AndyRae commented Nov 20, 2026 •

Copy link
Copy Markdown
Member
✨ Feature

PR Description

Adds a reusable workflow that publishes a dataset repo's metadata to the HDR UK Health Data Research Gateway, so each LinkML dataset repo (starting with nuh-data-sact) keeps its Gateway entry up to date on every release.

This enables our approach of using Github/LinkML as the source of truth for NUH data, and publishing out to catalogues automatically. Worth reading the linked issue for reasoning of our approach around this.

And see the nuh-data-sact repository for how this will work at a data level: https://github.com/Health-Informatics-UoN/nuh-data-sact

How

A dataset repo holds its LinkML schema plus two hand-written files: gateway/metadata.yaml (catalogue fields such as title, abstract and coverage, in HDR shape) and gateway/gateway.yaml (team, DRAFT/ACTIVE status, and the Gateway's dataset ID).

The script:

  1. builds the payload: structural come from the LinkML schema, and the rest from metadata.yaml.
  2. Validates the payload with HDR's TRASER service, then sends it as a new version of the dataset and reads it back to check.

Creating the dataset on the Gateway is a one-off: the dataset repo runs this workflow with create: true from a manual workflow_dispatch, behind the same approval. It prints the Gateway's dataset ID, which a person then commits to gateway.yaml.

This has been tested end to end against the live Gateway, using the demographics schema from nuh-data.

And built up from the HDR docs: https://hdruk.atlassian.net/wiki/spaces/HDRGTD/pages/3315630110/Custom+Integrations

Note that if you point an AI at this change, it likely will want to add a lot of tests, and swell this PR to 30+ files. The design choice is to deliberately keep this lean, yet still meaningful.

Related Issues or other material

Related: Health-Informatics-UoN/nuh-data#10

✅ Added/updated tests?

  • This PR contains relevant tests / Or doesn't need to per the below explanation

AndyRae and others added 6 commits November 20, 2026 15:42
Add the gateway-publish composite action (a Python CLI, installed with
uv from its lock file) and two reusable workflows that use it:

- gateway-validate.yml builds a dataset repo's Gateway metadata from its
  LinkML schema and gateway/metadata.yaml, and validates it against
  HDRUK 4.1.0 and HDR UK's TRASER service. No secrets; for PRs.
- gateway-publish.yml validates a release, then, in an approval
  environment, sends it to the Gateway as a new version of an existing
  dataset and reads it back.

Also add the action's pytest suite to action-tests.yml, a Dependabot
entry for its uv.lock, docs and samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validate with TRASER only, which checks the same HDRUK 4.1.0 schema the
Gateway uses, and drop the bundled HDRUK 3.0.0 and 4.1.0 schemas and the
local validator. Drop the CLI commands that publishing doesn't use (list,
delete, update/create from a file) and the live test. Replace the test
fixtures with one small LinkML schema that covers each mapping case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the gateway-publish package with a single script,
gateway_publish.py (validate, create, push), plus one test file. Merge
gateway-validate.yml and gateway-publish.yml into gateway.yml: it always
validates, and publishes after an environment approval when
`publish: true`. Drop the samples and the action README; the docs page
has the caller snippets and the script's docstring has the API notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Gateway blocks web UI edits, including status changes, for datasets
managed by an integration, so every change goes through a PR and a
release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The script takes --gateway-url and --traser-url instead of falling back
to built-in defaults; the defaults live only in the workflow inputs. The
team comes only from gateway.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split main() into validate, create and push functions. Require --version
for create and push, so publishing without a version fails instead of
publishing 0.0.0. Turn network errors into clear messages, warning that
a failed write may still have been applied. Comment the conventions a
reader can't infer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AndyRae AndyRae changed the title feat: add HDR UK Gateway publish action and workflows feat: add HDR UK Gateway publish workflow Nov 23, 2026
@AndyRae
AndyRae marked this pull request as ready for review November 23, 2026 16:47
AndyRae and others added 2 commits November 24, 2026 12:47
The script never writes to the dataset repo. create prints the new
dataset_id (as soon as the Gateway returns it) and pid, and a person
adds them to gateway/gateway.yaml and commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a `create` input to gateway.yml. A dataset repo runs it once from a
workflow_dispatch workflow, behind the same environment approval as
publishing, so nobody needs the Gateway credentials locally. The job log
prints the dataset_id and pid for a person to commit to gateway.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AndyRae and others added 2 commits November 25, 2026 17:21
Print errors as ::error:: so they show on the run summary and PR checks,
like the repo's other actions. The script is only run through the
workflow, so drop the local create instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants