Skip to content
Β 
Β 

Repository files navigation

Project Ashwini

A Comprehensive IoT-Ready Healthcare Management Platform for Clinics and Hospitals

Project Ashwini is an enterprise-grade, full-stack healthcare management system with multi-platform support, role-based access control, patient portal, mobile applications, and IoT device integration capabilities. The platform streamlines patient flow, vitals monitoring, prescription management, medical report analysis, and patient engagement.


Live Application Links:

πŸ“‹ Table of Contents


🎯 Overview

Project Ashwini is a complete healthcare ecosystem supporting multiple user types:

Staff Portals

  1. Reception/Registration Staff: Patient registration and queue management
  2. Nurses/Health Monitoring: Record patient vitals (manual or IoT-based)
  3. Doctors: Comprehensive patient view with vitals, prescriptions, medical reports, and notes

Patient Portals

  1. Patient Web Portal: Self-service access to health records, prescriptions, and visit history
  2. Patient Mobile App: Native Android application for on-the-go health tracking

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       Project Ashwini Platform                          β”‚
β”‚            Multi-Portal Healthcare Management System                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Main Frontend   β”‚  β”‚ Unified Frontend β”‚  β”‚  Patient Portal  β”‚
β”‚  (Port 4000)     β”‚  β”‚  (Port 3000)     β”‚  β”‚  (Vite)          β”‚
β”‚                  β”‚  β”‚                  β”‚  β”‚                  β”‚
β”‚ β€’ Registration   β”‚  β”‚ β€’ Doctor View    β”‚  β”‚ β€’ Dashboard      β”‚
β”‚ β€’ Health Monitor β”‚  β”‚ β€’ Prescriptions  β”‚  β”‚ β€’ Measurements   β”‚
β”‚ β€’ Report Upload  β”‚  β”‚ β€’ Patient Nav    β”‚  β”‚ β€’ Prescriptions  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚      Patient Mobile App (Android)           β”‚      β”‚
β”‚                                             β”‚      β”‚
β”‚  β€’ Native Android (Capacitor)               β”‚β—„β”€β”€β”€β”€β”€β”˜
β”‚  β€’ Health Tracking & Reports                β”‚
β”‚  β€’ Offline Capability                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                    β”‚                    β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Django Backend     β”‚
                    β”‚   (Port 8000)        β”‚
                    β”‚                      β”‚
                    β”‚  β€’ REST API          β”‚
                    β”‚  β€’ JWT Auth          β”‚
                    β”‚  β€’ RBAC              β”‚
                    β”‚  β€’ PostgreSQL/SQLite β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   External Services  β”‚
                    β”‚                      β”‚
                    β”‚  β€’ Azure AI (OCR)    β”‚
                    β”‚  β€’ Cloudinary        β”‚
                    β”‚  β€’ IoT Devices       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

Current Features

Patient Management

  • Patient Registration: Complete demographic capture with auto-generated patient IDs
  • Queue Management: Real-time status tracking (waiting β†’ checking β†’ examined β†’ completed)
  • Multi-Visit Support: Track visit history and patient journey
  • Patient Portal Integration: Link patients to user accounts for self-service access

Health Monitoring

  • Manual Vitals Entry: Blood pressure, temperature, SpOβ‚‚, heart rate, height, weight
  • Measurement History: Track vitals over time with trend analysis
  • IoT-Ready Framework: Pre-built models and endpoints for device integration
  • Real-time Updates: Automatic synchronization across all interfaces

Clinical Management

  • Prescription Management: Add/edit medicines with dose, type, and quantity
  • Prescription History: Track medication changes across visits
  • Doctor's Notes: Clinical observations and next visit scheduling
  • Patient Navigation: Easy previous/next patient browsing for doctors

Medical Report Analysis

  • Report Upload: Support for images and PDFs
  • AI-Powered OCR: Azure Document Intelligence integration for text extraction
  • Key Phrase Analysis: Automatic extraction of important medical terms
  • Cloud Storage: Cloudinary integration for production deployments

