Invoicing · 08 / 26

Data Model and Classification

The logical data model of the receivables platform: entities, classification matrix, retention, data flows and deletion.

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

Core entities of the receivables platform A customer has contracts, invoices and payments. An invoice has lines and tax lines. A payment has remittance lines and is applied to invoices through application entries. A deduction or short pay opens a dispute with evidence and may produce a credit note. Collections actions and audit records tie to customers and invoices. Customer, payment and contact data carry sensitive fields. Customer account · terms · limit Contract prices · terms · clauses Invoice lines · tax · due date Credit note reason · approver Payment amount · bank token Remittance line invoice · amount · note Application invoice · amount · evidence Dispute reason · evidence · status Collections action contact · promise date Risk score factors · date Audit record who · what · when Trace event span ids · outcome has credited by lists becomes settles short pay about sensitive data knowledge operational record
Sensitive entities are shaded. Every entity carries the trace identifier, so any record can be tied to one decision.
EntityKey fieldsOwnerNotes
Customercustomer_id, legal name, terms, credit limit, contactsERP customer masterPlatform holds a reference and cached terms only
Contractcontract_id, price schedule, clauses, effective datesCommercial operationsClauses are chunked for retrieval with dates and scope
Invoiceinvoice_id, lines, tax lines, due date, statusBilling engine and ERPCreated only by the billing engine
Paymentpayment_id, amount, bank token, payer name, statusBank feedRaw bank data tokenised on arrival
Remittance linepayment_id, invoice reference, amount, deduction codeDocument AI (artificial intelligence)Extracted into a validated schema
Applicationpayment, invoice, amount, evidence, matched_byCash applicationReversible entry
Disputedispute_id, invoice, reason, evidence links, statusCollectionsEvidence is a set of links, not copies
Credit notecredit_id, invoice, amount, reason, approverERPCreated only after an approval
Audit recordevent, actor, tool, args hash, outcome, trace_idPlatformAppend-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.

DataClassIn promptsIn logs and tracesIn analyticsRetention
Bank account numbersRestrictedNever; token onlyNeverMasked by roleLife of the account plus 13 months
Payer and customer contact names, emailsRestrictedOnly when a draft needs themNeverMasked by roleLife of the account
Raw remittance documents and emailsRestrictedExtracted text for the item onlyNeverPointer only90 days, then deleted
Payment history and risk scoresConfidentialSummary for the stepAggregates onlyYes, masked ids7 years for finance
Invoices, amounts, tax linesConfidentialYesYes, no identifiersYes7 years
Contract clausesConfidentialYes, as cited clausesYesYesVersioned, kept
Trace and security eventsInternalNoYes, no contentYes13 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.

ar_prod.silver.payments
-- 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

FromToWhatControl
Bank feed and mailboxPlatformPayment lines, remittance documentsAuthentication, scan, tokenise bank data
PlatformAI gateway and modelsOnly the fields a step needsMinimise, scan, no provider retention
PlatformTool gateway and ERPStructured argumentsScopes, approval check, audit
PlatformCollectorSpans, metrics and events with identifiersSensitive attributes dropped or hashed
CollectorLakehouseTelemetry and masked copiesUnity Catalog masks, row filters
LakehouseEvaluation and analyticsMasked cases and outcomesRole-based access, no raw documents

Deletion, correction and access

  1. Find

    Every record carries the customer identifier or its hash, so all copies can be found, including redacted ones.

  2. Delete or anonymise

    Raw documents and contact details are deleted. Invoices and ledger entries are kept for the legal period and anonymised after it.

  3. Propagate

    Deletion events reach the lakehouse tables, the clause index sources and the evaluation sets.

  4. 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.

Handling a deletion request A customer contact asks for their personal data to be deleted. The privacy officer verifies the request, the platform deletes raw documents and contact details and publishes a deletion event, downstream copies are masked or removed, and an audit record shows what was done without the content. Contact Privacy officer Platform Lakehouse Evaluation sets Audit log deletion request verify identity and scope delete event, contact hash delete raw documents and contacts propagate deletion event mask or remove copies remove from evaluation sets done done audit: what, when, by whom complete confirmation; ledger records kept
Handling a deletion request

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