Product EngineeringFeaturesOrder SplitBackend

Scope and Gaps

Confirmed implementation decisions, out-of-scope areas for V1, and known backend gaps.

๐Ÿ‘ค Sachin Sharma๐Ÿ“… Updated: May 2, 2026๐Ÿท๏ธ feature๐Ÿท๏ธ backend๐Ÿท๏ธ scope๐Ÿท๏ธ decisions

Repository (crelio-app)

FilePurpose
finance/views/bill_split.pyView layer โ€” request validation, mode routing, and response construction
finance/views/bill_split_manager.pyManager โ€” all business logic, DB operations, and post-commit side effects
finance/urls/__init__.pyURL registration for POST /api-v3/finance/bill/split/{bill_id}
admin/account/models/lab_settings.pyenable_bill_split field definition
admin/account/migrations/0110_labsettings_enable_bill_split.pyMigration adding the field
admin/account/views/account_configuration_constant.pyAdmin panel config entry for the flag

Scope boundaries


Confirmed decisions

Traceability

  • No parent-child mapping table is created. The ActivityLog with log_context = BILL_SPLIT is the authoritative audit trail.
  • orderNumber on the split bill is derived from the parent by appending ~{step} โ€” providing lineage without a dedicated linking table.

Data handling decisions

  • Smart report attachments are soft-deleted on the parent; users can regenerate reports as needed.
  • Bill approval, unresolved missing details, and symptoms relations are cloned โ€” not shared โ€” to keep each bill independently actionable.
  • AOE and patient consent records are migrated in the same atomic transaction as the split.
  • LabForm (consent type) is handled: a new LabForm record is cloned for the split bill. Revoked forms are excluded.
  • LabForm (AOE config type) is not handled: the form config structure stays on the parent. Only QuestionValue responses are migrated.

Source and amount behavior

  • Destination source defaults to Org Pay; Self Pay is the other option. Both are non-insurance sources.
  • For non-insurance destination, insurance-specific payable fields (co_pay_amount, deductible_amount, patientPayableAmount) are reset to 0 on both the split bill and moved BillingInfo rows.

Feature flag

  • The enable_bill_split field on LabSettings must be True for the feature to be accessible.
  • Added via migration 0110_labsettings_enable_bill_split.
  • Configurable in the admin panel under Workflow Configurations โ†’ Enable Bill Splitting.

Out of scope (V1)

  • Splitting paid or settled bills.
  • Splitting into more than two bills.
  • Merge or reverse-split flows.
  • Claim-linked split variants beyond existing allowed checks.
  • Home collection, appointment, and kit-centric split workflows.
  • Full advanced batch/rack scenarios beyond current validated coverage.
  • AOE Promotion and Store process types (left on parent bill, not migrated).
  • LabForm AOE config records โ€” only QuestionValue responses are migrated, not the form config.
  • prescriptions, TestClinicalInfo, BillClassifierTags โ€” not migrated; no planned V1 support.

On this page