Skip to main content

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 in the Pipeline

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:

InputAfter title stripping
dr. Erik SurnameErik Surname
Prof. dr. SurnameSurname
Hoofdverpleegkundige SurnameSurname

Dedup key generation​

Produces a stable, case-insensitive clustering key per entity type:

Entity TypeKey StrategyExample
Doctorlast name + first initialsurname_e
Departmentlower-cased, underscored canonical namecardiologie
Conditionlower-cased, underscored canonical namehartfalen
Treatmentlower-cased, underscored canonical nameknieprothese
Examinationlower-cased, underscored canonical nameechografie_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.

Why Not Fuzzy Matching for Dedup Keys?

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:

PromptExtractsKey Instructions
DoctorsNames, specialties, departments, campusesIgnore job titles; extract only medical professionals
DepartmentsCanonical department name, aliases, domain groupNormalize to Belgian standard department names
ConditionsDutch condition names, severity hintsExclude body parts and generic terms
TreatmentsTreatment/procedure namesExclude examinations and generic verbs
ExaminationsDiagnostic test namesDistinguish from treatments
ServicesNavigational 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.

Dutch Language Handling

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:

  1. All entities sharing a dedup key receive the same cluster identifier
  2. The entity with the highest AI confidence is marked as the cluster's primary
  3. All others are marked as non-primary
  4. 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.

SNOMED as a Quality Signal

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:

TierMethodExampleThreshold
1Exact match"ablatie" → "ablatie"1.0
2Compound splitting + normalization"peniskanker" → "kanker van penis"0.95
3Fuzzy (pg_trgm)"hartritmestoornissen" → "hartritmestoornis"≥0.4
4Word overlapAll significant words must appear in SNOMED term0.7
5LLM fallbackGPT-4.1 mini normalizes Dutch term, then searches0.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:

  1. Starting an extraction returns immediately and runs it in the background
  2. Progress is stored in Redis per hospital
  3. The admin interface polls for progress every 2 seconds
  4. 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:

TierCriteriaTypical Action
100% overlapExact token overlap between entity namesAuto-merge (highest confidence)
80% overlap>= 80% token overlapBulk merge with quick review
SNOMED matchBoth entities map to the same SNOMED concept IDBulk merge (semantic equivalence)
High confidenceAI confidence >= 0.85 for both candidatesBulk 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​