Skip to content

amitascra/arogyapath

Repository files navigation

ArogyaPath

A comprehensive Pathology Lab Management System built on Frappe Framework

License: MIT Frappe Version Python Version Code style: ruff

πŸ“‘ Documentation Tabs


Overview

ArogyaPath is a full-featured pathology lab management system designed to streamline laboratory operations, from sample collection and testing to result reporting and billing. Built on the Frappe Framework, it provides a complete solution for managing lab workflows, inventory, quality control, and financial operations.

🎯 Key Highlights

  • 200+ Predefined Lab Tests β€” Organized by department with reference ranges
  • GST Compliance β€” Automatic CGST/SGST/IGST calculations for India
  • Complete Lab Workflow β€” From order to invoice to payment
  • Quality Control β€” QC material tracking and Westgard rules
  • Equipment Management β€” NABL-compliant calibration logging
  • Payment Integration β€” Razorpay support with Payment Request
  • Professional Reports β€” Jinja2-based lab reports with signatures and QR codes
  • Role-Based Access β€” 5 predefined roles with granular permissions

πŸ“Š Quick Stats

Metric Value
DocTypes 60+
Lab Tests 200+
Test Panels 50+
Departments 6
Roles 5
Custom Fields 40+
Scheduled Tasks 5

πŸš€ Quick Start

Installation (5 minutes)

# Clone and install
bench get-app https://github.com/yourusername/arogyapath.git
bench install-app arogyapath --site your-site.localhost

# Post-installation configuration
# 1. Create Pathology Lab
# 2. Create Lab Branch
# 3. Configure Lab Settings
# 4. Create Tax Templates (for GST)

First Lab Order (2 minutes)

1. Create Patient
2. Create Lab Order (select tests)
3. Record Sample Collection
4. Enter Lab Results
5. Generate Lab Report
6. Create Invoice
7. Process Payment

See INSTALLATION.md for detailed setup instructions.


πŸ“‹ Core Features

Lab Operations

  • Lab Orders β€” Create and track orders with multiple tests
  • Sample Collection β€” Track collection centers and workflows
  • Lab Testing β€” 200+ tests with calculated parameters
  • Lab Results β€” Advanced result entry with QC validation
  • Lab Reports β€” Professional reports with signatures and QR codes
  • Quality Control β€” QC material tracking and Westgard rules

Financial Management

  • Lab Invoice β€” GST-compliant invoicing with automatic tax calculations
  • Payment Entry β€” Integrated payment processing
  • Payment Request β€” Online payment support via Razorpay
  • Doctor Commission β€” Automatic commission calculation
  • Corporate Accounts β€” Special pricing for corporate clients
  • Discount Schemes β€” Flexible discount management

Inventory & Equipment

  • Reagent Management β€” Lot tracking with expiry alerts
  • Equipment Calibration β€” NABL-compliant calibration logging
  • Analyzer Management β€” Equipment tracking with history
  • Stock Ledger β€” Real-time inventory tracking

GST Compliance (India)

  • Automatic Tax Calculation β€” CGST/SGST/IGST based on location
  • Tax Templates β€” Pre-configured for intra-state and inter-state
  • GSTIN Validation β€” Built-in validation with state code extraction
  • Tax Invoices β€” Professional tax invoice and bill of supply formats
  • Place of Supply β€” Automatic determination based on customer location

Notifications & Alerts

  • TAT Alerts β€” Turn-around-time breach notifications
  • Expiry Alerts β€” Reagent and calibration expiry notifications
  • Critical Results β€” Automatic alerts for critical lab values
  • WhatsApp Integration β€” Send notifications via WhatsApp

For complete feature list, see FEATURES.md.


πŸ—οΈ Architecture

