Morrow CreekData Services
← Morrow Creek Data Journal

How to Document Data Transformations So Analysis Can Be Reproduced

Morrow Creek Data ServicesMorrow Creek Data Journal

A final dataset shows what the data looks like now. It rarely explains how it got that way.

A standardized region column does not reveal whether “N.E.,” “Northeast,” and “NE” were treated as equivalent. A total does not show which incomplete records were excluded. A calculated metric does not explain how zero denominators were handled.

When those decisions exist only in someone’s memory, an old message, or overwritten spreadsheet cells, the analysis becomes difficult to reproduce or review.

The practical answer is to document each consequential transformation as a handoff from one named dataset version to the next. Do not settle for a note that says, “cleaned the file.” Record what entered the step, what changed, why it changed, and what came out.

Treat each transformation as a record

A transformation record describes one meaningful data change. It links the exact version that entered the step to the version that came out.

This reflects the practical idea behind [W3C PROV](https://www.w3.org/TR/prov-overview/): connect data entities, the activities that changed them, and the people or teams responsible. It does not require a specialized lineage platform.

A controlled spreadsheet tab, README, data catalog entry, query comment, or pipeline record can work. Consistency matters more than the tool.

For each consequential step, capture:

  • Step ID and date: Use a label such as T-07 so later discussions can identify the change.
  • Named input: Record the source extract, snapshot date, revision ID, or another stable reference. “Latest export” is not a reliable version.
  • Named output: Identify the resulting file, table, or dataset revision.
  • Purpose: State the business or analytical reason for the change.
  • Scope: Name the fields and records affected.
  • Rule: Write the formula, filter condition, mapping rule, or selection criteria.
  • Tool and revision: Record the relevant workbook, query, script, mapping table, software, or package version when it could affect the result.
  • Owner: Identify the responsible person or team.
  • Validation: State what was checked and what the check found.
  • Limitations: Preserve unresolved exceptions, assumptions, and known gaps.

Document meaningful transformations rather than every cosmetic formatting action. Teams should define what is consequential based on the analysis and the decisions it supports.

Put the rationale beside the rule

Mechanics alone are not enough. A useful record also explains why the chosen rule fit the analysis.

Consider blank revenue values. An analyst might exclude them from an average, preserve them as unknown, or convert them to zero. Each choice answers a different question and may change the result.

A reproducible note would say: “Excluded blank revenue from the average because source-system blanks mean revenue was not reported, rather than zero.” That is clearer than “handled missing values.”

The same principle applies to filters, joins, recoding, deduplication, and calculated metrics. A reviewer should not have to infer a decision from the final numbers.

Write rules that another person can apply

Compare a weak note with a stronger record.

> Normalized regions.

> Mapped source_region using region_map_v3. Labels “N.E.,” “Northeast,” and “NE” were recoded as “Northeast.” Unrecognized labels remained unchanged and were flagged for review. Input and output row counts were equal. Regional sales totals were unchanged after recoding.

The second version identifies the mapping table, rule, treatment of exceptions, and validation result. Another analyst can repeat those checks.

A deduplication record should name the matching fields and survival rule. For example: “Removed 14 exact duplicate rows using source_record_id; retained the earliest ingestion timestamp; saved removed rows to an exceptions tab.”

A calculated-field record should state both the formula and the handling of exceptional values. Gross margin percentage might be defined as:

(recognized revenue − cost of goods sold) / recognized revenue

The record could specify that the formula applies only when recognized revenue is greater than zero. Other records would remain in the output with a blank margin and a not calculated status.

Make validation part of each step

Documentation should say how the team checked that a transformation behaved as intended.

Useful checks include:

  • Row counts before and after a filter
  • Null counts after parsing or recoding
  • Uniqueness tests before and after a join
  • Reconciliation of totals to a source extract
  • Review of a targeted sample
  • Counts of records written to an exceptions file

If a step reduces 12,483 rows to 12,469, record why the 14-row reduction was expected. Also state where the removed records can be reviewed.

Joins need particular care. Record the join key, any preprocessing applied to it, the expected match rate, and the handling of records without a corresponding key. Duplicate-key records and exceptions should not disappear without explanation.

Document manual corrections

Manual corrections are sometimes necessary. They should not become invisible because they happened in a spreadsheet.

Record the selection criteria, before-and-after values, reason, file version, and reviewer when applicable. A separate correction table can provide a compact record without relying on overwritten cells.

For example: “Step T-12 corrected seven product-category values listed in the vendor correction notice dated August 18. Before-and-after values are retained in category_corrections_v1. No rows were added or removed.”

Preserve referenceable inputs and outputs

Keep source extracts and consequential intermediate outputs when feasible. This allows a team to investigate processing problems or rerun a downstream step without starting from an opaque final file.

Not every input can be shared broadly. Personal, contractual, proprietary, or security restrictions may require controlled access. In those cases, record a secure internal reference, snapshot date, permissions, and enough metadata for an authorized colleague to locate the source.

A timestamp alone may not identify a version. Use a file revision, immutable snapshot identifier, content hash, or documented export criteria when needed.

Use the colleague test

Ask a direct question before treating an analysis-ready table as complete: could a competent colleague rebuild it using the named inputs, transformation records, and permitted tools, without guessing at hidden choices?

Exact reproduction may not always be possible. A source may change, access may expire, or software behavior may differ across environments. Good documentation makes the original method inspectable and helps explain justified differences in a later run.

Document the change when it happens. Connect it to the dataset versions on either side, then record the rule, rationale, exceptions, and validation. The result is an analysis-ready dataset whose history can be traced and tested.

Have a dataset that needs to become usable?

Morrow Creek Data Services handles paid research, cleanup, verification, and structured delivery projects.

Start a data project