Skip to main content

Taxonomy Extraction Pipeline

Overview​

The taxonomy extraction pipeline automatically discovers and extracts medical entities (doctors, departments, conditions, treatments, examinations) from a hospital website. It replaces the manual entity creation process with an AI-driven staged pipeline whose output is always reviewed by a human before it goes live (draft, review, publish).

Pipeline Stages​

Stage 1: Data Management​

Purpose: Configure the hospital tenant: campuses, websites, pipeline settings.

Components:

  • Hospital registration (name, domain, campuses)
  • Website address configuration
  • A budget limit on the cost of an extraction run

Stage 2: Crawl & Ingest​

Purpose: Discover all pages on the hospital website and ingest their content.

Components:

  • Sitemap-based page discovery
  • Content extraction and chunking
  • Contextual embeddings and canonical questions (see the related decision record, ADR-0019)
  • A dashboard showing processed, discovered, empty and dead page counts and a content-type breakdown

Stage 3: Hub Detection​

Purpose: Find listing pages (hubs) that contain entity links, for example an "Our doctors" page listing all doctors.

AI classification pipeline:

  1. Pre-filter. Score pages by keyword matching (30 Dutch medical keywords) and keep those above a threshold.
  2. Content retrieval. Fetch up to three chunks per candidate from the document store.
  3. AI classifier. An LLM evaluates each candidate: is it a hub? Which entity types does it list? What is the pattern of its child pages?
  4. Address inference fallback. For pages rendered by JavaScript with no retrievable content, entity types are inferred from the page address pattern.

Output: Confirmed hub pages with entity types and child page patterns.

Stage 4: Entity Extraction​

Purpose: Extract entities from each hub's child pages using an LLM.

Extraction flow:

  1. For each confirmed hub, resolve the child pages (by pattern matching, with a prefix fallback).
  2. An LLM extracts entities from the page content (name, type, confidence, relationships).
  3. A resolution pipeline deduplicates by name normalization and matches SNOMED CT.
  4. Auto-approval: entities with confidence of 0.90 or higher and a SNOMED match are auto-approved.
  5. A fuzzy dedup scan (SP-7) finds near-duplicates by edit distance.

Entity types:

TypeSourceExample
DoctorIndividual doctor pagesA cardiologist
DepartmentImplicit from relationshipsCardiologie
ConditionCondition pagesEpilepsie
TreatmentTreatment pagesHartrevalidatie
ExaminationExamination pagesEchografie
CampusThe authoritative campus listCampus Sint-Jan

Relationship types:

TypeSourceTarget
WORKS_INDoctorDepartment
LOCATED_ATDoctorCampus
TREATSDepartmentCondition
OFFERSDepartmentTreatment
PERFORMSDepartmentExamination

Stage 5: Review & Publish​

Purpose: An operator reviews the extracted entities, approves, rejects or merges them, then publishes.

Actions:

  • Approve (automatic or manual)
  • Reject (with a reason)
  • Merge duplicates (fuzzy dedup candidates)
  • Edit (canonical name, aliases)
  • Publish as a new taxonomy version

Entity Resolution and Deduplication​

After raw entity extraction (Stage 4), entities pass through a multi-step resolution pipeline before they appear in the review table. This pipeline eliminates duplicates, links to medical terminology standards, and determines which entities can be auto-approved.

Step 1: Name Normalization​

Every extracted entity name is normalized to produce a dedup key. For example, "Cardiologie" becomes cardiologie, and "Hartrevalidatie (cardiale revalidatie)" becomes hartrevalidatie_cardiale_revalidatie. A doctor's full name, including title, is likewise reduced to a lower-case underscored key.

Normalization rules:

  • Lower-case
  • Replace non-alphanumeric characters with underscores
  • Strip leading and trailing whitespace
  • Collapse multiple underscores

Entities with identical dedup keys within the same type are automatically merged (the highest-confidence version wins).

