Skip to main content

Graph Seeding Pipeline

The seeding pipeline populates the PostgreSQL-backed taxonomy from three knowledge sources: automated web scraping (Source 1), the SNOMED CT medical ontology (Source 2), and curated configuration (Source 3). It is a multi-phase process: scrape (HTML to frozen data objects with campus inference), enrich (LLM-generated universal medical knowledge), seed (merge all sources into the taxonomy), and SNOMED enrichment (ontology-derived concept IDs, synonyms, and relationships).

Two Paths to Entity Storage​

New to the term "golden page"? Read Golden Pages first. It defines what a golden (hub) page is, how the AI-discover / human-confirm lifecycle works, and why top-down seeding exists. This page assumes that concept and focuses on the pipeline mechanics.

The system has two distinct paths for writing entities to the taxonomy:

PathWhenWhatAuthority
Hub page seedingManually triggered by an operatorFull taxonomy from hub pages, domain knowledge and LLM enrichmentHighest: defines the authoritative entity set
Content ingestionPer page during a crawlEntity extraction from individual pagesLower: gated by golden-only mode

With golden-only mode on (the default), content ingestion does not write to the taxonomy. Only the hub page seeding path populates the entity store. This prevents unvalidated relationships from leaking into the taxonomy from crawled pages.

Pipeline Walkthrough​

The pipeline runs as three sequential operator-run steps (command-line tools, also available from the administrative interface).

Phase 1: Scrape Taxonomy​

Fetches HTML from the hub pages auto-discovered by the LLM classifier (previously these were listed by hand in a configuration file), and parses doctors, departments, conditions, treatments, examinations and consultation schedules. The result is saved to the taxonomy with a full-replacement strategy (existing scraped data is replaced by the new scrape). A dry-run option shows what would change without writing.

note

Hub page addresses are no longer manually configured. The system auto-detects hub pages from crawled content using a binary hub/detail LLM classifier.

Phase 1.5: LLM Enrichment (One-Time)​

Loads the taxonomy and calls a Tier 3 reasoning model to classify relationships between entities. It produces five data modules:

ModuleRelationshipDescription
Department-conditionsHANDLESWhich departments handle which conditions
Department-treatmentsOFFERSWhich departments offer which treatments
Department-examinationsPERFORMSWhich departments perform which examinations
Condition-examinationsDIAGNOSESWhich examinations diagnose which conditions
Treatment-conditionsTREATSWhich treatments treat which conditions

The LLM prompt uses standard Belgian hospital department names rather than hospital-specific names, so the output is portable across hospitals. Resolution to hospital-specific names happens at seeding time.

This step runs once and the output is kept under version control for human review.

Phase 2: Seed Taxonomy​

Loads the scraped data, initialises the frozen taxonomy registry, builds an extraction result by merging all three knowledge layers, and stores everything in the taxonomy through the golden-page seeder.

By default the seeding performs a full replacement of existing taxonomy data before re-seeding. An option runs the scraper first, so scrape and seed happen in one step.

Three-Source Merge​

The seeder combines three knowledge sources following the Three-Source Knowledge Architecture:

Merge Priority​

Hospital-specific data always takes precedence over universal knowledge. When the two lists are combined, hospital-specific values come first and duplicates are removed case-insensitively. The result is used for all enrichment passes:

  1. Entity priority. Scraped entities are created first. Synthetic entities (high-traffic search terms that were not scraped) are only added if they do not already exist.
  2. Relationship priority. Scraped relationships from hub pages get confidence 1.0. Enrichment passes only add relationships that do not already exist.
  3. Type overrides. A curated override list reclassifies mistyped entities (for example, items scraped from a treatment section that are actually conditions).

What the Merge Produces​

The merge produces entities and relationships in this order:

Entities:

  1. The hospital entity
  2. Campus entities (four)
  3. Departments: normalized, deduplicated, reclassified (department, facility or centre)
  4. Doctors, with provider-type inference and multi-fallback department resolution
  5. Conditions, treatments and examinations, filtered against a blocklist and type overrides
  6. Synthetic entities: curated conditions and treatments for high-traffic search terms
  7. Curated navigational services (visiting hours, route and parking, appointments)

