FLAGSHIP SAAS LIVE IN PRODUCTION FLASK 3 · POSTGRESQL · JHAMED AI · ANDROID APP · RAZORPAY · IST

JhaMed HMS

Comprehensive Architectural, Clinical & Technical Deep-Dive

An enterprise-grade, doctor-first Hospital & Clinic Management SaaS platform designed by CodeHype Tech Labs. Built on a secure multi-tenant architecture with 31 PostgreSQL database models, 70+ REST API endpoints, 148+ automated integration tests, role-aware JhaMed AI Assistant with 20 backend domain tools, native Android patient application, Razorpay payment gateway, dynamic slot concurrency row-locking, live sequential queue tokens, digital Rx letterhead designer, and automated staff payroll hub.

31 SQLAlchemy Models
70+ REST API Endpoints
10+ Engines & AI Copilot
148 / 148 Integration Tests Passed
Android Patient Mobile App
Razorpay Payment Gateway

1. Executive Platform Architecture & Multi-Tenant Model

JhaMed HMS is an enterprise-grade, doctor-first Hospital & Clinic Management SaaS platform designed by CodeHype Tech Labs. Built on a secure multi-tenant architecture, it provides every healthcare practitioner with an isolated, branded, and end-to-end digital practice environment while centralizing SaaS governance, subscription packaging, and security oversight under a single administrative umbrella.

High-Level Multi-Tenant Architecture JhaMed HMS Core: Flask 3 · PostgreSQL · JhaMed AI · REST API v1 · Razorpay
                                   ┌────────────────────────────────────────────────────────┐
                                   │                    JhaMed HMS Core                     │
                                   │   (Flask 3 · SQLAlchemy · PostgreSQL · REST APIs v1)   │
                                   └───────────────────────────┬────────────────────────────┘
                                                               │
                      ┌────────────────────────────────────────┼────────────────────────────────────────┐
                      │                                        │                                        │
                      ▼                                        ▼                                        ▼
     ┌─────────────────────────────────┐      ┌─────────────────────────────────┐      ┌────────────────────────────────┐
     │    Platform Administration      │      │     Multi-Tenant Doctor         │      │    Public & Patient Portals     │
     │    • Doctor Vetting & Approval  │      │     Workspaces (Isolated)       │      │    • Dedicated /dr/slug Sites   │
     │    • 10-Digit Recovery Workflow │      │     • Queue & Sequential Tokens │      │    • Native Android Mobile APK │
     │    • Granular Feature Overrides │      │     • Digital Rx & Letterheads  │      │    • Live Queue Position & Wait│
     │    • Subscription Periods (FIFO)│      │     • Multi-Session Courses     │      │    • Razorpay Online Advance    │
     │    • Contact Inquiries & Audits │      │     • Staff Attendance & Payroll│      │    • JhaMed AI Patient Copilot │
     │                                 │      │     • 30-Day Internal Team Chat │      │    • GST Invoices & PDF Rx      │
     │                                 │      │     • Pharmacy & Stock Manager  │      │                                │
     └─────────────────────────────────┘      └─────────────────────────────────┘      └─────────────────────────────────┘

Doctor-First Isolation

Each doctor operates in their own autonomous workspace with customized consultation fees, session intervals, staff roles, and branded letterhead pads.

Branded Clinic Microsites & App

Instant high-speed public clinic webpage generated under /dr/doctor-slug alongside native Android APK support for direct patient engagement.

Centralized Governance & AI

SuperAdmin controls medical council doctor vetting, multi-tier subscription billing, feature entitlement flags, 10-digit emergency recovery IDs, and JhaMed AI tools.

2. Exhaustive Role-Based Workspaces, Portals & AI Copilot

The platform enforces rigorous role boundaries across 4 core stakeholder portals and an embedded AI Assistant, each tailored with specialized workflows, interfaces, and contextual processors.

Super Admin

1. Platform Super Administrator Workspace

