Skip to main content

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.

Every value here is real

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.

StageWhat happensConcept pageGlossary
1 · Intent + RewriteOne 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 Pipelineintent classifier
2 · EnrichConditional. 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 Enrichmenttaxonomy
SNOMED CTThe clinical terminology that stamps snomed_concept_id onto entities and bridges colloquial ↔ clinical terms — the source behind Layer-1 enrichment.SNOMED CT Terminology
3 · RetrieveThree signals fuse: dense vectors, sparse BM25, and intent-routed taxonomy SQL.Hybrid Searchdense, BM25, RRF, hybrid
4 · Rerank + GateValue 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, SafetyValue Framework, reranking, medical-advice refusal
5 · GenerateThe LLM produces an answer grounded in retrieved context, with citations + disclaimer; ungrounded generation is disallowed.What is RAG, Context AssemblyRAG, grounding, chunk
What the real traces reveal

Running five queries through the live pilot surfaced three things the architecture diagram alone does not:

  1. The rewrite does most of the normalization. Cross-language and lay→clinical mapping happen inside the intent/rewrite LLM call — back painDorsalgie, suikerziekteDiabetes Mellitus — before any enrichment runs.
  2. Enrichment is conditional. SNOMED Layer-1 (prostaatkankerLokaal uitgebreide prostaatkanker) and taxonomy Layer-2 TREATS (EpilepsieNeurochirurgie, Neurologie) fire only when terms map to known entities; for many queries this stage is a no-op.
  3. 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.

StageReal traceReference
Raw"ik heb epilepsie, naar welke dienst moet ik?"
1 · Rewriteintent ambiguous_symptom_description (0.90); rewritten_query = "Welke afdelingen bij zol behandelen Epilepsie?"Rewriting
2 · Enrichtaxonomy TREATSQuery enriched: '… (Neurochirurgie, Neurologie)'Enrichment
3 · Retrieve20 vector + 0 taxonomyHybrid Search
5 · Generateroutes 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.

StageReal traceReference
Raw"welke artsen werken op cardiologie?"
1 · Rewriteintent doctor_lookup (0.95); rewritten_query = "Welke artsen werken bij de afdeling Cardiologie van zol?" (canonical template)Rewriting
3 · Retrieve20 vector + 0 taxonomyHybrid Search
4 · Stage 5csynthetic chunk Taxonomy:doctors in cardiologie injected — relevance 1.0, is_graph_result: true, full roster with per-doctor campusesStage 5c
5 · Generatelists 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.

StageReal traceReference
Raw"hoeveel ibuprofen mag ik geven aan mijn kind?"
1 · Rewriteintent out_of_scope_medical_advice (0.99)Rewriting
3 · Retrieve20 vector; grounded brochure br0976-nl.pdf (Kinderen — Pijnmedicatie)Hybrid Search
4 · Safety gategrounded_dosing_synthesis hits=3 citations=1SERVE (grounded, not speculated)Safety
5 · Generateserved: 6–12,5 kg: 60 mg · 12,5–20,5 kg: 125 mg, max 3×/day; citation [1] + disclaimergrounding

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.

StageReal traceReference
Raw"back pain" (English)
1 · Rewriteintent ambiguous_symptom_description (0.90); rewritten_query = "Welke afdelingen bij zol behandelen Dorsalgie?" — English → Dutch and lay → clinical (Dorsalgie), jaccard 0.00 vs rawRewriting
3 · Retrieve20 vector + 0 taxonomyHybrid Search
5 · Generateanswers 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.

StageReal traceReference
Raw"behandelingen voor prostaatkanker"
1 · Rewriteintent institutional_treatment_info (0.95); rewritten_query = "Wat zijn de behandelingen voor prostaatkanker bij zol?"Rewriting
2 · EnrichSNOMED L1SNOMED partial expansion: 'prostaatkanker' → ['Lokaal uitgebreide prostaatkanker'] → appended to the search querySNOMED
3 · Retrieve20 vectorHybrid Search
5 · Generatedisclaimer 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.