Purpose and scope
This is the logical data model for the receivables platform: the entities it creates, what each holds, who may see it and how long it is kept. It makes the privacy decisions in ADR-006 concrete. The system of record for customers, contracts, invoices and the ledger stays in the ERP (Enterprise Resource Planning) and billing systems; the platform keeps decisions, evidence and copies it needs to explain a match.
Core entities
| Entity | Key fields | Owner | Notes |
|---|---|---|---|
| Customer | customer_id, legal name, terms, credit limit, contacts | ERP customer master | Platform holds a reference and cached terms only |
| Contract | contract_id, price schedule, clauses, effective dates | Commercial operations | Clauses are chunked for retrieval with dates and scope |
| Invoice | invoice_id, lines, tax lines, due date, status | Billing engine and ERP | Created only by the billing engine |
| Payment | payment_id, amount, bank token, payer name, status | Bank feed | Raw bank data tokenised on arrival |
| Remittance line | payment_id, invoice reference, amount, deduction code | Document AI (artificial intelligence) | Extracted into a validated schema |
| Application | payment, invoice, amount, evidence, matched_by | Cash application | Reversible entry |
| Dispute | dispute_id, invoice, reason, evidence links, status | Collections | Evidence is a set of links, not copies |
| Credit note | credit_id, invoice, amount, reason, approver | ERP | Created only after an approval |
| Audit record | event, actor, tool, args hash, outcome, trace_id | Platform | Append-only |
Classification matrix
Four classes drive every control. Restricted data is limited to what a step needs, masked by role and kept for the shortest time.
| Data | Class | In prompts | In logs and traces | In analytics | Retention |
|---|---|---|---|---|---|
| Bank account numbers | Restricted | Never; token only | Never | Masked by role | Life of the account plus 13 months |
| Payer and customer contact names, emails | Restricted | Only when a draft needs them | Never | Masked by role | Life of the account |
| Raw remittance documents and emails | Restricted | Extracted text for the item only | Never | Pointer only | 90 days, then deleted |
| Payment history and risk scores | Confidential | Summary for the step | Aggregates only | Yes, masked ids | 7 years for finance |
| Invoices, amounts, tax lines | Confidential | Yes | Yes, no identifiers | Yes | 7 years |
| Contract clauses | Confidential | Yes, as cited clauses | Yes | Yes | Versioned, kept |
| Trace and security events | Internal | No | Yes, no content | Yes | 13 months |
A table, as built
The payments table in the silver layer shows how the model becomes columns, with sensitive columns marked and the rule or approver recorded for every match.
-- Silver layer: customer payments, with sensitive columns marked for masking
CREATE TABLE ar_prod.silver.payments (
payment_id STRING NOT NULL,
customer_id STRING, -- null until matched
received_at TIMESTAMP NOT NULL,
amount DECIMAL(14,2) NOT NULL,
currency STRING NOT NULL,
bank_account_tok STRING, -- SENSITIVE: tokenised, masked except for approved roles
payer_name STRING, -- SENSITIVE
reference STRING,
remittance_doc STRING, -- pointer to the stored document, not its text
status STRING NOT NULL, -- received | matched | partially_applied | unapplied | reversed
matched_by STRING, -- rule id, or the approver for a confirmed match
match_score DOUBLE,
idempotency_key STRING NOT NULL,
created_at TIMESTAMP NOT NULL
) USING DELTA
TBLPROPERTIES ('delta.enableChangeDataFeed' = 'true');Where data moves
| From | To | What | Control |
|---|---|---|---|
| Bank feed and mailbox | Platform | Payment lines, remittance documents | Authentication, scan, tokenise bank data |
| Platform | AI gateway and models | Only the fields a step needs | Minimise, scan, no provider retention |
| Platform | Tool gateway and ERP | Structured arguments | Scopes, approval check, audit |
| Platform | Collector | Spans, metrics and events with identifiers | Sensitive attributes dropped or hashed |
| Collector | Lakehouse | Telemetry and masked copies | Unity Catalog masks, row filters |
| Lakehouse | Evaluation and analytics | Masked cases and outcomes | Role-based access, no raw documents |
Deletion, correction and access
Find
Every record carries the customer identifier or its hash, so all copies can be found, including redacted ones.
Delete or anonymise
Raw documents and contact details are deleted. Invoices and ledger entries are kept for the legal period and anonymised after it.
Propagate
Deletion events reach the lakehouse tables, the clause index sources and the evaluation sets.
Prove
The audit record shows what was deleted, when and by whom, without the deleted content.
Retention periods are illustrative. Set them with legal counsel for each jurisdiction.
Build this for your business
This example is a receivables platform for a distributor, but the same pattern, deterministic financial rules, a governed gateway, runtime security, grounded evidence and measured quality, fits any back-office process that moves money. We can scope a pilot on your own systems.
Book a discovery call