blueprints/admin
  • Doctor Registration & Verification Pipeline: Reviews pending doctor registrations with medical degree qualifications, state medical council registration numbers, specialization, clinic details, and address proof before activation.
  • Sequential Subscription Engine (FIFO): Immutable subscription periods with sequential start/end date queuing (DoctorSubscriptionPeriod), eliminating plan overwriting and preventing revenue leakage.
  • Emergency Recovery Identifier Governance: Generates a cryptographically randomized, unique 10-Digit Doctor Recovery Identifier upon approval. Governs doctor password recovery requests via verification audit trails.
  • Granular Subscription Packaging & Overrides: Dynamic creation and customization of subscription plans (STANDARD, PROFESSIONAL, ENTERPRISE) with doctor-level granular feature overrides.
  • Dedicated Doctor Profile Audit: Real-time operational KPI audit per clinic (Consultations, Patients, Prescriptions, Treatments, Staff, Subscription Revenue).
Doctor Workspace

2. Independent Doctor Workspace

blueprints/doctor
  • Clinical Dashboard & Operational Metrics: Real-time snapshot of today’s patient queue, completed consultations, expected wait times, active treatment courses, pending staff attendance, unread internal chat messages, and today's revenue.
  • Advanced Multi-Slot Scheduling Engine: Multi-session schedule builder (Morning & Evening clinic hours), customizable slot intervals (e.g. 15m, 20m, 30m), seat capacity limits per slot, custom date-range blocks, and holiday exceptions.
  • Sequential Live Queue Controller: Single-click queue progression (Call Next Patient, Mark With Doctor, Complete Consultation, Mark No-Show, Priority Overrides).
  • Digital Rx Generator with Smart Prefill: Fast prescription writer with structured medicine dosage grids, frequency, meal relation (Before/After Food), duration, diagnosis, and clinical advice with instant historical pre-fill.
  • Custom Prescription Letterhead Suite: Uploadable clinic header graphics, logos, footer banners, digital doctor signatures, and precise top/bottom print margins (in cm) for physical stationary printing.
  • Multi-Session Treatment Tracking & Staff Payroll: Multi-session treatment course logs, staff attendance rosters, and automated monthly salary calculations with deduction/bonus rules.
Staff Workspace

3. Clinic Staff Workspace (Receptionists, Nurses, Assistants)

blueprints/doctor
  • Role-Based Login: Staff members log in directly using credentials provisioned by the clinic doctor or from the doctor's public page.
  • 11-Key Granular Permissions Matrix: Access is strictly governed by permission toggles assigned by the doctor:
    Appointments & Assisted Booking: Calendar scheduling & walk-in registration.
    Queue & Check-In: Mark arrival, record vital signs, and issue sequential tokens.
    Patients & Prescriptions: View issued Rx PDFs and medical records.
    Billing, Attendance & Pharmacy: Collect fees, record attendance, and manage stock.
  • Daily Attendance Check-In: One-click staff check-in recording daily arrival timestamps and absence/leave logs.
  • 30-Day Internal Team Directives: View urgent doctor directives, patient preparation tasks, and room assignments in real time.
Public & Patient

4. Patient Portal & Native Android Mobile App

blueprints/user & /api/v1
  • Dedicated Doctor Webpages (/dr/doctor-slug): Professional doctor-branded public microsite containing clinic bio, timings, address map, treatment catalogs, and instant online booking.
  • Native Android Patient Application: Direct APK download and Play Store app for mobile appointment booking, real-time sequential token tracking, and PDF downloads.
  • Live Queue & Token Tracker: Real-time queue tracker showing token number, current token in consultation, patients ahead, and dynamic wait estimation.
  • Lifelong Digital Health Records: Patients can view past consultation summaries, download vector PDF prescriptions, check active treatment courses, and download GST invoices.
  • Razorpay Online Advance Payments: Secure online booking fee payment with instant receipt generation.

3. Deep-Dive Functional Engines & System Modules

The backbone of JhaMed HMS comprises 10 custom-developed domain engines designed for high concurrency, deterministic financial calculations, clinical compliance, and zero timezone drift.

⚙️ 01

Engine 1: Slot Concurrency & Capacity Controller

