metabolomicshub-announcement-authoring
Turn a dataset's metadata into an MHD announcement that the hub will accept, and
find out that it will not before submitting rather than after.
When this applies
A repository, a consortium partner or a submitter with a large deposit needs a
study to appear in the MetabolomicsHub index. The route is not a web form: it is
a common-model file, an announcement derived from it, a validation pass, an
identifier, and a submitted revision. Each of those has a failure mode of its
own, and two of them are asynchronous.
This is the depositor's side of the hub. Reading the index is a different job.
The two artefacts, in the order they exist
- The MHD common data model file — the full description of the study:
samples, assays, protocols, parameters, instruments, publications.
- The announcement file — derived from the model file, and the thing the
hub actually ingests. It references the model file by URL.
Deriving the second from the first is a command, not an editing task. Writing an
announcement by hand and keeping it consistent with a model file is the mistake
this ordering exists to prevent.
Procedure
Choose the profile before writing anything. Two model versions (v0.1,
v1.0) each carry two profiles: ms-profile and legacy-profile. The MS
profile expects structured acquisition metadata; the legacy profile is the
reduced shape for studies migrated from an existing repository. Both the
announcement file and the common-model file have their own schema per
profile, so there are four schemas in play and picking the wrong one produces
validation errors that read as missing data.
GET /v0_1/schemas returns the profiles the server currently enforces, and
GET /v0_1/server-info reports which is the default. Ask the server; the
defaults move with releases.
Validate the model file first.
mhd-cli validate mhd <mhd_study_id> <mhd_model_file_path>
Fixing the model file after deriving an announcement means deriving again.
Derive the announcement.
mhd-cli create announcement [--output-dir DIR] [--output-filename NAME] \
<mhd_study_id> <mhd_model_file_path> <target_mhd_model_file_url>
The third argument is where the model file will be publicly readable. The
hub checks that URL for accessibility when the announcement is shared, so a
placeholder or a private link fails at submission rather than at derivation.
Publish the model file before you submit, not before you derive.
Validate the announcement.
mhd-cli validate announcement [--output-path FILE] <mhd_study_id> \
<announcement_file_path>
Use --output-path in any automated pipeline: it writes the result where a
later step can read it, instead of leaving it in a log.
Mint an identifier in the test lane first. POST /v0_1/identifiers,
or MhdClient.get_new_mhd_accession(dataset_repository_identifier, accession_type).
The accepted accession types are mhd, legacy, test-mhd, test-legacy
and dev. Do a full dry run on a test accession before requesting a real
one; identifiers are the part of this process you cannot take back.
Submit the revision, then poll. POST /v0_1/datasets/{accession}/announcements
is a multipart upload authenticated with an x-api-token header, and it
returns a taskId rather than a verdict. The outcome is read from
GET /v0_1/datasets/{accession}/tasks/{task_id}. The shipped client polls it
for you (ten attempts, five seconds apart); anything you write yourself must
poll too. A 200 on the upload means the file was accepted for validation, not
that the dataset was announced.
Record the revision. Announcements are versioned: every submission takes
an announcement_reason and GET /v0_1/datasets/{accession}/announcements
lists the revisions. The reason string is the only human-readable account of
why a dataset's public record changed, so write it for someone reading it in
two years.
Related outputs from the same model file
mhd-cli create sdrf and mhd-cli create neo4j-input emit an SDRF table and a
graph-import form of the same study. Both take the model file, so they stay
consistent with the announcement by construction — worth preferring over
exporting from the announcement or from a repository's own metadata.
Verification
- The model file validates under the same profile the announcement declares.
target_mhd_model_file_url resolves publicly and returns the model file that
was used to derive the announcement, not a later edit of it.
- The submission task reached a terminal state and was read; the upload's own
status code was not treated as the result.
- The study appears in the search index under the expected repository, and the
fields you care about are populated rather than merely present.
Limitations
- The announcement carries what the model file carried. Fields the source
repository never recorded stay empty, and the hub cannot infer them; this is
the origin of the uneven field coverage seen from the search side.
- Identifier minting and submission need an API token issued to a repository.
A submitter without one goes through their repository, not directly.
- The client and the schemas move together. Pin the
mhd-model version used for
a deposit, and re-validate rather than assuming an older announcement still
conforms.
- The accession types accepted by the client are the five listed above. The
package README's example passes
test, which is not among them.
1---2name: metabolomicshub-announcement-authoring3description: Use when publishing a metabolomics dataset into the MetabolomicsHub index — building the common-model file, deriving and validating the announcement against the right profile, minting an identifier, and submitting a revision whose outcome only a polled task reports.4license: CC-BY-4.05---67# metabolomicshub-announcement-authoring89Turn a dataset's metadata into an MHD announcement that the hub will accept, and10find out that it will not before submitting rather than after.1112## When this applies1314A repository, a consortium partner or a submitter with a large deposit needs a15study to appear in the MetabolomicsHub index. The route is not a web form: it is16a common-model file, an announcement derived from it, a validation pass, an17identifier, and a submitted revision. Each of those has a failure mode of its18own, and two of them are asynchronous.1920This is the depositor's side of the hub. Reading the index is a different job.2122## The two artefacts, in the order they exist23241. **The MHD common data model file** — the full description of the study:25 samples, assays, protocols, parameters, instruments, publications.262. **The announcement file** — derived from the model file, and the thing the27 hub actually ingests. It references the model file by URL.2829Deriving the second from the first is a command, not an editing task. Writing an30announcement by hand and keeping it consistent with a model file is the mistake31this ordering exists to prevent.3233## Procedure34351. **Choose the profile before writing anything.** Two model versions (v0.1,36 v1.0) each carry two profiles: `ms-profile` and `legacy-profile`. The MS37 profile expects structured acquisition metadata; the legacy profile is the38 reduced shape for studies migrated from an existing repository. Both the39 announcement file and the common-model file have their own schema per40 profile, so there are four schemas in play and picking the wrong one produces41 validation errors that read as missing data.42 `GET /v0_1/schemas` returns the profiles the server currently enforces, and43 `GET /v0_1/server-info` reports which is the default. Ask the server; the44 defaults move with releases.45462. **Validate the model file first.**4748 ```49 mhd-cli validate mhd <mhd_study_id> <mhd_model_file_path>50 ```5152 Fixing the model file after deriving an announcement means deriving again.53543. **Derive the announcement.**5556 ```57 mhd-cli create announcement [--output-dir DIR] [--output-filename NAME] \58 <mhd_study_id> <mhd_model_file_path> <target_mhd_model_file_url>59 ```6061 The third argument is where the model file *will be* publicly readable. The62 hub checks that URL for accessibility when the announcement is shared, so a63 placeholder or a private link fails at submission rather than at derivation.64 Publish the model file before you submit, not before you derive.65664. **Validate the announcement.**6768 ```69 mhd-cli validate announcement [--output-path FILE] <mhd_study_id> \70 <announcement_file_path>71 ```7273 Use `--output-path` in any automated pipeline: it writes the result where a74 later step can read it, instead of leaving it in a log.75765. **Mint an identifier in the test lane first.** `POST /v0_1/identifiers`,77 or `MhdClient.get_new_mhd_accession(dataset_repository_identifier, accession_type)`.78 The accepted accession types are `mhd`, `legacy`, `test-mhd`, `test-legacy`79 and `dev`. Do a full dry run on a test accession before requesting a real80 one; identifiers are the part of this process you cannot take back.81826. **Submit the revision, then poll.** `POST /v0_1/datasets/{accession}/announcements`83 is a multipart upload authenticated with an `x-api-token` header, and it84 returns a `taskId` rather than a verdict. The outcome is read from85 `GET /v0_1/datasets/{accession}/tasks/{task_id}`. The shipped client polls it86 for you (ten attempts, five seconds apart); anything you write yourself must87 poll too. A 200 on the upload means the file was accepted for validation, not88 that the dataset was announced.89907. **Record the revision.** Announcements are versioned: every submission takes91 an `announcement_reason` and `GET /v0_1/datasets/{accession}/announcements`92 lists the revisions. The reason string is the only human-readable account of93 why a dataset's public record changed, so write it for someone reading it in94 two years.9596## Related outputs from the same model file9798`mhd-cli create sdrf` and `mhd-cli create neo4j-input` emit an SDRF table and a99graph-import form of the same study. Both take the model file, so they stay100consistent with the announcement by construction — worth preferring over101exporting from the announcement or from a repository's own metadata.102103## Verification104105- The model file validates under the same profile the announcement declares.106- `target_mhd_model_file_url` resolves publicly and returns the model file that107 was used to derive the announcement, not a later edit of it.108- The submission task reached a terminal state and was read; the upload's own109 status code was not treated as the result.110- The study appears in the search index under the expected repository, and the111 fields you care about are populated rather than merely present.112113## Limitations114115- The announcement carries what the model file carried. Fields the source116 repository never recorded stay empty, and the hub cannot infer them; this is117 the origin of the uneven field coverage seen from the search side.118- Identifier minting and submission need an API token issued to a repository.119 A submitter without one goes through their repository, not directly.120- The client and the schemas move together. Pin the `mhd-model` version used for121 a deposit, and re-validate rather than assuming an older announcement still122 conforms.123- The accession types accepted by the client are the five listed above. The124 package README's example passes `test`, which is not among them.