How sarthak-248/summer_training- works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express, React, Node) healthcare management system.
• It serves two user-roles (Patients & Doctors), supports appointment booking, real-time notifications via Socket.IO, secure payments (Razorpay), image storage (Cloudinary), email reminders (SendGrid), and AI-powered health analysis (Python ML modules).
File structure
• Top-level:
• api/ – Node.js/Express backend
• client/ – React/Vite frontend
• requirements.txt – Python dependencies for ML
• .env.example, package.json, README.md
• api/ sub-folders:
• config/ – external API keys (Cloudinary, Razorpay)
• controllers/ – route-level business logic (auth, doctor, patient, payment)
• models/ – Mongoose schemas (User, Doctor, Patient)
• routes/ – Express routers mapping endpoints to controllers
• middlewares/ – JWT authentication, file uploads (Multer+Cloudinary)
• ml/ – Python scripts for training and inference (train_model.py, model_predictor.py)
• uploads/ & CSV datasets
• reminderScheduler.js – Node scheduler for email reminders
• client/ sub-folders:
• src/components, layouts, pages – React UI components, route pages
• state management via Redux Toolkit
• styling via Tailwind CSS
• real-time updates via Socket.IO client
• Configuration: Vite, ESLint, Tailwind, Cloudinary, Razorpay, SendGrid, JWT, socket.io.
README for additional insights
• Describes dual-role workflows (Doctor vs Patient)
• Real-time flows: appointment notifications, payment confirmations
• ML features: OCR + health severity prediction
• Payment flow: create-order → checkout → webhook/verify → status tracking
• Reminder service: emails at 24hr and 1hr before appointments
• Deployment & build steps for both front- and back-end.
a. Main components:
• Frontend: React app (UI layer, Redux, Socket.IO Client, Razorpay Checkout)
• API Layer: Node.js/Express server
• Database: MongoDB (hosted, accessed via Mongoose)
• ML Service: Python scripts (invoked from Node or as separate microservice)
• Real-Time Bus: Socket.IO server (in Express)
• Scheduler: Node reminderScheduler module (cron or setTimeout patterns)
• External Services:
– Razorpay (Payment Gateway)
– Cloudinary (Image storage)
– SendGrid (Email service)
b. Relationships & data flows:
1. User (Doctor/Patient) → React app → HTTP(S) REST API (Express)
2. Express routes → Controllers → Models → MongoDB
3. Express emits/receives events via Socket.IO ↔ React client for live updates
4. Payment: Express ↔ Razorpay API → Webhook → Controller → DB → Client notification
5. File upload: Client → Express → Multer → Cloudinary → URL stored in DB
6. ML analysis: Controller calls Python model_predictor.py → returns health severity data
7. Scheduler: reminderScheduler reads upcoming appointments from DB → SendGrid API → email
c. Architectural patterns & principles:
• Layered architecture (Presentation, API, Business, Data Access)
• Modular controllers and routes for separation of concerns
• Asynchronous event-driven design for real-time notifications
• Externalizing configuration (12-factor principles via .env)
• Integration of a specialized ML component as a service
• React/Redux/Vite
• Express.js/Mongoose
• Socket.IO
• Python (scikit-learn, joblib)
• Razorpay, Cloudinary, SendGrid
• Cron-style scheduler (Node)