Protocol Assistant
Answers clinicians’ questions from the hospital’s own protocols and formulary, with citations.
| Industry | Level | Difficulty | Recommended mode |
|---|---|---|---|
| Healthcare | 1 of 5 | Beginner | flat |
The problem
Section titled “The problem”- Clinicians hunt through intranet PDFs for the current protocol.
- Local formulary rules differ from general references.
- Clinical text cannot be sent to external AI services.
How SrvDB powers Protocol Assistant
Section titled “How SrvDB powers Protocol Assistant”- Protocols, formulary entries and local policies are split into passages, embedded and stored in SrvDB on hospital servers.
- Each question is one
search; a local LLM answers only from the retrieved passages and quotes them. - Protocol updates replace old passages with
upsert; withdrawn documents are removed withdelete. persist()keeps the index consistent through restarts.
What changes
Section titled “What changes”| Today | With Protocol Assistant on SrvDB |
|---|---|
| Searching PDFs on the intranet | A plain-language question returns the exact protocol passage |
| Out-of-date copies circulate | Updates replace old passages the same day |
| External AI is not permitted | Everything runs on hospital infrastructure |
How it works
Section titled “How it works”- Collect approved protocols, formulary and policies.
- Chunk and embed with a local model.
- Store with document, version and section as metadata.
- Answer questions with citations via a local LLM.
- Re-ingest on every document release.
SrvDB features it uses
Section titled “SrvDB features it uses”- Exact search (
flat): every query compares against every stored vector, so results are exact and explainable. upsert: inserts new items and replaces changed ones, so the knowledge base stays current.deleteandcompact(): remove items immediately from search, then reclaim disk space.- Crash-safe
persist(): after it returns, data survives a crash or power loss and reopens exactly as committed. - Fully offline: SrvDB runs in-process and never opens a network connection.
Use cases
Section titled “Use cases”- Dosing guidance from the local formulary
- Sepsis or stroke pathway steps
- Infection-control rules
- Pre-operative checklists
- Ward-specific procedures
- Escalation and on-call policies
Core code
Section titled “Core code”embed() is your embedding model (for example sentence-transformers, or a function that turns your records into feature vectors).
import jsonimport srvdb
db = srvdb.Database("./protocol-assistant-db", dimension=384)
def ingest(items): """items: list of (id, text, metadata dict)""" db.upsert( ids=[i for i, _, _ in items], embeddings=[embed(t) for _, t, _ in items], metadatas=[json.dumps(m) for _, _, m in items], ) db.persist() # crash-safe checkpoint
def find_protocol(question, k=5): hits = db.search(embed(question), k) return [(json.loads(db.get(i)), round(score, 3)) for i, score in hits]Limits and honest notes
Section titled “Limits and honest notes”- Decision support only; clinicians remain responsible.
- Only approved, current documents should be ingested.
Build roadmap
Section titled “Build roadmap”- Prototype: load a sample of real data with
flatmode and check that searches return what an expert expects. - Measure: if you move to an approximate mode, compare its results with
flaton the same queries (recall). - Pipeline: add continuous
upsertand decide when to callpersist(). - Harden: test restarts and crashes, add logging, review every output path with domain experts.
- Deploy: ship the database directory with the application or service.
All Healthcare projects
Section titled “All Healthcare projects”| Level | Project | What it does |
|---|---|---|
| 1 · Beginner | Protocol Assistant (this page) | Answers clinicians’ questions from the hospital’s own protocols and formulary, with citations. |
| 2 · Intermediate | Similar Case Finder | Finds de-identified past cases that resemble the patient in front of you. |
| 3 · Advanced | Trial Matcher | Shortlists patients for clinical trials by comparing summaries with eligibility criteria. |
| 4 · Expert | Pharmacovigilance Monitor | Matches new adverse-event reports to known safety signals and groups similar reports. |
| 5 · Frontier | On-prem Clinical AI Stack | A complete hospital AI stack with zero data egress: local embeddings, local LLM, SrvDB. |
See also: Use cases · Live examples (coming soon)