Skip to content

SatynarayanMaurya/Health-Connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩺 HealthConnect – Full-Stack Telemedicine Platform

HealthConnect is a full-featured telemedicine platform designed to simulate real-world scenarios where pharmacy devices connect patients with available doctors in real time. It includes powerful tools for Admins, Doctors, and Pharmacy Devices to streamline remote consultations, manage availability, and ensure smooth communication.


πŸ” Admin Features

Admins have access to a powerful dashboard to oversee platform operations:

  • βœ… Monitor Real-Time Doctor Availability

    • View doctors currently online with status: Available, Busy, or Offline.
    • Monitor their last activity timestamps.
  • 🧠 Track Active Sessions

    • Live tracking of chat sessions between pharmacy devices and doctors.
    • View session duration and message flow in real time.
  • πŸ“ Manage Connected Pharmacy Devices

    • View all registered pharmacy devices.
    • Monitor real-time device activity and geolocation.
  • πŸ—ƒοΈ User Account Management

    • Approve, suspend, or remove doctor and pharmacy accounts.
    • View registration details and manage credentials.
  • πŸ“Š Dashboard Analytics

    • Key metrics like total active users, session frequency, doctor availability trends, and most active devices.

🩺 Doctor Features

Doctors are essential users who can manage their availability and connect with patients via chat:

  • ✍️ Register & Manage Profile

    • Secure account creation.
    • Edit name, specialization, contact info, etc.
  • 🟒 Set Availability Status

    • Toggle between Available, Busy, or Offline.
    • Devices can only contact doctors marked as Available.
  • πŸ’¬ Real-Time Chat with Pharmacy Devices

    • Chat with patients through connected pharmacy systems.
    • Multiple conversations can be handled efficiently.
  • πŸ•“ Session Logs

    • Access history of all consultations.
    • View chat transcripts, timestamps, and device info.

πŸͺ Pharmacy Device Features

Pharmacy devices act as entry points for patients to initiate remote consultations:

  • πŸ–₯️ Device Registration

    • Register securely using a unique Device ID.
    • Pharmacy info linked to each device.
  • πŸ” View Available Doctors

    • Instantly fetch a list of doctors who are currently Available.
  • πŸ“² Start Real-Time Chat

    • Initiate chat with selected doctors.
    • Designed for low-latency, high-reliability communication.
  • πŸ“œ Chat History

    • Maintain recent session history for continuity.
    • Access previous consultations made through the device.

πŸ’‘ This platform enables a seamless healthcare communication bridge between pharmacies and doctors, while giving admins full visibility and control over the ecosystem.



πŸš€ Tech Stack

πŸ”§ Backend

  • Node.js + Express.js
  • MongoDB with Mongoose ORM
  • Socket.IO for real-time communication
  • JWT-based Authentication

🎨 Frontend

  • React.js with Tailwind CSS
  • Axios for API requests
  • Socket.IO-client for real-time UI updates

🌐 Features Overview

βœ… Core Functionalities

Backend APIs

  • Pharmacy Device Registration
    Register a device with GPS coordinates and a unique ID.

  • Doctor Authentication
    Login/Logout APIs with the ability to toggle availability.

  • Session Management
    Devices can initiate a session with available doctors based on a matching algorithm.

Admin Dashboard (Frontend)

  • πŸ”΅ Live status of online doctors
  • πŸ“ Mocked device activity map
  • πŸ§‘β€βš•οΈ Active doctor-patient sessions
  • βš™οΈ Device registration and doctor onboarding

✨ Bonus Features

  • Real-time doctor status updates using WebSocket (Socket.IO)
  • Persistent chat messaging between doctor and device
  • Basic logging of device connections and session events

πŸ” Authentication & Authorization

  • Protected routes secured using JWT
  • Role-based access controls for doctor, device, and admin

πŸ“ Project Structure

