Municipal revenue does not arrive from one place — it arrives from everywhere. SADAD sends payment confirmations, Maken sends commercial registration data, ELM sends vehicle and licensing feeds, the Diwan sends royal-court fee schedules, Eskan sends housing-related charges, Tahsil sends collection lines, and each arrives with its own workbook format, its own key columns, and its own silent assumptions about what a "customer" is. The naive integration merges them into one table and discovers, three months later, that the same invoice exists four times under four spellings and the totals disagree with the ministry by an amount nobody can locate. The architecture that survives is stricter: every import type is tied to its issuing authority — more than forty of them — and every row that enters the ledger carries its source attribution forever, so "where did this number come from" is a field, not a forensic investigation.
The import pipeline as a contract #
- Parallel parsing with live progress and error counters per sheet — the operator watches row 12,340 fail on an invalid date while the rest stream on.
- Duplication analysis against pre-fetched indexes and the current run — duplicates counted and skipped, never written twice.
- Invalid-invoice detection: a stored invoice whose due date or amount conflicts with the incoming row is detected during matching, audited per row.
- Municipality change detection: rows whose municipality cannot be resolved are flagged separately while the geo index extends for later imports.
The reconciliation consequence is the part finance leadership cares about: because every row is attributable, the ledger's totals decompose cleanly by source authority — the SADAD total, the Tahsil total, the central-vs-internal split — and disagreement with a ministry's statement becomes a bounded search (this authority, this month, these rows) instead of an open-ended audit of everything. Deleted and non-uploaded reporting closes the last gap: central deletion sheets soft-delete invoice families traceably, and rejected rows become audit documents — a full account of what never reached the ledger, which is the number unscrupulous reconciliations always quietly drop. When the ministry asks "why does your total differ from ours," the answer is a report, not a career.