Concurrency protection, dynamic intervals, and real-time IST capacity filtering
services/slots.py & services/appointments.py
                          ┌─────────────────────────────────────────────────────────┐
                          │             Patient / Staff Selects Date                │
                          └────────────────────────────┬────────────────────────────┘
                                                       │
                                                       ▼
                          ┌─────────────────────────────────────────────────────────┐
                          │       Check Doctor Booking Window & Blocked Dates       │
                          └────────────────────────────┬────────────────────────────┘
                                                       │
                                                       ▼
                          ┌─────────────────────────────────────────────────────────┐
                          │          Generate Time Slots for Doctor Sessions        │
                          └────────────────────────────┬────────────────────────────┘
                                                       │
                                                       ▼
                          ┌─────────────────────────────────────────────────────────┐
                          │     Is appointment_date == get_ist_today() & Public?    │
                          └──────────────┬───────────────────────────┬─────────────┘
                                         │ YES                       │ NO
                                         ▼                           ▼
                          ┌──────────────────────────┐  ┌───────────────────────────┐
                          │ Filter slot <= IST Time  │  │ Include All Session Slots │
                          └──────────────┬───────────┘  └─────────────┬─────────────┘
                                         │                            │
                                         └─────────────┬──────────────┘
                                                       │
                                                       ▼
                          ┌────────────────────────────────────────────────────────┐
                          │    Count Active Bookings (CONFIRMED/CHECKED_IN/DOCTOR) │
                          │    Calculate: Remaining = max_patients - active_count  │
                          │    Exclude slots where Remaining <= 0                  │
                          └────────────────────────────┬───────────────────────────┘
                                                       │
                                                       ▼
                          ┌────────────────────────────────────────────────────────┐
                          │   Row-Lock on booking_day_locks (SELECT FOR UPDATE)    │
                          │   Atomically Commit New Booking with Unique Ref Code   │
                          └────────────────────────────────────────────────────────┘
1. Concurrency Row-Locks

Enforces zero double-booking race conditions during simultaneous checkout requests via explicit transaction locking on booking_day_locks.

2. Real-Time IST Slot Pruning

For today's bookings, instantly prunes past hour slots according to Asia/Kolkata current time while allowing staff overrides for late arrivals.

3. Multi-Session Capacity

Supports Morning, Afternoon, and Evening schedule sessions with independent consultation intervals (10m, 15m, 20m, 30m, 45m, 60m).

⚙️ 02

Engine 2: Sequential Live Queue & Dynamic Wait Estimation

Deterministic token allocation, priority insertion, and live public waiting telemetry
services/queue.py
Sequential Daily Token Allocation

