Building a dashboard from a prompt
A dashboard is a web page in the project: plain JavaScript that runs SQL on a DuckDB file in the app, with D3 charts and a Leaflet map. Describe what you want and the assistant writes it. 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 (4.7 MB) and unzip it. Add the files in its data folder to a library, then include the library in a project.
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.
Expand2. 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.
Expand3. Ask for the dashboard
Say what to show and from which data. Here: "Make a dashboard of violent crime in Durham from the Durham crime library: counts at the top, a weekly trend I can drag across to choose dates, a map of where the crimes happened, and the offenses as bars I can click to see only one." The dashboards skill gives the assistant the method and a whole example to work from.
Expand4. 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.
Expand5. 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.
Expand6. 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.
Expand7. Drag to choose dates
Drag across the weekly trend. The counts, the map, and the offense bars show only those weeks.
Expand8. Click to see one offense
Click an offense's bar: every view shows only that offense, and a second click brings the rest back.
ExpandGood to know
- Ask for changes the same way: another crime type, a monthly trend, or a table of the latest crimes. The assistant edits the page's files, and the dashboard reloads.
- 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.