Collections Management System — Real-Time, Event-Driven Collections Platform on Foundry
Replaced a legacy Oracle BRM batch collections engine with an end-to-end Foundry platform — moving eligibility evaluation from a daily batch cycle to event-driven, near-real-time triggers while preserving full idempotency and auditability across every state transition.
Overview
problem → platformThe legacy collections engine ran as a nightly Oracle BRM batch job. Accounts that crossed eligibility thresholds overnight waited until the next batch window before any collection record or action existed — a 24-hour time-to-action that left delinquency unmanaged for a full business day.
The Foundry platform reverses that model. Source changes land through CDC and batch merges, materialise into a governed ontology, and fire Automate property-change monitors that invoke TypeScript Ontology Functions. Eligibility is re-evaluated as soon as bill-unit or bill-summary properties change. A daily sweep covers the edge case of bills that become past due overnight without any object mutation.
Two design decisions shape the whole system. First, transform-backed objects stay read-only mirrors of source truth, while action-managed objects own platform lifecycle state — so source refreshes never clobber in-flight collections. Second, every create and transition path is idempotent: existence checks for active and paused records run before creation, so parallel Automate triggers cannot double-open a collection.
Ingestion — CDC & Batch
six Oracle BRM tablesSource of truth remains Oracle BRM. Foundry does not become a second ledger — it becomes the operational brain that reacts to ledger state. Six BRM tables feed the platform through a dual-path ingest: continuous CDC for low-latency deltas, and scheduled batch snapshots for catch-up and recovery.
Merge contract
CDC winsLEFT ANTI JOIN merge with timestamp-based deduplication
Transforms & Analytics
Python · PySpark · SQLMulti-table PySpark pipelines turn merged BRM tables into ontology-ready datasets. Derived analytics columns — days overdue, ageing bucket, days to close — are computed once in transforms so every downstream function and monitor reads the same numbers.
Key transform chains
pipelinesOntology Model
eight object typesThe ontology is the system of record for collections operations. Transform-backed objects mirror BRM truth and stay read-only. Action-managed objects own lifecycle state that only Ontology Functions may edit — protecting in-flight work from source refreshes.
Object catalogue
8 typesDual State Machine
records · actions · cascadesCollections is not a single status field. It is two coordinated state machines — one for the collection record, one for each collection action — with cascading side effects when either machine exits.
Collection Record
Record exit triggers bulk action cancellation, orphan closure, and linked promise-to-pay / dispute resolution in one atomic Ontology transaction.
Collection Action
Sequential gate logic enforces step-order promotion — an action cannot advance until its predecessor reaches a valid terminal state (completed, cancelled, or historical).
Cascading exit
atomicityEligibility Rules Engine
profiles · filters · thresholdsEligibility is data-driven, not hard-coded. Collection profiles are editable object types supporting per-segment and per-currency escalation paths. The engine evaluates five static filters plus an aggregation threshold against 962 profile-action mappings.
Evaluation model
real-timeTypeScript Ontology Functions
15+ production functionsOntology Functions are the only writers of action-managed state. They encapsulate eligibility, creation, scheduling, external dispatch, and CSR overrides — each designed for idempotent, concurrent-safe execution.
Function catalogue (representative)
TypeScript v1Automate Orchestration
11 monitors · zero manual standard pathAutomate is the event bus. Property-change monitors catch live mutations; entered-set and scheduled monitors cover lifecycle progression and the overnight past-due edge case.
Real-time entry (3)
triggersLifecycle monitors (8)
automationIntegrations
Mailgun · CSR · auditExternal email delivery
MailgunOperator controls
CSR overridesParallel-Run Migration
safe cutover · rollback readyCutover did not flip a single switch. Legacy batch and real-time monitors ran in parallel so outcomes could be compared before retiring the batch path.
Cutover strategy
risk controlProduction Outcomes
first sweep · steady stateEnvironment
stackDesign Invariants
what must never breakThese are the rules the architecture is built to defend. If a change violates one of them, it is not a feature — it is a regression.