Authentication & Security

  • JWT-Based Authentication: Secure token-based auth with 1-hour access tokens and 7-day refresh tokens
  • Rate Limiting: Protection against brute force attacks (5 login attempts/minute, 3 registrations/hour per IP)
  • Required SECRET_KEY: No default secret key - must be explicitly configured in environment
  • Role-Based Access Control (RBAC): Five user roles (Admin, Doctor, Nurse, Reception, Patient)
  • Portal-Specific Access: Automatic routing based on user role
  • Consent Management: GDPR-compliant consent logging
  • CORS Configuration: Configured for mobile app compatibility (Android/iOS)

Patient Portal Features

  • Personal Dashboard: Overview of health metrics and upcoming visits
  • Measurement Tracking: View vitals history with interactive charts
  • Prescription Access: Current and historical prescriptions
  • Visit History: Comprehensive record of past consultations
  • Profile Management: Update contact information and preferences

Mobile Application

  • Native Android App: Built with Capacitor for native performance
  • Offline Support: Access health data without internet
  • Push Notifications: Appointment reminders and health alerts
  • Responsive Design: Optimized for mobile devices
  • CI/CD Pipeline: GitHub Actions for automated builds

IoT-Ready Architecture

  • Device Management Models: Complete device registration and tracking system
  • Measurement Session Tracking: Workflow for device-initiated measurements
  • ESP32 Integration: Sample code and setup guide for IoT devices
  • RESTful Device APIs: Pre-built endpoints for device communication
  • Real-time Synchronization: Automatic updates when devices submit data

πŸ› οΈ Tech Stack

Backend

  • Framework: Django 4.2+ with Django REST Framework
  • Authentication: djangorestframework-simplejwt (JWT tokens)
  • Database: SQLite (development) / PostgreSQL (production)
  • API: RESTful JSON APIs with CORS support
  • AI Integration: Azure Document Intelligence for OCR
  • Storage: Cloudinary for media files (production)
  • Server: Gunicorn with Whitenoise for static files

Frontend Stack

Main Frontend (Staff Portal)

  • Framework: React 18+ with Create React App
  • UI: Bootstrap 5 + Custom CSS
  • HTTP: Axios
  • Routing: React Router v6
  • Markdown: react-markdown with remark-gfm
  • Port: 4000

