Code
Architecture

One medallion, two engines: PySpark and Python

Four source systems land as raw extracts, move through bronze, silver and gold under one orchestrator, and pass a quality gate before Power BI reads them. The core logic runs in Python notebooks and again in PySpark / Spark SQL, and a parity gate proves both produce identical tables.

Swipe the diagram sideways to see all of it.

SOURCE SYSTEMSTimesheet SaaSflat rows · blank emails for leaversthree timestamp formatsIssue trackernested JSON · opaque author keysoverlapping API pagesDirectory (Entra ID)snapshot · departments · managershire and leave datesCRMaccounts · deliverables · assignmentswho was sold whereLanding · Files/landingone JSON envelope per extract (full · incremental · snapshot) · kept as the replay archiveCopy jobs land them in production; nb_land_synthetic writes them in the demoMEDALLION · ONE RUNBronzenb_bronze_ingestappend-only · stringslineage on every rowSilver · usersnb_silver_usersSCD2 in one MERGEidentity mapSilver · worklogsnb_silver_worklogsperson-day rulereplayableGoldnb_goldstar schema · martsstable project keysQuality gatenb_quality18 checksan error fails the runPower BIwl_model · Direct Lake26 DAX measureswl_report · 4 pagesSPARK PATH · SAME LOGIC IN PYSPARK AND SPARK SQLSpark · usersnb_spark_silver_usersDelta MERGE API (SCD2)Spark · worklogsnb_spark_silver_worklogsperson-day rule, Spark SQLSpark · factnb_spark_gold_factranked matching rulesParity gatenb_parity · Python vs Sparkzero differences requiredOPERATIONSOrchestrationpl_daily (incremental) · pl_monthly_full (full)→ nb_orchestrator: one run_id, steps called by nameuser_mapping.csvtracker keys · alt emailsmaintained by a personops_run_log · ops_quality_resultsevery step and every check, per runmonitoring and trendssettings in wl_settings · secrets in Key VaultDELIVERYCI · GitHub Actionslint · item checks · end-to-end runs · Spark vs Python parityDeploy · fabric-cicdGit-format items → dev / prod workspace · parameter.yml swaps IDs
Sources and storageFabric items (deterministic)Quality and controlConsumers

Four layers, each with a contract the next one relies on.

SOURCES

Four systems, synthetic

A timesheet SaaS, an issue tracker, an Entra-shaped user directory and a CRM. They land as JSON extracts in Files/landing, the way Copy jobs would.

  • timesheets · users
  • worklogs · users
  • directory users
  • accounts · deliverables · assignments
BRONZE

Raw and append-only

One generic notebook loads every new file as strings, with lineage on every row, and records each extract in a manifest.

  • bronze_<system>_<entity> × 9
  • ops_ingested_files
SILVER

Canonical and replayable

Both time sources in one schema, rebuilt from bronze each run. User history is SCD Type 2 in one Delta MERGE; an identity map links every login to a person. Built in Python notebooks and in PySpark / Spark SQL.

  • silver_worklogs
  • silver_user_history
  • silver_user_identities
  • silver_project_registry
GOLD

Star schema for Power BI

Lean facts, conformed dimensions with unknown members, project keys that never change, and marts that feed report tiles directly. The fact attribution also runs in Spark SQL.

  • fact_worklog · fact_assignment_month
  • dim_user · dim_project · dim_deliverable · dim_date
  • mart_sold_vs_utilized · mart_coverage_month
  • mart_nonloggers · audit_unmatched_workers

A week of runs

One backfill, then a daily incremental run per day. Each step is logged to ops_run_log; all six steps succeeded every time.

Run dateModeSeconds
2026-09-30full (backfill from Jan 1)30.5
2026-10-01incremental17.3
2026-10-02incremental19.5
2026-10-03incremental16.0
2026-10-04incremental16.8
2026-10-05incremental16.8
2026-10-06incremental16.2
2026-10-07incremental17.0