Skip to content

Dacchu2004/MedConnect

Repository files navigation

πŸ₯ MediConnect

A modern full-stack doctor-patient communication platform built with React, TypeScript, and Flask.


πŸ“‹ Table of Contents


🌟 Overview

MediConnect bridges the communication gap between doctors and patients through a unified digital platform. It enables seamless appointment scheduling, digital prescription management, real-time emergency chat, health vitals tracking, and AI-powered medical assistance β€” all in one place.

πŸ”— Live Demo: https://lovable.dev/projects/44271c15-65b7-4b2e-88b8-74a9d48f3f84


✨ Features

πŸ‘¨β€βš•οΈ For Doctors

  • Dashboard β€” View today's, upcoming, and past appointments at a glance
  • Patient Management β€” Access patient profiles, vitals, medical history, and notes
  • Voice Transcription β€” Record consultations with real-time voice-to-text transcription
  • Prescription Management β€” Create, manage, and print digital prescriptions
  • Emergency Chat β€” Respond to urgent patient messages with quick-reply templates

πŸ§‘β€πŸ’Ό For Patients

  • Appointment Booking β€” Browse available time slots and schedule appointments
  • Health Vitals β€” Track blood pressure, heart rate, temperature, and oxygen levels
  • Prescriptions β€” View active and past prescriptions with full medication details
  • Emergency Help β€” Direct line to your doctor for urgent queries

πŸ€– AI-Powered Features

  • AI Chat Assistant β€” Medical Q&A powered by GPT-4
  • First Aid Assistant β€” Step-by-step emergency guidance with video suggestions
  • Symptom Analyzer β€” AI-driven symptom-to-condition analysis with severity rating
  • Medication Information β€” Detailed drug info including side effects and interactions
  • Voice Commands β€” Navigate the app hands-free using speech recognition

🌍 Additional Highlights

  • Multilingual Support β€” English, Spanish, French, German, Chinese (i18n via i18next)
  • Real-time Notifications β€” Socket.IO-powered push alerts for appointments and messages
  • PDF Export β€” Download appointment summaries and invoices as PDFs
  • PWA Support β€” Installable progressive web app with service worker caching
  • Responsive Design β€” Fully optimized for mobile, tablet, and desktop

πŸ›  Tech Stack

Frontend

Technology Purpose
React 18 + TypeScript UI framework
Vite Build tool
Tailwind CSS Styling
shadcn/ui + Radix UI Component library
React Router v6 Client-side routing
TanStack Query Server state management
Socket.IO Client Real-time communication
i18next Internationalization
jsPDF + jspdf-autotable PDF generation
date-fns Date utilities

Backend

Technology Purpose
Flask Web framework
Flask-SQLAlchemy ORM / Database
Flask-SocketIO Real-time WebSocket events
Flask-JWT-Extended Authentication
Flask-CORS Cross-origin support
OpenAI API (GPT-4) AI features
SQLite Database (dev)

πŸ“ Project Structure