Unified Frontend (Doctor's Portal)

  • Framework: React 18+ with Create React App
  • UI: Bootstrap 5 + Custom CSS
  • HTTP: Axios
  • Routing: React Router v6
  • Port: 3000

Patient Portal (Web)

  • Framework: React 18+ with Vite
  • UI: Custom CSS with modern gradients
  • HTTP: Axios
  • Routing: React Router v6
  • Charts: Recharts for health data visualization

Patient Mobile App

  • Framework: React 18+ with Vite
  • Native: Capacitor 6.0
  • Platform: Android (iOS capable)
  • UI: Responsive mobile-first design
  • Charts: Recharts for health metrics
  • Build: Gradle-based Android build system

IoT Integration

  • Device: ESP32 microcontrollers
  • Protocol: HTTP/REST
  • Language: Arduino (C++)

Deployment & DevOps

  • Backend: Render.com (or Heroku)
  • Frontend: Vercel
  • Mobile: Google Play Store (Android)
  • CI/CD: GitHub Actions for Android builds
  • Version Control: Git/GitHub

Development Tools

  • Python: 3.8+
  • Node.js: 16+
  • Package Managers: pip, npm
  • Scripts: PowerShell automation scripts
  • Android Studio: For mobile development

πŸ“ Project Structure

Ashwini/
β”œβ”€β”€ .github/                          # GitHub Configuration
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   └── android-build.yml         # CI/CD for Android app builds
β”‚   └── ANDROID_BUILD_SETUP.md
β”‚
β”œβ”€β”€ backend/                          # Django Backend (Port 8000)
β”‚   β”œβ”€β”€ ashwini_backend/              # Main Django project
β”‚   β”‚   β”œβ”€β”€ settings.py               # Django configuration (CORS, JWT, DB)
β”‚   β”‚   β”œβ”€β”€ urls.py                   # Root URL routing
β”‚   β”‚   β”œβ”€β”€ wsgi.py                   # WSGI application
β”‚   β”‚   └── asgi.py                   # ASGI application
β”‚   β”‚
β”‚   β”œβ”€β”€ patients/                     # Patient Management App
β”‚   β”‚   β”œβ”€β”€ models.py                 # Patient, VisitHistory, ConsentLog
β”‚   β”‚   β”œβ”€β”€ views.py                  # Patient CRUD APIs
β”‚   β”‚   β”œβ”€β”€ serializers.py            # Patient serializers
β”‚   β”‚   β”œβ”€β”€ auth_models.py            # CustomUser with RBAC roles
β”‚   β”‚   β”œβ”€β”€ auth_views.py             # JWT login/register/role endpoints
β”‚   β”‚   β”œβ”€β”€ auth_serializers.py       # Authentication serializers
β”‚   β”‚   β”œβ”€β”€ auth_urls.py              # Auth API routes
β”‚   β”‚   β”œβ”€β”€ patient_portal_views.py   # Patient portal-specific views
β”‚   β”‚   β”œβ”€β”€ patient_portal_urls.py    # Patient portal API routes
β”‚   β”‚   β”œβ”€β”€ permissions.py            # Custom permission classes
β”‚   β”‚   β”œβ”€β”€ urls.py                   # Patient API routes
β”‚   β”‚   └── admin.py                  # Django admin configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ measurements/                 # Vitals/Measurements App
β”‚   β”‚   β”œβ”€β”€ models.py                 # Measurement model (IoT-ready)
β”‚   β”‚   β”œβ”€β”€ views.py                  # Measurement CRUD APIs
β”‚   β”‚   β”œβ”€β”€ serializers.py            # Measurement serializers
β”‚   β”‚   └── urls.py                   # Measurement API routes
β”‚   β”‚
β”‚   β”œβ”€β”€ prescriptions/                # Prescription Management App
β”‚   β”‚   β”œβ”€β”€ models.py                 # Prescription, PrescriptionHistory
β”‚   β”‚   β”œβ”€β”€ serializers.py            # Prescription serializers
β”‚   β”‚   └── admin.py                  # Admin interface
β”‚   β”‚
β”‚   β”œβ”€β”€ devices/                      # IoT Device Management App
β”‚   β”‚   β”œβ”€β”€ models.py                 # Device, MeasurementSession models
β”‚   β”‚   β”œβ”€β”€ views.py                  # Device command/measurement APIs
β”‚   β”‚   β”œβ”€β”€ urls.py                   # Device API routes
β”‚   β”‚   └── admin.py                  # Device admin interface
β”‚   β”‚
β”‚   β”œβ”€β”€ reports/                      # Medical Report Analysis App
β”‚   β”‚   β”œβ”€β”€ models.py                 # Report model
β”‚   β”‚   β”œβ”€β”€ views.py                  # Report upload & analysis APIs
β”‚   β”‚   β”œβ”€β”€ services.py               # Azure AI integration
β”‚   β”‚   β”œβ”€β”€ storage.py                # Cloudinary custom storage
β”‚   β”‚   β”œβ”€β”€ serializers.py            # Report serializers
β”‚   β”‚   └── urls.py                   # Report API routes
β”‚   β”‚
β”‚   β”œβ”€β”€ media/                        # Uploaded files (development)
β”‚   β”‚   └── reports/
β”‚   β”‚
β”‚   β”œβ”€β”€ manage.py                     # Django CLI
β”‚   β”œβ”€β”€ requirements.txt              # Python dependencies
β”‚   β”œβ”€β”€ db.sqlite3                    # SQLite database (development)
β”‚   β”œβ”€β”€ build.sh                      # Render.com build script
β”‚   β”œβ”€β”€ start.sh                      # Render.com start script
β”‚   └── Procfile                      # Heroku deployment config
β”‚
β”œβ”€β”€ frontend-main/                    # Main Frontend - Staff Portal (Port 4000)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ RegistrationDashboard.js    # Patient registration UI
β”‚   β”‚   β”‚   β”œβ”€β”€ HealthMonitoringStation.js  # Vitals entry UI
β”‚   β”‚   β”‚   β”œβ”€β”€ ReportAnalysis.js           # Report upload & AI analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.js                    # Staff authentication
β”‚   β”‚   β”‚   └── RoleProtectedRoute.js       # RBAC route guard
β”‚   β”‚   β”œβ”€β”€ App.js                    # Main routing & navigation
β”‚   β”‚   β”œβ”€β”€ api.js                    # Axios API client
β”‚   β”‚   └── index.js                  # React entry point
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ package.json                  # Dependencies & scripts
β”‚   β”œβ”€β”€ vercel.json                   # Vercel deployment config
β”‚   └── .env                          # API URL configuration
β”‚
β”œβ”€β”€ frontend-unified/                 # Doctor's Dashboard (Port 3000)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ PatientView.js        # Comprehensive patient view
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.js              # Doctor authentication
β”‚   β”‚   β”‚   └── RoleProtectedRoute.js # RBAC route guard
β”‚   β”‚   β”œβ”€β”€ App.js                    # Patient navigation & switching
β”‚   β”‚   β”œβ”€β”€ api.js                    # Axios API client
β”‚   β”‚   └── index.js                  # React entry point
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ package.json                  # Dependencies & scripts
β”‚   β”œβ”€β”€ vercel.json                   # Vercel deployment config
β”‚   └── .env                          # API URL configuration
β”‚
β”œβ”€β”€ frontend-patient/                 # Patient Web Portal (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx             # Patient login
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.jsx          # Patient registration
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx         # Health overview
β”‚   β”‚   β”‚   β”œβ”€β”€ Measurements.jsx      # Vitals history with charts
β”‚   β”‚   β”‚   β”œβ”€β”€ Prescription.jsx      # Current & past prescriptions
β”‚   β”‚   β”‚   β”œβ”€β”€ Visits.jsx            # Visit history
β”‚   β”‚   β”‚   └── Profile.jsx           # Profile management
β”‚   β”‚   β”œβ”€β”€ components/               # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ context/                  # Auth context
β”‚   β”‚   β”œβ”€β”€ routes/                   # Route configuration
β”‚   β”‚   └── api/                      # API client
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json                  # Vite & dependencies
β”‚   β”œβ”€β”€ vite.config.js                # Vite configuration
β”‚   β”œβ”€β”€ vercel.json                   # Vercel deployment
β”‚   └── README.md                     # Patient portal documentation
β”‚
β”œβ”€β”€ frontend-patient-mobile/          # Patient Mobile App (Android)
β”‚   β”œβ”€β”€ android/                      # Android native project
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   └── src/main/
β”‚   β”‚   β”‚       β”œβ”€β”€ AndroidManifest.xml
β”‚   β”‚   β”‚       β”œβ”€β”€ res/              # App resources
β”‚   β”‚   β”‚       └── assets/           # Web assets
β”‚   β”‚   β”œβ”€β”€ build.gradle              # Android build config
β”‚   β”‚   β”œβ”€β”€ gradle.properties
β”‚   β”‚   └── gradlew                   # Gradle wrapper
β”‚   β”‚
β”‚   β”œβ”€β”€ src/                          # React source (same as patient portal)
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   └── api/
β”‚   β”‚
β”‚   β”œβ”€β”€ resources/                    # App icons & splash screens
β”‚   β”‚   β”œβ”€β”€ icon.png
β”‚   β”‚   └── splash.png
β”‚   β”‚
β”‚   β”œβ”€β”€ capacitor.config.json         # Capacitor configuration
β”‚   β”œβ”€β”€ package.json                  # Capacitor & dependencies
β”‚   β”œβ”€β”€ vite.config.js                # Vite configuration
β”‚   β”œβ”€β”€ setup.ps1                     # Windows setup script
β”‚   β”œβ”€β”€ setup.sh                      # Linux/Mac setup script
β”‚   β”œβ”€β”€ ICON_SETUP_GUIDE.md           # Icon generation guide
β”‚   └── README.md                     # Mobile app documentation
β”‚
β”œβ”€β”€ IoT-Integration/                  # IoT Device Code
β”‚   └── iot_integration_with_api/
β”‚       β”œβ”€β”€ iot_integration_with_api.ino  # ESP32 Arduino code
β”‚       └── keys.h                    # WiFi & API credentials
β”‚
β”œβ”€β”€ Documentation/                    # Comprehensive Documentation
β”‚   β”œβ”€β”€ API_DOCUMENTATION.md          # Complete API reference
β”‚   β”œβ”€β”€ ARCHITECTURE.md               # System architecture details
β”‚   β”œβ”€β”€ CI_CD.md                      # CI/CD implementation guide
β”‚   β”œβ”€β”€ DEPLOYMENT_GUIDE.md           # Production deployment guide
β”‚   β”œβ”€β”€ DEPLOYMENT_CHECKLIST.md       # Pre-deployment checklist
β”‚   β”œβ”€β”€ ESP32_SETUP_GUIDE.md          # ESP32 device setup
β”‚   β”œβ”€β”€ IOT_INTEGRATION.md            # IoT integration guide
β”‚   β”œβ”€β”€ MOBILE_APP_SUMMARY.md         # Mobile app overview
β”‚   β”œβ”€β”€ QUICKSTART.md                 # 5-minute quick start
β”‚   β”œβ”€β”€ SUPERUSER_GUIDE.md            # Admin user guide
β”‚   └── USER_GUIDE.md                 # End-user documentation
β”‚
β”œβ”€β”€ RBAC.md                           # Role-based access control guide
β”œβ”€β”€ Ashwini_Project_Report.md         # Complete project report
β”‚
β”œβ”€β”€ setup.ps1                         # Complete project setup (Windows)
β”œβ”€β”€ start-servers.ps1                 # Start all servers (Windows)
β”œβ”€β”€ render.yaml                       # Render.com deployment config
β”œβ”€β”€ LICENSE                           # Project license
└── README.md                         # This file

πŸš€ Quick Start

Option 1: Automated Setup (Windows - Recommended)

# Clone the repository
git clone https://github.com/yourusername/ashwini.git
cd ashwini

# Run automated setup script
.\setup.ps1

# Start all servers in separate windows
.\start-servers.ps1

Option 2: Quick Start Guide

See QUICKSTART.md for a detailed 5-minute setup guide.

Option 3: Manual Setup

Follow the detailed instructions in the Setup Instructions section below.


πŸ“ Setup Instructions

Prerequisites

  • Python 3.8 or higher
  • Node.js 16 or higher
  • pip (Python package manager)
  • npm (Node package manager)
  • Android Studio (optional, for mobile development)

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Create a virtual environment (recommended):

    python -m venv venv
    .\venv\Scripts\Activate      # Windows
    # source venv/bin/activate   # Linux/Mac
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure environment variables (REQUIRED):

    Create a .env file in the backend/ directory:

    # Generate a secure SECRET_KEY (REQUIRED)
    python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

    Add to backend/.env:

    SECRET_KEY=your-generated-secret-key-here
    DEBUG=True
    ALLOWED_HOSTS=localhost,127.0.0.1

    ⚠️ IMPORTANT: The application will not start without SECRET_KEY set in environment variables. See .env.example for all available configuration options.

  5. Run database migrations:

    python manage.py makemigrations
    python manage.py migrate
  6. Create superuser (for Django admin):

    python manage.py createsuperuser

    Follow the prompts to set username, email, and password.

  7. Start the Django server:

    python manage.py runserver 0.0.0.0:8000

    Backend will be available at: http://localhost:8000 Admin interface at: http://localhost:8000/admin API root at: http://localhost:8000/api/

Frontend Setup - Main Portal (Registration + Health Monitoring)

  1. Open a new terminal and navigate to frontend-main:

    cd frontend-main
  2. Install dependencies:

    npm install
  3. Configure environment (.env file should contain):

    REACT_APP_API_URL=http://localhost:8000
    
  4. Start the development server:

    npm start

    Main Frontend will be available at: http://localhost:4000

Frontend Setup - Unified Portal (Doctor's Dashboard)

  1. Open a new terminal and navigate to frontend-unified:

    cd frontend-unified
  2. Install dependencies:

    npm install
  3. Configure environment (.env file should contain):

    REACT_APP_API_URL=http://localhost:8000
    
  4. Start the development server:

    npm start

    Unified Frontend will be available at: http://localhost:3000

Frontend Setup - Patient Portal (Web)

  1. Open a new terminal and navigate to frontend-patient:

    cd frontend-patient
  2. Install dependencies:

    npm install
  3. Configure API in src/api/axios.js:

    const API_URL = 'http://localhost:8000';
  4. Start the development server:

    npm run dev

    Patient Portal will be available at: http://localhost:5173 (or similar Vite port)

Mobile App Setup (Android)

See frontend-patient-mobile/README.md for detailed setup instructions.

Quick setup:

cd frontend-patient-mobile
npm install
npx cap sync android
npm run android    # Opens Android Studio

Verify Installation

With all servers running, you should have:


πŸ‘₯ User Roles & RBAC

Project Ashwini implements comprehensive Role-Based Access Control (RBAC) with five distinct user roles:

Role Overview

Role Portal Access Permissions
ADMIN All portals Full system access, user management, all operations
DOCTOR Unified Portal Patient view, prescriptions, notes, complete consultations
NURSE Main Portal Health monitoring, vitals entry, patient status updates
RECEPTION Main Portal Patient registration, queue management
PATIENT Patient Portal Personal health data, prescriptions, visit history

Authentication

  • JWT-based: Secure token authentication for all API calls
  • Login Endpoints: Separate login APIs for staff and patients
  • Role Verification: Automatic role checking on protected routes
  • Session Management: Token refresh mechanism for extended sessions

Example Users

After running python manage.py createsuperuser, you can create additional users via Django admin or registration APIs.

Test Accounts (create these in Django admin for testing):

  • Doctor: username: doctor1, password: <your-password>, Role: DOCTOR
  • Nurse: username: nurse1, password: <your-password>, Role: NURSE
  • Reception: username: reception1, password: <your-password>, Role: RECEPTION

See RBAC.md for complete RBAC implementation details.


πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/login/ Staff login (returns JWT token + role)
POST /api/auth/register/ Staff registration
GET /api/auth/role/ Get current user's role
POST /api/patient-portal/auth/login/ Patient login
POST /api/patient-portal/auth/register/ Patient registration

Patient Management

Method Endpoint Description
GET /api/patients/ List all patients (supports ?status= filter)
POST /api/patients/ Create new patient (auto-generates ID)
GET /api/patients/<id>/ Get patient details with latest measurement
PUT/PATCH /api/patients/<id>/ Update patient (partial updates allowed)
DELETE /api/patients/<id>/ Delete patient
GET /api/patients/<id>/history/ Get patient visit history

Prescription Management

Method Endpoint Description
GET /api/patients/<id>/prescription/ Get patient's current prescription
PUT/PATCH /api/patients/<id>/prescription/ Update prescription medicines
GET /api/patients/<id>/prescription/history/ Get prescription history

Prescription Format:

{
  "medicines": [
    {
      "name": "Paracetamol",
      "dose": "twice a day",
      "type": "Tablet",
      "quantity": "Full"
    }
  ]
}

Measurement Management

Method Endpoint Description
GET /api/patients/<id>/measurements/ Get all measurements (history)
GET /api/patients/<id>/measurements/latest/ Get latest measurement
POST /api/patients/<id>/measurements/ Create manual measurement

Measurement Format:

{
  "blood_pressure": "120/80",
  "temperature": 98.6,
  "spo2": 98.0,
  "heart_rate": 72.0,
  "height": 170,
  "weight": 70
}

Medical Reports

Method Endpoint Description
GET /api/reports/ List all reports
POST /api/reports/ Upload new report with OCR analysis
GET /api/reports/<id>/ Get report details
GET /api/reports/patient/<patient_id>/ Get all reports for a patient

IoT Device Endpoints

Method Endpoint Description
GET /api/devices/ List all registered devices
GET /api/devices/<device_id>/command/ Device polls for commands
POST /api/devices/<device_id>/measurements/ Device submits measurements

Patient Portal APIs

Method Endpoint Description
GET /api/patient-portal/dashboard/ Patient dashboard data
GET /api/patient-portal/measurements/ Patient's measurement history
GET /api/patient-portal/prescriptions/ Patient's prescriptions
GET /api/patient-portal/visits/ Patient's visit history
PUT /api/patient-portal/profile/ Update patient profile

See API_DOCUMENTATION.md for complete API reference with request/response examples.


πŸ”Œ IoT Integration

Project Ashwini is designed with IoT integration in mind. The system includes:

IoT Components

  1. Device Management: Register and track IoT devices
  2. Measurement Sessions: Workflow for device-initiated measurements
  3. Command Polling: Devices poll for patient measurement instructions
  4. Data Submission: Devices POST vitals data to the backend

ESP32 Integration

Sample ESP32 code is provided in IoT-Integration/iot_integration_with_api/

Setup Steps:

  1. Install Arduino IDE with ESP32 support
  2. Configure WiFi credentials in keys.h
  3. Set API URL in keys.h
  4. Upload code to ESP32
  5. Register device in Django admin

Integration Points

Backend:

  • backend/devices/views.py - Device API endpoints
  • backend/devices/models.py - Device and MeasurementSession models

Frontend:

  • frontend-main/src/components/HealthMonitoringStation.js - IoT device UI placeholders

See IOT_INTEGRATION.md and ESP32_SETUP_GUIDE.md for detailed integration instructions.


πŸš€ Deployment

Production Deployment

The system is designed for easy cloud deployment:

Backend (Render.com)

# Connect GitHub repository to Render
# Use render.yaml for automatic configuration
# Set environment variables in Render dashboard

Frontend (Vercel)

# Frontend-main
cd frontend-main
vercel --prod

# Frontend-unified
cd frontend-unified
vercel --prod

# Frontend-patient
cd frontend-patient
vercel --prod

Mobile App (Google Play Store)

GitHub Actions workflow automatically builds APK on push to main branch.

# Manual build
cd frontend-patient-mobile
npm run build
npx cap sync android
# Open in Android Studio and build release APK

See DEPLOYMENT_GUIDE.md and DEPLOYMENT_CHECKLIST.md for complete deployment instructions.


οΏ½ CI/CD & DevOps

Current CI/CD Implementation

Project Ashwini has implemented automated CI/CD pipelines for continuous integration and deployment:

1. GitHub Actions - Android Build Pipeline

  • Location: .github/workflows/android-build.yml
  • Purpose: Automated Android APK builds for patient mobile app
  • Triggers: Push to main/develop, pull requests, manual dispatch
  • Features:
    • Automated dependency installation
    • React app build and Capacitor sync
    • Android debug APK generation
    • Artifact upload (30-day retention)
    • Automatic PR comments with download links

Accessing APK:

  1. Go to GitHub Actions tab
  2. Select latest "Build Android APK" workflow
  3. Download from Artifacts section

2. Render.com - Backend Auto-Deploy

  • Configuration: render.yaml (Infrastructure as Code)
  • Deployment: Automatic on push to connected branch
  • Features:
    • Python 3.11 runtime
    • PostgreSQL database
    • Automatic migrations via build.sh
    • Health check monitoring
    • Zero-downtime deployments

3. Vercel - Frontend Auto-Deploy

  • Components: All 3 React frontends (Reception, Doctor, Patient portals)
  • Deployment: Automatic on git push
  • Features:
    • Preview deployments for pull requests
    • CDN distribution and edge caching
    • Automatic environment variable management
    • Instant cache invalidation

Live Deployments:

CI/CD Maturity: ~30%

βœ… Implemented:

  • Continuous Deployment for all components
  • Automated build pipelines
  • Preview environments for testing
  • Infrastructure as Code (IaC)

πŸ”„ Future Enhancements:

  • Automated testing (unit, integration, E2E)
  • Code quality checks (linting, formatting)
  • Security scanning (dependencies, vulnerabilities)
  • Staging environment setup
  • Release automation and versioning

See CI_CD.md for detailed CI/CD documentation, workflow configurations, and future enhancement plans.


οΏ½πŸ“š Documentation

Comprehensive documentation is available:

Document Description
API_DOCUMENTATION.md Complete API reference
ARCHITECTURE.md System architecture and design
DEPLOYMENT_GUIDE.md Production deployment guide
DEPLOYMENT_CHECKLIST.md Pre-deployment checklist
SECURITY_IMPROVEMENTS.md Security enhancements & rate limiting
CI_CD.md CI/CD implementation guide
IOT_INTEGRATION.md IoT device integration
ESP32_SETUP_GUIDE.md ESP32 hardware setup
RBAC.md Role-based access control
QUICKSTART.md 5-minute quick start
USER_GUIDE.md End-user documentation
SUPERUSER_GUIDE.md Admin user guide
MOBILE_APP_SUMMARY.md Mobile app overview
Ashwini_Project_Report.md Complete project report

πŸ“– Usage Guide

For Registration Staff

  1. Access Main Frontend at http://localhost:4000
  2. Login with RECEPTION or ADMIN role
  3. Click "Registration Dashboard"
  4. Fill patient details form and click "Register Patient"
  5. View patient queue in real-time
  6. Patient status starts as "waiting"

For Health Monitoring Staff

  1. Access Main Frontend at http://localhost:4000
  2. Login with NURSE or ADMIN role
  3. Click "Health Monitoring Station"
  4. Select a patient from dropdown
  5. Click "Start Health Check" if patient is waiting
  6. Enter vitals manually in the form
  7. Click "Save Measurement"
  8. Patient status updates to "examined"

For Doctors

  1. Access Unified Frontend at http://localhost:3000
  2. Login with DOCTOR or ADMIN role
  3. Use "Previous Patient" / "Next Patient" buttons to navigate
  4. Review patient information and latest vitals
  5. Add medicines to prescription
  6. Add clinical notes in "Doctor's Notes" section
  7. Set next visit date if needed
  8. Click "Mark as Completed" when finished

For Patients

Web Portal:

  1. Access Patient Portal at http://localhost:5173
  2. Register or login with patient credentials
  3. View dashboard with health overview
  4. Navigate to Measurements, Prescriptions, or Visits
  5. Update profile information

Mobile App:

  1. Install Android APK on device
  2. Login with patient credentials
  3. Access health data on-the-go
  4. View charts and historical data

See USER_GUIDE.md for detailed usage instructions.


🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

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


πŸ™ Acknowledgments

  • Django and Django REST Framework communities
  • React and Vite communities
  • Capacitor for mobile app capabilities
  • Azure AI for OCR services
  • All contributors and testers

πŸ“ž Support

For questions, issues, or support:

  • Open an issue on GitHub
  • Check documentation in the /docs folder
  • Review existing issues and discussions

Project Ashwini - Empowering Healthcare with Technology πŸ₯πŸ’™

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages