Skip to content

krishnasahnp/supchar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Supachar - Integrated Healthcare Platform

1. Project Overview

Supachar is a comprehensive, location-based healthcare ecosystem designed to bridge the gap between patients, doctors, and medical institutions (clinics). It provides a seamless digital experience for medical consultations, pharmacy services, and diagnostic testing. By leveraging real-time communication and geographic mapping, Supachar ensures that healthcare is accessible, immediate, and localized.

The platform empowers patients to manage their health journey from a single appโ€”from initial symptoms to medicine deliveryโ€”while providing doctors and clinics with robust tools to manage their practice and operations.


2. Key Features

๐Ÿ‘ค Patient Module

  • Smart Appointment Booking: Search for doctors by specialty and book physical or virtual visits.
  • Telemedicine (Video Calls): High-quality, real-time video consultations integrated directly within the app.
  • Medical Vault: Securely upload and store medical history, prescriptions, and lab reports.
  • E-Pharmacy: Order medicines from nearby pharmacies based on doctor recommendations or manual search.
  • Lab Test Integration: Book diagnostic tests and receive digital reports directly in the app.
  • Health Reminders: Automated notifications for medicine schedules and upcoming appointments.

๐Ÿฉบ Doctor Module

  • Digital Consultation Desk: Accept/manage appointments and maintain digital patient records.
  • E-Prescriptions: Generate digital prescriptions with suggested medicines and lab tests.
  • Virtual Practice: Conduct remote consultations via integrated video conferencing.
  • Patient Analytics: View patient medical history and previous consultation notes for better diagnosis.

๐Ÿฅ Clinic (Medical Institution) Module

  • Inventory Management: List and manage available medicines and diagnostic tests.
  • Order Fulfillment: Receive and process medicine orders and lab test bookings from nearby patients.
  • Staff Management: Manage doctors affiliated with the clinic.
  • Localized Presence: Use map-based visibility to attract nearby patients.

3. Technology Stack

Backend (The Core)

  • Runtime: Bun (High-performance JavaScript runtime)
  • Language: TypeScript
  • Framework: ElysiaJS (Fast, type-safe web framework)
  • Database: MySQL (Relational data) with [Sequelize ORM]
  • Caching & Queues: Redis
  • Real-time: Socket.io (Signaling for WebRTC, Chat, Notifications)
  • Storage: AWS S3 (Secure file storage for reports and images)
  • Auth: JWT (JSON Web Tokens) with Bcrypt encryption
  • DevOps: Docker & Docker Compose

Mobile App (Patient & Doctor)

  • Framework: React Native (Cross-platform iOS/Android)
  • State Management: Redux ToolKit with Reselect
  • Real-time: WebRTC (P2P Video/Audio), Socket.io-client
  • Maps: React Native Maps & Geolocation API
  • Notifications: Firebase Cloud Messaging (FCM) & Notifee
  • UI: Emotion (CSS-in-JS), Reanimated 4, Bottom Sheet

Web Panels (Admin & Clinic)

  • Framework: React 19 (Modern UI)
  • State Management: Redux
  • Maps: Leaflet.js (Interactive mapping and clinic boundaries)
  • Styling: Framer Motion (Animations), Emotion, Lucide Icons
  • Rich Text: React Quill (For medical reports/notes)

4. How It Works

  1. Discovery: A patient opens the app and uses the Map View to find nearby doctors or clinics.
  2. Engagement: The patient books an appointment. If virtual, a Socket.io event triggers a notification to the doctor.
  3. Consultation: During the WebRTC video call, the doctor discusses symptoms and uses the Clinic Panel or App to create a digital prescription.
  4. Action: The doctor suggests specific medicines/tests. The system automatically identifies the nearest clinic stocking those items.
  5. Fulfillment: The patient confirms the order. The clinic receives an alert, prepares the order, and updates the status for the patient to track.
  6. Follow-up: The patient receives automated reminders via the app to take their medicine as prescribed.

5. System Architecture

graph TD
    subgraph Clients
        App[React Native Mobile App]
        Web[React Admin/Clinic Web]
    end

    subgraph API_Gateway
        Bun[Bun / Elysia Server]
    end

    subgraph Services
        Auth[Auth Service - JWT]
        RealTime[Socket.io - WebRTC Signaling]
        Geo[Geolocation Service]
        Notify[Firebase / Nodemailer]
    end

    subgraph Storage
        DB[(MySQL)]
        Cache[(Redis)]
        S3[AWS S3 - Reports/Images]
    end

    App <--> Bun
    Web <--> Bun
    Bun <--> Auth
    Bun <--> RealTime
    Bun <--> Geo
    Bun <--> Notify
    Bun <--> DB
    Bun <--> Cache
    Bun <--> S3
