Data Quality and Consistency

When systems are healthy but the data is wrong: common data-quality problems, data lineage, expected delays between systems, seven quality dimensions and the data-quality report.

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

The concept Healthy systems, wrong data

A system can be up, its APIs can answer and its queries can finish, and the business process can still be wrong, because the data being exchanged is incomplete, inconsistent, duplicated or stale.

ProblemExample at Apex
Missing valuesA required loan reference is empty
Invalid valuesA negative amount where the rules do not allow one
Duplicate recordsOne payment appears twice as two postings
Inconsistent identifiersProvider IDs do not map reliably to internal payment IDs
Wrong timestampsA local time read as UTC
Inconsistent statusesCAPTURED, COMPLETED and POSTED used as if they meant the same
Stale dataA report shows a loan balance not yet updated
Wrong relationshipsA payment linked to the wrong loan

Lineage Follow one value from source to report

Data lineage describes where a value started, how it was transformed, where it moved and where it was used. For a payment amount, ask: which system created it, was it transformed, was the currency changed, was rounding applied, where was it stored, who uses it, and can it be traced back to its source?

The lineage of one payment amount and identifier as five luggage tags. Payment provider: amount 500.00, transactionId TX1001. Integration: amount kept, TX1001 mapped to provider_txn_id, provider IDs mapped. Loan servicing: amount stored as a decimal, PM9001 linked to TX1001. Reconciliation, highlighted: amount compared, TX1001 mapping looked up, three sources matched. Reporting: daily total, counted once. Two highlights: provider B sends B/2026/1117/044 which is reshaped before it is stored, and a missing mapping row leaves one provider B payment unmatched.
At every hop, record the source field, transformation, validation and destination field.

For each hop, also record the identifiers that let you prove the path later: the event ID, the version of the transformation that ran, when it was processed, and which system and team are responsible. Without the version, you cannot tell whether a wrong value came from today's code or last month's. Here is TX1001 on November 18:

HopEvent or request IDTransformation and versionProcessed atResponsible
Payment providerEVT100None: source record TX1001, amount 500.0009:00:01Provider A
IntegrationEVT100provider-a-mapper v2.3: transactionId becomes provider_txn_id09:00:02Integration service, IT integration team
Loan servicingREQ-7101servicing-api v5.1: amount stored as a decimal with two places09:00:03Loan servicing team
ReconciliationRun R-1119-0600Matching rules v1406:00 the next dayFinance systems team
ReportingDaily batch D-1119Daily totals v307:00 the next dayReporting team

Lineage is something you can query. Join what each provider sent to the payment rows it became and to the loan they point at. Every hop that changed or lost a value shows up as a row that fails the check. Here is the six-row sample from Lesson 03, next to the four provider records it came from:

sqlFollow every provider record to its payment rows and loan

SELECT
    r.transaction_id,
    r.loan_reference AS sent_loan,
    p.payment_id,
    p.loan_id AS stored_loan,
    CASE
        WHEN p.payment_id IS NULL THEN 'no payment row'
        WHEN p.amount <> r.amount THEN 'amount changed'
        WHEN p.loan_id IS NULL THEN 'loan lost in mapping'
        WHEN l.loan_id IS NULL THEN 'loan not found'
        ELSE 'ok'
    END AS lineage_check
FROM provider_records AS r
LEFT JOIN payments AS p
    ON p.provider_id = r.provider_id
   AND p.provider_transaction_id = r.transaction_id
LEFT JOIN loans AS l
    ON l.loan_id = p.loan_id
ORDER BY r.transaction_id, p.payment_id;

Result on the sample

transaction_id  sent_loan  payment_id  stored_loan     lineage_check
--------------  ---------  ----------  -----------  --------------------
TX1001          LN500      PM9001      LN500        ok
TX1001          LN500      PM9002      LN500        ok
TX1002          LN501      PM9003      LN501        ok
TX2001          LN502      PM9004      LN502        ok
TX2001          LN502      PM9005      LN502        ok
TX2002          LN503      PM9006                   loan lost in mapping

Real output from SQLite 3.54 on a fictional sample (tools/fde/apex_lineage.sql), November 22, 2026. The payments rows are the Lesson 03 sample.

The query moves the question. PM9006 has no loan, but the provider did send LN503, and LN503 exists. So the value was lost between the provider and the payments table, in the mapping step, not at the source. The next question goes to the team that owns that mapping: which version ran for TX2002, and what did it do with the loan reference? The check also shows what it cannot see: TX2001 passes, because both of its rows are consistent with what was sent. Whether it was posted twice is a ledger question, not a lineage one.

Timing Not every difference is a defect

Systems update at different times: the provider records a payment, the integration service publishes an event, loan servicing processes it, and reporting catches up later. For a while the systems disagree even though everything works as designed. Understand the expected processing delay, data freshness requirements, eventual consistency, reconciliation windows, which system is authoritative, and the business acceptance criteria before you call a difference a bug.

Eventual consistency is acceptable only within an agreed window. At Apex, for example, the agreement might be that loan servicing reflects a payment within 15 minutes of capture, and reconciliation is complete by 6:00 a.m. the next day. A difference inside that window is expected. The same difference an hour later, or the next afternoon, is a defect. If nobody has agreed a window, that is a finding in itself: ask the business owner to set one.

Systematic checks Seven dimensions of data quality

DimensionQuestion to ask
CompletenessAre all required fields filled in?
AccuracyDoes the value represent the correct business fact?
ConsistencyDo related systems agree where they should?
UniquenessAre there duplicate logical records?
ValidityDoes the value follow the accepted rules?
TimelinessIs the information available when it is needed?
Referential integrityDoes the record link to the correct entity?

Write the results as a data-quality report: dataset name, sample period, records examined, validation rules, failed record counts, failure categories, business impact, example records with sensitive data protected, known limitations and recommended corrections.

Practice Score a sample

Practical exercise

Seven dimensions, six rows

Look again at the six-row payments sample from Lesson 03 (PM9001 to PM9006).

  1. Check it against all seven dimensions.
  2. Write one finding per problem you find, with its business impact.
Show sample findings
  • Completeness: PM9006 has no loan_id. Impact: the payment cannot be posted to any loan. The lineage query shows the provider sent LN503, so the value was lost in mapping, not at the source.
  • Uniqueness: TX2001 has two POSTED rows (PM9004 and PM9005, 28 seconds apart). That is a possible duplicate, not proof of a double posting. Check the loan servicing ledger history for LN502 and the business rules: did the balance drop twice, or is the second row a status record for the same posting? Impact if confirmed: a $450 double credit to LN502.
  • Consistency: TX1001 has AUTHORIZED and POSTED rows; confirm the business allows one row per status.
  • Timeliness and accuracy: cannot be judged from this sample alone; request settlement data and timestamps from other systems.

3 questions

Check your understanding

1. Reporting shows yesterday's balance for a loan paid this morning. Is it a defect?
2. What is data lineage?
3. A payment links to the wrong loan. Which dimension failed?
Answer every question to submit.

What you can do now

  • Recognize common data-quality problems.
  • Trace a value through its lineage.
  • Tell expected delays apart from real defects.
  • Check data against seven dimensions and write a data-quality report.