📜 ⬆️ ⬇️

How we organized the automatic sending of appeals to government bodies



Hello! I work in the Angry Citizen project team. I would like to tell you how we have organized communication with government organizations.

There are 3 types of cooperation:
')


The whole process from the creation of a statement to the response from the organization can be divided into 3 stages:



Filling out a form and creating an application



In the rubricator of the “Angry Citizen” portal there are about 500 different categories of problems, and each category has its own specific form for creating appeals. This is a small mechanism called AngryForm. By the way, we write it in PHP. It contains metadata of forms and is able to process them. AngryForm knows how to form an appeal out of a completed form and who needs to send it. Perhaps, I will write about AngryForm in detail in a separate article. So, the user is looking for his category of problems and fills out a form for it. Statements are generated based on data received from the user.

Sending a request

After the appeal is generated, you need to send it to someone. We have a base of organizations and all kinds of communication methods with them. Organizations are tied to specific problems and, depending on the category and region chosen, the appeal is sent to a specific representation of this organization.

As soon as the organization received an appeal, it has a certain period during which it must respond to the applicant, and if it does not fit into this period, the user can send a complaint to the prosecutor's office - also through our service.

There are several communication channels with organizations:



Depending on the communication channel, which is available in the desired representative office, the dispatch takes place in different ways. Briefly tell you about the fax and portal API.

Fax call delivery



Everything is simple here, the call is sent via API to the fax of the responsible organization. For appeals sent by fax, a unique email address is created on AngryMail (about it below), where it expects an answer from the organization. The response from the organization comes through the channel AngryMail.

Delivery of requests through the state portal API



Now we have integration with several portals such as gorod.mos.ru and openregion71.ru. If these portals are subject to the conditions chosen by the user, then requests are received, in addition to our service, also to these portals. Having received the answer to these appeals, they also appear on our portal. During the entire time, we are polling the servers of these portals for the presence of answers on our statements. And if the answer is found, then it falls into the timeline of our portal.

Delivery of applications using e-mail



Here is more interesting. Together with the creation of the appeal, a chain of correspondence between the user and the representative office is also created. After creating a call and a chain, it goes to the queue of sending calls. We use RabbitMQ as queues. From the queue, the appeal is sent to AngryMail.

AngryMail is an application written in Java that processes incoming and outgoing emails. AngryMail assigns an identifier to the chain and generates a reverse email in the format {id@@anrymail.ru, to which an answer will be waited.

The organization responds to the generated email address ({id} @ angrymail.ru), as a rule, with attached documents with all seals and signatures. As soon as AngryMail receives a similar letter, it sends it to the AngryCitizen service. The answer is attached to the timeline of circulation on the portal and a notification is sent to the user.

If very briefly, then so. The work of our service does not end there, but this is another story.

Thank you for reading the article to this place.

If interested, I will continue to talk about life in our project, along with technical subtleties.

Source: https://habr.com/ru/post/238665/


All Articles