Loading

6. Project Flow Diagrams

6.1. High-Level System Journey

sequenceDiagram
    participant P as Patient
    participant S as Supachar Server
    participant D as Doctor
    participant C as Clinic

    P->>S: Search Nearby Doctors (Geo-query)
    S-->>P: List of Doctors & Clinics
    P->>S: Book Appointment
    S->>D: Notify Appointment Request
    D->>S: Accept Appointment
    S->>P: Appointment Confirmed

    Note over P,D: Virtual Consultation Starts
    D->>S: Create Consultation Report & Prescription
    S->>P: View Report / Suggest Medicines
    P->>S: Order Medicine from Nearby Clinic
    S->>C: New Medicine Order
    C->>S: Order Dispatched
    S->>P: Medicine Delivered / Take Reminder Set
Loading

6.2. Patient (User) Flow

graph TD
    P1[Start: Mobile App] --> P2{Registered?}
    P2 -- No --> P3[Sign Up & Profile Setup]
    P2 -- Yes --> P4[Home: Search via Maps]
    P3 --> P4
    P4 --> P5[Select Doctor/Clinic]
    P5 --> P6{Action?}
    P6 -- Book Appointment --> P7[Select Slot & Pay]
    P6 -- Order Medicine --> P8[Add to Cart & Order]
    P6 -- Book Lab Test --> P9[Select Test & Schedule]
    P7 --> P10[Video Call / Physical Visit]
    P10 --> P11[Receive E-Prescription]
    P11 --> P8
    P8 --> P12[Track Delivery]
    P9 --> P13[Sample Collection]
    P13 --> P14[Digital Report Uploaded]
    P12 --> P15[End: Health Improved]
    P14 --> P15
Loading

6.3. Doctor Workflow

graph TD
    D1[Start: Doctor Portal] --> D2[Login & Availability Setup]
    D2 --> D3[Receive Appointment Notification]
    D3 --> D4{Accept Request?}
    D4 -- No --> D5[Notify Patient: Reschedule]
    D4 -- Yes --> D6[Join Consultation]
    D6 --> D7[Access Patient Medical History]
    D7 --> D8[Conduct Video/Physical Exam]
    D8 --> D9[Generate Digital Prescription]
    D9 --> D10[Suggest Medicines & Lab Tests]
    D10 --> D11[End Consultation]
    D11 --> D12[Update Earnings/Stats]
Loading

6.4. Clinic Operations Flow

graph TD
    C1[Start: Clinic Dashboard] --> C2[Inventory Management]
    C2 --> C3[Update Meds & Lab Test Prices]
    C3 --> C4[Monitor Incoming Orders]
    C4 --> C5{Order Type?}
    C5 -- Medicine --> C6[Pack Items & Verify]
    C5 -- Lab Test --> C7[Assign Phlebotomist]
    C6 --> C8[Dispatch for Delivery]
    C7 --> C9[Collect Sample & Process]
    C9 --> C10[Upload Digital Report]
    C8 --> C11[Order Completed]
    C10 --> C11
Loading

6.5. Admin Management Flow

graph TD
    A1[Start: Admin Panel] --> A2[Verify New Doctors/Clinics]
    A2 --> A3[Monitor System Analytics]
    A3 --> A4[Manage Revenue & Commissions]
    A4 --> A5[Handle Support Tickets]
    A5 --> A6[Audit Medical Data Privacy]
    A6 --> A7[Platform Configuration Updates]
Loading

7. 8-Week Development Milestones

7. Detailed 8-Week Development Roadmap

Week 1: Foundation, Architecture & Environment Setup

  • System Architecture: Finalized the choice of Bun/Elysia for high-concurrency handling.
  • Project Scaffolding: Initialized Monorepo-style structure for Backend, App, and Admin.
  • Database Modeling: Designed ER diagrams and initialized Sequelize models for 15+ entities (Users, Doctors, Appointments, Orders, etc.).
  • Dockerization: Configured docker-compose.yml for localized development with MySQL and Redis.

Week 2: Security, Authentication & Role-Based Access Control (RBAC)

  • Auth Engine: Implemented JWT authentication with refresh token logic.
  • RBAC: Developed custom middleware in Elysia to manage access levels for Patients, Doctors, and Clinic Admins.
  • File System: Integrated AWS S3 SDK for secure, scalable storage of medical reports.
  • Verification: Created a document upload and approval workflow for healthcare providers.

