Multi-branch dental practices, optometry and eyewear retail chains, dermatology clinics, and physiotherapy centers operate on a hybrid clinical-plus-retail business model that standard Hospital Management Information Systems (HMIS) simply cannot handle. A general hospital EHR is built for ward beds, vital signs, and tablet prescriptions—it has no concept of an interactive 32-tooth FDI/Universal Odontogram, a multi-stage root-canal or orthodontic installment plan, or an Optical Rx Prescription Matrix (SPH, CYL, AXIS, ADD, PD) tied to a barcode-tracked showroom designer frame and a central lens-surfacing workshop job card.
We engineer custom Dental Chain, Optical Retail & Specialist Outpatient Practice Management ERPs in Python, Django, React, and PostgreSQL that unify visual clinical charting, showroom frame and contact-lens POS, central laboratory/workshop fabrication tracking, automated insurance dental/optical benefit sub-limit verification, and automated per-procedure doctor revenue-share splits.
1. Why Generic Hospital EHRs & Retail POS Fail Dental and Optical Chains
Attempting to run a 5-to-30 branch dental or optical group by duct-taping a generic outpatient EHR to a retail POS creates four costly operational breakdowns:
- No Tooth-Surface or Eye-Specific Clinical Charting: Dentists cannot record existing restorations, caries, periodontal pocket depths, or planned crowns per tooth number (
FDI 11–48) and surface (Mesial, Occlusal, Distal, Buccal, Lingual / MODBL) inside a text box. Similarly, optometrists need structured refraction grids for Right Eye (OD) and Left Eye (OS) distance/near vision, Keratometry, and Intraocular Pressure (IOP) that automatically validate lens blank compatibility. - Showroom Frame Pilferage & Unlinked Lens Lab Work Orders: In an optical store displaying 1,200 high-value frames (Ray-Ban, Oakley, Tom Ford, silhouette), sales staff help patients select a frame, pair it with progressive photochromic high-index (
1.67) anti-glare lenses, and send the order to the central glazing/edging workshop. Without a unified Rx Job Card that locks the showroom frame serial, lens blank lot, and workshop breakage log, branches suffer chronic frame shrinkage and misground lenses. - Rejected Dental & Optical Insurance Claims (Sub-Limit Blindness): Corporate medical insurers (Jubilee, AAR, Britam, Old Mutual, Madison, APA, Smart, Livia/MTIBA) enforce strict family/individual Dental and Optical Sub-Limits, 2-year frame replacement cooldown rules, and mandatory pre-authorization for crowns, root canals, and progressive lenses. Submitting claims without upfront pre-auth token locking leads to 20%+ claim rejections.
- Complex Associate Doctor & Optometrist Commission Calculations: Specialist dental and optical clinics compensate associate dentists, orthodontists, maxillofacial surgeons, and optometrists via tiered revenue-share models—for example, 40% of net procedure revenue after deducting external dental lab prosthetic costs (crowns, aligners, dentures) and consumables, paid only once the insurer or patient settles the invoice.
2. Unified Specialist Clinic, Showroom POS & Lab Workshop Architecture
Our architecture connects the clinical chair/refraction room, the retail optical/dental front desk, the central dental/glazing laboratory, and the insurance billing engine in one seamless workflow:
A. Interactive SVG Odontogram & Multi-Visit Treatment Plan Engine
For dental practices, our chairside tablet and desktop interface renders a vector Adult (32-tooth) and Pediatric (20-tooth) FDI/Universal Odontogram. When the dentist clicks Tooth #36 and selects the Mesial-Occlusal-Distal (MOD) surfaces to plan a composite restoration or zirconia crown:
- The tooth surface updates visually (color-coded by status: Pre-Existing, Diagnosed/Planned, In-Progress, Completed) and attaches digital intraoral photos and DICOM/periapical X-ray snapshots directly to Tooth
#36. - The system automatically generates a multi-visit Clinical & Financial Treatment Plan (e.g., Visit 1: Access & Pulp Extirpation; Visit 2: Biomechanical Preparation & Obturation; Visit 3: Crown Prep & Impression; Visit 4: Crown Cementation), allowing the patient or insurer to approve the entire plan or stage-by-stage payments.
B. Optical Rx Validation, Frame Reservation & Doctor Net-of-Lab Commission Engine
Below is the core Python/Django service that validates an optometrist's OD/OS lens prescription, reserves the physical frame SKU at the branch showroom, dispatches a barcode-tracked glazing work order to the central optical lab, and computes the specialist doctor's net commission after deducting laboratory fabrication costs:
# Python / Django: Optical Rx Validation, Lab Work Order & Net-of-Lab Doctor Commission Engine
from decimal import Decimal, ROUND_HALF_UP
from django.db import transaction
from django.core.exceptions import ValidationError
class SpecialistClinicOrderService:
@staticmethod
def validate_optical_rx_eye(eye_label: str, sph: Decimal, cyl: Decimal, axis: int | None):
if cyl != Decimal("0.00") and (axis is None or not (1 <= axis <= 180)):
raise ValidationError(
f"RX VALIDATION ERROR ({eye_label}): Cylinder power ({cyl}) requires an Axis between 1° and 180°."
)
if abs(sph) > Decimal("25.00") or abs(cyl) > Decimal("10.00"):
raise ValidationError(f"RX OUT OF BOUNDS ({eye_label}): Verify sphere/cylinder diopter values.")
@classmethod
@transaction.atomic
def create_optical_dispensing_and_commission_record(
cls,
consultation_id: int,
frame_sku_id: int,
lens_package_id: int,
rx_data: dict,
insurance_approved_amount: Decimal,
patient_copay_paid: Decimal,
) -> dict:
# 1. Validate Right Eye (OD) and Left Eye (OS) optical parameters
cls.validate_optical_rx_eye("OD (Right)", rx_data["od_sph"], rx_data["od_cyl"], rx_data.get("od_axis"))
cls.validate_optical_rx_eye("OS (Left)", rx_data["os_sph"], rx_data["os_cyl"], rx_data.get("os_axis"))
# 2. Lock and deduct showroom frame stock at the branch
frame_stock = BranchFrameInventory.objects.select_for_update().get(sku_id=frame_sku_id)
if frame_stock.qty_on_display < 1:
raise ValidationError("Selected frame SKU is out of stock at this branch showroom.")
frame_stock.qty_on_display -= 1
frame_stock.save(update_fields=["qty_on_display"])
# 3. Create Central Glazing / Surfacing Workshop Job Card
lab_job = OpticalLabJobCard.objects.create(
consultation_id=consultation_id,
frame_sku_id=frame_sku_id,
lens_package_id=lens_package_id,
rx_payload=rx_data,
status="QUEUED_AT_CENTRAL_LAB",
)
# 4. Compute Associate Doctor / Optometrist Commission (Net of Lab Cost & Frame Landed Cost)
gross_collected = insurance_approved_amount + patient_copay_paid
direct_lab_and_material_cost = frame_stock.landed_cost_kes + lab_job.lens_package.internal_lab_cost_kes
net_commissionable_margin = max(Decimal("0.00"), gross_collected - direct_lab_and_material_cost)
doctor_rate = lab_job.consultation.specialist.revenue_share_rate # e.g., Decimal("0.35")
doctor_commission = (net_commissionable_margin * doctor_rate).quantize(
Decimal("0.01"), rounding=ROUND_HALF_UP
)
SpecialistCommissionLedger.objects.create(
specialist=lab_job.consultation.specialist,
lab_job=lab_job,
gross_revenue_kes=gross_collected,
deducted_lab_material_cost_kes=direct_lab_and_material_cost,
net_margin_kes=net_commissionable_margin,
commission_earned_kes=doctor_commission,
payout_status="PENDING_CLAIM_SETTLEMENT" if insurance_approved_amount > 0 else "READY_FOR_PAYROLL",
)
return {
"lab_job_number": lab_job.job_number,
"net_commissionable_margin_kes": str(net_commissionable_margin),
"specialist_commission_kes": str(doctor_commission),
}
C. Automated Patient Recall Engine (6-Month Dental Scaling & 12/24-Month Optical Renewal)
The highest-margin patient in a dental or optical chain is a returning patient whose annual insurance benefit has just reset. Our CRM & Recall Engine tracks every patient's insurance policy anniversary date, last dental prophylaxis (scaling & polishing) date, orthodontic wire-adjustment schedule, and 1-to-2 year optical frame replacement eligibility—automatically sending personalized WhatsApp appointment booking links when their benefit renews.
3. Build vs. Generic Hospital HMIS & Off-the-Shelf SaaS Comparison
| Capability | Generic Hospital HMIS | Per-Chair Cloud Dental/Optical SaaS | Custom Dental & Optical Chain ERP |
|---|---|---|---|
| Visual Clinical Charting | Plain text consultation notes | Good charting, disconnected from local billing | Interactive SVG Odontogram + Optometry Rx Grid |
| Central Lens / Dental Lab Tracking | None | Manual external PDF forms | Barcode Lab Job Cards, breakage logs & branch dispatch |
| Local Insurance & eTIMS Billing | Basic inpatient/outpatient claims | No Smart/MTIBA/SHIF or KRA eTIMS integration | Dental/Optical sub-limit lock, split co-pay & eTIMS |
| Doctor Revenue-Share Payroll | Simple flat fee per consultation | Basic gross percentage only | Net-of-lab-cost & cash-collected commission engine |
4. Development Timeline & Cost Guide
- Phase 1: Multi-Branch Appointment Scheduling, Interactive Odontogram & Refraction EHR (Weeks 1–5): Chair/room calendar management, visual tooth-surface charting, optometry refraction grids, and DICOM/image attachments.
- Phase 2: Showroom Frame POS, Central Lab Job Cards & Inventory Control (Weeks 6–9): Barcode frame display tracking, lens blank stock matrix, central workshop surfacing/glazing queue, and orthodontic installment billing.
- Phase 3: Insurance Sub-Limit Pre-Auth, eTIMS Split-Invoicing & Doctor Commissions (Weeks 10–12): Corporate insurer benefit integration, automated net-of-lab specialist commission statements, and WhatsApp recall campaigns.
5. Frequently Asked Questions (FAQ)
How does the system handle a transaction where insurance covers KES 15,000 of a pair of glasses or crown and the patient tops up KES 8,500 via M-Pesa?
Our split-billing POS handles multi-payer invoices natively: it locks the KES 15,000 insurance pre-authorization code to the corporate insurer's AR sub-ledger, triggers an M-Pesa STK Push for the KES 8,500 patient co-pay/top-up, and transmits a single compliant KRA eTIMS receipt before releasing the lab job card.
Can we track rework and lens breakage inside our central optical surfacing lab?
Yes. Every lens blank issued to a surfacing/edging technician is scanned against the Rx Job Card. If a technician spoils a progressive lens blank during edging, they must log a barcoded Breakage Reason Code to draw a replacement blank, giving management live visibility into lab wastage by technician and machine.
Does the system withhold doctor commissions on insurance procedures until the insurance company actually pays?
You can configure commission release rules per doctor contract: pay immediately upon procedure completion, pay 50% on completion and 50% on insurer settlement, or release 100% automatically the moment the insurance remittance advice reconciles against that claim.
For related production architectures and system implementations, explore these companion guides:
- Multi-Tenant SaaS Architecture, PostgreSQL RLS & White-Labeling — Isolate multi-clinic patient health records and franchise branch ledgers with PostgreSQL Row-Level Security.
- Private Waste Management, Skip-Bin & Biomedical Manifest ERP — Track regulated yellow/red clinical and sharps waste manifests from outpatient dental and surgical clinics to incineration.
- Diagnostic Laboratory (LIMS), HL7 Analyzer & Barcode Tracking — Connect specialist outpatient clinics with central pathology, DICOM imaging, and optical/dental fabrication labs.
- Scalable Python & Django Systems Engineering — Explore our production engineering deliverables, or benchmark your stack with the interactive Celery & Redis Worker Capacity Planner.