ArogyaPath follows a layered architecture built on Frappe Framework:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Frappe Desk (Vue.js UI)        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚    Frappe Framework (Backend)       β”‚
β”‚  - DocType Controllers              β”‚
β”‚  - Custom Scripts (JS/Python)       β”‚
β”‚  - Hooks & Event Handlers           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  ArogyaPath Application Layer       β”‚
β”‚  - Controllers (Cross-cutting)      β”‚
β”‚  - Utils (GST, GSTIN, Calcs)        β”‚
β”‚  - Seed Data (Tests, Templates)     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      Database (MariaDB)             β”‚
β”‚  - 60+ DocTypes                     β”‚
β”‚  - Child Tables & Relationships     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Modules

Module Purpose
controllers/ Cross-cutting hooks for Lab Invoice validation and GST
doctype/ 60+ DocTypes for lab operations, finance, and inventory
utils/ GST calculations, GSTIN validation, state code mapping
seed_*.py 200+ lab tests, tax templates, chart of accounts
print_format/ Tax Invoice and Lab Report Jinja2 templates
workspace/ Organized module navigation for different roles
tasks.py Scheduled jobs for TAT alerts and expiry notifications

See ARCHITECTURE.md for detailed system design.


πŸ”§ Configuration

Basic Setup (Post-Installation)

  1. Create Pathology Lab β€” Your lab entity with GSTIN
  2. Create Lab Branch β€” Physical lab locations
  3. Configure Lab Settings β€” Default TAT, critical thresholds
  4. Create Tax Templates β€” GST configuration for India
  5. Add Collection Centers β€” Sample collection locations
  6. Configure Notifications β€” Email and WhatsApp alerts

Advanced Configuration

  • Custom Test Parameters β€” Add calculated parameters
  • Reference Ranges β€” Configure by age and gender
  • Westgard Rules β€” QC validation rules
  • Report Templates β€” Custom report layouts
  • Payment Gateway β€” Razorpay integration

See INSTALLATION.md for step-by-step configuration.


πŸ“– Documentation

User Documentation

Developer Documentation

Quick Links


πŸ”Œ API Reference

Payment Entry Creation

Endpoint: arogyapath.arogyapath.doctype.lab_invoice.lab_invoice_payment.get_payment_entry

Parameters:

  • lab_invoice_name (string, required) β€” Lab Invoice document name

Response:

{
  "doctype": "Payment Entry",
  "name": "PE-2026-00001",
  "payment_type": "Receive",
  "company": "Company Name",
  "party": "PT-2026-00001",
  "party_name": "Patient Name",
  "paid_amount": 472.00,
  "received_amount": 472.00
}

Example:

frappe.call({
  method: 'arogyapath.arogyapath.doctype.lab_invoice.lab_invoice_payment.get_payment_entry',
  args: {
    lab_invoice_name: 'INV-BRANCH-2026-00009'
  },
  callback: function(r) {
    if (!r.exc) {
      frappe.set_route('Form', r.message.doctype, r.message.name);
    }
  }
});

GST Details Fetching

Endpoint: arogyapath.arogyapath.controllers.lab_invoice.get_patient_gst_details

Parameters:

  • patient (string, required) β€” Patient document name
  • pathology_lab (string, required) β€” Pathology Lab document name

Response:

{
  "customer_address": "Address-001",
  "company_address": "Address-002",
  "billing_address_gstin": "27AAAAP0267H2ZN",
  "company_gstin": "27ACDFA2150L1ZJ",
  "gst_category": "Registered Regular",
  "place_of_supply": "27-Maharashtra",
  "tax_category": "In State GST",
  "taxes_and_charges": "GST 18% Intrastate - Lab Name",
  "contact_person": "Patient Name",
  "contact_display": "Patient",
  "contact_mobile": "9560859178",
  "contact_email": "patient@example.com",
  "company_contact_person": "Lab Name"
}

GST Calculation

Function: arogyapath.arogyapath.utils.gst.compute_invoice_taxes

Parameters:

  • doc (LabInvoice) β€” Lab Invoice document

Behavior:

  • Calculates item-level CGST/SGST/IGST amounts
  • Aggregates tax totals
  • Updates invoice grand total
  • Handles tax exemptions and discounts

