CODE WORKSPACE

Partner feed reconciliation

Compare warehouse records with an external partner feed and return a clear reconciliation report for matches, mismatches, and missing rows.

Build keyed lookups first, then compare fields through a small helper so mismatch rules stay easy to explain.

Sample input

warehouse rows

Internal truth set keyed by partner order id.

[
  {
    "partner_order_id": "po-1001",
    "amount": 42.5,
    "status": "paid"
  },
  {
    "partner_order_id": "po-1002",
    "amount": 84.5,
    "status": "paid"
  },
  {
    "partner_order_id": "po-1004",
    "amount": 19,
    "status": "refunded"
  }
]

partner rows

External feed with mismatches and partner-only records.

[
  {
    "partner_order_id": "po-1001",
    "amount": 42.5,
    "status": "paid"
  },
  {
    "partner_order_id": "po-1002",
    "amount": 86,
    "status": "paid"
  },
  {
    "partner_order_id": "po-1005",
    "amount": 11,
    "status": "paid"
  }
]

Expected output

expected report shape

{
  "matches": [
    "po-1001"
  ],
  "mismatches": [
    {
      "partner_order_id": "po-1002",
      "field": "amount",
      "warehouse": 84.5,
      "partner": 86
    }
  ],
  "missing": [
    {
      "partner_order_id": "po-1005",
      "source": "partner_only"
    }
  ]
}

Constraints

Use partner_order_id as the comparison key, keep field-level mismatches explicit, and separate partner-only records from warehouse-only records.

Expected skills

Dictionary indexing, diffing nested data, exception grouping, and returning review-friendly data structures.

Python
Loading...

AI evaluation

Run the transform to inspect normalized rows and error summaries.