Finance Billing
Revenue Cycle & Financial Engine Specifications
Financial Architecture Guardrail
This document designs the ledger framework for the HMIS, enforcing multi-payer transaction splits, atomic billing states, and real-time reconciliation with SHA and M-Pesa.
1. Payer Architecture & Multi-Channel Routing
The Level 4 facility handles three primary financial intake channels: Cash/Mobile Money, the Social Health Authority (SHA), and Private Corporate Insurers. The financial engine tracks liability at the individual line-item level, allowing split billing within a single encounter.
2. Double-Entry Ledger & Database Schema Design
To prevent arbitrary data manipulation and ensure transaction integrity, the billing architecture uses an append-only, double-entry bookkeeping design.
2.1 Core Billing Database Schema
3. Financial Edge Cases & Exception Workflows
3.1 Partial Payments & Item Discharges
When a patient lacks the funds to settle a comprehensive bill, the system locks downstream fulfillment steps until the balance is cleared or an administrative waiver is applied:
3.2 Credit-Based Care and Corporate Guarantors
For authorized organizations (e.g., corporate partners, agricultural firms, county staff insurance schemes), the system allows account-based credit loops:
- The system checks the corporate client's credit limit before allowing credit selections:
lock:credit:corporate_id. - Transactions generate an authorized invoice token linked directly to the parent account.
If a credit limit is breached, the system locks further requests and displays a balance notice to the user.
4. Payment Gateway Integrations
4.1 M-Pesa Express C2B (STK Push) Engine
The system integrates directly with Safaricom's Daraja API to provide an automated checkout workflow at payment terminals.
4.2 SHA Claim Transmission Engine
Claims for the Primary Healthcare Fund (PHF) and Social Health Insurance Fund (SHIF) are compiled automatically from clinical documentation data structures:
5. Automated Reconciliation & Audit Logs
To prevent internal fraud, modifications to any financial record or ledger item status generate an entry in an immutable audit ledger:
Document Verification Block
Target Scope: Level 4 Hospital Production Infrastructure