A full-stack AI web application that allows patients to search 500+ common pharmacy questions β covering drug interactions, OTC medications, dosage guidance, and more β powered by semantic search, voice recognition, and the Claude AI API.
Patients visiting a pharmacy often have simple but important questions:
- "Can I take ibuprofen with my blood pressure medication?"
- "What cold medicine is safe if I have diabetes?"
- "How much Tylenol can I take per day?"
RxBuddy lets patients get instant, AI-powered answers without waiting for a pharmacist consultation β available 24/7 on any device. Just type or speak your question and RxBuddy handles the rest.
rxbuddy/
β
βββ backend/ # FastAPI Python backend
β βββ main.py # API entry point
β βββ search.py # ML search engine (TF-IDF + KNN)
β βββ database.py # PostgreSQL connection & queries
β βββ claude_client.py # Anthropic Claude API integration
β βββ models.py # Data models / schemas
β
βββ data/ # Data pipeline
β βββ questions.csv # 500+ pharmacy questions dataset
β βββ load_data.py # Pandas pipeline to clean & load data
β βββ seed_db.py # Seeds PostgreSQL database
β
βββ ml/ # Machine Learning
β βββ tfidf_search.py # TF-IDF + Cosine Similarity baseline
β βββ knn_search.py # KNN + Sentence Embeddings
β βββ train.py # Model training & retraining pipeline
β
βββ frontend/ # React / Next.js frontend
β βββ pages/
β β βββ index.js # Home / search page
β β βββ results.js # Search results page
β β βββ category.js # Browse by category page
β βββ components/
β β βββ SearchBar.js # Includes voice recognition button
β β βββ QuestionCard.js
β β βββ AnswerModal.js
β βββ styles/
β
βββ dashboard/ # Streamlit analytics dashboard
β βββ app.py # Most searched queries, usage trends
β
βββ .env.example # Environment variables template
βββ requirements.txt # Python dependencies
βββ package.json # Node dependencies
βββ README.md
| Language | Usage |
|---|---|
| Python | Backend, ML pipeline, data processing |
| JavaScript | React frontend |
| SQL | PostgreSQL queries, search logging |
| Library | Usage |
|---|---|
| scikit-learn | TF-IDF vectorizer, KNN model, cosine similarity |
| pandas | Data cleaning, structuring 500 questions dataset |
| NumPy | Numerical operations, vector math |
| sentence-transformers | Sentence embeddings for semantic search |
| NLTK | Drug name extraction, NLP preprocessing |
| Tool | Usage |
|---|---|
| FastAPI | REST API server |
| PostgreSQL | Questions database + search logs |
| SQLAlchemy | ORM for database interaction |
| Anthropic Claude API | AI-generated answers |
| Tool | Usage |
|---|---|
| React / Next.js | Patient-facing web interface |
| Tailwind CSS | Styling |
| Web Speech API | Voice recognition for hands-free search |
| Tool | Usage |
|---|---|
| Streamlit | Internal analytics dashboard |
| Matplotlib / Seaborn | Search trend visualizations |
| Tool | Usage |
|---|---|
| JIRA | Sprint planning, ticket tracking, team collaboration |
| GitHub | Version control, pull requests, code review |
| Tool | Usage |
|---|---|
| Vercel | Frontend deployment |
| Railway | Backend + PostgreSQL hosting |
User types or speaks a query
β
Web Speech API (voice β text)
β
TF-IDF + Cosine Similarity βββ Instant baseline match
β
KNN + Sentence Embeddings βββ Semantic understanding
β
Popularity weighting βββ From PostgreSQL search logs
β
Claude API βββ Generates full AI answer
β
User clicks result β logged β model improves over time
RxBuddy uses a feedback-driven ML system β every user search is logged to PostgreSQL, and the model continuously re-ranks results based on real patient behavior.
-- Questions table
CREATE TABLE questions (
id SERIAL PRIMARY KEY,
question TEXT NOT NULL,
category VARCHAR(50),
tags TEXT[],
answer TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
-- Search logs table (feeds ML retraining)
CREATE TABLE search_logs (
id SERIAL PRIMARY KEY,
query TEXT NOT NULL,
matched_question_id INT REFERENCES questions(id),
clicked BOOLEAN DEFAULT FALSE,
session_id VARCHAR(100),
searched_at TIMESTAMP DEFAULT NOW()
);The Streamlit dashboard (internal use) shows:
- Top 20 most searched questions
- Search volume by category
- Click-through rate per question
- Daily/weekly usage trends
- Unanswered query clustering (questions users ask that don't match anything)
git clone https://github.com/thechaoticsportsguy/rxbuddy.git
cd rxbuddypip install -r requirements.txtcp .env.example .env
# Add your Anthropic API key and PostgreSQL connection stringpython data/seed_db.pyuvicorn backend.main:app --reloadcd frontend
npm install
npm run devstreamlit run dashboard/app.pyBuilt RxBuddy, a full-stack AI pharmacy consultation app using FastAPI, React, PostgreSQL, and the Claude API β implementing a hybrid NLP search engine combining TF-IDF, KNN, and sentence embeddings with a PostgreSQL feedback loop that continuously improves from real user search behavior, with voice recognition via Web Speech API, deployed on Vercel + Railway.
RxBuddy is an informational tool only. It does not replace professional medical or pharmaceutical advice. Always consult a licensed pharmacist or physician for medical decisions.
Om Gohel
- GitHub: @thechaoticsportsguy
- LinkedIn: linkedin.com/in/omgohel
Mihir Jani
- GitHub: @mihirzx
- LinkedIn: linkedin.com/in/mihir-jani
- Email: mihirjani@umass.edu