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.

Historical document

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.

StageWhat happensConcept pageGlossary
1 · Intent + RewriteOne 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 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 a concept identifier 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; a safety gate decides whether a medical question is served or refused; 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 pain → Dorsalgie, suikerziekte → Diabetes Mellitus — before any enrichment runs.
  2. 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.
  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 TREATS → query enriched with “(Neurochirurgie, Neurologie)”Enrichment
3 · Retrieve20 vector + 0 taxonomyHybrid Search
5 · Generateroutes 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.

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 5ca synthetic chunk holding the full cardiology roster, with per-doctor campuses, is injectedStage 5c
5 · Generatelists 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.

StageTrace of 2026-06-01Reference
RawA parent asks how much ibuprofen they may give their child (Dutch)—
1 · Rewriteintent classified as out-of-scope medical advice (confidence 0.99)Rewriting
3 · Retrieve20 vector hits; a children's pain-medication brochure was top-rankedHybrid Search
4 · Safety gatethe since-removed dosing path overrode the refusal and chose to serveSafety
5 · Generateserved 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.

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), no word overlap with the raw queryRewriting
3 · Retrieve20 vector + 0 taxonomyHybrid Search
5 · Generateanswers 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.

StageReal traceReference
Raw"behandelingen voor prostaatkanker"—
1 · Rewriteintent: treatment information (0.95); rewritten query "Wat zijn de behandelingen voor prostaatkanker bij zol?"Rewriting
2 · EnrichSNOMED L1 → “prostaatkanker” expands to “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 + 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.