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:
- Pre-filter. Score pages by keyword matching (30 Dutch medical keywords) and keep those above a threshold.
- Content retrieval. Fetch up to three chunks per candidate from the document store.
- 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?
- 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:
- For each confirmed hub, resolve the child pages (by pattern matching, with a prefix fallback).
- An LLM extracts entities from the page content (name, type, confidence, relationships).
- A resolution pipeline deduplicates by name normalization and matches SNOMED CT.
- Auto-approval: entities with confidence of 0.90 or higher and a SNOMED match are auto-approved.
- A fuzzy dedup scan (SP-7) finds near-duplicates by edit distance.
Entity types:
| Type | Source | Example |
|---|---|---|
| Doctor | Individual doctor pages | A cardiologist |
| Department | Implicit from relationships | Cardiologie |
| Condition | Condition pages | Epilepsie |
| Treatment | Treatment pages | Hartrevalidatie |
| Examination | Examination pages | Echografie |
| Campus | The authoritative campus list | Campus Sint-Jan |
Relationship types:
| Type | Source | Target |
|---|---|---|
| WORKS_IN | Doctor | Department |
| LOCATED_AT | Doctor | Campus |
| TREATS | Department | Condition |
| OFFERS | Department | Treatment |
| PERFORMS | Department | Examination |
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 Type | Raw Extracted | After Dedup | Duplicates Merged |
|---|---|---|---|
| Condition | 871 | 712 | 159 |
| Doctor | 774 | 387 | 387 |
| Examination | 883 | 268 | 615 |
| Treatment | 786 | 692 | 94 |
| Total | 3,314 | 2,059 | 1,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:
| Tier | Method | Example |
|---|---|---|
| Tier 1: Exact match | The entity name matches a SNOMED description exactly | "Epilepsie" |
| Tier 2: Normalized match | Lower-cased, stripped name matches | "epilepsie" matches "Epilepsie" |
| Tier 3: Fuzzy match | Best 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:
- AI confidence of 0.90 or higher. The extraction LLM was confident.
- 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:
| Action | Effect |
|---|---|
| Approve | The entity moves to approved status and becomes eligible for publishing |
| Reject | The entity moves to rejected status and is excluded from the taxonomy |
| Merge | Several entities are combined into one, with aliases preserved |
| Edit | Canonical name, aliases or entity type are modified |
Step 7: Publish
When the operator is satisfied, they publish the taxonomy as a new version. Publishing:
- Creates a snapshot of the published entities and relationships
- Records the version number and timestamp
- Runs the auto-linker (Step 8 below) to fill relationship gaps
- Makes the taxonomy available to the RAG query pipeline
- 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.
Related Pages
- Entity Resolution: dedup and SNOMED matching details
- Query Enrichment: how taxonomy data improves search at query time
- Medical Knowledge Architecture: entity type definitions and relationships