Skip to content

Data Model: Corpus Records

NeuLitTrace's corpus is a fixed collection of 329 papers spanning 14 conditions (10 rare, 4 common), sourced from PubMed. The corpus stays fixed for the duration of a query.

NeuLitTrace data model diagram

Overview

This page documents the two record types that make up the corpus itself: Condition and Paper. A Condition defines a diagnosis and its rarity classification; the corpus contains many Paper records, each linked to a condition by string matching on Condition.name. For the records produced per-query (search loop trace, summary, API response), see Data Model: API Schemas.

Record Types

Condition

A Condition represents one diagnosis in the corpus scope. Each condition defines its own PubMed search strategy, expected brain regions, and rarity classification.

FieldTypeDescription
namestringCanonical condition name, e.g. "Scalp angiosarcoma"
raritystringEither "rare" or "common"
pubmed_querystringSearch query used to retrieve initial candidate papers for this condition
region_literaturestringPlain-language description of the typical brain or imaging region associated with this condition
atlas_labelstringComma-separated atlas region labels (from Harvard-Oxford), used for the 3D viewer
target_countintegerDesired number of papers to retrieve during corpus construction
overlaps_withlist of stringsCondition names that can be radiologically confused with this condition, for differential-diagnosis flagging (defaults to empty)

Paper

A Paper is one record in the corpus. Each paper is linked to exactly one condition via its condition field (string matching, not a foreign key ID). The paper data comes from PubMed metadata and includes full abstract text for summary generation.

FieldTypeDescription
pmidstringPubMed identifier, e.g. "40902156"
titlestringPaper title from PubMed
abstractstringFull abstract text; used as primary content for LLM summarization
conditionstringCondition name this paper belongs to; must match a condition's name field exactly
raritystringInherited from the condition; "rare" or "common"
region_literaturestringInherited from the condition
atlas_labelstringInherited from the condition
overlaps_withlist of stringsInherited from the condition; candidate conditions for differential diagnosis

Extending the Corpus

The 14-condition scope was set deliberately for this build to keep retrieval quality and evaluation numbers verifiable end to end. Adding a condition is a small, mechanical change, since the corpus is fetched automatically rather than hand-curated:

  1. Add one entry to CONDITIONS in backend/app/corpus/conditions.py: a name, rarity, a PubMed search query, the literature-described brain region, a matching Harvard-Oxford atlas label, and a target paper count. This is the only step that takes real judgment, since the atlas label has to match a real Harvard-Oxford region name for the brain visualization to be accurate.
  2. Run python -m backend.app.corpus.build_corpus. It fetches the abstracts from PubMed's E-utilities API automatically and rewrites corpus.json, no manual data entry required.
  3. Bump the condition count in backend/tests/test_corpus_coverage.py, the data-integrity check for corpus size.

No schema changes or pipeline rewrite required. The near-term path to a larger corpus is adding more entries to CONDITIONS, and extending the fetch beyond PubMed to Orphanet for rare-disease-specific literature a PubMed query alone may miss.