Upon patient arrival check-in on the appointment date, the system issues an incremental, sequential queue token (Token #1, Token #2, etc.) isolated per doctor and date.

Dynamic Real-Time Wait Calculation

Live wait calculation: Estimated Wait = (Tokens Ahead of Patient) × (Doctor Session Slot Duration). Updates instantly when consultations conclude.

⚙️ 03

Engine 3: Digital Prescription & Custom Letterhead Designer

Dosage grids, smart prefill, margin calibration, and ReportLab vector PDF export
services/prescription_export.py
1. Structured Medicine Grids

Medicine name, dosage, frequency (1-0-1), food relation (Before/After Food), duration in days, diagnosis, and advice notes.

2. Smart Prefill Intelligence

Automatically fetches prior clinical notes, chronic medications, and dosage histories for returning patients to save doctor typing time.

3. Print Margin Calibration

Configurable top and bottom print margins (in cm) allowing printing directly onto physical clinic letterhead stationery or blank paper.

⚙️ 04

Engine 4: Clinical Treatment Catalog & Multi-Session Courses

Session progress tracking, procedure prep directives, and follow-up fee waivers
models.py & services/billing.py
1. Clinical Procedure Catalog

Configurable treatment items with pricing, duration, prep times, and staff directives.

2. Multi-Session Course Tracking

For procedures requiring multiple sittings (Orthodontics, Root Canals, PRP, Physiotherapy): total planned vs completed sessions counter (e.g. Session 3 of 6), date logs, and clinical observation notes.

3. Intelligent Fee & Waiver Calculator

Automatically computes consultation fees, procedure pricing, and repeat visit waivers (e.g. Free consultation if visiting within doctor-configured window).

⚙️ 05

Engine 5: 30-Day Auto-Expiring Clinic Chat & Directives

models.py & blueprints/doctor
  • Integrated Clinic Channel: Direct doctor-to-staff messaging within the application.
  • Tagged Patient Directives: Tag messages with patient token numbers (e.g. "Collect vitals for Token #4", "Prepare Room 2").
  • Targeted Broadcasts: Send messages to ALL, DOCTOR, or specific staff roles (RECEPTIONIST, NURSE, PHARMACIST).
  • Confidential 30-Day Auto-Expiry: All internal chat messages automatically expire and clear after 30 days, preventing clutter and ensuring confidentiality.
  • Real-Time Unread Counters: Injected via Flask context processors to display badge alerts in doctor and staff navigation bars.
⚙️ 06

Engine 6: Staff Management, Attendance & Automated Payroll Hub

models.py & blueprints/doctor
  • Staff Roles & Credentials: Secure staff user accounts mapped to Doctor profiles.
  • 11 Granular Access Toggles: Independent permission flags (appointments, assisted_booking, queue, billing, etc.).
  • Daily Attendance Roster: Check-in timestamp logging, status tracking (PRESENT, ABSENT, HALF_DAY, LEAVE), and remarks.
  • Automated Monthly Payroll Calculator:
    • Base Monthly Salary • Total days in month • Per-day rate calculation
    • Attendance deductions based on recorded absences and half-days
    • Bonus additions, manual adjustments, and net payable calculation
    • Payment status tracking (UNPAID → PAID with reference and method)
⚙️ 07

Engine 7: Pharmacy & Stock Inventory Management

models.py & blueprints/pharmacy
  • Drug Master Catalog: Medicine name, generic name, category (Tablet, Syrup, Injection, Ointment), manufacturer, batch number, expiry date, purchase price, and selling price.
  • Real-Time Stock Deductions: Automatic quantity deduction from inventory upon prescription dispensing.
  • Low-Stock Alerting: Real-time highlight of medicines reaching or falling below configured reorder threshold levels.
⚙️ 08

Engine 8: Razorpay Payments & Indian GST Invoicing

services/payment.py & services/billing.py
  • Razorpay Online Payments: Integrated payment gateway for booking advance fees and SaaS subscriptions.
  • Tamper-Proof Webhook Processing: Asynchronous HMAC-SHA256 signature verification endpoint (/api/v1/razorpay/webhook) ensuring zero payment drops.
  • Indian GST Billing Engine: Automatic calculation of Taxable Base, CGST, SGST, and IGST with vector PDF invoice generation via ReportLab.
  • Multi-Method Tracking: Supports ONLINE_RAZORPAY, CASH, UPI, CARD, and NETBANKING.
⚙️ 09

Engine 9: JhaMed AI Assistant & Role-Aware Copilot

services/chatbot/
  • 20 Controlled Domain Tools: AI agent executes authorized backend operations (appointment lookups, queue status, staff permission inspection, Rx lookup).
  • Strict RBAC & Tenant Isolation: Every AI query enforces doctor/clinic boundary checks and staff permission gating before tool execution.
  • Ephemeral In-Memory Privacy: Zero permanent database conversational retention with 15-minute inactivity auto-expiry protecting clinical privacy.
  • Prompt Injection Defense: System prompt hardening and strict output sanitization preventing hallucinated actions.
⚙️ 10

Engine 10: Centralized India Timezone Architecture

services/time_service.py
  • ZoneInfo Centralization: Standardized on ZoneInfo("Asia/Kolkata") (IST, UTC+5:30) across all business workflows.
  • Storage vs Presentation Fidelity: PostgreSQL timestamp columns store clean, naive UTC (TIMESTAMP WITHOUT TIME ZONE).
  • Business Calculations: Today's clinic queue, doctor metrics, slot boundaries, and staff attendance strictly evaluate get_ist_today() and get_ist_time().
  • Jinja Skew Prevention: UI templates render stored timestamps using |ist_datetime and |ist_date Jinja filters with zero timezone skew across midnight/day boundaries.

4. Subscription Plans, Feature Packaging & Mobile Tiers

JhaMed HMS offers structured subscription tiers designed for single-practitioner clinics up to multi-specialty healthcare centers, complemented by flexible mobile patient app distribution models.

STANDARD PLAN
₹999 / month
Solo Clinic Practice
  • Dedicated Clinic Page (/dr/slug)
  • Online Patient Self-Booking
  • Live Queue & Sequential Tokens
  • Assisted Walk-In Booking
  • Treatments & Procedures Catalog
  • Digital Prescriptions
  • Custom Letterheads & Margins
  • Email Notifications (Resend API)
  • SMS Text Alerts
  • 10-Digit Doctor Recovery ID
PROFESSIONAL PLAN
₹1,999 / month
Team Clinic & Multi-Role Practice
  • Everything in Standard Plan, PLUS:
  • Staff Accounts (Reception / Nurse)
  • 11 Granular Staff Permissions
  • Daily Attendance Roster Log
  • Automated Monthly Salary & Payroll
  • 30-Day Internal Team Chat & Directives
  • Pharmacy & Medicine Inventory
  • Custom Letterhead Signature Upload
  • 🎁 1 Month Free Promotional Trial
ENTERPRISE PLAN
₹4,999 / month
Complete Healthcare Facility
  • Everything in Professional, PLUS:
  • WhatsApp Alerts & Token Dispatch
  • Razorpay Online Payments & Webhooks
  • JhaMed AI Assistant (20 Domain Tools)
  • GST Tax Invoices (CGST/SGST/IGST)
  • Advanced Reports & CSV Exports
  • Priority 24/7 Platform Support
MOBILE PATIENT APPLICATION

Native Android & iOS Patient Ecosystem

🎁 6 Months Free APK for All Registered Doctors

Deliver a dedicated mobile app for your clinic where patients can book appointments, track live sequential queue tokens in real-time, and download digital prescriptions.

Option 1: Direct Android APK
₹1,000 one-time lifetime

First 6 months included free. One-time fee for direct APK download button on doctor's public microsite with auto-updates.

Option 2: Google Play Store App
₹249 / month per clinic

Official listed Android App on Google Play Store with clinic branding, push notifications, and seamless installation.

Option 3: Android + iOS Suite
₹600 / month per clinic

Full dual-platform mobile deployment on both Google Play Store and Apple App Store with unified backend sync.

5. Comprehensive Database Entity Relationship Schema (31 Models)

JhaMed HMS utilizes 31 interconnected SQLAlchemy models across 6 core architectural categories with complete foreign-key cascading and integrity constraints.

PostgreSQL / SQLAlchemy Relational Map 31 Models Active
[ users ] (id, email, password_hash, full_name, phone, login_role, is_active, created_at)
    │
    ├── 1:1 ──► [ doctors ] (id, user_id, public_slug, registration_number, consultation_fee, plan_id, recovery_identifier, letterhead_*)
    │               │
    │               ├── 1:N ──► [ doctor_subscription_periods ] (FIFO Queued Subscription Periods)
    │               ├── 1:N ──► [ doctor_features ] (Doctor Feature Overrides)
    │               ├── 1:N ──► [ doctor_schedules ] ──► 1:N ──► [ doctor_schedule_sessions ]
    │               ├── 1:N ──► [ doctor_booking_blocks ]
    │               ├── 1:N ──► [ schedule_exceptions ]
    │               ├── 1:N ──► [ doctor_treatments ]
    │               ├── 1:N ──► [ patient_treatment_courses ]
    │               ├── 1:N ──► [ pharmacy_medicines ]
    │               ├── 1:N ──► [ staff ] ──► 1:N ──► [ staff_attendances ]
    │               │                     ──► 1:N ──► [ staff_salary_payments ]
    │               ├── 1:N ──► [ clinic_messages ] (30-Day Auto-Expiring Team Chat)
    │               ├── 1:N ──► [ doctor_recovery_requests ]
    │               ├── 1:N ──► [ invoices ] ──► 1:N ──► [ invoice_items ]
    │               │                     ──► 1:N ──► [ payments ] ──► 1:N ──► [ payment_transactions ]
    │               └── 1:N ──► [ bookings ] (id, booking_reference, doctor_id, user_id, appointment_date, appointment_time, status, queue_token, total_fee)
    │                               │
    │                               ├── 1:1 ──► [ prescriptions ] ──► 1:N ──► [ prescription_medicines ]
    │                               └── 1:N ──► [ patient_vitals ] (BP, Pulse, Temperature, SpO2, Weight)
    │
    ├── 1:N ──► [ bookings ] (as Patient)
    ├── 1:N ──► [ patient_recovery_requests ]
    └── 1:1 ──► [ staff ] (as Staff Account)

[ plans ] (id, name, price, billing_interval, is_active)
    └── M:N (plan_features) ──► [ features ] (id, key, name, category, parent_key, display_order)

[ contact_messages ] (id, sender_name, sender_email, phone, organization, subject, message, is_read)
[ booking_day_locks ] (id, doctor_id, appointment_date, locked_at)

Explore 31 Core Database Entities

users Root Identity

id, email, password_hash, full_name, phone, login_role (SUPERADMIN, DOCTOR, STAFF, PATIENT), is_active, created_at

doctors 1:1 with users

id, user_id, public_slug, registration_number, specialization, consultation_fee, plan_id, recovery_identifier, letterhead_*

doctor_subscription_periods FIFO Periods

id, doctor_id, plan_id, start_date, end_date, is_active, source • Immutable queued subscription periods

doctor_features Feature Overrides

id, doctor_id, feature_id, is_enabled • Granular per-doctor feature toggle overrides

doctor_schedules 1:N with doctors

id, doctor_id, day_of_week (0-6), is_active • Parent container for weekly schedule days

doctor_schedule_sessions 1:N with schedules

id, schedule_id, session_name (Morning/Evening), start_time, end_time, slot_duration_minutes, max_patients

doctor_booking_blocks 1:N with doctors

id, doctor_id, start_date, end_date, reason • Full-date range clinic closure and holiday blocks

schedule_exceptions 1:N with doctors

id, doctor_id, exception_date, start_time, end_time, is_available • Single-day override hours

doctor_treatments 1:N with doctors

id, doctor_id, name, description, fee, prep_time_minutes, clinical_prep_directives

booking_day_locks Concurrency Lock

id, doctor_id, appointment_date, locked_at • Row-level locking for zero double-bookings

bookings Core Engine

id, booking_reference, doctor_id, user_id, appointment_date, appointment_time, status, queue_token, total_fee

prescriptions 1:1 with bookings

id, booking_id, doctor_id, user_id, diagnosis, clinical_advice, qr_token, created_at

prescription_medicines 1:N with Rx

id, prescription_id, medicine_name, dosage, frequency, timing (Before/After Food), duration_days

patient_treatment_courses Multi-Session

id, doctor_id, user_id, treatment_id, total_planned_sessions, completed_sessions, status, logs

patient_vitals Clinical Telemetry

id, booking_id, doctor_id, patient_id, blood_pressure, pulse, temperature, spo2, weight_kg

pharmacy_medicines Inventory Master

id, doctor_id, name, generic_name, category, batch_number, expiry_date, current_stock, reorder_level

staff 1:1 user / 1:N doctor

id, doctor_id, user_id, staff_role (RECEPTIONIST, NURSE), monthly_salary, permissions_json

staff_attendances Daily Log

id, staff_id, attendance_date, status (PRESENT, ABSENT, HALF_DAY, LEAVE), check_in_time, remarks

staff_salary_payments Payroll Engine

id, staff_id, month, year, base_salary, calculated_deductions, bonus, net_amount, payment_status

clinic_messages 30-Day Team Chat

id, doctor_id, sender_id, recipient_role, message, patient_token_tag, created_at, expires_at

invoices GST Billing

id, invoice_number, doctor_id, patient_id, booking_id, total_taxable, cgst, sgst, igst, total_amount

invoice_items 1:N with Invoices

id, invoice_id, item_description, item_type (CONSULTATION, PROCEDURE, MEDICINE), unit_price, quantity, tax_rate

payments Payment Ledger

id, invoice_id, amount_paid, payment_method (RAZORPAY, CASH, UPI, CARD), payment_status, paid_at

payment_transactions Razorpay Sync

id, payment_id, razorpay_order_id, razorpay_payment_id, razorpay_signature, status, raw_webhook_payload

patient_recovery_requests Patient Auth

id, user_id, phone, otp_hash, is_used, expires_at • Secure patient password recovery

plans Subscription Tier

id, name (Standard, Professional, Enterprise), price, billing_interval, is_active

features Entitlement Master

id, key, name, category, parent_key, display_order • Master feature registry

plan_features M:N Association

plan_id, feature_id • Many-to-many relationship linking plans to entitlements

doctor_recovery_requests 10-Digit ID Recovery

id, doctor_id, recovery_identifier_attempt, status (PENDING, APPROVED, REJECTED), admin_notes

contact_messages Inquiry Inbox

id, sender_name, sender_email, phone, organization, subject, message, is_read, created_at

api_tokens REST Auth

id, user_id, token_hash, device_name, is_revoked, expires_at • Mobile app bearer tokens

6. Automated Testing & Production Quality Assurance

The codebase is backed by 148 comprehensive end-to-end automated integration tests across 16 test files validating 100% of application flows against PostgreSQL.

pytest — PostgreSQL Integration Test Suite
$ pytest --verbose
platform darwin -- Python 3.13.15, pytest-8.4.2
rootdir: /JhaMed-HMS, configfile: pytest.ini
collected 148 items across 16 test suites

tests/test_hms.py .............................................                      [ 45%]
tests/test_chatbot_security.py .................                                      [ 65%]
tests/test_razorpay_payments.py ............                                          [ 80%]
tests/test_postgresql_migration.py ...........                                       [ 90%]
tests/test_timezone.py ...............                                                [100%]

================================== 148 passed in 31.40s =====================================

10 Verified Test Categories (16 Test Files)

1. Authentication & Multi-Role Security

Registration, admin vetting/approval, temporary password forced resets, and role boundary protection.

2. Doctor Practice Workspaces

Schedule creation, exception blocks, appointment management, queue progression, and lifelong EHR history.

3. Digital Prescriptions & Letterhead

Structured medicine dosage, smart prefill for returning patients, and letterhead margin rendering.

4. Treatments & Clinical Courses

Multi-session course progress logs, attendance tracking, and dynamic repeat-patient fee waiver rules.

5. Staff Attendance & Payroll

Staff login delegation, 11 permission gates, daily attendance rosters, deduction calculations, bonus adjustments, and payment disbursement.

6. JhaMed AI Assistant Security

20 controlled domain tools, prompt injection defense, RBAC permission verification, and ephemeral memory auto-wipe.

7. Razorpay Payments & GST Invoicing

Order generation, HMAC webhook signature verification, CGST/SGST calculation, and vector PDF invoice compilation.

8. Deletion Cascades & Integrity

Verified cascading deletion of clinic records, orphan cleanups, and non-destructive plan reassignments.

9. Resend HTTPS API Transport

Verified resilient error handling and non-blocking transactional email delivery.

10. IST Timezone Fidelity & Seat Availability

Validated Asia/Kolkata boundary calculations, naive UTC storage, and same-day past-slot auto-filtering.

DEPLOYED APPLICATION

Experience JhaMed HMS in Action.

JhaMed HMS is actively deployed in production. Explore the live multi-tenant doctor microsites, patient queue flows, and digital practice management live at hms.codehypetech.in.