311 triage: route every request to the right system
Cleans and checks changed 311 requests, sends bad ones to a data-quality sub-flow, checks the city database to see if each is new, then routes new potholes, lights and trees to Scheduler crews, code cases to the ArcGIS map, and the rest to an SFTP file. Changed requests are upserted into the database with map points, and a summary by department is emailed.
18 steps
The whole flow, as it appears on the canvas.
Scroll sideways on small screens. Colors show the kind of step: start, read, change, decide, write.
What each step does.
- 01 · Start · On a schedule
Every 15 minutes
- Every 15 minutes (workspace time zone)
Then: Changed 311 requests
- 02 · Read · Get records · Sentra 311
Changed 311 requests
- Reads Service requests from Sentra 311
- Only records changed since the last good run
- At most 1,000 records per run
Then: Clean and check
- 03 · Change · Apply rules
Clean and check
description: collapsedepartment: copydept_codedept_code: translate with the value map Department codesaddress: required (else “No address”)lat: is number (else “No map location”)- Records that fail a check leave by the Invalid output
Then: Already in the database?; Count by department; Invalid → Data quality alert
- 04 · Change · Summarize
Count by department
- Counts records by
dept_code
Then: Email operations
- Counts records by
- 05 · Database · Look up in database · PostgreSQL / PostGIS
Already in the database?
- Looks for a row in
service_requestswhererequest_idmatches{{id}} - Saves it on the record as
existing
Then: New request?
- Looks for a row in
- 06 · Act · Run another flow
Data quality alert
- Hands the records to the Data quality alert (sub-flow) sub-flow
- 07 · Act · Send email
Email operations
- Emails
[email protected]: “311 activity by department” - One summary email
- Emails
- 08 · Decide · If / else
New request?
- Yes when
existingis empty
Then: Yes → Crew work?; No → Name like the columns
- Yes when
- 09 · Decide · If / else
Crew work?
- Yes when
categoryis one ofPothole, Streetlight out, Tree down
Then: Yes → Shape as a crew visit; No → Code enforcement?
- Yes when
- 10 · Change · Map fields
Name like the columns
- Shapes each record into 11 fields:
request_id,number,category,department,status,address,description,created_at,updated_at,lat…
Then: Update the database copy
- Shapes each record into 11 fields:
- 11 · Change · Map fields
Shape as a crew visit
- Shapes each record into 6 fields:
description,site_address,crew_id,priority,external_ref,scheduled_for
Then: Create Scheduler visit
- Shapes each record into 6 fields:
- 12 · Decide · If / else
Code enforcement?
- Yes when
departmentisCode Enforcement
Then: Yes → Map attributes; No → Everything else to SFTP
- Yes when
- 13 · Database · Write to database · PostgreSQL / PostGIS
Update the database copy
- Upserts rows in
service_requestskeyed onrequest_id - Builds a map point in
geom(SRID 4326)
- Upserts rows in
- 14 · Write · Send records · Sentra Scheduler
Create Scheduler visit
- Creates Visits in Sentra Scheduler
- 15 · Change · Map fields
Map attributes
- Shapes each record into 6 fields:
ref,status,address,category,lat,lng
Then: Make map point
- Shapes each record into 6 fields:
- 16 · Files · Write file · SFTP server
Everything else to SFTP
- Writes CSV file
other-311-{{ $today }}.csvtooutbox - One file with every record
- Writes CSV file
- 17 · Database · Make map point
Make map point
- Builds an ArcGIS map point from
latandlng - Drops records without coordinates
Then: Add to the code-case map
- Builds an ArcGIS map point from
- 18 · Write · Send records · Esri ArcGIS feature layer
Add to the code-case map
- Creates Features in Esri ArcGIS feature layer
Code tables that ship with it.
Each client edits its own copy, so one template fits every municipality.
| from | to |
|---|---|
| Public Works | PW |
| Code Enforcement | CE |
| Parks | PRK |
| Utilities | UTL |
| Sanitation | SAN |
Connectors used
Swap any of them for another system with the same kind of data.
Run this flow on your systems.
We'll set up a workspace with your systems in a sandbox and build your first flow with you.