Inspiration
AI Hospital Policy & SOP Assistant
Inspiration
Hospital staff often need to search through multiple policies and Standard Operating Procedures (SOPs) to find answers to administrative questions. Manually searching long documents can take time and make it difficult to locate the right information quickly.
We wanted to explore how AI could make hospital policy information easier to search, understand, and access.
What It Does
The AI Hospital Policy & SOP Assistant is a web-based application that allows users to ask questions about hospital policies in natural language.
Users can upload policy PDF documents and ask questions through a simple interface. The application extracts text from documents, uses Nomic embeddings and FAISS to retrieve relevant passages, and uses an OpenRouter language model to generate answers based on the retrieved information.
Key features include:
- PDF policy processing: Extracts text from uploaded policy documents.
- Semantic search: Finds relevant policy passages using Nomic embeddings and FAISS.
- AI-powered answers: Uses OpenRouter to generate responses grounded in retrieved policy content.
- Source evidence: Displays source document names, page numbers when available, and retrieved passages.
- Safe fallback responses: Indicates when sufficient information cannot be found in the available documents.
- Policy management foundation: Uses SQLite to register document metadata, including titles, versions, statuses, and effective dates.
How We Built It
We developed the application in Python using the following technologies:
- Gradio: Web interface for uploading documents and asking questions.
- PyPDF: Extracts text from PDF documents.
- Nomic Embeddings: Converts policy passages and questions into vector representations for semantic search.
- FAISS: Searches the embedding index to retrieve relevant passages.
- OpenRouter API: Connects the application to a language model for answer generation.
- SQLite: Stores policy metadata for document management.
- Python dotenv: Loads API credentials from environment variables.
The application follows a Retrieval-Augmented Generation (RAG) approach. Instead of asking the language model to answer from general knowledge alone, the system retrieves relevant policy passages and provides them as evidence for generating a response.
Challenges We Faced
One of the main challenges was connecting document processing, semantic search, and AI answer generation into a single workflow.
We also needed to consider what happens when a policy document does not contain the answer to a question. To address this, we designed fallback behaviour and prompts that instruct the language model not to invent hospital policies.
Another challenge was organizing policy documents and their metadata so that document versions and statuses can be managed as the application develops.
What's Next
Our planned improvements include:
- Building a complete policy library and document management interface.
- Managing policy versions and archived documents.
- Keeping the searchable index synchronized when policies are added, replaced, or removed.
- Improving retrieval accuracy and evaluating generated answers against known test questions.
- Adding authentication and role-based access controls.
- Supporting scanned PDFs through OCR.
- Deploying the application for controlled demonstration and testing.
Built With
Python, Gradio, Nomic Embeddings, FAISS, OpenRouter, PyPDF, SQLite, Retrieval-Augmented Generation (RAG).
Important Note
This project is a prototype intended to demonstrate AI-assisted searching of hospital policy documents. It is not a clinical decision-support system and does not provide medical diagnosis or treatment advice. Testing should use fictional or appropriately authorized documents. Real hospital deployment would require security controls, access permissions, policy verification, and institutional approval.
Log in or sign up for Devpost to join the conversation.