Collins Opeyemi
Hire me
n8nAI agentsDocuments and data
Published October 3, 2026

n8n AI Patient Assistant: Cited RAG, OCR and Eligibility Engine

n8n Automation Expert | RAG, Citation Verification, OCR, Multilingual AI, Rules Engine

RAG in English, Arabic and Hebrew. Citations verified in code, never by the model.

8 of 8criteria checked in code, not AI
3 languagesdetected, retrieved, answered

Video, 2:50, 2 MB. It only downloads when you press play.

In short

Two n8n workflows for a fertility clinic brief. The first answers patient questions in English, Arabic and Hebrew from approved clinic content only, with a citation on every line, and refuses with a handoff when the question falls outside that content. The second accepts scanned lab reports that contain no selectable text, OCRs a copy while the original is stored untouched, extracts the values, and pre-screens the case against eight criteria in plain code. The model never decides eligibility, and invented citations are stripped before a patient sees them.

Project description

Most clinic chatbots fail in the same two places. They answer from general medical knowledge instead of the clinic's own material, and they fold the moment a patient uploads a lab report. This build fixes both. One n8n workflow answers patient questions in English, Arabic and Hebrew from approved content only, citing the exact passage behind every line and refusing when the question falls outside it. A second workflow takes scanned lab reports that contain no selectable text, reads them, and pre-screens the case against the clinic's own criteria.

Tools & Deliverables

  • Retrieval-augmented chat workflow in n8n: language detection, translation for retrieval, deterministic passage lookup, grounded answer, citation check, logged exchange
  • Knowledge base and eligibility criteria held in a Google Sheet the clinic edits, so content and rules change without touching a workflow
  • Citation verification in code after the model replies, so an invented reference is stripped before the patient sees it
  • Refusal path that returns a handoff to the clinic team and an empty citation list, cleared by code rather than by the model's good behaviour
  • OCR pipeline for image-only lab PDFs: the original is stored untouched, a copy is OCR'd, and the values are extracted
  • Eight-criterion eligibility engine in plain code, returning a verdict with a pass or fail line per criterion, and a missing-data path that asks for exactly what it still needs

The problem

  • General medical knowledge is the wrong source. A patient-facing assistant that answers from whatever the model absorbed in training will eventually contradict the clinic's own protocol, and the clinic carries the consequence.
  • Models invent citations. Asking a model to cite its sources is not the same as the sources being real. A reference that looks plausible and does not exist is worse than no reference at all.
  • Lab reports arrive as pictures. Patients photograph a printout or forward a scanned PDF. Those files contain zero selectable text, so any pipeline that assumes it can read the text layer returns nothing and stalls.
  • Records arrive incomplete. A patient uploads one report out of three. A system that guesses the rest is dangerous, and a system that simply stops wastes the coordinator's time instead of saving it.
  • The patient's language is not the clinic's. Approved material is written in English while patients write in Arabic or Hebrew, and a reply in the wrong language is no reply at all.
  • Eligibility is not a job for a language model. Deciding whether someone meets clinical criteria has to be inspectable and repeatable, and a model producing a confident verdict is neither.

Approach

The chat workflow is built so the model only ever sees approved material. A patient question arrives on a webhook, the language is detected, and the question is translated into English for retrieval because the approved content is English. Retrieval itself runs with no AI: it reads the clinic's Google Sheet knowledge base and returns passage ids deterministically, and those passages are the only thing the model is given. The answer comes back in the patient's own language, with the passage code printed next to each claim. Arabic and Hebrew answers render right to left, with the English translation used for retrieval kept visible so a reviewer can follow what was searched.

The part that makes it safe to put in front of a patient happens after the model replies. The answer is checked against the passages that were actually retrieved, and any citation code the retrieval never returned is stripped out. If retrieval found nothing relevant, the assistant does not improvise: it refuses, offers a handoff to the clinic team, and returns an empty citation list, cleared in code rather than left to the model's discretion. The report pre-screen follows the same principle. Uploaded PDFs are stored untouched and OCR'd on a copy, the values are read off, and then plain code scores the case against eight criteria held in a spreadsheet. The model does not decide eligibility, which means a verdict can be explained line by line, argued with, and changed by editing a row rather than a prompt.

Solution

In the recorded runs, the same question was asked in English, Arabic and Hebrew. Each was detected, translated for retrieval, and answered in the language it was asked in, with every claim carrying the passage code it came from. Asked to prescribe a drug, the assistant refused, offered the clinic team, and returned no citations at all. On the report side, two scanned reports with no text layer were read and the values extracted, and the case scored eight out of eight against the criteria with a reason printed for each one, returning likely suitable for assessment. Uploading only one of the two reports produced a different and more useful outcome: cannot assess yet, three required items missing, followed by three specific questions for the hormone panel, the karyotype and the Y microdeletion test, generated from the criteria rows that failed.

