311 service request generation using OpenAI
itamargal / chat311 Goto Github PK
View Code? Open in Web Editor NEW311 service request generation using OpenAI
311 service request generation using OpenAI
Cities are going to be interested in using OpenAI/ChatGPT
Like many others, the advent of OpenAI and ChatGPT will interest city leaders and get them wondering where and how the technology might be useful. As with any new technologies cities look to adopt, it is critical to think through days project and security, as well as if the product truly helps people as opposed to just being a shiny new tool to try.
While there are still many questions to be answered about OpenAI and ChatGPT, we thought of a couple of ways it could help.
Current challenge
Virtually every city has a method for allowing residents to request service - from reporting potholes or street light outages to asking for a street to be plowed, 311 services are a key way city governments interact with their constituents. There are two common challenges.
Our solution:
Constituent Requests
Using the available OpenAI APIs, we are able to identify the most likely service request and its severity based on a string of text. Instead of relying on a series of drop down menus in a typical 311 application, we can map the person's comments to the correct request type.
If someone types "it is dark on the street on the corner of Washington and Salina streets" the API recognizes the person is likely talking about a street light issue, even though the request says nothing about street lights.
If someone types, "there is a huge pothole near the carrier dome" the API recognizes this as a pothole request, but also says the request is severe (because of the huge pothole). It also recognizes the location of the Carrier Dome as being in Syracuse, though it does not do a good job of finding the right latitude and longitude.
[Screenshot of output]
Requests Standardized
OpenAI also does a good job categorizing requests across cities. Giving lists of categories to the algorithm and asking it to relate them with an explanation for why they are associated works pretty well.
For cities that are interested in performance management and understanding of they are filling similar numbers of potholes in the same amount of time as a related city, this solution helps make the requests apples-to-apples. While not perfect, it allows for a good first pass at relating thetypes of requests quickly.
[Screenshot of output]
Streamlit App
We built the solution using Streamlit, allowing for a quick app deployment that easily leverages the OpenAI API and is extendable to other packages - we added maps and started outputting data quickly.
[Link to repo]
Other thoughts:
The OpenAI APIs are easy to use, but having this app be fully in production and used widely would quickly get expensive. OpenAI gives
For a city to use this, it would also be important to consider legal implications of the API - it is very new and still unclear what happens with the data they are collecting.
As with any new technology a city implements, thinking about adoption and roll out for both city staff and the community is critical. In concept this app could act as a front end that could integrate with a number of typical 311 products on the market.
Potential next steps:
Using the following lists from Syracuse, Buffalo, and Rochester create a table with Syracuse in one column and Rochester in the second column and Buffalo in the third column that best associates items from each list and tell me why you think they are associated in a final column. Make sure all categories are listed in the table, but only use the categories listed, you shouldn't make up categories on your own. If one category does not associate with others, that is ok, just leave blank for other cities. Here are the lists:
Syracuse:
Rochester:
Buffalo:
Using the latitude and longitude, plot the request on a map within the streamlit app
https://docs.streamlit.io/library/api-reference/charts/st.map
This will be useful when showing how many requests are made per day
Each request should be saved and appended as a row to a database or parquet file. The output from the OpenAI response should be saved as well, along with the date of the request. This will let us do further analysis later on.
Other options for investigation:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.