VULCAN VEIL Analyst's AI workbench

Docs · Desktop · Projects

A CompStat dashboard

A CompStat table of two numbers hides whether this week is unusual and whether crime is trending. This dashboard shows both: each week against the mean of the 8 weeks before it with Poisson z-score bands, and each month against earlier years. The data is a library of crimes reported in Durham, NC, from the city's open data; a data connection's lakehouse works the same way.

Follow along: download dashboards.zip (1.2 MB) and unzip it. Add the files in its data folder to a library, then include the library in a project.

Expand

1. Put the data in a library

Add the data files to a library: each becomes a table in the library's DuckDB file, with a profile the assistant reads. Here, Durham crime: the city's crimes, calls for service, and outline. A data connection's lakehouse works the same way. Then include it in a project with the Explorer's + Library.

The Durham crime library with its three tablesExpand

2. Let the assistant work

Open the project and press Sandbox locked. Turn on Accept assistant edits automatically, so it can write the dashboard's files, and Assistant-run Python, so it can look at the data first.

The Sandbox panel with Assistant-run Python and Accept assistant edits automatically onExpand

3. Ask for the dashboard

Say what to show and from which data. Here: "Make a CompStat dashboard from the Durham crime library: the weekly chart of crimes with the Poisson bands, a chart by month with a line for each year, a treemap of the offenses I can click to pick one, a list of districts, and a table of the last 28 days against the 28 before for each crime group." The dashboards skill gives the assistant the method and a whole example to work from.

The assistant looking at the data before it writes the dashboardExpand

4. Read what it made

It writes the page (an HTML file with its styles and its JavaScript) in a folder under dashboards. After each write the app opens the page in its tab and sends the assistant what failed and a picture of how it looks, so it fixes what it sees before it finishes. Then it says what each part shows.

The assistant's summary of the dashboard it wroteExpand

5. Open the dashboard

The page is index.html in the Explorer. It opens as a live dashboard: the page runs its SQL on the DuckDB file in the app, so the data never leaves this computer.

The dashboard open in the projectExpand

6. Undock it

Press the arrow on the file's tab to move the dashboard into a window of its own, then maximize it or drag it to another screen.

The dashboard in its own maximized windowExpand

7. Pick an offense

Click an offense in the treemap: the weekly chart, the months, and the table show only it, and the other offenses fade. Click it again to see all of them.

The CompStat dashboard filtered to one offense from the treemapExpand

8. Choose a district

Choose a district from the list: every view shows only that district.

The CompStat dashboard for one districtExpand

Good to know

  • A week outside the band is more change than chance alone makes. The Poisson z-score in the table says the same for the last 28 days: beyond 2 or below -2 is worth a look. It is steadier than a percent change on small counts.
  • Each run is a little different: the assistant writes its own page each time, so yours will not look exactly like this one.
  • The dashboard is drawn on this computer, in a sandboxed page that reads only the project's files, the app's own copies of D3, Leaflet, and DuckDB, and Esri's map tiles. It cannot send anything anywhere.
  • With a data connection, the page opens the connection's lakehouse by its name, and the connection's scheduled update keeps it fresh: Reload shows the new data.
  • After the assistant writes the page, the app opens it in its tab, tells the assistant what failed or drew nothing, and, for a model that reads images, sends it a picture of the tab. The picture is the app's own screenshot of its window, cut to the dashboard: nothing else on the screen is in it.
  • The crimes come from the City of Durham's open data portal.