HEALTHCONNECT PRO/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ Config/              # DB connection and environment setup
β”‚   β”œβ”€β”€ Controllers/         # Request handlers for each route
β”‚   β”œβ”€β”€ Middlewares/         # Authentication and other middleware
β”‚   β”œβ”€β”€ Models/              # Mongoose schema definitions
β”‚   β”œβ”€β”€ Routes/               # Helper functions (if any)
β”‚   β”œβ”€β”€ index.js            # Entry point for backend
β”‚   └── .env                 # Environment variables
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/              # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ Components/      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ Pages/           # Page-level components
β”‚   β”‚   β”œβ”€β”€ Redux/           # Redux slices and store setup
β”‚   β”‚   β”œβ”€β”€ Services/        # API service calls (e.g., axios)
β”‚   β”‚   β”œβ”€β”€ App.jsx          # Main App component
β”‚   β”‚   └── main.jsx         # React entry point
β”‚   └── .env                 # Frontend environment variables
β”‚
β”œβ”€β”€ README.md                # Project documentation
└── package.json             # Project dependencies and scripts

πŸ› οΈ Installation and Setup Instructions

πŸ“¦ Backend

  1. Navigate to the backend folder:
    cd backend
  2. Install dependencies:
    npm install
  3. Create a .env file and add:
     PORT=4000
     MONGODB_URI=your_mongo_uri
     JWT_SECRET=your_secret_key
    NODE_ENV = "development"
  4. Start the server:
     npm run dev

πŸ’» Frontend

  1. Navigate to the frontend folder:
    cd frontend
  2. Install dependencies:
    npm install
  3. Start the app:
     npm run dev

πŸ“‘ API Endpoints

All secure routes require a valid JWT token in the cookies as:


πŸ” Auth Routes

Method Endpoint Description
POST /api/signup Register a new user (doctor/device/admin)
POST /api/login Authenticate user and return JWT token
POST /api/logout Logout current user (clears cookie or token)
GET /api/get-user-details Get authenticated user details

πŸ§‘β€βš•οΈ Doctor Routes

Method Endpoint Description
GET /api/get-all-doctors Get list of all doctors
PUT /api/update-doctor-availability Update doctor’s availability status
GET /api/get-doctor-chats/:deviceId Get all chat messages between doctor and specific device

πŸ’Š Device Routes

Method Endpoint Description
GET /api/get-all-devices Get list of all registered pharmacy devices

πŸ’¬ Chat Routes

Method Endpoint Description
GET /:userId/:peerId Fetch chat messages between a user and their peer (doctor or device)

πŸ›‘ Note: All endpoints that modify or view sensitive data are protected and require authentication.

πŸ“Š Database Schema

Below are the core Mongoose models used in the HealthConnect platform:


πŸ‘€ Admin

{
  _id: ObjectId,
  name: String,              // Admin full name
  email: String,             // Unique email address
  role: "admin",             // Default: "admin"
  password: String,          // Hashed password
  createdAt: Date            // Auto-generated on registration
}

πŸ§‘β€βš•οΈ Doctor

{
  _id: ObjectId,
  name: String,              // Doctor's full name
  email: String,             // Unique email address
  password: String,          // Hashed password
  role: "doctor",            // Default: "doctor"
  specialization: String,    // e.g. "Cardiologist", Default: "General"
  isAvailable: Boolean,      // Indicates availability status
  lastLogin: Date,           // Timestamp of last login
  createdAt: Date,           // Auto-generated
  updatedAt: Date            // Auto-updated on each save
}

πŸ’Š Pharmacy Device

{
  _id: ObjectId,
  deviceId: String,          // Unique ID of the pharmacy device
  password: String,          // Hashed password
  latitude: Number,          // GPS Latitude
  longitude: Number,         // GPS Longitude
  role: "device",            // Default: "device"
  registeredAt: Date,        // When device was registered
  lastActive: Date           // Last active timestamp
}

πŸ’¬ Message

{
  _id: ObjectId,
  sender: String,            // Sender ID (doctorId or deviceId)
  receiver: String,          // Receiver ID (doctorId or deviceId)
  message: String,           // Chat message content
  timestamp: Date            // Time message was sent
}

🌍 Deployment

πŸ”— Live URL:

πŸ“ Notes:

  • CORS should be configured correctly.
  • .env files are required for deployment (add secrets to your host).

About

A full-stack telemedicine platform where pharmacy devices connect patients to available doctors in real-time. Includes admin monitoring, doctor availability management, and secure device-doctor chat.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages