Skade- och incidenthantering (SoI)

Implemented owned by Jönköpings Kommun Swedish
2y ago update

Hej!

Vi på Jönköpings kommun har tillsammans med AI-studenter på Jönköping University upprättat ett antal projekt där de involverat och tillämpat AI. Delvis för att vi gemensamt ska få en bättre förståelse kring vad AI innebär men också till ren nytta och tillämpning i framtida skarp drift.

Ett av projekten som drivits igenom och som jag senare kommer tillbaka till när det gäller AI är "Skade- och incidenthantering". 

För att göra en lång historia kort så innebär SoI (Skade- och incidenthantering) följande för oss i Jönköpings kommun:

Kontroll- och uppföljning av skador på kommunal egendom. Statistik ska kunna tas fram och nyttjas i det brottsförebyggande arbetet inom kommunen.

En enkel inrapportering av skador och incidenter.

Rapportören ska bara behöva rapportera/anmäla på ett ställe.

Anmälaren/rapportören ska ges möjlighet att få en återkoppling om vad som hänt i ärendet.

Enkla digitala arbetsflöden.

En dokumentation av vilka skador och incidenter som initialt ska rapporteras i systemet.

All ovan rapportering görs i Infracontrol Online där vi byggt en struktur för involverade förvaltningar inom Jönköpings kommun där de jobbar med sina ärenden lättast.

Nu till lite mer AI och hur vi tillämpat det:
SOI har varit igång i  ett år (start 2021) så får vi ibland in ärenden där en polisanmälan behöver upprättas. I en del ärenden är fallet solklart och rapportören har polisanmält händelsen innan hen rapporterar i Infracontrol Online. Men i vissa fall kanske rapportören inte vet om att en polisanmälan bör upprättas av olika anledningar, eller att det finns en gråzon kring om det ska polisanmälas eller inte.

Det studenterna har tagit fram är en AI som baserat på historisk data (från tidigare rapporteringar i andra system) ger ärendehandläggaren en rekommendation att en polisanmälan bör upprättas. Rekommenderas en polisanmälan så finns all data i ärendet för att upprätta en sådan. Förenklat - AI'n använder alla fält som finns i Polisens e-tjänster och skapar en ifylld PDF som bifogas i ärendet, redo att skickas till Polismyndigheten för upprättande av en polisanmälan.

På engelska!

The objective for this project was also to automate the work process described in the summary with the help of AI. Due to legal requirements, a report to the police cannot be created completely automatically.

Therefore, the goal was to create a report as a PDF document, which has the same format as a real report to the police. With the help of the automatically generated report, an office employee of the municipality can then create the report in a short period of time by simply copying it. 

The AI also decides whether or not to create a report for a given case. The long-term goal is to be able to submit the generated PDF document directly to the police so that even the last step does not have to be done by an employee.

System architecture

An incident/damage report is sent to Infracontrol Online by employees such as teachers. The damage report is retrieved by the custom API periodically according to a set time interval, the default value being every 30 minutes, and is put through and processed by the AI model. 

If the incident/damage report is deemed serious enough to be reported to the police by the AI model, a PDF, with the same structure as a real police report, will be generated automatically using the information retrieved from the incident/damage report. The generated police report is then automatically uploaded to Infracontrol Online on the page of the incident/damage report.

Functions

The following chapter discusses the technological functioning. This section describes the machine learning model that was utilised, as well as the API that was used. Additionally, an overview of the training process for a new model is presented. For this use case, Python was employed as a programming language.

ML Model

A machine learning model built using the Tensorflow framework is at the foundation of this project. This framework was chosen since it is a well-known industry standard and it is fully documented. 

Ethical considerations

Due to the inherently sensitive nature of this project, some ethical considerations had to be made. Therefore, an array accessible in the code was added to censor certain words from interacting with the model. This functionality is used both in the training of the model and the final prediction phase of the trained model. The reason this functionality was added is to remove the possibility from the model learning any unconscious biases to words prefixing nouns/subjects. 

Training of a new model

A custom-designed script can be used for training a new model, for example, if additional data is available. This script was created to make the process of training a new model as simple as possible from the users perspective. For the usage of this, the training data has to be stored in a specific way. The new data should be exported from InfracontrolOnline in a CSV format. The following
columns need to be used in the exact order. 

Ärendenummer | Typ av fel | Beskrivning | Har händelsen skett tidigare? |
Har polisanmälan gjorts? | Kameraövervakad plats? | Inbrott?
The file train_police_incident_model.py can be called from the command line, with the additional parameter of the CSV file containing the training data. It automatically performs the necessary preprocessing steps and trains a new model. Additionally, the model gets evaluated on the validation data and finally saved under uploads/models/retrained_models/police_incident. If the model presents the required accuracy, it only needs to be copied and replaced into the main folder of the model under backend/uploads/models/police_incident.

Custom API

Method: /policeincident/
Description: This is a manual activation function for the API to call the AI model and get reports filed by municipal workers within the last 30 minutes. It will then classify the reports and if the report is deemed a criminal action a PDF will be generated and uploaded to Infracontrol online. This will be done automatically within the API regardless of this path getting called or not. 

Expected return: 200 OK, "Report filed with X confidence" or "No report filed with X confidence"
Unexpected return: 504, Gateway Timeout. Backend Error, Possibly python code.

The results from the developed AI model and custom API, automating the work process for the police incident reporting by automatically processing the damage reports and generating a PDF document, reached a satisfactory accuracy of 99.84%. 

The automatic generation of the PDF document successfully follows the format that the Jönköping police department is currently using. The case in Infracontrol Online is automatically updated with the PDF, allowing for municipality employees to easily continue the workflow from within the system that they are already used to.

Attributes

Municipality
Customer Service & Support
Better Customer Experience
Experimenter
Optimization
Decision Tree
Structured Data