Crime Dashboard Data Pipeline

In short

Background
A crime dashboard is only as good as its map layers. The previous job deleted and re-uploaded a layer whenever its row count changed, and skipped it when the count stayed the same, even if rows had changed. It also reported layers as published when rows were missing.
My contribution
I built the SQL Server views that feed the dashboard and the Python pipeline that keeps its ArcGIS Online layers in sync with them, and I designed the dashboard itself.
Result
The pipeline has run in production since October 2026. It sends only the rows that changed and reads every layer back to confirm it matches. It fills in missing locations from the city's own address data, and emails only when something couldn't be published.

Why it matters

People read the dashboard as the current state of the records. If a refresh drops rows, duplicates them, or quietly stops, the map is wrong and nobody notices. Records without coordinates don't appear on the map at all.

My contribution

I built the whole path from the database to the map:

  • the SQL Server views that shape the records for each layer;
  • reading and cleaning the data;
  • geocoding records without coordinates;
  • comparing them with the hosted layers;
  • applying and checking the changes;
  • handling schema changes;
  • alerting on failures.

I also designed and implemented the dashboard below on the layers the pipeline maintains.

How an update works

Find the changes. Every row gets a fingerprint of its contents. Comparing fingerprints, and how many copies of each there are, shows exactly which rows to add and delete. Legitimate duplicate records are kept.

Apply and verify. Only those additions and deletions are sent. The job then reads the layer back and repairs any gap or extra copy once. If the layer still differs, the job marks that view failed and sends an email.

Fill in locations. Records without coordinates first go to a locator the job builds from the city's own address points and streets, then to the city's address server. Answers are cached, so each address is looked up once. Addresses that can't be placed are listed for review instead of getting a guessed point.

Protect public data. Public layers only use the locations the source supplies. Geocoded points never reach a public layer.

Problems found in production

Duplicate rows. The GIS library quietly resent edit requests that timed out, which added the same rows twice. The pipeline switches those resends off and treats an unclear answer as unknown. It then re-reads the layer to see what was actually stored.

Stale reads. ArcGIS Online caches public layers' query results for 30 seconds. A check right after an edit could get the old rows back, and the repair then added them a second time. Every check now adds a unique, always-true condition to its query, so the cache can't answer it.

Account lockouts. A failed sign-in could be sent more than once, and every copy counted toward the account's lockout. Setup now tests a new password with exactly one sign-in, and saves it only if it works.

Dashboard design and reporting

I designed and implemented the dashboard below on the layers this pipeline maintains.

Result

The pipeline has run in production since October 2026, keeping the dashboard's ArcGIS Online layers in sync with the SQL Server views. It sends only the rows that changed and reads every layer back to confirm it matches; if a layer still differs, the job marks that view failed and sends an email. Addresses that can't be placed are listed for review instead of getting a guessed point.

Tools

  • SQL Server (T-SQL views)
  • Python
  • pandas
  • SQLAlchemy and pyodbc
  • ArcGIS API for Python
  • ArcPy
  • ArcGIS Online
  • ArcGIS Dashboards
  • SQLite
  • pytest
  • Windows Task Scheduler

The gallery panels were made by running the project's own functions on synthetic records and simulated services. They are not screenshots of the live system, and no AI image generation was used. The update checks compare record fingerprints and counts; they don't re-check every field value or map location.

Open original application (opens in a new tab or window)

Loading the application connects to the external provider. If it cannot load here, use the original application link above.

Technical details

Professional · Geospatial data engineering and software development

The dashboard's layers had to follow a SQL Server database without manual exports. Records without coordinates needed geocoding before they could appear on the map.

  • SQL views: write the SQL Server views that shape each layer's records. The job picks up every view that follows the naming pattern.
  • Schema changes: compare each view's columns with the hosted layer. Add new fields, or rebuild the service from a file geodatabase while keeping its item ID and URL. Report values that don't fit a field.
  • Changes: fingerprint every row, then compare fingerprints and copy counts, so legitimate duplicates are kept.
  • Skipping: skip a view when neither the source nor the layer changed since the last verified run, and compare in full at least once a day.
  • Deletion guard: hold back deletions when a view suddenly shrinks, until someone confirms the drop.
  • Edits: send edits in paired, all-or-nothing batches, and never resend one blindly. An unclear answer means waiting and re-reading. Refused rows are isolated by splitting the batch, and retried daily.
  • Full reloads: reload a layer only after every replacement row is ready, and only when the reload fits the run's time budget.
  • Geocoding: use a locator built from the city's address points and streets first, then the city's address server. Cache every answer, and apply the acceptance rules when reading the cache.
  • Public layers: keep public layers to the locations the source supplies. Each unchanged incident keeps the offset it was first published with.
  • Run control: run one copy at a time under a lock and a watchdog, and keep state between runs. Queue failure emails, so a failed delivery is retried.
  • Tests: 203 automated tests, with mocked services, cover the comparison, edits, geocoding, schema changes, credentials and email.
  • Dashboard: design and implement the dashboard on the hosted layers.

Record comparison

Same total. Different records.

Three records on each side can still hide a missing copy and an extra record.

In the database

3 records

  • Record AFirst copy
  • Record AA second, legitimate copy
  • Record BDifferent contents

In the online layer

3 records

  • Record AOnly one copy remains
  • Record BCount matches
  • Record CAn extra record appears

−1Missing copy of AExpected two. Found one.

+1Extra record CExpected none. Found one.

Check matching contents and the number of copies
RecordDatabaseOnlineFinding
A211 missing
B11Count matches
C011 extra

Keep legitimate duplicates. Compare more than the total.

Synthetic example. A, B and C represent matching contents, not unique record IDs. The pipeline compares stored record fingerprints and counts; it does not independently confirm every field value or map location.

Image viewer

100%