A Query, End-to-End
The pipeline is documented one concept at a time — rewriting, enrichment, SNOMED, hybrid retrieval, safety. This page is the connective tissue: it traces five real queries through every stage so you can see how the pieces compose.
The intents, rewritten queries, enrichment terms, retrieval counts, and answers below were captured live from the pilot on 2026-06-01 by running each query through the public chat and reading the pipeline's own logs — not illustrative placeholders. Where a stage was a no-op for a given query, this page says so.
The pipeline at a glance
Stage legend
Each stage links to the page that explains it in depth, plus the glossary terms it uses.
| Stage | What happens | Concept page | Glossary |
|---|---|---|---|
| 1 · Intent + Rewrite | One LLM call emits intent, rewritten_query, and entities. Normalizes the question into canonical Dutch clinical form (incl. cross-language and lay→clinical), and resolves follow-up pronouns. | Query Rewriting, Query Pipeline | intent classifier |
| 2 · Enrich | Conditional. Appends canonical terms in parentheses: SNOMED L1 synonyms, taxonomy TREATS departments, Latin→Dutch. Fires only when the query's terms map to known entities. | Query Enrichment, Taxonomy Query Enrichment | taxonomy |
| SNOMED CT | The clinical terminology that stamps snomed_concept_id onto entities and bridges colloquial ↔ clinical terms — the source behind Layer-1 enrichment. | SNOMED CT Terminology | — |
| 3 · Retrieve | Three signals fuse: dense vectors, sparse BM25, and intent-routed taxonomy SQL. | Hybrid Search | dense, BM25, RRF, hybrid |
| 4 · Rerank + Gate | Value Framework reranks by intent×content affinity; the injection gate decides whether taxonomy data enters context; the safety synthesis gate decides serve-vs-refuse for medical queries; Stage 5c may inject a full doctor roster. | Value Framework, Injection Gate, Safety | Value Framework, reranking, medical-advice refusal |
| 5 · Generate | The LLM produces an answer grounded in retrieved context, with citations + disclaimer; ungrounded generation is disallowed. | What is RAG, Context Assembly | RAG, grounding, chunk |
Running five queries through the live pilot surfaced three things the architecture diagram alone does not:
- The rewrite does most of the normalization. Cross-language and lay→clinical mapping happen inside the intent/rewrite LLM call —
back pain→Dorsalgie,suikerziekte→Diabetes Mellitus— before any enrichment runs. - Enrichment is conditional. SNOMED Layer-1 (
prostaatkanker→Lokaal uitgebreide prostaatkanker) and taxonomy Layer-2 TREATS (Epilepsie→Neurochirurgie, Neurologie) fire only when terms map to known entities; for many queries this stage is a no-op. - Typed taxonomy SQL rarely fired for these queries (0 typed results) — the knowledge-graph contribution arrived instead via Stage 5c (the synthetic doctor roster) and the Layer-2 department hints appended during enrichment.
The five examples
Each example stresses a different lane. All values are from the live pilot trace.
1 · Enrichment lane — symptom → department routing
Star stage: taxonomy Layer-2 TREATS enrichment appends the treating departments before retrieval.
| Stage | Real trace | Reference |
|---|---|---|
| Raw | "ik heb epilepsie, naar welke dienst moet ik?" | — |
| 1 · Rewrite | intent ambiguous_symptom_description (0.90); rewritten_query = "Welke afdelingen bij zol behandelen Epilepsie?" | Rewriting |
| 2 · Enrich | taxonomy TREATS → Query enriched: '… (Neurochirurgie, Neurologie)' | Enrichment |
| 3 · Retrieve | 20 vector + 0 taxonomy | Hybrid Search |
| 5 · Generate | routes to Neurologie, gives the Genk secretariaat number, cites Brochure het ZOL (0.592) [1][2] | grounding |
2 · Knowledge-graph lane — full doctor roster (Stage 5c)
Star stage: Stage 5c injects a synthetic chunk holding the entire department roster, so the LLM can list everyone.
| Stage | Real trace | Reference |
|---|---|---|
| Raw | "welke artsen werken op cardiologie?" | — |
| 1 · Rewrite | intent doctor_lookup (0.95); rewritten_query = "Welke artsen werken bij de afdeling Cardiologie van zol?" (canonical template) | Rewriting |
| 3 · Retrieve | 20 vector + 0 taxonomy | Hybrid Search |
| 4 · Stage 5c | synthetic chunk Taxonomy:doctors in cardiologie injected — relevance 1.0, is_graph_result: true, full roster with per-doctor campuses | Stage 5c |
| 5 · Generate | lists all 23 cardiologists (Dr. Ferdinande, Dr. Cottens, … Prof. dr. Dens, Prof. dr. Piso) | What is RAG |
3 · Safety lane — grounded dosing is served, not refused
Star stage: the safety synthesis gate serves brochure-grounded dosing (with citation + disclaimer) rather than refusing.
| Stage | Real trace | Reference |
|---|---|---|
| Raw | "hoeveel ibuprofen mag ik geven aan mijn kind?" | — |
| 1 · Rewrite | intent out_of_scope_medical_advice (0.99) | Rewriting |
| 3 · Retrieve | 20 vector; grounded brochure br0976-nl.pdf (Kinderen — Pijnmedicatie) | Hybrid Search |
| 4 · Safety gate | grounded_dosing_synthesis hits=3 citations=1 → SERVE (grounded, not speculated) | Safety |
| 5 · Generate | served: 6–12,5 kg: 60 mg · 12,5–20,5 kg: 125 mg, max 3×/day; citation [1] + disclaimer | grounding |
What the same lane refuses: when the answer is not grounded in a vetted brochure — an out-of-allowlist intent (insulin, urgent symptoms), a diagnosis question, or a treatment recommendation the corpus can't ground — the synthesis gate falls below its 0.72 threshold or the allowlist blocks, and the system returns a refusal + disclaimer rather than LLM-speculated content.
4 · Rewrite lane — cross-language + lay→clinical normalization
Star stage: the rewrite turns an English colloquial term into the Dutch clinical term in one step.
| Stage | Real trace | Reference |
|---|---|---|
| Raw | "back pain" (English) | — |
| 1 · Rewrite | intent ambiguous_symptom_description (0.90); rewritten_query = "Welke afdelingen bij zol behandelen Dorsalgie?" — English → Dutch and lay → clinical (Dorsalgie), jaccard 0.00 vs raw | Rewriting |
| 3 · Retrieve | 20 vector + 0 taxonomy | Hybrid Search |
| 5 · Generate | answers in Dutch about rugrevalidatie (David Back-concept), cites Jaarverslag 2005 (0.62) [10][11] | grounding |
5 · SNOMED lane — Layer-1 synonym expansion
Star stage: SNOMED Layer-1 appends a clinical synonym the corpus uses, widening recall.
| Stage | Real trace | Reference |
|---|---|---|
| Raw | "behandelingen voor prostaatkanker" | — |
| 1 · Rewrite | intent institutional_treatment_info (0.95); rewritten_query = "Wat zijn de behandelingen voor prostaatkanker bij zol?" | Rewriting |
| 2 · Enrich | SNOMED L1 → SNOMED partial expansion: 'prostaatkanker' → ['Lokaal uitgebreide prostaatkanker'] → appended to the search query | SNOMED |
| 3 · Retrieve | 20 vector | Hybrid Search |
| 5 · Generate | disclaimer prefix "Ter informatie, dit is geen medisch advies —", then robot-prostatectomie (Da Vinci Xi) + bestraling; cites Robot geassisteerde prostatectomie (0.612) [1] | grounding |
Where to go next
- A Voice Call, End-to-End — the same treatment for the voice channel: one real four-turn cardiology appointment call.
- Core Concepts overview — the end-to-end narrative that ties these subsystems together.
- Glossary — canonical definition of every term used above.
- What is RAG? — the retrieval-augmented generation foundation.