This ADR was written when the system used Neo4j for entity storage. As of March 2026, Neo4j has been fully removed and replaced by PostgreSQL taxonomy tables. The decision rationale documented here remains valid; the storage layer has changed.
ADR-0015: Taxonomy-Driven Entity Normalization
Date: 2026-02-09 | Status: Accepted
Context
After implementing LLM entity validation (ADR-0014), the knowledge graph reached 3,578 nodes and 28,374 relationships — but the project's own quality audit (a weighted composite of sub-scores; self-reported) scored it only 69/100 overall, with particularly poor scores for naming consistency (58/100) and search utility (55/100).
Root Cause: Scattered Normalization Data
The normalization logic was distributed across ~20 constants in 2 code modules (extraction and storage), with no single source of truth. This produced three categories of defects:
| Defect Category | Example | Impact |
|---|---|---|
| Contradictory normalization | "Anesthesie" normalized to "Anesthesiologie" in one file but kept as "Anesthesie" in another | Duplicate nodes in Neo4j for the same department |
| Missing campus constraints | A 5th campus ("ZOL") appeared alongside the 4 real campuses (Sint-Jan, André Dumont, Sint-Barbara, Maas en Kempen) | Phantom campus hub node with incorrect relationships |
| Duplicate department pairs | 7+ pairs like "Cardiologie" / "Dienst Cardiologie", "Urologie" / "Dienst Urologie" | Fragmented graph — queries miss half the relationships |
Doctor Name Pollution
Regex extraction parsed role tokens and body parts as doctor name components:
- "Hoofdverpleegkundige <surname>" → doctor named "Hoofdverpleegkundige <surname>" (head nurse is a role, not a name)
- "Borstkaschirurgie" → doctor named "Borstkas" (chest is a body part, not a person)
- "Diensthoofd Dr. <surname>" → doctor named "Diensthoofd <surname>" (department head is a role)
These polluted the graph with dozens of fake doctor nodes that connected to real departments, degrading relationship quality.
Entity Type Confusion
Several entities exist as both a department and a treatment in the hospital context:
- Radiotherapie: a department (afdeling) that patients visit, and a treatment (behandeling) that patients receive
- Dialyse: a department with staff and rooms, and a treatment procedure
- Revalidatie: a department on campus, and a treatment program
Without an authoritative type override, the extraction pipeline would randomly classify these as one or the other depending on page context, creating inconsistent graph structure.
Decision
1. Multi-Layer Taxonomy Architecture
The taxonomy data is organized in a layered architecture, separating hospital-specific configuration from general Dutch medical vocabulary:
Layer 1: Hospital configuration
All hospital-specific data lives in a configuration file, validated at load time against a schema. This includes:
- Campus definitions (4 campuses with addresses)
- Department definitions (~57 departments with aliases, campus assignments, domain groups)
- Domain knowledge maps (department to conditions, department to treatments, condition to examinations)
- Hub page definitions for curated taxonomy seeding
- Search aliases mapping patient language to clinical terms
Layer 2: Runtime API
A runtime module loads the configuration and exposes it as immutable definitions (campuses and departments, each with a canonical name, aliases and campus assignments) and pre-computed lookup structures: valid campus names, department-to-campus mapping, the department-condition and department-treatment maps, pre-compiled sets of department, condition and specialty names for constant-time lookup, and combined universal and hospital-specific patient-facing search aliases.
Layer 3: General medical vocabulary
Language-level medical knowledge that is not hospital-specific:
- Entity-type overrides that prevent misclassification (for example, radiotherapy, dialysis and rehabilitation are treated as departments)
- A dual-entity map for departments that also represent treatments (for example, radiotherapy maps to external radiation and brachytherapy)
- Condition and treatment alias maps (55+ and 20+ entries) that normalize patient language, such as "suikerziekte" to "Diabetes Mellitus"
- Doctor-name cleanup rules: role tokens to strip and a blocklist of body parts and generic terms that are not person names
- Treatment-specialty constraints that prevent cross-specialty leakage (for example, a cochlear implant belongs to ENT only)
- An entity blocklist of terms that should never become graph entities
Layer 4: Curated medical knowledge
LLM-generated and human-reviewed relationship maps: which department offers which treatments, which department handles which conditions, which examination diagnoses which condition, and the valid Belgian hospital department names.
2. Consumption by Extraction and Storage
Both downstream modules import from the taxonomy layers:
- Entity extraction imports campus lists, department aliases, doctor cleanup rules, entity type overrides, and domain knowledge maps
- Typed-node storage imports normalization maps, entity type overrides, and canonical names
- Curated taxonomy seeding imports all taxonomy data, plus the curated knowledge maps
- LLM validation prompt (ADR-0014) includes taxonomy context: the list of valid campuses, departments, and known dual-entities is appended to the system prompt
3. Quality Metrics Targets
| Metric | Before (v1) | Target (v2) | Measurement Method |
|---|---|---|---|
| Overall quality | 69/100 | 80+/100 | Weighted composite of all sub-scores |
| Naming consistency | 58/100 | 75+/100 | Duplicate detection + canonical name coverage |
| Search utility | 55/100 | 70+/100 | Query hit rate for common patient search terms |
| Relationship accuracy | 74/100 | 85+/100 | Manual sampling of 50 random relationships |
| Campus assignment | Unknown | 95+/100 | Departments assigned to correct campus(es) |
Consequences
Positive
- Layered architecture: Hospital data (a configuration file) separated from general medical vocabulary (code) — clear ownership boundaries
- Duplicate prevention: Canonical names are enforced at both extraction and storage layers, which is designed to prevent duplicate nodes
- Clean doctor names: Role tokens and body parts systematically stripped before storage
- Entity type clarity: Entity-type overrides and a dual-entity map handle ambiguous entity types
- Improved search: Patient-facing aliases map colloquial Dutch terms to clinical entities (55+ condition aliases, 20+ treatment aliases)
- Better LLM validation: Taxonomy context in the validation prompt gives the LLM authoritative reference data
- Testable: Taxonomy module is pure data — easy to unit test for completeness and consistency
- Extensible: New hospitals can add their own configuration file without modifying code
Negative
- Taxonomy maintenance burden: New departments, conditions, or treatments require updating the hospital configuration and/or the vocabulary module
- Large refactor: Original consolidation required careful migration from ~20 scattered constants
- Domain expertise required: Taxonomy curation needs clinical/hospital knowledge — not purely a development task
- Risk of over-normalization: Aggressive alias maps could incorrectly merge entities that are actually distinct
Neutral
- Pipeline architecture unchanged — regex extraction, LLM validation, and taxonomy storage still operate in the same sequence
- No database migration required — only the data flowing into the taxonomy changes
- No impact on query-time latency — normalization happens at ingestion time
- LLM validation (ADR-0014) continues to operate as an independent quality gate
Alternatives Considered
Alternative 1: Fix Constants In-Place
Continue maintaining normalization data as separate constants in the extraction and storage modules, just fixing the contradictions. Rejected: this does not solve the root cause. With two files independently defining canonical names, contradictions will inevitably re-emerge as new entities are added. The scattered approach also makes auditing impossible — you cannot answer "what is the canonical name for X?" without searching multiple files.
Alternative 2: Database-Driven Taxonomy
Store the taxonomy in PostgreSQL or Neo4j itself, with an administrator interface for editing. Rejected: the hospital domain is stable — departments and campuses rarely change. A database-driven approach adds migration complexity, administrator-interface development cost, and cache invalidation logic for a problem that a simple configuration file plus a code module solves cleanly. If the domain becomes dynamic (e.g., frequent department reorganizations), this alternative should be revisited.
Alternative 3: LLM-Only Normalization
Remove all hardcoded normalization and let the LLM (ADR-0014) handle all canonicalization. Rejected: LLM responses are non-deterministic — the same entity might be normalized differently across runs. This makes the graph unreproducible and hard to debug. LLMs also hallucinate canonical names that don't exist. The taxonomy provides the deterministic foundation; the LLM validates what the taxonomy cannot express (semantic plausibility).
Implementation
The change touched the extraction, storage and LLM-validation modules, added the hospital configuration file with its schema validation, added the runtime taxonomy module and the vocabulary and curated-knowledge modules, and added a taxonomy consistency and completeness test suite.
References
- Hogan, A., et al. (2021). Knowledge graphs. ACM Computing Surveys, 54(4), 1--37. https://doi.org/10.1145/3447772
- Paulheim, H. (2017). Knowledge graph refinement: A survey of approaches and evaluation methods. Semantic Web, 8(3), 489--508. https://doi.org/10.3233/SW-160218