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 from the pilot on 2026-06-01 by running each query through the public chat and reading the pipeline's own logs. They describe the system as it was that day. Example 3 shows behaviour that was removed the same day: see the Safety overview. 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 the intent, the 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 a concept identifier 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; a safety gate decides whether a medical question is served or refused; 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 with “(Neurochirurgie, Neurologie)” | Enrichment |
| 3 · Retrieve | 20 vector + 0 taxonomy | Hybrid Search |
| 5 · Generate | routes to Neurologie, gives the department's secretariat number, cites a hospital brochure [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 | a synthetic chunk holding the full cardiology roster, with per-doctor campuses, is injected | Stage 5c |
| 5 · Generate | lists all 23 cardiologists (a roster of named doctors) | What is RAG |
3 · Safety lane — a dosing question (historical; superseded)
Star stage: the safety gate. On 2026-06-01 the trace below showed the pre-remediation behaviour: a brochure-based dosing path served a dose for a medical-advice question, even though the intent classifier had correctly flagged it. This is the failure described in the June 2026 dose incident. On the same day the project replaced it with the refuse-and-link policy (ADR-0065): such questions are now designed to be refused, with a link to the relevant validated brochure, and an output check runs on both chat and voice.
| Stage | Trace of 2026-06-01 | Reference |
|---|---|---|
| Raw | A parent asks how much ibuprofen they may give their child (Dutch) | — |
| 1 · Rewrite | intent classified as out-of-scope medical advice (confidence 0.99) | Rewriting |
| 3 · Retrieve | 20 vector hits; a children's pain-medication brochure was top-ranked | Hybrid Search |
| 4 · Safety gate | the since-removed dosing path overrode the refusal and chose to serve | Safety |
| 5 · Generate | served a weight-band dose with a citation and disclaimer. Under the current policy this is a refusal with a brochure link. | grounding |
Lesson recorded: a grounding check that confirmed a dose appeared in a source did not confirm that it applied to the person asking. Questions the corpus cannot ground (diagnosis, treatment recommendation) were and are refused rather than answered from LLM speculation.
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), no word overlap with the raw query | Rewriting |
| 3 · Retrieve | 20 vector + 0 taxonomy | Hybrid Search |
| 5 · Generate | answers in Dutch about rugrevalidatie , cites an annual report [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: treatment information (0.95); rewritten query "Wat zijn de behandelingen voor prostaatkanker bij zol?" | Rewriting |
| 2 · Enrich | SNOMED L1 → “prostaatkanker” expands to “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 + bestraling; cites a robot-assisted prostatectomy page [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.