medconnect/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app.py                  # Flask app factory
β”‚   β”œβ”€β”€ config.py               # Environment configuration
β”‚   β”œβ”€β”€ extensions.py           # SQLAlchemy & SocketIO instances
β”‚   β”œβ”€β”€ models.py               # Database models
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.py             # Register, login, profile
β”‚   β”‚   β”œβ”€β”€ appointments.py     # CRUD for appointments
β”‚   β”‚   β”œβ”€β”€ prescriptions.py    # CRUD for prescriptions
β”‚   β”‚   β”œβ”€β”€ chat.py             # Messaging + AI fallback
β”‚   β”‚   β”œβ”€β”€ notifications.py    # Real-time notifications
β”‚   β”‚   └── voice.py            # Voice command processing
β”‚   └── utils/
β”‚       └── auth.py             # JWT middleware decorators
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ appointments/       # AppointmentList, Form, Details
β”‚   β”‚   β”œβ”€β”€ chat/               # AIChatAssistant
β”‚   β”‚   β”œβ”€β”€ first-aid/          # FirstAidAssistant
β”‚   β”‚   β”œβ”€β”€ health/             # SymptomAnalyzer, MedicationInfo, HealthTips
β”‚   β”‚   β”œβ”€β”€ layout/             # Header, Sidebar, Layout
β”‚   β”‚   β”œβ”€β”€ prescriptions/      # PrescriptionBilling
β”‚   β”‚   β”œβ”€β”€ voice/              # VoiceAssistant
β”‚   β”‚   └── ui/                 # shadcn/ui primitives
β”‚   β”œβ”€β”€ contexts/
β”‚   β”‚   └── AuthContext.tsx     # Auth state management
β”‚   β”œβ”€β”€ data/                   # Mock data (appointments, patients, etc.)
β”‚   β”œβ”€β”€ hooks/                  # Custom hooks (use-toast, use-mobile)
β”‚   β”œβ”€β”€ i18n/                   # Translations (en, es)
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ doctor/             # DoctorDashboard, Transcription, Prescriptions, Patients
β”‚   β”‚   β”œβ”€β”€ patient/            # PatientDashboard, Booking, Vitals, Prescriptions
β”‚   β”‚   β”œβ”€β”€ EmergencyChat.tsx
β”‚   β”‚   β”œβ”€β”€ LoginPage.tsx
β”‚   β”‚   └── Index.tsx
β”‚   β”œβ”€β”€ services/               # aiService, prescriptionService, voiceAssistantService
β”‚   └── types/                  # TypeScript type definitions
β”‚
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ manifest.json           # PWA manifest
β”‚   └── service-worker.js       # Offline caching
└── package.json

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18
  • Python >= 3.10
  • npm or yarn

1. Clone the Repository

git clone https://github.com/your-username/medconnect.git
cd medconnect

2. Frontend Setup

npm install
npm run dev

The frontend will start at http://localhost:5173.

3. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py

The backend API will start at http://localhost:5000.


πŸ” Environment Variables

Create a .env file in the backend/ directory:

OPENAI_API_KEY=your_openai_api_key
JWT_SECRET_KEY=your_jwt_secret
FLASK_SECRET_KEY=your_flask_secret
SOCKETIO_MESSAGE_QUEUE=redis://localhost:6379/
CORS_ORIGINS=http://localhost:5173
API_BASE_URL=http://localhost:5000/api
JWT_ACCESS_TOKEN_EXPIRES=3600
JWT_REFRESH_TOKEN_EXPIRES=604800

Create a .env file in the root (frontend) directory:

VITE_API_BASE_URL=http://localhost:5000/api
VITE_OPENAI_API_KEY=your_openai_api_key

πŸ§ͺ Demo Credentials

The frontend uses mock authentication for demo purposes. No backend required to explore the UI.

Role Email Password License ID
Doctor doctor@example.com password DOC12345
Patient patient@example.com password β€”

πŸ“‘ API Reference

Auth

Method Endpoint Description
POST /auth/register Register a new user
POST /auth/login Login and receive JWT
GET /auth/profile Get current user profile
PUT /auth/profile Update user profile

Appointments

Method Endpoint Description
GET /appointments List appointments (role-filtered)
POST /appointments Create appointment
GET /appointments/:id Get appointment details
PUT /appointments/:id Update appointment
DELETE /appointments/:id Delete appointment

Prescriptions

Method Endpoint Description
GET /prescriptions List prescriptions
POST /prescriptions Create prescription (doctor only)
GET /prescriptions/:id Get prescription
GET /prescriptions/:id/invoice Download invoice

Chat & AI

Method Endpoint Description
GET /chat/messages Get messages between two users
POST /first-aid Get first aid guidance
POST /voice/process-command Process voice command

Notifications

Method Endpoint Description
GET /notifications List notifications
PUT /notifications/:id/read Mark as read
PUT /notifications/read-all Mark all as read
GET /notifications/unread-count Get unread count

🀝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push to the branch: git push origin feature/your-feature-name
  5. Open a Pull Request

Please follow Conventional Commits for commit messages.


πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


Built with ❀️ using React, TypeScript, and Flask

Live Demo β€’ Report Bug β€’ Request Feature

About

A fullstack doctor patient communication platform with appointment booking, digital prescriptions, health vitals tracking, emergency chat, and AI-powered medical assistance.

Topics

Resources

Stars

Watchers

Forks

Contributors