Skip to content

Add a vocabulary manifest for normalized ids - #60

Merged
jdkent merged 2 commits into
mainfrom
claude/vocab-manifest-286e7d
Nov 6, 2026
Merged

jdkent merged 2 commits into
mainfrom
claude/vocab-manifest-286e7d

Conversation

@jdkent

@jdkent jdkent commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Adds src/study_schema/vocabularies.json, shipped in the package and loaded by study_schema.vocabularies. It pins the release of every vocabulary whose ids land in a record's normalized entries, and gives each one a neutral name. The rule, now in Normalization.vocabulary's description and the README: a normalized entry's vocabulary is a manifest name, or an enum this schema defines (AgeUnit), and its value resolves against the release the manifest pins.

vocabulary stays free text and its description lists the names. It isn't an enum: pondie's closed-field normalizers write schema enum names (AgeUnit, SexCategory, …), and every record written so far carries the legacy strings, so an enum would reject both.

The entries

Name Legacy string written today Release Pinned by Hierarchy
mondo MONDO 2026-09-01 purl.obolibrary.org/obo/mondo/releases/2026-09-01/mondo.json, sha256 is_a
onvoc ONVOC 1.0.0 commit-pinned skos.ttl (see below), sha256 skos:broader
canonical_task astra canonical task task-inventory-3.1 ns-pond data/task_inventory_v3.json @ 47e8470, sha256 the inventory entry's family → task_family
task_family astra task family task-inventory-3.1 same file (23 families, listed) none
condition_atom astra condition atom: {axis} (and astra condition atom on unmapped entries) ns-pond-47e8470 taskcat/conditions.py, sha256 prefix before : (the axis)
condition_phase astra condition phase ns-pond-47e8470 taskcat/conditions.py (11 phases, listed) none
contrast_key astra contrast key ns-pond-47e8470 records.py (the key rule) prefix before | → task_family
contrast_set ns-pond contrast set {fit_id} fit-ed5ac7b08c20 the fit's contrast_sets/sets.jsonl sha256 + contrasts.py prefix before # → task_family
contrast_set_orientation ns-pond contrast set orientation {fit_id} fit-ed5ac7b08c20 sidecars.py (same/reversed) none
medical_role astra medical role ns-pond-47e8470 medical.py (none/comorbid/primary) none

ns-pond pins point at merge commit 47e84703 (#202), the last merge that touched ingestion_workflow/normalization/. Main's copy of that directory is still identical to it.

The entries also carry an upstream list, described below. study_schema.vocabularies.vocabulary(name) returns one entry. for_legacy(string) maps an old string back to its entry: {axis} matches [a-z_]+ and {fit_id} matches fit-<12 hex>.

Borrowed vocabularies

canonical_task and task_family list their sources under upstream. Each hash below was checked against ns-pond's copy.

  • HED-task (hedtags.org/hed-task, hed-standard/hed-task, MIT):
    • The tasks: all 107 hedtsk_* ids, their names and definitions, their primary family, and the hedvar_* variations. The source is data/task_details.json at merge 4a9e8582 (Say in the JSON Schema which slots key a nested list #35, 2026-09-23); ns-pond's copy is byte-identical, and that file hasn't changed on HED-task's main since.
    • The families: 19 of the 23 come from data/task_family_defs.tsv at the same commit. ns-pond adds animal_behavior, dyadic_interaction_observation, information_evaluation_and_belief and ingestive_behavior.
  • Cognitive Atlas: task names are used only as synonyms when matching task names, through HED-task's data/mappings/atlas_task_to_hed.tsv at merge 55f7d586 (Describe the inverse sign-split half as negated values (text only) #31). No Cognitive Atlas id is written. ns-pond's copy is older than HED-task's main.
  • BrainMap: the 14 tct_bm_* tasks come from BrainMap paradigm classes, through ns-pond's brainmap_crosswalk.json. I didn't verify a BrainMap release or license, so that entry gives neither.
  • ns-pond's own additions: the remaining 111 tct_* tasks.

Verified

  • MONDO: I downloaded the versioned URL into a scratch directory: 107,586,061 bytes, sha256 ba19a3be…. It is byte-identical to pondie's data/vocab/mondo.json, and its version IRI is …/releases/2026-09-01/mondo.owl, the release the fit manifest names.
  • ONVOC: skos.ttl at OpenNeuroOrg/onvoc-widget commit 05d2df56 is byte-identical to pondie's data/vocab/onvoc.ttl (sha256 459a51cc…, owl:versionInfo "1.0.0").
  • ns-pond files: each sha256 is computed from the file at 47e8470. The task inventory's hash also matches the one in the fit manifest's code_sha256.
  • Contrast-set fit: fit-ed5ac7b08c20's manifest (on beast) names mondo/releases/2026-09-01. Its sets.jsonl has 5,445 sets, sha256 7a398fa0….

Not verified

  • ONVOC's publisher. BioPortal serves downloads only with an API key, so I couldn't compare against it. The URL in the manifest is OpenNeuro's widget repo, not an ONVOC release page. It is the same bytes pondie maps against, but it isn't an official versioned download.
  • Which fit is deployed. I pinned fit-ed5ac7b08c20, the newest fit, built 2026-11-05 for #202. No normalize_fit_dir is set in beast's ns-pond configs, so I couldn't confirm that assign runs with this fit. The fit directory isn't published anywhere; the manifest pins only the hash of sets.jsonl.
  • The fit's code. It was built from code whose taskcat/lexicon.py differs from the merged #202, which adds a word-mask fix. This changes which canonical task some names match, not the vocabulary itself.
  • Condition atoms have no value list. normalize_condition_ctx produces atoms that ATOMS doesn't list (for example congruency:neutral), so the manifest pins the rules file, not a list of values.

Decisions for James

  • The condition-atom id. Under the neutral name the id is <axis>:<value>, the form taskcat itself produces. Today the axis sits in the vocabulary string and the value alone in value.
  • One name beyond the requested list: contrast_set_orientation. Its values also land in normalized.
  • JSON, not YAML. The manifest is JSON, so the loader needs only pydantic, the package's one dependency; pyyaml would have become a runtime dependency.
  • CognitiveAtlas isn't in the manifest. pondie's vocabularies/onvoc.py writes CognitiveAtlas mappings only to corpus rows, never into normalized.

Generated files

python tools/generate_models.py regenerated models/extraction.py and jsonschema/extraction-record.schema.json (the description change), and --check passes. Tests run locally: test_vocabularies.py (new), test_normalized.py and test_generated.py, 38 passed; with the HED-task test added, test_vocabularies.py alone runs 31.

🤖 Generated with Claude Code

jdkent and others added 2 commits November 6, 2026 08:20
src/study_schema/vocabularies.json pins the release of every vocabulary
whose ids land in a record's `normalized` entries (MONDO 2026-09-01,
ONVOC 1.0.0, and ns-pond's canonical tasks, task families, condition
atoms and phases, contrast keys, contrast sets and their orientation,
medical roles) under neutral names, with the legacy strings records
carry today. study_schema.vocabularies loads and validates it.

Normalization.vocabulary's description states the rule; models
regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
canonical_task and task_family now list their upstream vocabularies:
HED-task (MIT) at the hed-standard/hed-task merge commits ns-pond's
copies match byte for byte, Cognitive Atlas names through HED-task's
crosswalk, and the BrainMap paradigm classes behind tct_bm_* tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jdkent jdkent left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdkent
jdkent merged commit 9d438fd into main Nov 6, 2026
6 checks passed
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.

1 participant