Putting ChatGPT to work for Local Government

An example of how I am experimenting with ChatGPT to solve real-world problems I encounter in the local government workplace.

Abstract photo of robot writing code at a desk generated by Canva Text-to-Image AI tool.
Abstract photo of robot writing code at a desk generated by Canva Text-to-Image AI tool.

As the Chief Innovation Officer for the City of Lebanon, I spend significant time thinking of ways to creatively solve the problems we encounter on a daily basis. The work is exciting but can also be exhausting, especially against the backdrop of local government being typically under-resourced. As a result, I often feel discouraged, knowing we could solve problems faster if we had enough staffing, expertise, and time. This is where new breakthroughs in artificial intelligence (AI) can prove helpful.

I'll get straight to the point with an example of how I am experimenting with ChatGPT to solve real-world problems in the local government workplace.

One thing we want to provide for our constituents is a simple calculator that allows people to see how much their building permit will cost. The calculations aren't complex, but we don't have a web developer available to write the script. I have enough skill to edit scripts and understand them when they already exist but not enough to pump a script out in my daily routine. I could do it if you gave me enough time, but that's not where my time is best spent.

This is where AI and I converge. We shake hands and enter into a dialogue together. I get straight to the point and ask ChatGPT to perform the following task:

💡
write client-side javascript calculator code with a field to enter the cost of construction in whole dollars. If the cost of construction is $5,001 or greater, the cost of construction should be multiplied by .006 then have $75 added to it with a subtotal displayed that is then multiplied by 5%, and the total rounded up to the nearest dollar displayed on the screen in bold text labeled Total. If the cost of contruction is $500 or less, the total displayed on screen should be $31. If the cost of construction is between $501 and $1,000 then the total displayed should be $37. If the cost of construction is between $$1,001 and $3,000 then the total displayed should be $58. If the cost of construction is between $$3,001 and $5,000 then the total displayed should be $79.

That's the conversation, word for word, including typos. I don't have to make small talk or set the stage. ChatGPT pauses for one second, then begins writing code, line by line, in front of me without taking a breath. After about 20 seconds, she wraps it up with a quick summary of her work (I say she because I think there should be more women in tech). Hers is the fastest, most accurate response to a question I have received all week.

ChatGPT: > This code creates a simple form with a field to enter the cost of construction, and a button to calculate the total cost. The JavaScript function "calculate()" is called when the button is clicked. It first gets the value of the cost input field and assigns it to the variable "cost". It then checks the value of "cost" against different conditions using if-else statements, and assigns the appropriate total cost to the "total" variable. Finally, it displays the "total" in a "p" element with the id "total" and the style "font-weight: bold;".

Encouraged by her response, I continue barking commands at her and she responds without frustration or hesitation, rewriting the original code to include all the extras. Occasionally, I remember to say please.

Add a toggle button for residential or commercial. If residential is checked, run function calculate cost. If commercial is checked, do nothing.
create another function that calculates commercial permit fees so when costInput is $5,001 or greater, the cost of construction is multiplied by .0075 then have $110 added to it with a subtotal displayed that is then multiplied by 5%, and the total rounded up to the nearest dollar displayed on the screen in bold text labeled Total. If the cost of contruction is $500 or less, the total displayed on screen should be $37. If the cost of construction is between $501 and $1,000 then the total displayed should be $63. If the cost of construction is between $$1,001 and $3,000 then the total displayed should be $84. If the cost of construction is between $$3,001 and $5,000 then the total displayed should be $115
please change the script so it rounds the total to the nearest dollar
can you update the script so total is cleared when residential toggle is checked the same way it works with the commercial toggle?
please update the script so when commercial toggle is checked, it will be active, the same way it works for the residential toggle. When neither radio button is active, disable calculation

At one point, she stalls without finishing the script. I ask her to "please continue building the script" to which she responds, "Sure, here is the continuation of the script" and closes it out perfectly. All I have to do is copy and paste it into a web page to see how it runs.

I'm not done with this project yet (it needs some tidying up) but here is the result you can try. Select residential or commercial, enter a dollar amount then click calculate to view the total permit fee.

Residential Commercial

Cost of construction:


In this example, I showed how ChatGPT helped solve a programming problem but it can do far more than that. For example, we have some events coming up in our city so I fed the basic details to ChatGPT, asking her to write an article inviting community members using plain language standards while avoiding gender and racial bias. Within a few seconds, I had the text of the article ready to publish on our website. I asked her to create three alternative titles for the article, which she did without trouble.

ChatGPT can also suggest solutions to other types of problems and check existing work for errors. In other words, it has the potential to be a personal assistant for every staff member.

These are a few simple examples of how AI can help advance local government work. You will hear more about AI tools such as ChatGPT, DALL·E, Clip, neural networks, and more in the coming year. We are in the early stages of seeing how AI will be incorporated into our daily lives. Where we end up and how we use these tools is up to us - the humans. My interest is in making local government work better for the people. I see ChatGPT as a tool to help in that space.

Obviously, as the AI landscape continues to evolve, there will need to be budget lines to include future funding for these types of tools. There is also the issue of setting policy to outline how AI will be responsibly used as well as ensuring protocols to protect privacy, data integrity, and human interests are established. These are the conversations that are happening. This is the work that is being done.

As for me, I intend to clearly identify any AI work I publish to begin developing a pattern of transparency (i.e. is it human or AI). Some people are squeamish about admitting they use these types of assistants because they fear AI will take over their job. I am not in that camp. I see it as a tool to assist and enhance each person's current line of work. This is especially true in local government where we are so often under-resourced.

As AI becomes more accessible in the mainstream human experience, so will our ability to solve common problems and implement viable solutions. I see no better place for this emerging technology than in local government.