Step 2: Cluster-Based Deduplication​

Within each entity type, entities are grouped into clusters by dedup key. Counts from one extraction run (March 2026, the project's own data):

Entity TypeRaw ExtractedAfter DedupDuplicates Merged
Condition871712159
Doctor774387387
Examination883268615
Treatment78669294
Total3,3142,0591,255

The high doctor duplicate count (387 merged from 774) occurs because the same doctors appear on several hub pages (for example, one list by name and one list by specialty).

Step 3: SNOMED CT Matching​

Each deduplicated entity is matched against the Dutch SNOMED CT terms using a tiered strategy:

TierMethodExample
Tier 1: Exact matchThe entity name matches a SNOMED description exactly"Epilepsie"
Tier 2: Normalized matchLower-cased, stripped name matches"epilepsie" matches "Epilepsie"
Tier 3: Fuzzy matchBest edit-distance match above a threshold (0.85)"cardiale revalidatie" matches "Cardiale revalidatie" at 0.95

When a SNOMED match is found, the entity stores the concept ID, the preferred term (for display) and a match confidence between 0 and 1.

Step 4: Auto-Approval​

Entities meeting both criteria are automatically approved without operator review:

  1. AI confidence of 0.90 or higher. The extraction LLM was confident.
  2. A SNOMED match was found. The entity maps to a recognised medical concept.

Entities that do not meet both criteria are set to proposed and require manual operator approval.

Step 5: Fuzzy Dedup Scan (SP-7)​

After initial dedup and SNOMED matching, a second pass uses LLM-assisted fuzzy deduplication to find near-duplicates that name normalization missed. Examples of what it finds:

  • "Lumbale discushernia" and its plural variant (same condition)
  • "Schildklierkanker" and "schildklierlijden" (related but distinct, correctly dismissed)
  • "ZOL Genk, campus Sint-Barbara" and "Sint-Barbara Lanaken" (same campus, different names)

The fuzzy scan produces merge candidates that operators review. Each candidate shows the proposed canonical name, all variant names, a confidence score, and the option to merge or dismiss.

Step 6: Operator Review​

The taxonomy review interface presents all entities for operator action:

ActionEffect
ApproveThe entity moves to approved status and becomes eligible for publishing
RejectThe entity moves to rejected status and is excluded from the taxonomy
MergeSeveral entities are combined into one, with aliases preserved
EditCanonical name, aliases or entity type are modified

Step 7: Publish​

When the operator is satisfied, they publish the taxonomy as a new version. Publishing:

  1. Creates a snapshot of the published entities and relationships
  2. Records the version number and timestamp
  3. Runs the auto-linker (Step 8 below) to fill relationship gaps
  4. Makes the taxonomy available to the RAG query pipeline
  5. The taxonomy is then used for query enrichment and for post-answer doctor listing

Step 8: Auto-Linker (Post-Publish)​

An auto-linker runs automatically at the end of every publish. It classifies orphaned entities (conditions, treatments and examinations with no department relationship) to the most appropriate department via an LLM, then adds the missing relationships to the published snapshot.

This step is non-fatal: if the LLM call fails, the publish still succeeds and the gap remains (it can be filled later by an on-demand administrative function). When links are created, their count appears in the publish result.

See Multi-Tenancy & Hospital-Agnostic Architecture for full details on the auto-linker design.

Resolution Pipeline Architecture​

Key Design Decisions​

  • Campus entities come from the authoritative campus list, not AI extraction. This avoids duplicates from external hospitals mentioned in the content.
  • SNOMED CT integration provides Dutch synonym resolution at both extraction time (entity matching) and query time (search expansion).
  • Child page patterns are matched with wildcards, converted from the AI-detected placeholder format.
  • A cost budget prevents runaway extraction costs (configurable per hospital).
  • A composite quality gate in evaluation handles the known faithfulness-scoring limitation for taxonomy-enriched answers.