Entity Resolution & Deduplication
The entity resolution pipeline (SP-4) transforms raw HTML content from confirmed hub pages into clean, deduplicated, SNOMED-linked draft taxonomy entities. It is the first stage of the Draft/Publish System — entities produced here land as drafts that operators review before publishing.
SP-4 sits between hub page confirmation (SP-2/SP-3) and the publish step (SP-5). Hub pages provide the URLs; entity resolution extracts and normalizes the entities; the publish system promotes approved entities to the live RAG index.
The Problem
The same real-world entity appears under dozens of name variations across a hospital's web properties:
- Doctors: "dr. Surname", "Dr. E. Surname", "Erik Surname", "Surname Erik" — four strings, one person
- Departments: "Cardiologie", "Hartafdeling", "Afdeling Cardiologie" — three strings, one department
- Conditions: "hartfalen", "Hartfalen", "Congestief hartfalen" — same condition, varying capitalization and specificity
Without resolution, these duplicates produce a fragmented taxonomy: query enrichment fails ("hartfalen" doesn't match "Hartfalen"), relationship inference fires multiple times for the same pair, and operators see hundreds of redundant entities to review.
The pipeline solves this with a four-stage pipeline: name normalization → LLM extraction → deduplication clustering → SNOMED matching.
Pipeline Overview
Step 1: Name Normalization
A name normalizer converts raw extracted strings into a canonical form and generates a dedup key used downstream for clustering.
Title stripping
Removes Dutch honorific and role prefixes before normalization:
| Input | After title stripping |
|---|---|
dr. Erik Surname | Erik Surname |
Prof. dr. Surname | Surname |
Hoofdverpleegkundige Surname | Surname |
Dedup key generation
Produces a stable, case-insensitive clustering key per entity type:
| Entity Type | Key Strategy | Example |
|---|---|---|
| Doctor | last name + first initial | surname_e |
| Department | lower-cased, underscored canonical name | cardiologie |
| Condition | lower-cased, underscored canonical name | hartfalen |
| Treatment | lower-cased, underscored canonical name | knieprothese |
| Examination | lower-cased, underscored canonical name | echografie_hart |
Doctor keys use last name + first initial rather than full name so that "Erik Surname" and "E. Surname" both produce surname_e and cluster together.
Deterministic string keys are simpler, faster, and fully testable. Fuzzy matching (Levenshtein, Jaro-Winkler) is reserved for cases where the key itself doesn't suffice — at that point, the LLM dedup step handles it with semantic understanding.
Step 2: LLM Extraction
The entity extractor sends hub page HTML to GPT-4.1 mini with type-specific extraction prompts. Six prompts exist, one per entity type, each tuned for Dutch hospital content:
| Prompt | Extracts | Key Instructions |
|---|---|---|
| Doctors | Names, specialties, departments, campuses | Ignore job titles; extract only medical professionals |
| Departments | Canonical department name, aliases, domain group | Normalize to Belgian standard department names |
| Conditions | Dutch condition names, severity hints | Exclude body parts and generic terms |
| Treatments | Treatment/procedure names | Exclude examinations and generic verbs |
| Examinations | Diagnostic test names | Distinguish from treatments |
| Services | Navigational services (Bezoekuren, Route) | Only concrete navigational entities |
Each LLM call returns structured JSON with:
- the raw extracted name
- a confidence value between 0 and 1 (the model's self-reported confidence)
- the source snippet: the text fragment that triggered the extraction
The confidence score is stored with the draft entity and drives dedup cluster selection in Step 3.
All prompts explicitly instruct the model to work in Dutch. Entity names are preserved in their Dutch form. SNOMED matching (Step 4) handles the mapping to international concept IDs without translating the names.
Content Assembly
Page content is assembled from the database — no live HTTP fetches during extraction. The pipeline takes the stored chunks of each confirmed hub page child URL and concatenates them. This ensures deterministic, reproducible extraction from the same corpus snapshot.
Step 3: Deduplication Clustering
The deduplication service groups extracted entities by their dedup key and selects one as the primary entity per cluster:
Cluster rules:
- All entities sharing a dedup key receive the same cluster identifier
- The entity with the highest AI confidence is marked as the cluster's primary
- All others are marked as non-primary
- Non-primary entities are not deleted — they remain available for operator review and can be merged or reinstated
LLM-assisted dedup handles edge cases where the key strategy isn't sufficient. When two different dedup keys refer to the same entity (e.g., a department scraped as "Intensieve Zorgen" from one page and "Intensive Care" from another), the LLM dedup step compares the candidates semantically and merges them, recording on the subordinate row which entity it was merged into.
Step 4: SNOMED Matching
The resolution pipeline links clinical entities (conditions, treatments, examinations) to SNOMED-CT concept IDs using the existing SNOMED matcher. Each matched entity stores the concept ID (for example the code for heart failure matched to "hartfalen"), the preferred term ("heart failure") and a match confidence (for example 0.94).
Doctors and departments do not receive SNOMED links — SNOMED covers clinical concepts, not organizational entities.
A high SNOMED match confidence (above 0.85) is a strong indicator that the extracted entity name is a legitimate clinical term, not a spurious extraction artifact. The operator review UI surfaces this as a confidence badge.
SNOMED Matching Strategy
The SNOMED matcher uses a 5-tier matching strategy to maximize coverage of Dutch medical terminology:
| Tier | Method | Example | Threshold |
|---|---|---|---|
| 1 | Exact match | "ablatie" → "ablatie" | 1.0 |
| 2 | Compound splitting + normalization | "peniskanker" → "kanker van penis" | 0.95 |
| 3 | Fuzzy (pg_trgm) | "hartritmestoornissen" → "hartritmestoornis" | ≥0.4 |
| 4 | Word overlap | All significant words must appear in SNOMED term | 0.7 |
| 5 | LLM fallback | GPT-4.1 mini normalizes Dutch term, then searches | 0.85 |
The compound splitter handles Dutch medical suffixes (-kanker, -stoornis, -operatie) and anatomical prefixes (hart-, nier-, borst-), expanding them into multi-word forms and "van/de" patterns that match SNOMED descriptions.
Coverage results (self-reported; the project's own dataset of 1,465 non-doctor entities, measured during development):
- Conditions: 97.5% (539/553)
- Examinations: 90.1% (227/252)
- Treatments: 86.5% (571/660)
Incremental Extraction
Entity extraction supports incremental mode: when re-running extraction, URLs that have already been successfully extracted are skipped. The pipeline checks for existing successful results per URL and only processes new or previously failed URLs. This reduces extraction time significantly for subsequent runs after adding new hub pages or retrying after partial failures.
Execution Model
Entity extraction runs as a background task (not SSE streaming) with Redis-stored progress:
- Starting an extraction returns immediately and runs it in the background
- Progress is stored in Redis per hospital
- The admin interface polls for progress every 2 seconds
- Progress survives a page refresh
The extraction also creates implicit entities from relationships: when a works-in relationship references "Cardiologie" but no DEPARTMENT entity exists, the pipeline auto-creates it as an approved entity.
Operator Review
After the three-stage pipeline completes, entities sit as proposed drafts. Operators manage them through the administrative interface:
Review Functions
Operators can list entities (filtered by type, status or search text), open a single entity with its relationships, edit its name, type or status, approve or reject it, merge one entity into another, approve in bulk everything above a confidence threshold, and see entity counts by type and status.
Tiered Bulk Merge
For large taxonomy datasets with hundreds of potential duplicates, reviewing merge candidates one by one is impractical. The system provides a tiered bulk merge workflow that groups merge candidates by confidence level, allowing operators to approve entire tiers at once:
| Tier | Criteria | Typical Action |
|---|---|---|
| 100% overlap | Exact token overlap between entity names | Auto-merge (highest confidence) |
| 80% overlap | >= 80% token overlap | Bulk merge with quick review |
| SNOMED match | Both entities map to the same SNOMED concept ID | Bulk merge (semantic equivalence) |
| High confidence | AI confidence >= 0.85 for both candidates | Bulk merge after spot check |
Each tier is presented as a batch in the UI. The operator can approve an entire tier with one click, or expand individual candidates for inspection before deciding.
NEEDS_REVIEW Merge Candidates
Merge candidates that do not meet the automatic threshold are flagged as "needs review". These appear in a dedicated review queue with Merge and Reject buttons directly on each candidate row. This replaces the previous workflow where operators had to navigate to individual entity pages to perform merges. The inline action buttons reduce the number of clicks per decision from 4-5 to a single click, making it feasible to process hundreds of candidates in a single review session.
Audit Trail
Every operator action (approve, reject, rename, merge, bulk approve) is recorded in an override log. Each record stores the hospital, the type of action, the affected entity, a before/after snapshot, the responsible operator, the draft version and a timestamp.
This audit trail is designed to support the EU AI Act Article 12 requirement for automatic logging of AI operations, with human override decisions recorded.
Draft Data Model (SP-4 Additions)
SP-4 extends the draft entity record with: the owning hospital; the raw extracted name (before normalization); the dedup key; the hub page that produced the entity; the AI confidence (the LLM's self-reported value between 0 and 1); the SNOMED concept ID, preferred term (English) and match confidence; the cluster identifier and the primary flag; a pointer to the primary entity when this one was merged; and a draft version, incremented on each pipeline run.
A uniqueness rule on hospital, entity type, dedup key and draft version prevents duplicate entries within a version, and database indexes support the entity list, the review queue and dedup clustering lookups.
Integration with the Publish System
Approved entities are the input to SP-5's publish step. The publish pipeline selects the approved primary entities of the chosen draft version for the hospital.
Only primary entities are published — non-primary cluster members are excluded unless the operator explicitly promotes them.
See Draft/Publish System for how approved entities transition to the published store consumed by the frozen taxonomy registry.
References
- Getoor, L., & Diehl, C. P. (2005). Link mining: A survey. ACM SIGKDD Explorations, 7(2), 3–12. https://doi.org/10.1145/1117454.1117456
- SNOMED International. (2023). SNOMED CT Technical Implementation Guide. https://confluence.ihtsdotools.org/
- Hogan, A., et al. (2021). Knowledge graphs. ACM Computing Surveys, 54(4), 1–37. https://doi.org/10.1145/3447772