Skip to main content
NewNMC’s advertising guidelines for doctors are in force from 6 Oct 2026. See what to change, and get a free compliance auditNew NMC advertising rules for doctors: what to change
AI & Automation

RAG Over Hospital Content: Chunking Doctor Profiles, Packages and Department Pages

A hospital chatbot is only as accurate as its retrieval. This guide shows how to chunk doctor profiles, packages and department pages as per-entity records, with metadata and freshness rules.

RAG Over Hospital Content: Chunking Doctor Profiles, Packages and Department Pages

This post is for the engineers and technical product owners building a retrieval-augmented chatbot on top of a hospital website, and for the marketing leads who own the content it will draw from. It assumes you know what retrieval-augmented generation (RAG) is: documents are split into chunks, indexed, retrieved by similarity to a question and handed to a language model that composes the answer. The question here is how to split hospital content so the answers are right.

Hospitals are a hard case for naive chunking. The content is full of entities that change often: doctors who join, leave or change timings; packages whose inclusions and prices are revised; departments that open new services. A generic pipeline that crawls pages, splits them into fixed-size blocks and embeds them will answer "Which doctor treats knee pain?" with a fragment of a department page, a different fragment of a profile and last year's package. It will sound sure of itself throughout.

The argument of this post is that hospital knowledge should be stored as records for entities, not as blobs of pages. The sections below give a record design for doctors, packages and departments, the metadata that makes retrieval filterable, a freshness policy and an evaluation method. Examples use hypothetical data, labelled as such.

Why page-based chunking fails here

Three failure patterns recur.

Split entities. A page about a doctor includes qualifications, specialities, timings, locations and a biography. Fixed-size chunks cut across these. The chunk with the timings might not contain the doctor's name, so a question about timings retrieves a fragment no one can attribute.

Mixed entities. A department page lists ten doctors and fifteen procedures. A chunk may contain parts of three doctors' descriptions. The model blends them, and you get a plausible but wrong statement about who does what.

Stale truth. The page was updated but the index was not, or two versions of the same page coexist. The model has no way to know which is current.

A fourth, quieter problem: marketing prose. Text written to persuade ("renowned for compassionate care") is rarely what a patient asks about, yet it matches many queries and crowds out the factual chunks.

The unit of retrieval is an entity record

Instead of chunking pages, build a record per entity, derived from your source systems (CMS, doctor master, package catalogue), and chunk records.

For a hospital, the main entity types are:

  • Doctor
  • Department or service line
  • Package (health check, procedure bundle)
  • Location or facility
  • FAQ item
  • Policy (visiting hours, insurance acceptance, preparation instructions)

Each record has an ID, a type, a text body written for retrieval, structured metadata and a last-verified date. Think of the text body as a short, complete, standalone description, and of the metadata as the fields used to filter and to cite.

Doctor records

A doctor record should be understandable if it is the only thing the model sees. Include the doctor's name and designation in every chunk of the record, which is a form of contextual prefix.

Illustrative fields for a hypothetical record:

  • id: a stable doctor ID from your master system
  • name and designation
  • department and sub-specialty, using a controlled vocabulary
  • conditions treated and procedures performed, as lists
  • languages spoken
  • locations and consultation timings per location
  • consultation modes: in person, video
  • accepting new patients: yes or no, if you track it
  • profile URL
  • last verified

This mirrors the properties of a public vocabulary. The schema.org Physician type defines properties such as medicalSpecialty, availableService, hospitalAffiliation, isAcceptingNewPatients, openingHours and knowsLanguage. If your website already publishes structured data on doctor pages, reuse the same fields for the RAG record, so one source feeds both search markup and the chatbot, and they cannot disagree.

Chunk a doctor record into two or three chunks at most: a profile chunk (who they are, what they treat, languages) and a schedule chunk (where and when). Repeat the name, designation and department in both chunks. Keep timings in their own chunk because they change most often and need the shortest refresh cycle.

Package records

Packages are the most error-prone entity because they combine inclusions, exclusions, preparation, price and validity.

Illustrative fields:

  • id, name, category (preventive health check, maternity, surgery bundle)
  • inclusions as a list of tests or services
  • exclusions and conditions
  • price and currency, with an effective date, if the hospital allows quoting prices
  • eligible age or sex, where relevant
  • preparation instructions such as fasting, if clinically approved
  • location availability
  • valid from and valid to
  • last verified

One rule helps a lot: never split an inclusion list across chunks. A chunk that holds half the tests under a package heading will cause the model to state an incomplete inclusion confidently. If a package is too long for one chunk, restructure it, for example into a summary chunk and a full-inclusions chunk that begins by naming the package.

Put the price and validity in the same chunk as the package name, and have the chatbot's instructions tell it to quote prices only from records within their validity dates and to show the verified date. If your policy is to avoid giving prices over chat, exclude the field and let the bot route the question to staff.

Department and service-line records

Department pages are narrative, which makes them the closest to ordinary document chunking. Even so, treat them as records:

  • A summary chunk describing what the department treats and for whom.
  • Condition and procedure chunks, one per item, each starting with the department name.
  • A pointer list of doctor IDs and facility IDs rather than copies of their profiles. The model follows the pointers by retrieving those records.

This keeps one source of truth for each fact. Our guide to hospital service-line pages describes how to write the pages well, and the approach in department-level SEO applies the same entity thinking to search. A well-structured service-line page is also a good source for the record.

