How samyakraka/medecro-ai-smart-healthcare-disease-prediction works
Project Type and Purpose
• This is a full-stack, monolithic Flask web application with an embedded machine-learning component.
• Purpose: an AI-driven medical chatbot and recommendation system that lets users assess symptoms, get medical info, book appointments, and receive personalized medicine/diet/workout recommendations.
File Structure
• Top‐level application code:
• app.py, index.py, wsgi.py – Flask application entry points and routing
• main.py & Medicine Recommendation System.ipynb – scripts/notebooks for training the recommendation model
• Static/UI Layers:
• /templates – Jinja2 HTML templates (home, chat, login, register, patient/doctor dashboards, appointment pages)
• /static – CSS, JS, images, assets for front-end interaction
• Models & Data:
• /models/svc.pkl – serialized Support Vector Classifier used at runtime
• /datasets/*.csv – raw symptom, medication, diet, workout, precaution datasets used for model training
• Data stores:
• JSON files (users.json, user_credentials.json, doctors.json, responses.json, users_data.json) acting as flat-file databases
• Deployment config:
• requirements.txt (implied), vercel.json, credentials.json for external API keys
README Insights
• Backend: Python + Flask
• Data: JSON stores for user, doctor, and chat history
• ML: personalized recommendations via scikit-learn
• Features: symptom assessment, chat, appointment scheduling, chat history retention
a. Main Components
• Client Browser (User/Doctor UI)
• Flask Web Server
• Machine-Learning Service (Model Loader + Predictor)
• Data Layer (JSON “databases” + Optional CSV warehouse for retraining)
• Appointment Scheduler Module
• Static Asset Server
b. Relationships & Interactions
• Browser → Flask Server: HTTP(S) requests (GET/POST) for pages, API calls (symptom submission, chat messages, appointment booking)
• Flask Server → Static Asset Server: serves CSS/JS/images
• Flask Server → Data Layer: read/write JSON files for authentication, user/doctor profiles, chat history
• Flask Server → ML Service: load svc.pkl once on startup, invoke predict() on user symptom input to return medicine/diet/workout recommendations
• Flask Server → Appointment Scheduler: reads/writes doctor schedules and user appointments in JSON or in-memory structures
c. Architectural Patterns & Principles
• Monolithic MVC:
– Model = JSON files + ML model
– Views = Jinja2 templates + static assets
– Controllers = Flask route handlers in app.py/index.py
• Separation of Concerns: UI layer decoupled from backend logic, ML inference isolated as a service module, data persistence via JSON
• Single-file flat-file DB: lightweight storage avoiding external database for prototyping
d. Key Technologies
• Flask (routing, templating, request handling)
• scikit-learn (SVC model)
• Jinja2 (HTML templates)
• JavaScript/CSS (front-end interactivity)
• JSON flat files (data persistence)