Offline ยท Explainable ยท Privacy-First
A rule-based medicine safety analyzer with a premium medical-tech UI
Chikitsฤmedhฤ is an offline, explainable-AI web app with a FastAPI backend and React/Vite frontend, powered by rule-based logic rather than black-box machine learning.
It helps users โ especially pharmacy students and healthcare practitioners โ check drugโdrug interactions, disease conflicts, and side effects in clear, simple language.
The system does not collect or upload personal data. It focuses on transparency, education, and offline safety analysis.
Simply double-click start_oneclick.bat in the project root. This will:
- โ Automatically create and activate a Python virtual environment
- โ Install all backend dependencies
- โ Build the frontend (React/Vite)
- โ Launch the FastAPI backend server
- โ Run comprehensive smoke tests
- โ Open your browser to http://127.0.0.1:8000/app
That's it! The entire application will be running end-to-end.
If you prefer manual control:
-
Backend Setup:
cd chikitsamedha python -m venv .venv312 .venv312\Scripts\activate pip install -r requirements.txt
-
Frontend Setup:
cd frontend npm install npm run build -
Run the Application:
python -m uvicorn chikitsamedha.backend.app:app --host 127.0.0.1 --port 8000
-
Access the App: Open http://127.0.0.1:8000/app in your browser
- Fuzzy search (RapidFuzz) for drug names with synonym recognition & spelling correction
- Support for up to 5 medicines simultaneously
- Drug-drug, drug-disease, drug-context, and age-based interaction detection
- Multi-dimensional risk profiling with scores across 4 categories
- Inputs: name, age, weight, height, blood group, diseases
- Age band selector (Infant โ Senior) with emoji labels
- Collapsible sidebar profile with save/load/delete support
- Multiple named profiles stored in localStorage
- Drag-and-drop or click-to-upload image interface
- Pytesseract OCR to extract medicine names from prescriptions
- Detected medicines shown as clickable chips with confidence scores
- One-click "Use All" to send detected medicines to analysis
- Context chips: Alcohol ๐บ, Grapefruit ๐, With Food ๐ฝ๏ธ
- Context interactions modify risk scores dynamically
- Age-band-specific contraindications (e.g., Aspirin + Children)
- Animated meters with count-up numbers and gradient fill bars
- Donut charts for context risk visualization
- Risk breakdown bar charts by category
- Alternatives bar chart for safer medicine suggestions
- Risk indicator cards with color-coded severity (green โ red)
- Exports analysis as downloadable PDF (via ReportLab)
- Includes user profile, medicines, risk scores, and explanations
- Color-coded risk status card with large score display
- Full English and Marathi (เคฎเคฐเคพเค เฅ) interfaces
- One-click language switching in the navbar
- Bilingual explanations in analysis results
- Reduced motion toggle for users who prefer less animation
- Keyboard-navigable UI elements
- ARIA labels on all interactive components
- Proper focus states and screen reader support
Chikitsฤmedhฤ features a Royal Futurism design language:
| Element | Details |
|---|---|
| Theme | Dark mode with emerald/teal accent palette |
| Cards | Gradient backgrounds, inner shadows, hover shimmer effect |
| Buttons | 4 variants (Primary, Secondary, Ghost, Danger) with ripple effects |
| Inputs | Enhanced focus rings, subtle glow on focus |
| Meters | Animated width + count-up numbers (0% โ 98%) |
| Toasts | Type-specific icons, colored accent borders, backdrop blur |
| Modals | Centered, backdrop blur, scale animation |
frontend/src/
โโโ components/ # 14 reusable components
โ โโโ AdvancedButton โ State-aware button (5 states, ripple, loading, success)
โ โโโ Navbar โ Fixed nav with search, lang toggle, theme, mobile menu
โ โโโ Modal โ Centered overlay with backdrop blur
โ โโโ SearchBar โ Expandable search with focus animation
โ โโโ Meter โ Animated progress bar with count-up
โ โโโ RiskIndicator โ Color-coded risk display card
โ โโโ SkeletonLoader โ Loading placeholder animations
โ โโโ ContextChips โ Interactive context toggles
โ โโโ StickyBar โ Mobile bottom action bar
โ โโโ ToastStack โ Notification system with icons
โ โโโ MedicineCard3D โ 3D card with tilt effect
โ โโโ AltCarousel โ Safer alternatives carousel
โ โโโ Loader โ Full-page loading animation
โ โโโ Seo โ Dynamic meta tags
โ
โโโ pages/ # 5 pages
โ โโโ Home โ Hero section, how-it-works steps, CTA
โ โโโ Check โ Main analysis page (medicines + profile sidebar)
โ โโโ Scan โ OCR prescription scanner
โ โโโ Report โ Analysis results with export
โ โโโ About โ Feature cards with gradient icons
โ
โโโ charts/ # 3 visualization components
โ โโโ RiskBreakdown โ Category-based risk bar chart
โ โโโ AlternativesBar โ Safer alternatives comparison
โ โโโ DonutSingle โ SVG donut chart
โ
โโโ context/ # 4 React contexts
โ โโโ ThemeContext โ Dark/light mode management
โ โโโ LangContext โ English/Marathi language state
โ โโโ MotionContext โ Reduced motion preferences
โ โโโ ToastContext โ Notification queue management
โ
โโโ index.css โ Complete design system (1000+ lines)
โโโ App.tsx โ Router & layout wrapper
| Medicine | Purpose | Common Risks | Notes |
|---|---|---|---|
| Paracetamol | Fever, Pain relief | Liver strain at high dose, Alcohol interaction | Safe in BP/Diabetes |
| Ibuprofen | Pain, Inflammation | Raises BP, irritates stomach, Ulcer risk | Caution in BP, elderly |
| Atenolol | Blood pressure control | Lowers HR, fatigue | Avoid with other BP drugs |
| Cetirizine | Allergy relief | Drowsiness | Safe with Paracetamol |
| Metformin | Diabetes control | Contraindicated in CKD | Monitor kidney function |
| Atorvastatin | Cholesterol management | Grapefruit interaction | Muscle pain risk |
| Aspirin | Blood thinner, Pain | Contraindicated in children, Alcohol interaction | GI bleeding risk |
| Combo | Risk | Description |
|---|---|---|
| Paracetamol + Alcohol | Severe liver toxicity risk | |
| Ibuprofen + Atenolol | โ Moderate | Ibuprofen may reduce BP medicine effect |
| Metformin + CKD | โ Contraindicated | Lactic acidosis risk |
| Atorvastatin + Grapefruit | Increases statin blood levels | |
| Aspirin + Child (age < 12) | โ Contraindicated | Reye's syndrome risk |
| Paracetamol (alone, adult) | โ Low (15%) | Safe when used as directed |
| Layer | Tools |
|---|---|
| Backend | FastAPI, Python 3.11+, Uvicorn (ASGI) |
| Frontend | React 18, TypeScript, Vite 7 |
| Styling | CSS3 (1000+ line design system), Tailwind CSS utilities |
| Animations | Framer Motion, CSS transitions |
| Icons | Lucide React |
| Fuzzy Matching | RapidFuzz |
| PDF Generation | ReportLab |
| OCR | Pytesseract (optional) |
| TTS | pyttsx3 (Text-to-Speech) |
| Data | Pandas, CSV-based knowledge base |
graph LR
A[Enter Profile] --> B[Select Medicines]
B --> C[Add Contexts]
C --> D[Analyze Safety]
D --> E{Risk Level}
E -->|Low| F[โ
Safe - Confetti]
E -->|Moderate| G[โ ๏ธ Caution - Explanation]
E -->|High| H[๐ด Warning - Shake]
E -->|Contraindicated| I[โ Do Not Use]
D --> J[Export PDF]
D --> K[View Charts]
- User enters personal info (age, weight, height, diseases)
- User searches and selects up to 5 medicines
- User optionally adds contexts (Alcohol, Food, Grapefruit)
- App normalizes names โ finds matches โ applies rule-based logic
- App displays:
- Overall Risk Level (Low / Moderate / High / Contraindicated)
- Multi-dimensional risk profile (Drug-Drug, Drug-Disease, Context, Age)
- Animated effectiveness & safety meters
- Plain-language explanations (English + Marathi)
- Interactive visualizations & charts
- Safer alternative suggestions
- User can export full PDF report
Chikitsฤmedhฤ is designed around transparent reasoning, where every result includes a "Why":
"Ibuprofen reduces the BP-lowering effect of Atenolol by affecting kidney-mediated sodium retention."
"Paracetamol with Alcohol: High risk (85%) - Alcohol significantly increases the risk of liver damage when combined with paracetamol."
No black-box ML โ every step is rule-based and explainable.
chikitsamedha/
โ
โโโ start_oneclick.bat # One-click launcher (Windows)
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โ
โโโ scripts/
โ โโโ smoke_test.py # Automated smoke testing suite
โ
โโโ chikitsamedha/
โ โโโ backend/
โ โ โโโ app.py # FastAPI main application + static file serving
โ โ โโโ interaction_engine.py # Core risk calculation engine
โ โ โโโ data_loader.py # Medicine database loader (CSV โ Pandas)
โ โ โโโ pdf_engine.py # PDF report generator (ReportLab)
โ โ โโโ tts_engine.py # Text-to-speech engine (pyttsx3)
โ โ
โ โโโ frontend/
โ โ โโโ src/
โ โ โ โโโ App.tsx # Main React app with routing
โ โ โ โโโ main.tsx # Entry point
โ โ โ โโโ index.css # Design system (1000+ lines)
โ โ โ โโโ i18n.ts # Translations (EN + MR)
โ โ โ โโโ components/ # 14 reusable UI components
โ โ โ โโโ pages/ # 5 pages (Home, Check, Scan, Report, About)
โ โ โ โโโ charts/ # 3 chart components
โ โ โ โโโ context/ # 4 React context providers
โ โ โ โโโ lib/ # Utility functions & theme config
โ โ โโโ package.json
โ โ โโโ vite.config.ts
โ โ
โ โโโ data/
โ โโโ medicines.csv # Medicine database
โ โโโ interactions.csv # Drug-drug interaction rules
โ โโโ diseases.csv # Disease database
โ โโโ contexts.csv # Context interaction rules
โ โโโ age_rules.csv # Age-based contraindications
โ
โโโ tesseract/ # OCR engine (optional)
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/list |
GET | List all medicines in database |
/api/suggest |
GET | Fuzzy search suggestions (?type=medicine&q=para) |
/api/check |
POST | Analyze medicine interactions (main endpoint) |
/api/compare |
POST | Compare multiple medicine sets |
/api/pdf |
POST | Generate & download PDF report |
/api/scan |
POST | OCR prescription scanning (multipart upload) |
/app |
GET | Serve frontend application |
The application includes comprehensive smoke tests that verify:
- โ API health endpoint
- โ Medicine search and suggestions
- โ Risk calculation accuracy
- โ Context-based interactions (Alcohol, Grapefruit, etc.)
- โ Disease-based contraindications
- โ Age-based restrictions
- โ PDF generation
- โ Frontend UI loading
- โ Comparative analysis
- โ v15 and v18 regression tests
Run tests manually:
python scripts/smoke_test.pyBackend:
fastapi
uvicorn
pandas
rapidfuzz
reportlab
pillow
pytesseract
pyttsx3
python-multipartFrontend:
{
"react": "^18.x",
"react-dom": "^18.x",
"react-router-dom": "^7.x",
"typescript": "^5.x",
"vite": "^7.x",
"framer-motion": "^11.x",
"lucide-react": "^0.x",
"recharts": "^2.x"
}- โ
Marathi + English bilingual support(Implemented) - โ
Multi-medicine comparative analysis(Implemented) - โ
Context-based risk analysis(Implemented) - โ
Age band contraindications(Implemented) - โ
OCR prescription scanning(Implemented) - โ
Premium UI redesign(Implemented) - โ
Multi-profile management(Implemented) - โ
Animated meters & visualizations(Implemented) - ๐ Voice narration for accessibility
- ๐ Interactive graph of drugโenzymeโeffect relationships
- ๐๏ธ SQLite database for faster queries
- ๐ Educational mode for pharmacy students
- ๐ฑ Mobile app version (React Native)
This is an educational project. Contributions are welcome for:
- Adding more medicines to the database
- Improving interaction rules
- Enhancing UI/UX design
- Adding new features
- Bug fixes and optimizations
- Translating to additional languages
Open educational prototype โ for learning and research purposes only.
Built with โค๏ธ for safer healthcare