Schemas
This repository is the schema: LinkML YAML, and the prose that says how to read a paper into
it. The only Python here is generated from that YAML -- the study-schema package, which
hands the contracts to every repository that produces or consumes them (see
The contracts as a package).
Everything else that reads the schema lives in
pondie — the generator, the checks this README
runs, the extraction pipeline, and the three modules that define what a record means
(schema_utils, text_index, table_parse). pondie carries this repository as a
submodule, so a schema change and the code that consumes it are versioned together without
either being a copy of the other.
The LinkML lives under src/study_schema/linkml/. neuroimaging-study-storage.yaml and the modules under neuroimaging-study-storage/ are
the full storage schema: everything we might ever want to represent. It is the source of
truth and is never narrowed in place.
Per-field metadata
Three axes annotate the storage fields, and they deliberately do not collapse into one. A
field can be filled deterministically and still be outside the MVP, or be low priority and
inside it.
| Axis |
Where it lives |
Question it answers |
| Does a release represent this field? |
in_subset: [mvp] |
Is this in the MVP? |
| How does the field get filled? |
in_subset: [deterministic] or in_subset: [model_extracted] |
Does code fill it — API lookup, local store, derived value, generated identifier — or does a language model read it out of the source? |
| How urgently does a human review it? |
storage-parameter-priorities.yaml, keyed Class.field → 0–3 or n/a |
Reviewer triage order |
The subsets are declared in neuroimaging-study-storage/subsets.yaml and marked on the
attribute itself:
publication_year:
in_subset: [mvp, deterministic]
range: integer
design:
in_subset: [mvp, model_extracted]
Identifiers are minted at ingestion, so they count as deterministic whether or not they
carry the mark. Type designators are structural rather than either: the extraction record
states which variant it is — nothing downstream could guess — and storage keeps the same
slot, so they are in both schemas and in neither subset.
python3 -m pondie.schema.checks.storage_parameter_priorities # every field has exactly one priority entry
python3 -m pondie.schema.checks.field_provenance # every field says how it gets filled
python3 -m pondie.schema.checks.field_provenance --strict # ...and none are left unclassified
field_provenance fails on a field marked both deterministic and
model_extracted, or on an identifier marked model_extracted. Fields not yet classified
are reported as remaining work and only fail under --strict, so the check is usable while
the pass is in progress. It also prints where the marks disagree with n/a in the priority
file, as a second opinion rather than an authority — n/a has carried the same meaning as
deterministic, so a disagreement usually means a field changed hands and the priority
entry has not caught up.
Generating the MVP schema
Not implemented. No gen_mvp_schema.py appears anywhere in this repository's history
and no neuroimaging-study-storage-mvp tree is committed, so what follows is the design a
generator would be written to. It is kept because the mvp marks it reads are on the
fields today, and because the constraints below are what makes them meaningful.
Attributes are the only thing marked. A class has no mark of its own — it survives when a
marked attribute's range points at it — so leaving every attribute of a class unmarked is
how a whole entity gets dropped. Identifiers and type designators are kept without a mark,
but do not by themselves keep a class alive.
The generated tree would be committed and must not be hand-edited. The generator must
refuse to write a structurally broken schema, reporting instead when a marked attribute
points at a
class with nothing marked in it, or when a surviving class drops a required field.
required is only enforced inside classes that survive, so a field required within an
entity we do not extract is not a problem.
Only mvp generates a schema. deterministic and model_extracted label fields across
the whole schema rather than slicing it — the two are interleaved down every path from the
tree root, so pruning to either would strand the other's fields. Each subset declaration
says which it is via a generates_schema annotation, and the generator refuses the ones
that do not.
The extraction schema
The extraction schema is the storage schema with the values wrapped. Same classes, same
slots, same nesting; a scalar becomes an ExtractedValue carrying the evidence a model
found for it. It is generated, so that stays true:
python3 -m pondie.schema.generate # writes neuroimaging-study-extraction{.yaml,/}
python3 -m pondie.schema.generate --check # fails when the committed tree is out of date
The projection is mechanical, and the whole of it is:
| Storage |
Extraction |
in_subset: [model_extracted] |
kept |
in_subset: [deterministic] |
dropped — code fills it, so there is nothing to read off the page |
id (identifier: true) |
local_id, a plain string and still the class's identifier; storage mints its own id at ingestion |
range: string |
ExtractedString |
range: integer / float / boolean |
ExtractedInteger / ExtractedNumber / ExtractedBoolean |
range: <Enum> |
Extracted<Enum>, a generated wrapper whose value is that same closed vocabulary |
any_of: [<Enum>, string] |
Extracted<Enum>, whose value keeps the same any_of — the escape hatch moves inside the wrapper |
multivalued: true on any of the above |
the cardinality moves inside: Extracted<T>List, one wrapper over a list, under one evidence record |
range: <Class>, inlined |
unchanged; the child is projected too |
range: <Class>, not inlined |
unchanged; LinkML resolves it through the target's local_id |
minimum_value, rules, unique_keys |
dropped — they constrain a scalar, and the wrapper is in the way. The run report lists each one |
The vocabularies come across whole: 34 enums, 186 permissible values, 180 of them with
descriptions, and each field's range copied exactly — closed where storage is closed, open
where storage left an escape hatch. A closed one compiles to a real enum in the generated
JSON Schema, so structured output can be constrained to it. Storage has 37; the three that do
not project are the ones no extracted field reaches — EffectKind, which no slot has as a
range at all, StudyType, which the API supplies, and EdgeDirectionality, which the mapper
derives.
Anything that is not mechanical lives in extraction-deviations.yaml, in two parts.
required_additions is what extraction has because it is an extraction — which model ran,
what text it read, where the sections of that text begin and end. deviations is where the
two schemas are allowed to disagree about the domain, and it starts empty: the baseline is
that they are identical, and each entry is a claim that a paper-reading model does better
with a different shape. The generator refuses an entry that does not say what it rests on.
Keeping extraction and storage in step
The extraction schema is a projection, so extraction-to-storage.map.yaml is an
identity map. It holds 35 derivations, 5 free-text tables and 1 conditional field;
everything else is the field of the same name on the same class, with .value unwrapped.
python3 -m pondie.schema.checks.extraction_to_storage_map
Three things must hold, and each fails in its own way:
| Check |
The drift it catches |
| Every extracted storage field has an extraction field of the same name, and every extraction field has a storage field to land in |
A rename on either side, or a shape change applied through extraction-deviations.yaml without a matching map entry |
derivations names exactly the storage fields marked deterministic |
A field that changes hands — from an API lookup to something a model reads, or back |
| Each enum-ranged field's extraction wrapper carries the same vocabulary with the same range and the same cardinality |
A projection that opens a closed vocabulary, letting through a value storage rejects — or closes an open one, making the extractor coerce |
There is no normalize step, and this is recent. Extraction used to flatten every
vocabulary to ExtractedString, and 16 tables holding 316 synonyms were the only route from
a paper's wording back to a permissible value. Now the extractor emits a value storage
already accepts, so the tables had nothing left to do and were deleted; git log has them.
The five fields storage keeps as range: string — Group.age_unit, ModelEstimation.stage
and friends — still have a table under free_text_normalizations. There is no vocabulary to
project and nothing makes their wording consistent, so it earns its place. It normalizes for
queryability rather than for validity: an unmatched value is already storable, which is also
why nothing checks it. ModelEstimation.stage is the clearest case — it labels an estimation
stage in the source's words, and which stage fed which is inputs_from, so a value the table
misses costs a facet and nothing structural.
The direction that check three catches is worth naming, because only one half of it is
loud. Opening a closed vocabulary fails at ingestion. Closing an open one works fine and
quietly costs you something: an open vocabulary is where the paper's own wording is worth
keeping, since an answer the vocabulary has no slot for is the evidence it is short a value.
The paper-parse schema
neuroimaging-paper-parse.yaml and neuroimaging-paper-parse/ hold the two artifacts the
ingestion workflow hands downstream, as contracts both sides validate against:
| Class |
Producer |
Consumers |
ParsedPaper: the text every offset addresses, tables row by row, bibliography, is_meta_analysis |
ns-pond-ingestion-workflow (extract, metadata, triage) |
the workflow's coordinate stages, pondie, neurostore |
CoordinateParse: points grouped into keyed analyses, with roles and sign splits |
ns-pond-ingestion-workflow (analyses, resolve, space); pondie for a revision |
pondie, neurostore |
They live here rather than as a NIMADS extension because the extraction and storage
records point into them: evidence spans address ParsedPaper.text_sha256, and
Analysis.source_table_analysis names a CoordinateParse key. NIMADS stays the meta-analysis
interchange. A ParsedPoint's coordinates, space and values carry NIMADS's names and
meaning, so projecting a parse onto a studyset is a field copy.
What each side may rely on:
- One shape for every source. PMC, Europe PMC, pubget, Elsevier, ACE and PDF all emit
a
ParsedPaper, so a consumer never branches on where a paper came from.
- A preprint is not its version of record. The header's
doi, pmid and pmcid name
the version of record. A preprint server's DOIs, each with its PreprintServer, and
PubMed's and PMC's records of the preprint are kept beside them in preprint_dois,
preprint_pmids and preprint_pmcids. Any other DOI, PMID or PMCID of the work, neither the version of
record's nor a preprint's, goes in alternative_dois, alternative_pmids or
alternative_pmcids: another version (an eLife paper's .1, .2), a duplicate PubMed
record, a second PMC record, a Crossref alias, a DOI from before a publisher move. A
preprint server's DOI stays in preprint_dois even when Crossref lists it as a version,
and an eLife reviewed preprint with no version of record yet has its base DOI and .k DOIs
there (server elife) with doi empty. An identifier appears in one slot of an
ArticleIdentifiers only, DOIs compared case-insensitively; LinkML cannot state that
across fields, so check_paper and check_revision do.
publication_status states which the paper has
(published or preprint). The upload pointer neurostore_base_study_id is the
header's own, not an identifier of the paper.
- A licence belongs to a copy. A copy is four facts: where it is hosted (
route), which
version it is (version: vor, am, submitted), its own license, and, for a copy we
hold, how we obtained it (access: public, tdm_grant, unrecorded).
ParsedPaper.text_copy is the copy the text was read from; ParsedPaper.reported_copies
are copies a source lists and we do not hold. Copies are the parse's alone: storage holds
no copy. Bibliography.license is the paper's
licence: the version of record's, or the preprint's while publication_status is
preprint. A licence names its license_id (OpenAlex's licence slugs, cc-by and the
rest) and its determination: stated by a named source, or assumed all rights reserved when
every source that could state one answered and none did. A text-mining grant is an
access, not a licence: a PMC author manuscript under TDM