Everything shown is output from real executions with run ids attached, so nothing on the demo page is staged. Two things are deliberately placeholder and labelled as such: the knowledge base passages and the eight criteria rows, both written as stand-ins for the clinic's real documents and rules. Because both live in a spreadsheet, swapping in approved content and real criteria points the same pipeline at the clinic's own material with no rebuild. The output carries its own disclaimer throughout: this is an automated pre-screen against clinic criteria, not a diagnosis and not medical advice, and a clinician reviews every case.

FAQ

How do you stop the model inventing citations?

By checking them afterwards in code. The answer is compared against the passages retrieval actually returned, and any code that was not in that set is stripped before the reply is sent. The model is never trusted to be honest about its own sources.

What happens when the answer is not in the approved content?

It refuses, says so, and offers a handoff to the clinic team, with the citation list cleared by code. A refusal with no sources is the correct output, and it is enforced rather than requested.

How does it read lab reports that are photos or scans?

The uploaded file is stored untouched for the record, a copy is OCR'd, and the values are extracted from that copy. The demo reports were verified to contain zero text characters, so nothing is relying on a hidden text layer.

Who decides whether a patient is eligible?

Plain code, against criteria the clinic edits in a spreadsheet, with a pass or fail line for each one. The model is not involved in the verdict. When required information is missing, the workflow asks for exactly the missing items instead of guessing or stopping.

What does the clinic have to maintain?

A spreadsheet. The approved passages, the criteria and the thresholds all live there, so changing what the assistant can say, or what counts as eligible, is a row edit rather than a developer task.

Related skills and services for this project

n8n workflow automation

n8n, n8n automation, n8n expert, n8n developer, n8n automation expert, n8n automation developer, n8n workflow automation expert, n8n automation specialist, n8n consultant, n8n freelancer, n8n workflow, n8n workflows, n8n workflow development, n8n cloud, n8n self hosted, n8n docker, n8n AI workflow, n8n AI agent, n8n LangChain, n8n OpenAI node, n8n webhook, n8n HTTP request node, n8n code node, n8n schedule trigger, n8n loop over items, n8n sub workflow, n8n error workflow, n8n credentials, n8n expressions, n8n JavaScript, n8n Google Sheets, n8n Google Drive, n8n chat workflow, n8n RAG workflow, n8n document workflow, n8n debugging, fix n8n workflow, n8n troubleshooting, n8n optimisation, n8n maintenance, n8n retainer, n8n support, build n8n workflow, automate with n8n, n8n automation agency

RAG and retrieval

RAG, retrieval augmented generation, RAG pipeline, RAG system, RAG chatbot, RAG implementation, grounded AI, grounded answers, knowledge base AI, AI knowledge base, document retrieval, passage retrieval, semantic search, keyword retrieval, deterministic retrieval, context injection, chunking strategy, embeddings, vector database, vector search, pgvector, Supabase vector, Pinecone, Weaviate, Qdrant, hybrid search, reranking, metadata filtering, source attribution, citation generation, answer with sources, internal knowledge assistant, company knowledge AI, private AI assistant, support knowledge base, documentation assistant, FAQ automation, policy assistant, SOP assistant, approved content only, closed domain QA, context window management, prompt construction, retrieval evaluation

AI safety, citations and refusals

AI safety guardrails, LLM guardrails, hallucination prevention, citation verification, verified citations, source checking, post generation validation, output validation, response validation, schema validation, JSON schema, structured output, refusal handling, graceful refusal, out of scope handling, human handoff, escalation to human, human in the loop, approval workflow, confidence handling, uncertainty handling, no guessing, deterministic checks in code, model not trusted with facts, prompt injection mitigation, content moderation, safe AI deployment, responsible AI, explainable AI, auditable AI, traceable answers, AI evaluation, eval set, regression testing for prompts, accuracy testing, red teaming, compliance aware AI, regulated industry AI, clinical safety, disclaimer handling, liability aware design, logging every exchange, audit trail

OCR and document processing

OCR, OCR automation, OCR pipeline, scanned PDF processing, image only PDF, PDF data extraction, PDF parsing, document parsing, document data extraction, intelligent document processing, IDP, lab report parsing, medical report extraction, invoice OCR, receipt OCR, ID document extraction, handwriting recognition, Google Vision OCR, Tesseract, Google Drive OCR, Document AI, text layer detection, file conversion, PDF to text, PDF to image, image preprocessing, multi page document handling, structured field extraction, value extraction, units parsing, reference range parsing, data normalisation, original file preservation, working copy processing, file storage automation, attachment handling, upload workflow, document classification, document routing, batch document processing

Multilingual and localisation