Relationships:

  1. Hospital HAS_CAMPUS Campus (structural)
  2. Department BELONGS_TO Hospital (structural)
  3. Department LOCATED_AT Campus (from the scraper's campus inference, with a configuration fallback)
  4. Doctor WORKS_IN Department (from the scrape)
  5. Doctor WORKS_AT_CAMPUS Campus (from the scrape)
  6. Department HANDLES Condition (merged: scraped, hospital configuration, universal)
  7. Department OFFERS Treatment (merged)
  8. Department PERFORMS Examination (merged)
  9. Treatment TREATS Condition (merged)
  10. Examination DIAGNOSES Condition (merged)

Backfill Steps​

After the main seeding pass, the seeder runs two backfill steps.

Doctor Campus Inference​

Creates WORKS_AT_CAMPUS relationships by inference:

  • Pass 1. Doctors whose departments all resolve to a single campus get a link to that campus.
  • Pass 2. Doctors with exactly one department that spans several campuses (two or three, not all four) get a link to each of those campuses. The "not all four" guard prevents doctors from being linked to every campus.

BELONGS_TO Completion​

Finds all Department or Centre nodes without a BELONGS_TO relationship to the hospital and creates one. This catches departments created during enrichment that the structural pass missed.

Phase 3: SNOMED CT Enrichment (Approved Design)​

After the main seeding pass and backfills, the pipeline runs a SNOMED CT enrichment phase that adds ontology-derived data to existing graph nodes. This phase implements Source 2 of the Three-Source Knowledge Architecture.

What It Does​

StepInputOutputScope
1. Concept matchingEntity names matched against SNOMED descriptionsA SNOMED concept ID on the nodeExisting entities only
2. Synonym enrichmentConcept ID to Dutch descriptionsA list of Dutch synonyms on the nodeMatched entities only
3. IS_A hierarchyPre-computed SNOMED hierarchyIS_A relationships between existing nodesDepth limit: 3 hops
4. FINDING_SITE routingCondition concept, body structure, departmentNew HANDLES relationships (confidence 0.7)Conditions with matched concepts
5. PROCEDURE_SITE routingTreatment concept, body structure, departmentNew OFFERS relationships (confidence 0.7)Treatments with matched concepts

Node Property Additions​

After SNOMED enrichment, condition entities carry ontology-derived properties. For example, the entity "diabetes mellitus" gains its SNOMED concept ID, its preferred term ("diabetes mellitus") and a list of Dutch synonyms such as "suikerziekte" and "DM".

Scoping Guard​

The enrichment phase operates on a closed entity set: only the entities already created by Sources 1 and 3 are enriched. The roughly 356,000 SNOMED concepts are not bulk-imported. The expected growth is a modest number of IS_A relationships and of FINDING_SITE or PROCEDURE_SITE-derived relationships.

Plausibility Filtering​

SNOMED-derived relationships pass through the same plausibility guards as all other sources (the handles guard, the negative department-condition map and the hub condition blocklists). Their lower confidence (0.7 against 1.0) also reduces their weight in search ranking.

The Golden-Only Gate​

The golden-only setting (on by default) controls whether regular content ingestion can write entities to the taxonomy. When on, the system checks each page's classification to determine write permissions:

Page TypeCan Write to Taxonomy
HubAlways: defines the authoritative entity set
DetailOnly when golden-only mode is switched off

The golden-page seeder always has full write authority regardless of this setting.

Source Page Classification​

Hub/Detail Reclassification (2026-03-09)

The original 8-type classification was replaced with a binary hub/detail classification. Hub page addresses are now auto-discovered by an LLM classifier rather than manually configured.

Pages are classified into two types:

TypeDescriptionAuthority Level
HubNavigational listing pages (a few dozen per hospital), auto-detected by the LLM classifierHigh: defines the authoritative entity set
DetailSingle-entity pages (individual doctors, conditions, etc.)Standard: stored but not used for taxonomy seeding

The golden-only gate uses this classification to control write permissions. Hub pages have full write authority; detail pages are gated.

Pipeline Execution Summary​

  1. Scrape. HTML to frozen data objects, plus campus inference from doctor data, stored in the taxonomy.
  2. Enrich. Taxonomy entities to LLM classification to data modules (one-time, human-reviewed).
  3. Seed. Load the taxonomy and merge the three sources into the taxonomy, plus backfills.
  4. SNOMED enrich (Phase 3). Existing taxonomy entities to SNOMED concept matching to synonym, hierarchy and relationship enrichment.

The same pipeline can also be triggered from the administrative interface.

Production Pipeline (SP-4/SP-5/SP-6)​

The operator-run seeding pipeline described above is complemented by the production pipeline wizard:

  1. SP-4 Entity Resolution: LLM extraction from hub pages, deduplication, SNOMED matching.
  2. SP-5 Draft/Publish: versioned snapshots, impact preview, rollback.
  3. SP-6 Management UI: a 5-stage pipeline wizard for operators.

See Pipeline Wizard for the operator workflow.

References​

  • Hogan, A., et al. (2021). Knowledge graphs. ACM Computing Surveys, 54(4), 1--37. https://doi.org/10.1145/3447772
  • Robinson, I., Webber, J., & Eifrem, E. (2015). Graph Databases: New Opportunities for Connected Data (2nd ed.). O'Reilly Media.