πŸ§ͺ Testing

Run Tests

# All tests
bench --site your-site.localhost run-tests --module arogyapath

# Specific test
bench --site your-site.localhost run-tests --module arogyapath --test test_lab_invoice

# With verbose output
bench --site your-site.localhost run-tests --module arogyapath -v

Test Coverage

  • Unit tests for utility functions (GST, GSTIN validation)
  • Integration tests for DocType workflows
  • Edge case tests for validation logic

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for:

  • Development setup
  • Code style guidelines
  • Testing procedures
  • Pull request process
  • Issue reporting guidelines

Quick Contribution Steps

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/your-feature
  3. Make changes and test: bench --site dev.localhost run-tests --module arogyapath
  4. Commit with clear message: git commit -m "feat: Add feature description"
  5. Push to fork: git push origin feature/your-feature
  6. Create Pull Request

πŸ“‹ FAQ

Installation & Setup

Q: What are the system requirements? A: Python 3.10+, MariaDB 10.3+, Node.js 14+, and Frappe v15+. See INSTALLATION.md for details.

Q: How do I install ArogyaPath? A: Use bench get-app to clone the repository, then bench install-app arogyapath. See INSTALLATION.md for step-by-step instructions.

Q: Do I need ERPNext installed? A: No, but it's recommended. ArogyaPath uses Frappe's Company and Chart of Accounts, which are available in both Frappe and ERPNext.

Q: How do I configure GST? A: Create Lab Tax Categories and Lab Tax Templates. See INSTALLATION.md for detailed configuration steps.

Features & Usage

Q: How many lab tests are included? A: 200+ predefined tests organized by department. You can add custom tests as needed.

Q: Can I customize lab tests and parameters? A: Yes, you can add custom tests and test parameters. See FEATURES.md for details.

Q: How does GST calculation work? A: ArogyaPath automatically calculates CGST/SGST for intra-state and IGST for inter-state transactions based on customer location. See FEATURES.md for details.

Q: Can I integrate with payment gateways? A: Yes, Razorpay integration is supported via the Payments app. See INSTALLATION.md for setup.

Development & Customization

Q: How do I extend ArogyaPath? A: You can create custom DocTypes, add custom fields, and write custom scripts. See CONTRIBUTING.md for development guidelines.

Q: How do I report bugs? A: Open an issue on GitHub with clear description, steps to reproduce, and expected vs actual behavior.

Q: How do I request features? A: Open a feature request issue on GitHub with use case and proposed implementation.

Q: Can I contribute code? A: Yes! See CONTRIBUTING.md for contribution guidelines.

Troubleshooting

Q: Lab tests are not appearing after installation. A: Run bench --site your-site.localhost clear-cache and refresh the browser. If still not working, check the installation logs.

Q: GSTIN validation is failing. A: Ensure the GSTIN format is correct (15 characters) and the state code is valid. Check custom fields are created properly.

Q: Payment Entry creation is failing. A: Ensure the Pathology Lab has a Company linked, and the Company has a Chart of Accounts configured.

Q: Tax templates are not showing in Lab Invoice. A: Ensure Lab Tax Categories and Lab Tax Templates are created. Clear cache and refresh browser.


πŸ“ž Support

Getting Help

  1. Check Documentation:

  2. Search Issues:

  3. Contact:


πŸ“ License

MIT License β€” See LICENSE file for details


πŸ‘¨β€πŸ’» Author

Amit Kumar


πŸ™ Acknowledgments


πŸ—ΊοΈ Roadmap

  • Mobile app for field technicians
  • Advanced analytics and dashboards
  • Integration with LIS (Laboratory Information System)
  • Multi-language support
  • Advanced report scheduling
  • Inventory forecasting
  • Barcode scanning integration
  • DICOM support for imaging

Made with ❀️ for pathology labs worldwide

About

A comprehensive Pathology Lab Management System built on Frappe Framework - Complete lab workflow, GST compliance, quality control, and financial management for India

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors