Skip to content

Cohort check codes

What medh5 dataset check reports — and C204, which medh5 dataset split raises while it makes a split, before anything is written. These describe a cohort — a set of files considered together — not a file.

That is why they are a separate code space from the diagnostic codes, and deliberately so: every file in a cohort can be individually valid while the cohort is unusable, because two sites used different label sets, or a subject appears in both train and test. No per-file validator can see either problem, so no per-file code exists for them.

The codes are tooling-level rather than normative: the specification does not require an implementation to emit them, and a minor version may add to them freely. The table is generated at build time from the CHECK_CODES and CHECK_SEVERITY tables in crates/medh5/src/dataset/check.rs, the cohort check every frontend runs. In Python they are medh5.dataset.CHECK_CODES (each code's meaning) and medh5.dataset.CHECK_CODE_SEVERITY (each code's severity), and medh5.dataset.check(manifest) runs them, returning a report of medh5.dataset.Findings.

medh5 dataset check cohort.json --deep
Code Severity Meaning
C101 warning the cohort uses more than one label set
C102 error a class id means different things in different label sets
C103 warning a sample declares no label set
C201 error a split claim's manifest digest is not this manifest's
C202 error one subject's or grouping key's samples claim different partitions, or folds, of one split
C203 warning a sample carries no split claim
C204 error a group holds part of a subject, so the split is not subject-safe (raised by dataset split)
C301 warning a class is examined in only part of the cohort
C302 info a class is named but examined in no sample
C401 warning a file changed after the manifest was written
C402 error a file in the manifest no longer exists
C501 warning the cohort mixes de-identified and non-de-identified samples

The severity is each code's own. C401 is the one that changes: dataset check --deep re-reads every file's content_id, so it knows a file changed rather than suspecting it from its size and modification time, and reports C401 as an error. C204 is never reported: dataset split refuses with it.