Short answer: use a small, durable recovery queue around retrieval, keep appointment availability in a fresh transactional store, and let the assistant answer only from a versioned snapshot when search is degraded. This gives a healthcare appointment assistant a predictable failure mode: a delayed answer or a handoff, never a confident stale slot.
The decision matrix I would ship
| Failure or data shape | Primary path | Recovery path | User-facing behavior |
|---|---|---|---|
| Clinic policy and FAQ | Hybrid lexical plus vector search | Last known version, with age shown | Answer with citation and timestamp |
| Appointment slots | Transactional availability query | Read-only snapshot | Offer a callback or staff handoff |
| Index timeout | Bounded retry, then queue | Replay after backoff | Say search is temporarily delayed |
| Stale document version | Reject at merge time | Re-index from the event log | Do not cite the old text |
The key choice is separating mutable slots from explanatory content. A retrieval-augmented generation system can ground an answer in documents, but it cannot make a cached calendar authoritative. The original RAG paper describes retrieving passages before generation; that pattern is useful for clinic policies, insurance notes, and preparation instructions, while slot booking still needs an atomic check in the scheduling system.
I measure two things before tuning embeddings: freshness lag and recovery latency. A 200 ms search that returns yesterday's cancellation is worse than a two-second response that says it cannot verify the slot. Set a freshness budget per collection, record the document version in every chunk, and expose both values in traces.
Measure it.
How should retrieval architecture handle healthcare appointment failure recovery?
Treat each retrieval request as a short workflow with an idempotency key. The API gateway creates the key, the retriever attaches a deadline, and the answer service stores the evidence IDs it used. A retry may repeat a read, but it must not repeat a booking. Queue only work that is safe to replay, such as rebuilding an index or refreshing a clinic's policy bundle.
Here is a minimal TypeScript boundary. It keeps the recovery contract independent of a search vendor and makes the stale-data rule visible in code.
type Evidence = { id: string; version: string; updatedAt: string; text: string };
type RetrievalResult = { evidence: Evidence[]; snapshotAt: string };
interface Retriever {
search(query: string, deadlineMs: number): Promise<RetrievalResult>;
}
interface RecoveryQueue {
enqueue(job: { key: string; kind: "reindex" | "refresh"; payload: unknown }): Promise<void>;
}
async function retrieveWithRecovery(
retriever: Retriever,
queue: RecoveryQueue,
query: string,
key: string,
maxAgeMs: number,
): Promise<RetrievalResult> {
try {
const result = await retriever.search(query, 700);
const age = Date.now() - Date.parse(result.snapshotAt);
if (age > maxAgeMs) {
await queue.enqueue({ key, kind: "refresh", payload: { query } });
return { evidence: [], snapshotAt: result.snapshotAt };
}
return result;
} catch {
await queue.enqueue({ key, kind: "reindex", payload: { query } });
return { evidence: [], snapshotAt: new Date(0).toISOString() };
}
}
An empty evidence set is a deliberate state, not an invitation to improvise. The response policy should route it to a scripted clarification or a human queue. Log the request key, collection, snapshot timestamp, and reason for recovery; avoid logging full patient text unless the audit policy permits it. In practice, the useful debugging record is a compact chain: the question hash, the collection revision observed, the IDs returned, the deadline, and the transition into recovery. That chain lets an on-call engineer replay an index refresh without opening a patient's free-text note. It also makes a post-incident review concrete: you can tell whether the failure came from parsing, freshness validation, a timeout, or an unsafe merge.
Freshness is a data contract, not a slider. Chunking decisions follow the source, not a fashionable token count. Keep a clinic's cancellation rule in one chunk when possible, preserve headings, and attach metadata such as clinic ID, effective date, and audience. Split long operating procedures at semantic boundaries, then test retrieval with questions that cross those boundaries.
Chunking decisions follow the source, not a fashionable token count. Keep a clinic's cancellation rule in one chunk when possible, preserve headings, and attach metadata such as clinic ID, effective date, and audience. Split long operating procedures at semantic boundaries, then test retrieval with questions that cross those boundaries.
For every chunk, store a content hash and source revision. An update event should invalidate old chunks before publishing new ones. During the small gap between those operations, the answer service should prefer no answer over mixing revisions. Your mileage may vary on acceptable lag: a rural clinic with nightly policy updates has a different budget from an urgent-care network changing slots every minute. If a policy revision arrives while a request is in flight, compare the revision at retrieval time with the revision at answer time; a mismatch should trigger a fresh read or a handoff, not a silent blend. This is a small amount of bookkeeping, yet it prevents the most expensive class of support ticket: an answer that was internally coherent and externally wrong.
I also keep a canary set of appointment questions: rescheduling, preparation, insurance eligibility, and same-day availability. Run it after each parser or embedding change. Track recall at a fixed cutoff, citation-version match, timeout rate, and the percentage of requests sent to recovery. Those measures reveal whether a “better” index actually made the assistant safer.
When a simpler runner-up is better
The queue-and-snapshot design is not suitable when the assistant only searches static public FAQs and has no booking action. A managed hosted search service may then remove operational work, and a plain database full-text index can be easier to audit than a vector stack. Stick with that simpler path when your corpus is small, updates are infrequent, and a human already verifies every appointment.
The catch is operational ownership. Durable queues, replay protection, revisioned chunks, and audit traces add moving parts. Teams without an on-call rotation should reduce the number of components, set a conservative handoff policy, and accept slower refreshes. No architecture eliminates uncertainty; it makes the uncertainty explicit.
Top comments (0)