Want this applied to your practice? Get a free ai & automation audit.

Book my free audit

Metadata: the fields that make retrieval filterable

Embeddings find semantically similar text; they do not know that a question is about one location, one language or one date. Metadata filters do. Store these on every chunk:

FieldPurpose
entity_typeRestrict to doctors, packages or departments depending on the question
entity_idJoin back to the source record, and to cite
departmentFilter by specialty
location_idAnswer location-specific questions
languageRetrieve in the patient's language
validfrom, validtoExclude expired packages
last_verifiedRank and filter by freshness
statusactive, draft, retired
source_urlCitation back to the page

A practical query pattern: classify the question's entity type and any location or language it mentions, apply those as filters, then run similarity search inside the filtered set. Combine vector search with keyword search for names, since names such as doctors' surnames are rare tokens that embeddings handle poorly, and rerank the merged results.

Freshness: the policy matters more than the model

Entities change at different speeds. Design the refresh cycle by field, not by page.

  • Timings and availability: the fastest. Pull from the scheduling or doctor master system on a short interval, and consider answering timing questions with a live lookup instead of retrieved text.
  • Package prices and validity: refresh on every catalogue change, with an event trigger from your CMS or catalogue.
  • Department narrative: monthly or on publish.
  • Policies: on change, with a named owner.

Add three controls: a retire flag that removes a record from retrieval at once, a staleness threshold that makes the bot add a "please confirm with the hospital" line when a record is older than a set age, and a nightly diff that compares the index with the source and alerts on mismatches.

Prompting the generator

Retrieval quality is wasted if the generation step ignores it. Give the model clear rules: answer only from the retrieved records; if the answer is not present, say so and offer a handover; cite the record title and verified date; never infer a doctor's availability from a department page; never give clinical advice. These rules sit beside, not in place of, safety measures such as an escalation layer for emergencies.

A sample-site comparison method

We do not report results from a specific site here. To compare strategies on a sample of your own content:

  1. Take a slice: two departments, about ten doctors and ten packages.
  2. Build two indexes: one with fixed-size page chunks of, say, 500 tokens with overlap, and one with entity records as described.
  3. Write 100 test questions from real enquiries, labelled with the correct records: "Which doctor sees paediatric asthma on Saturday?", "What does the executive health check include?", "Is the cardiology package available at the second campus?"
  4. Measure retrieval: for each question, did the correct record appear in the top 3 or top 5 results? Compute hit rate per entity type.
  5. Measure answers: have a reviewer grade each answer as correct, partly correct, wrong or unsupported. Count answers with an invented or expired fact separately.
  6. Break out by failure: timings, inclusions, location, and name lookups.

Expect the entity approach to help most on timing, inclusion and location questions, since those depend on fields that page chunks split. That is a hypothesis to confirm on your data, not a promise.

Failure modes to design out

  • Duplicate records for one doctor across two campuses with conflicting timings. Use one doctor ID with per-location schedule entries.
  • Name collisions, two doctors with similar names. Include department and designation in the chunk and ask for disambiguation.
  • Translated content drift, where the Hindi page is updated and the English is not. Index per language with a shared entity ID.
  • PDF brochures with outdated prices. Either ingest them with validity dates or leave them out.
  • Copying clinical claims from marketing pages without clinical review.
  • Personal data in the index. Keep patient information out; the knowledge base should contain public hospital facts only.

Where to start

  • Choose three entity types, doctor, package and department, and write the record schema for each.
  • Feed records from source systems, not by scraping pages.
  • Put the entity name in every chunk and never split a package's inclusions.
  • Store metadata for type, location, language, validity and verification date.
  • Set refresh cycles by field and build a retire switch.
  • Run the 100-question comparison before choosing the strategy.

If you are using AiTextBotz, which lets patients ask questions on WhatsApp with AI handling the first response and handing over to your team, the same record design applies to its knowledge source. For the implementation work, see our AI chatbot service, healthcare chatbot integration and the article on whether AI chatbots convert patients.

Filed underrag hospital website chatbotchunking strategy hospital contentretrieval augmented generation healthcaredoctor profile embeddingshospital chatbot knowledge base

About the author

Co-Founder & CTO · Gurugram, India

Arush builds the systems the rest of the company runs on — the patient-acquisition pipelines, the AI chatbots, the analytics that tie a single click to a booked appointment. If a campaign reports a number, it's because something his team built is tracking it.

Free guide · 15 pages

The Patient Acquisition Blueprint

A 90-day plan from first search to booked appointment.

The Pioneers Brief — one essay, three benchmarks, one teardown, every Thursday. Subscribe free →

Free ai & automation audit

Your next chapter starts with a conversation.

Three quick questions. We come prepared with a plan for your specialty and city.

  • A 30-minute call with a healthcare specialist
  • Your top three growth opportunities, in writing
  • Honest advice — even if that means not hiring us
  • No obligation and no hard sell
You’ll speak with a senior strategist
Consultations are hosted by Arush Thapar’s team.
Step 1 of 3Takes 30 seconds

What do you want to improve first?

Details stay privateNo obligationReply within 1 working day

Client portfolio · Healthcare websites

Work relevant to rag over hospital content chunking doctor profiles packages and.

Explore client work →