MedoraX is a HIPAA-compliant, enterprise-grade medication management and clinical decision-support ecosystem. Built with a high-performance React + Vite frontend, a robust Spring Boot 3 REST API, and a dedicated Python FastAPI AI Service (powered by LangChain + Mistral AI and Google Gemini Vision AI), MedoraX eliminates prescription mismatch risks, calculates patient adherence metrics, and delivers automated medication reminders.
π Live Application: https://medora-x-five.vercel.app
βοΈ Backend Service: http://localhost:8080 / https://medorax-0.onrender.com
π€ AI Service (FastAPI): http://localhost:8000
MedoraX follows a multi-tier microservices architecture combining standard RESTful APIs with decoupled AI inference services.
graph TD
subgraph ClientLayer ["Client Layer (React 18 + Vite SPA)"]
UI["User Interface & Dashboard"]
AuthModule["Auth & OAuth2 Handler"]
Store["AppContext & Local State"]
Axios["Axios API Interceptor"]
end
subgraph BackendLayer ["Backend API & Gateway (Spring Boot 3)"]
CORS["CORS Preflight & Origin Filter"]
JWTFilter["JWT Authentication Filter"]
Security["Spring Security Chain"]
AuthCtrl["Auth Controller"]
MedCtrl["Medicine Controller"]
ProfileCtrl["Profile Controller"]
LogCtrl["Analytics & Log Controller"]
RemCtrl["Reminder Controller"]
MismatchCtrl["Mismatch & OCR Controller"]
AiCtrl["AI Integration Controller"]
FastAiService["FastAiService RestTemplate Proxy"]
end
subgraph AiMicroservice ["AI Service Microservice (Python FastAPI)"]
FastAPIApp["FastAPI Engine"]
ExplanationChain["LangChain Medicine Explanation Chain"]
PrescriptionChain["LangChain Prescription Analysis Chain"]
MistralLLM["Mistral AI LLM (mistral-small-latest)"]
end
subgraph ExternalServices ["External Vision & Data Engines"]
Gemini["Google Gemini Vision API"]
OCR["Tesseract OCR Engine"]
end
subgraph PersistenceLayer ["Persistence Layer"]
JPA["Spring Data JPA / Hibernate"]
DB[("MySQL Database")]
end
UI --> Store
Store --> Axios
Axios --> CORS
AuthModule --> Security
CORS --> JWTFilter
JWTFilter --> Security
Security --> AuthCtrl
Security --> MedCtrl
Security --> ProfileCtrl
Security --> LogCtrl
Security --> RemCtrl
Security --> MismatchCtrl
Security --> AiCtrl
AiCtrl --> FastAiService
FastAiService -->|HTTP POST| FastAPIApp
FastAPIApp --> ExplanationChain
FastAPIApp --> PrescriptionChain
ExplanationChain --> MistralLLM
PrescriptionChain --> MistralLLM
MedCtrl --> Gemini
MismatchCtrl --> OCR
MismatchCtrl --> Gemini
AuthCtrl --> JPA
MedCtrl --> JPA
ProfileCtrl --> JPA
LogCtrl --> JPA
RemCtrl --> JPA
JPA --> DB
- Authentication: Users log in via JWT credentials (
/auth/login) or Google OAuth2 (/oauth2/authorization/google). On OAuth success, the server redirects back to the SPA with signed tokens. - API Interception: All protected frontend requests attach
Authorization: Bearer <token>headers via Axios interceptors. - AI Pipeline:
- FastAPI Microservice (
/api/ai/*): Handles natural language medicine queries, prescription breakdowns, and AI assistant chats using LangChain chains with Mistral AI. - Multimodal Vision (
/api/mismatch/check): OCR extracts text from prescription images, while Gemini AI cross-references physical pill images against user medication profiles.
- FastAPI Microservice (
- Real-Time Streak Tracker: Computes consecutive compliant intake days without missed doses.
- Daily Compliance Rate: Calculates percentage of completed vs. missed doses dynamically.
- Weekly Adherence Graph: Interactive Area & Bar charts powered by Recharts.
- Active Shelf Catalog: Instant overview of current prescriptions, dosage strengths, and remaining pill counts.
- Multimodal AI Analysis: Scans uploaded physical prescription documents alongside pill packaging.
- Conflict Identification: Automatically flags drug mismatches, improper dosage frequencies, and dangerous drug-drug interactions using Google Gemini 1.5 Flash.
- Automated Fallbacks: Analyzes raw OCR text if medicine packaging images are omitted.
- Clinical Copilot Assistant: Interactive AI assistant for answering medical queries, explaining side effects, and verifying food/beverage interactions.
- Structured Markdown Rendering: Renders clinical headers, warning callout cards (
β οΈ), and bulleted recommendations cleanly in the UI. - FastAPI Proxy: Spring Boot proxies request payloads seamlessly to the Python FastAPI microservice.
- Horizontal Date Navigator: 7-day calendar strip allowing historical review and future intake planning.
- Hourly Medication Timeline: Chronological event sequence showing exact dosage times, food constraints (Before Meals, With Food, After Meals), and administration notes.
- Compliance Toggles: One-click action buttons to mark doses as Taken, Missed, or Reset.
- GitHub-Style Compliance Heatmap: 6-month density matrix visualizing long-term intake consistency.
- Per-Medication Adherence Rates: Individual breakdown of compliance percentages across every active treatment.
- Demographic Vitals: Blood group, height, weight, and allergy records.
- Emergency Guardian Contact: Stores emergency contact details for automated alert escalation.
| Layer | Technologies |
|---|---|
| Frontend Framework | React 18, TypeScript, Vite 6 |
| Styling & Design System | Vanilla CSS, Tailwind CSS 3, Glassmorphism, Dark Mode |
| Animations & UI Components | Framer Motion, Lucide Icons, React Hot Toast |
| Data Visualization | Recharts (Area, Bar, & Line Charts) |
| HTTP & State Management | Axios, React Context API, React Hook Form |
| Backend Framework | Java 21, Spring Boot 3.x, Spring MVC, RestTemplate |
| Security & Auth | Spring Security 6, JWT (io.jsonwebtoken), Google OAuth2 |
| AI Microservice | Python 3.11+, FastAPI, Uvicorn, LangChain, Pydantic |
| AI Models & LLMs | Mistral AI (mistral-small-latest), Google Gemini 1.5 Flash |
| Database & ORM | MySQL 8.0, Spring Data JPA, Hibernate |
| Build Tools | Maven (Spring Boot), UV / Pip (Python), Vite (React) |
MedoraX/
βββ README.md # Project Overview & Architecture Guide
βββ Ai Service/ # Python FastAPI AI Microservice
βββ app/
β βββ chains/ # LangChain chains (explanation & prescription)
β βββ models/ # Pydantic Request/Response models
β βββ prompts/ # Clinical system prompt templates
β βββ routes/ # FastAPI APIRouter endpoints
β βββ services/ # LLM invocation services
β βββ main.py # FastAPI application entrypoint
βββ main.py # Root FastAPI runner
βββ requirements.txt # Python dependencies
βββ pyproject.toml / uv.lock # UV package management
β
βββ frontend/ # React + Vite Frontend Application
β βββ src/
β β βββ api/ # Axios API clients
β β β βββ ai.api.ts # FastAPI AI integration client
β β β βββ analytics.api.ts # Analytics & Heatmap endpoints
β β β βββ auth.api.ts # Login, Signup, OAuth endpoints
β β β βββ medicine.api.ts # Medicine CRUD & AI endpoints
β β β βββ mismatch.api.ts # OCR & Prescription Scanner endpoints
β β βββ components/ # UI components (Header, Sidebar, Cards, Badges)
β β βββ context/ # AppContext global state
β β βββ pages/ # AIAssistant, Dashboard, PrescriptionMismatch, etc.
β β βββ App.tsx / main.tsx
β βββ .env # VITE_API_BASE_URL config
β βββ package.json
β
βββ backend/ # Spring Boot Java Backend Service
βββ medicineRemainder/
βββ medicineRemainder/
βββ src/main/java/com/project/medicineRemainder/
β βββ Security/ # SecurityConfig, JWT Filter, OAuth2 Handler
β βββ controller/ # REST API Controllers (AiIntegrationController, etc.)
β βββ dto/ # AiMedicineRequest, AiChatRequest, etc.
β βββ Entity/ # JPA Entities (User, Medicine, Reminder, Log)
β βββ service/ # FastAiService, GeminiServices, OCRservices, etc.
βββ src/main/resources/
β βββ application.properties# Environment configurations & database settings
βββ run-backend.ps1 # Helper script for running Spring Boot with env vars
βββ pom.xml| Method | Endpoint | Description | Proxied To |
|---|---|---|---|
POST |
/api/ai/chat |
AI Health Assistant chat | FastAPI POST /chat |
POST |
/api/ai/explain |
Explain medicine details & side effects | FastAPI POST /api/medicine/explain |
POST |
/api/ai/prescription |
Analyze unstructured prescription text | FastAPI POST /api/prescription/analyze |
GET |
/api/ai/health |
FastAPI service health check | FastAPI GET /health |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/auth/signup |
Register a new user account | β |
POST |
/auth/login |
Log in and receive JWT token | β |
GET |
/oauth2/authorization/google |
Trigger Google OAuth2 Sign-In | β |
GET |
/api/auth/me |
Fetch authenticated user details | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/medicines |
Get all active medicines for authenticated user | β |
POST |
/api/medicines |
Add a new medicine item | β |
PUT |
/api/medicines/{id}/taken |
Mark dose as taken today | β |
PUT |
/api/medicines/{id}/missed |
Mark dose as missed today | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/mismatch/check |
Analyze prescription image against medicine image or name | β |
POST |
/api/mismatch/ocr-only |
Extract raw text via Tesseract OCR | β |
git clone https://github.com/Rohit-code07/MedoraX.git
cd MedoraXcd "Ai Service"
# Option A: Using UV (Recommended)
uv run uvicorn app.main:app --port 8000 --reload
# Option B: Using Pip & Virtual Environment
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --port 8000 --reloadAI Service will run on http://localhost:8000.
Navigate to the Spring Boot directory:
cd "backend/medicineRemainder/medicineRemainder"Edit credentials in run-backend.ps1 or export environment variables, then execute:
.\run-backend.ps1Backend API will run on http://localhost:8080.
Navigate to the frontend folder:
cd frontend
npm install
npm run devFrontend app will run on http://localhost:5173.
This project is licensed under the MIT License β see the LICENSE file for details.
Developed with β€οΈ by Rohit Verma.