Every Firm Formats It Differently

A medium Pipeline Design interview practice problem on DataDriven. Design the pipeline on the canvas: sources, transforms, storage and checks, then get feedback on it.

Domain
Pipeline Design
Difficulty
medium
Seniority
L5

Problem

MiFID II transaction reports arrive as files from tens of thousands of regulated firms, each formatted slightly differently. The pipeline has to ingest these files, normalize them to a canonical schema, validate them against regulatory rules, and produce an immutable record that auditors can query years later. Design it end-to-end.

The regulator changed the format. Again. Handle it.

Business requirements

Worked solution and explanation

This is a file-contract check dressed up as a regulatory pipeline. Anyone can parse ten thousand CSV layouts. The skill is deciding what happens when a firm silently renames or swaps a column: do you guess, or stop that file at the door? Guess, and mis-mapped values land in the store regulators open at the start of business, and nobody finds out until an auditor does.

Step 1: Keep the original, then check structure first

Every file lands untouched in the submission audit log, which is the immutable record of what each firm actually sent. The schema validator compares columns, types and order to that firm's registered schema before anyone looks at a value. A mismatch goes to validation failures for review and never reaches the normalizer.

Step 2: Normalize, then apply regulatory rules

Files with a known structure pass through the canonical normalizer, which maps each firm's layout onto one schema. The content validator then checks the MiFID II rules on that single schema, so each rule is written once instead of once per firm. Passing rows move on.

Step 3: Return failures fast and hold the deadline

Failing rows land in validation failures with firm id, file id and the failed fields. firm feedback returns them in under an hour, so the firm can resubmit before the deadline. The orchestrator runs the chain and alerts if any firm's file is at risk of missing the overnight load.

Structure is checked against the registered schema before content. Both failure paths land in one quarantine store and return to the firm. Only validated rows reach the canonical table.
  • firm submissions (source, API)
  • orchestrator (transform, Airflow); alerting: Submission at risk vs overnight deadline
  • submission audit log (storage, object storage)
  • schema validator (quality gate, Great Expectations)
  • canonical normalizer (transform, Spark)
  • content validator (quality gate, Great Expectations)
  • validation failures (storage, object storage)
  • transaction reports canonical (storage, Iceberg); freshness: < 24h
  • firm feedback (consumer, API); freshness: < 1h
  • regulators (consumer, Metabase)
  • firm submissions -> submission audit log
  • orchestrator -> schema validator
  • submission audit log -> schema validator
  • schema validator -> canonical normalizer
  • schema validator -> validation failures
  • canonical normalizer -> content validator
  • content validator -> transaction reports canonical
  • content validator -> validation failures
  • validation failures -> firm feedback
  • transaction reports canonical -> regulators
  • Submission + raw: firm submissions, orchestrator, submission audit log
  • Validation: schema validator, canonical normalizer, content validator, validation failures
  • Canonical + consumers: transaction reports canonical, firm feedback, regulators
Infer the schema per file
The loader adapts to whatever columns arrive. A firm that swaps two decimal columns raises no error, and the values land in the wrong fields.
Registered schema as contract
Each firm has a versioned registered schema. Anything that breaks it is routed to validation failures, and a legitimate change becomes a config update a human approves.

Common follow-up questions