multilingual AI, multilingual chatbot, multilingual automation, language detection, automatic language detection, translation automation, machine translation, translate for retrieval, cross language retrieval, Arabic, Arabic chatbot, Arabic NLP, Arabic automation, Hebrew, Hebrew chatbot, Hebrew NLP, right to left, RTL support, RTL rendering, bidirectional text, English Arabic Hebrew, localisation, internationalisation, i18n, multilingual knowledge base, multilingual support automation, multilingual customer service, patient communication in native language, language routing, per language templates, locale handling, Unicode handling, font and layout for RTL, translation quality checks, back translation, glossary handling, terminology consistency, multilingual email automation, multilingual forms, Middle East market, MENA automation, Israel, Gulf region

Healthcare and clinic automation

healthcare automation, clinic automation, medical practice automation, patient communication automation, patient intake automation, intake form automation, pre-screening automation, eligibility pre-screen, referral triage, triage automation, appointment booking automation, appointment reminder automation, patient follow up automation, care coordination, coordinator workload reduction, fertility clinic automation, IVF clinic automation, andrology, reproductive medicine, diagnostics workflow, lab result handling, test result routing, medical records automation, EMR integration, EHR integration, practice management software, telehealth automation, patient portal automation, consent capture, clinical criteria, clinical pathway automation, protocol driven workflow, clinician review step, not a diagnosis, decision support, dental practice automation, veterinary practice automation, allied health automation, wellness clinic automation, medical tourism enquiries

Google workspace and data

Google Sheets, Google Sheets automation, Google Sheets API, Google Sheets as database, Google Sheets as knowledge base, client editable configuration, spreadsheet automation, Google Drive, Google Drive automation, Google Drive API, Drive folder automation, file upload automation, Google Docs automation, Google Workspace automation, Google Forms automation, Apps Script, Airtable, Airtable automation, Notion automation, Excel automation, CSV processing, JSON processing, database automation, PostgreSQL, Supabase, MySQL, data modelling, schema design, data validation, data cleaning, deduplication, logging to sheet, append row automation, audit log, reporting automation, dashboard automation, Looker Studio, data sync, two way sync, backup automation, access control, credential management

Make.com, Zapier and integration

Make.com, Makecom, Make.com automation, Make.com expert, Make.com developer, Make.com scenario, Make.com scenarios, Make.com integration, Make.com router, Make.com data store, Make.com webhook, Make.com HTTP module, fix Make.com scenario, Make formerly Integromat, Integromat, Zapier, Zapier automation, Zapier expert, Zapier developer, multi step Zap, Zapier paths, Zapier webhooks, fix Zapier automation, Zapier alternative, Make alternative, Make to n8n migration, Zapier to n8n migration, platform migration, API integration, REST API, GraphQL, webhook, webhooks, webhook integration, HTTP request, OAuth, OAuth2, API authentication, rate limit handling, pagination, retry logic, CORS configuration, JSON, data mapping, field mapping, system integration, SaaS integration, custom integration development

Rules engines, eligibility and reliability

rules engine, business rules automation, eligibility engine, eligibility criteria automation, criteria scoring, pass fail logic, per criterion reasons, decision logic in code, deterministic logic, repeatable results, auditable decisions, explainable decisions, configurable thresholds, spreadsheet driven rules, no code rule editing, missing data handling, required field checks, incomplete submission handling, follow up question generation, validation layer, input validation, sanity checks, error handling, retry with backoff, failure alerting, monitoring, execution logging, run ids, traceability, test runs, evaluation, quality assurance, version control, workflow backup, documentation, runbook, SOP, handover documentation, client ownership, credential management, maintainable automation, scalable automation, production ready automation

Industries, use cases and how clients search

AI automation, AI automation expert, AI automation engineer, AI automation specialist, AI workflow automation, AI agent, AI agents, AI agent development, AI chatbot, AI chatbot development, customer support AI, support automation, helpdesk automation, internal assistant, employee assistant, onboarding assistant, document assistant, AI receptionist, intake automation, form automation, workflow automation, business process automation, operations automation, automation expert, automation consultant, healthcare automation, legal document automation, insurance claims automation, finance document automation, education automation, recruitment screening automation, application screening, grant eligibility screening, benefits eligibility, compliance screening, KYC document checks, membership applications, multilingual support automation, MENA automation, UK automation, EU automation, MVP build, proof of concept, fixed price automation, long term automation support, ongoing retainer, monthly automation retainer, reduce coordinator workload, save staff hours

Work with me

Tell me what is eating your week. I will show you what can run itself.

Send a short message describing the task. I reply within a few hours with an honest view on whether automation fits, which tool is right, and what a clean build looks like.

Top Rated · 95% Job Success

Upwork

Hire me with Upwork's payment protection, verified reviews and milestone billing.

Hire me on Upwork
Level 2 seller · 4.9 from 74+ orders

Fiverr

Prefer a set scope and price? Order a package on Fiverr and we start right away.

Order on Fiverr
Talk it through

Book a call

Prefer to talk? Pick a time on my calendar and walk me through what you want to automate.

Book a call

↑↓ move↵ openmatches your words against my case studies