Repository navigation
Description
Overview
.nemar/metadata.json should be the single source of truth for all dataset metadata that goes into a DOI. Currently, metadata is assembled on the fly from multiple sources during DOI minting (dataset_description.json, .nemar/metadata.json, D1 cache). This makes it impossible to review what will be minted before it happens.
Instead, the metadata file should be built through a staged pipeline where each stage adds or refines metadata, and the file tracks its current stage.
Pipeline Stages
Stage 1: Seed
Pull all base metadata from BIDS sources into .nemar/metadata.json:
- All authors from
dataset_description.json(even without ORCIDs) - Title (
Name), license (License), data type (DatasetType: raw/derivative) SourceDatasets->IsDerivedFromrelated identifiersFundingreferencesReferencesAndLinks-> related identifiersHowToAcknowledge
Trigger: runs as part of dataset upload or on first push to main.
Stage 2: LLM Enrichment (current implementation)
Extract what BIDS doesn't provide from README:
- Rich description/abstract
- Methods description
- Structured keywords with subject schemes (e.g., MeSH)
- Additional funding details (award numbers found in text)
- Additional related identifiers from README
Trigger: llm-enrichment.yml workflow on push to main when README.md or dataset_description.json change.
Stage 3: LLM Validation (judge)
A second LLM pass that reviews the assembled metadata:
- Validates relation types (e.g.,
IsDerivedFromvsIsVersionOfvsIsDescribedBy) - Checks author completeness against README mentions
- Validates keyword relevance and scheme assignments
- Flags inconsistencies between description and actual data
- Produces a confidence score or list of concerns
Trigger: runs after enrichment completes, or on demand.
Schema Changes
Add pipeline_stage field to .nemar/metadata.json:
{
"version": "2.0",
"pipeline_stage": "validated",
"authors": { ... },
"description": "...",
...
}Values: "seeded" | "enriched" | "validated"
DOI Gating
Update the enrichment gate on DOI concept creation:
- Currently: checks
enrichment_json IS NOT NULL - Target: checks
pipeline_stage >= "enriched"(or"validated"once judge is reliable)
Changes to bidsToDataCite()
Currently assembles metadata from multiple sources. Should be refactored to read primarily from .nemar/metadata.json as the single source of truth, with dataset_description.json only as a fallback for unseeded datasets.
Motivation
- The LLM incorrectly classified a PhysioNet DOI as
IsVersionOfwhen it should beIsDerivedFrom. A validation stage would catch this. - Authors without ORCIDs are currently missing from
.nemar/metadata.jsonbecause only ORCID-bearing authors are stored during upload. All authors should be present. - No way to review what metadata will go into a DOI before minting.
- Data type (raw vs derivative) is in BIDS but never pulled into the metadata file.
Parent Issue
Sub-issue of #108 (Phase 3: Rich metadata enrichment for DataCite DOIs)
Activity
Document metadata pipeline architecture (issue #154)
neuromechanist commentedon Feb 18, 2026
LLM Validation Prompt Design (Stage 3)
Modeled after Anthropic's pr-review-toolkit agents, which use structured evaluation criteria with confidence scoring and actionable output.
System Prompt Structure
The validation LLM receives three inputs:
.nemar/metadata.json(the metadata to validate)README.md(ground truth for content)dataset_description.json(ground truth for BIDS fields)Validation Criteria (0-100 confidence scoring)
Output Format
{ "overall_pass": true, "criteria": { "author_completeness": { "confidence": 95, "pass": true, "issues": [], "suggestions": [] }, "related_identifiers": { "confidence": 40, "pass": false, "issues": ["10.13026/ym7v-bh53 has relation_type IsVersionOf but dataset_description.json lists this as a SourceDataset, suggesting IsDerivedFrom"], "suggestions": ["Change relation_type to IsDerivedFrom"] } }, "blocking_issues": ["Incorrect relation type for 10.13026/ym7v-bh53"], "warnings": [] }Blocking vs Warnings
Blocking (must fix before DOI): missing authors, incorrect relation types, factually wrong description
Warnings (should fix): missing keywords, imprecise descriptions, unconfirmed funding details
Implementation Notes
pipeline_stagefrom"enriched"to"validated"on pass"enriched"Align DataCite pipeline with kernel-4.6 (#152)
neuromechanist commentedon Feb 18, 2026
Implemented in PR #152. The staged metadata pipeline (seed -> enrich -> validate) is live on production.
Fix DOI metadata pipeline and add enrichment guard (#163)