Week 3: Core Healthcare Logic & Appointment Management

  • Booking Engine: Developed a robust slot-booking algorithm to prevent overbooking and manage doctor schedules.
  • State Machine: Implemented an appointment lifecycle (Pending -> Confirmed -> In-Progress -> Completed -> Cancelled).
  • Patient Dashboard: Created the mobile UI for viewing medical history and upcoming visits using React Native.

Week 4: Geo-Spatial Integration & Discovery

  • Mapping: Integrated Leaflet.js (Web) and React Native Maps (Mobile).
  • Spatial Queries: Optimized MySQL queries using Haversine formulas to locate clinics within a 5km-20km radius.
  • Marker Clusters: Implemented efficient marker rendering for high-density clinic areas on the map.
  • Geocoding: Integrated Google Geocoding API for address-to-coordinate conversion.

Week 5: Telemedicine & Real-time Synchronization

  • Signaling Server: Built a Socket.io signaling server to handle WebRTC handshakes (Offer/Answer/ICE Candidates).
  • Video Implementation: Integrated react-native-webrtc for peer-to-peer encrypted video consultations.
  • Live Updates: Implemented real-time status updates for clinic orders using WebSocket events.
  • Chat: Developed an in-consultation chat feature for instant communication.

Week 6: Pharmacy, Lab Services & Inventory Management

  • E-Commerce Logic: Built a specialized ordering system for medicines with dosage and quantity tracking.
  • Clinic Dashboard: Developed a comprehensive inventory management UI for clinics to list lab tests and medicines.
  • Order Workflow: Created a dispatch and delivery tracking system for pharmacy orders.
  • Diagnostics: Integrated a laboratory module for clinicians to upload digital test results.

Week 7: Automated Prescriptions & Health Notifications

  • PDF Engine: Developed a PDF generation service using Playwright and Sharp to convert HTML consultation notes into official prescriptions.
  • Notification Service: Configured Firebase Cloud Messaging (FCM) for cross-platform push notifications.
  • Medicine Reminders: Built a scheduling engine (Redis + Node-schedule) that sends automated reminders to patients based on their prescription schedule.

Week 8: Optimization, QA & Production Deployment

  • Performance: Implemented Redis caching for frequently accessed data like nearby doctor lists and clinic inventories.
  • Testing: Conducted unit testing for the booking engine and integration testing for the WebRTC flow.
  • Security Audit: Performed a security sweep, ensuring all medical data is encrypted at rest and in transit.
  • Final Polish: Conducted a UI/UX audit to ensure responsiveness across all device sizes.

8. Technical Challenges & Solutions

๐Ÿš€ High-Concurrency Backend with Bun & Elysia

  • Challenge: Traditional Node.js environments can struggle with high-concurrency real-time events.
  • Solution: Adopted Bun for its blazing-fast runtime and ElysiaJS for its type-safe, low-overhead routing, resulting in 3x faster response times compared to traditional Express setups.

๐ŸŽฅ WebRTC Signaling Stability

  • Challenge: Ensuring stable video connections across different network types (4G, Wi-Fi, Firewalls).
  • Solution: Developed a robust signaling server using Socket.io and configured STUN/TURN servers to ensure successful ICE candidate exchange and NAT traversal.

๐Ÿ—บ๏ธ Precise Geolocation Discovery

  • Challenge: Efficiently searching for clinics within a radius without overloading the database.
  • Solution: Utilized Haversine formula-based spatial queries in MySQL and implemented marker clustering on the frontend to handle thousands of clinic points smoothly.

9. Future Scope

  • AI Symptom Checker: Integration of a Large Language Model (LLM) to provide initial health assessments before a doctor's visit.
  • Wearable Integration: Synchronizing data from Apple HealthKit and Google Fit for real-time patient monitoring.
  • Multi-lingual Support: Expanding the platform to support regional languages for wider accessibility.
  • Blockchain for Health Records: Implementing a decentralized ledger for immutable and secure medical history management.

10. Usage

  • Patients: Download the Supachar app, register, and start exploring medical services nearby.
  • Doctors: Register via the clinic panel or app, verify credentials, and start receiving appointments.
  • Clinics: Use the Web Dashboard to onboard doctors, manage inventory, and fulfill local orders.

Focus: Scalability, Real-time Interconnectivity, and Localized Healthcare Access.

About

Supachar is a comprehensive, location-based healthcare ecosystem designed to bridge the gap between patients, doctors, and medical institutions (clinics).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors