Data Architecture and Data Modeling

The data model as business facts: the Apex entities and relationships, a logical model, traceability from source to audit, authoritative sources, and retention and privacy.

  • Intermediate to advanced
  • About 21 minutes
  • Includes an exercise and a knowledge check

The concept A data model is a set of business facts

In financial systems, the data model represents business facts and how they relate. Apex must answer: which provider reported this payment, which loan it belongs to, whether it settled and against which record, why it became an exception, who investigated it, whether the result changed, and what evidence supports the final status. If the model cannot answer these, the platform fails its users.

Start with the business Entities and relationships

Eight conceptual entities: payment transaction, settlement record, loan account, reconciliation result, exception case, audit event, provider and ingestion batch. They do not imply eight databases or eight services. The relationships: a payment is reported by one provider and belongs to one loan account; it may have several processing attempts, produces a reconciliation result and may create an exception. A settlement file contains many records. An exception may have many investigation actions. An audit event describes a change made by a user or by the system.

A logical entity relationship diagram. Provider sends many Payment Transactions; Loan Account has many Payment Transactions. Payment Transaction holds payment_id, provider_id, provider_transaction_id, loan_account_id, amount_minor_units, currency, provider_status and source_payload_ref. Each payment is evaluated one or more times, producing Reconciliation Results with match_status, rule_version and evidence. A Reconciliation Result is matched to zero or one Settlement Record and raises zero or more Exception Cases. An Ingestion Batch, one settlement file, contains many Settlement Records. Audit Events describe a change to any entity. Notation: a bar means one, a crow’s foot means many, a circle means optional.
Eight entities, one picture of the business. Entities are not services: they can live in one database.

In detail The logical data model

EntityImportant fields
Payment transactionInternal payment ID, provider ID, provider transaction ID, loan account ID, amount in minor units, currency, provider-reported status, transaction and ingestion timestamps, source payload reference
Settlement recordInternal ID, bank reference, settlement batch ID, amount in minor units, currency, settlement date, source file reference, processing status
Reconciliation resultReconciliation ID, payment ID, settlement record ID if matched, match status, matching rule version, matching evidence, created and updated timestamps
Exception caseException ID, reconciliation ID, category, severity, case status, assigned user, resolution code and timestamp
Audit eventAudit event ID, entity type and ID, actor identity, action, previous and new state references, timestamp, correlation ID

Rules that must never break Financial invariants

An invariant is a rule that must hold after every operation, whatever fails. Write them down in the architecture, and say what enforces each one, because Module 07 must implement every line and test it:

InvariantRuleEnforced by
Amount precisionAmounts are integer minor units (cents). An amount with more decimals than the currency allows is rejected, never rounded. Arithmetic overflow is an error, never a wrapped numberAdapter validation; CHECK constraint (amount greater than 0)
CurrencyUSD only in v1. Amounts in different currencies are never added or comparedValidation; CHECK constraint
One payment per provider transactionAt most one payment per (provider, provider transaction ID). Same ID with different content is refused, never overwrittenUNIQUE constraint; full SHA-256 of the normalized payload
One batch per fileA settlement file with the same content is processed once, even after a restartUNIQUE constraint on the full file SHA-256
Settlement control totalsLines read equal the trailer count, and accepted amounts plus readable rejected amounts equal the trailer total. Otherwise the batch cannot be COMPLETEDBatch validation, with the unexplained amount reported
Reconciliation uniquenessA payment is MATCHED at most once, and a settlement record is MATCHED at most oncePartial unique indexes on MATCHED results
No silent changesNothing financial is deleted or edited in place; corrections are new entries, each with an audit record in the same transactionAppend-only tables; no DELETE permission; audit written in the transaction

Explain any result Design for traceability

A photo of a wooden library card catalog with many small drawers: each card points to where the real book lives. Beside it, the traceability chain for one Apex payment as six linked cards. 1, the source record: the Provider A payload for PAY-1001, kept as received. 2, the normalized record: 42550 minor units in US dollars. 3, the reconciliation result: unmatched, with the rule version and evidence. 4, the exception case: missing settlement, assigned to a finance analyst. 5, the resolution: found under another bank reference and matched with approval. 6, the audit history: who did what, when, with the correlation ID. Do not overwrite the original.
A catalog never replaces the book. Keep the original next to the normalized copy, so any result can be explained.

A finance user must be able to follow a transaction: source record, normalized record, reconciliation result, exception case, resolution, audit history. Never overwrite original provider data with normalized values. Keep the source, or a protected, unchangeable reference to it, beside the normalized version.

Who owns each fact Data ownership

DataAuthoritative source
Provider transaction statusPayment provider
Bank settlement recordBanking system
Loan account informationLoan servicing system
Internal reconciliation statusApex reconciliation platform
Exception investigation historyApex exception management
User identityEnterprise identity provider

Apex may keep copies or derived data, but a copy must never silently become authoritative for a fact owned elsewhere.

Rules on data Retention and privacy

Financial records come with retention, access and audit rules. The architecture must identify retention periods, sensitive fields, encryption needs, data masking, access logging, deletion constraints, legal holds, and backup and recovery policies.

Practice Design the data model

Practical exercise

Exercise 04: logical data model and ownership

Produce the data architecture for Apex.

  1. A logical entity relationship diagram with keys and cardinalities.
  2. A field-level definition for the core entities.
  3. A data ownership matrix.
  4. A retention and privacy checklist.
  5. A traceability example for one payment.
Show a sample traceability example
  • Source: Provider A payload for PAY-1001, stored unchanged in protected object storage, referenced by source_payload_ref.
  • Normalized: sourceSystem PROVIDER_A, amountMinorUnits 42550, currency USD.
  • Result: UNMATCHED under rule version 1, evidence: no settlement with this reference after the agreed window.
  • Exception and resolution: missing settlement; an analyst finds it under another bank reference; a supervisor approves the manual match.
  • Audit: each step recorded with actor, time and correlation ID.

3 questions

Check your understanding

1. Why keep the original provider payload after normalizing it?
2. Eight entities in the model means how many databases?
3. Who should set the retention period for payment records?
Answer every question to submit.

What you can do now

  • Model business entities, relationships and core fields.
  • Design end-to-end traceability that keeps the original.
  • Write a data ownership matrix.
  • List retention and privacy questions for the customer.