📜 ⬆️ ⬇️

Collected all "Habrom" directory "Issued by whom ..." for passports. Download to health



From a couple of months ago, we experimented: whether it will be possible to gather at Habré a suitable directory of the units that issued Russian passports . This is a useful matter: many people need this data, there is no canonical source, and the existing ones are very so-so.

And you know, everything turned out. A usable reference book is ready, you can download and use. We also made prompts that speed up the introduction of units into forms.

"Naked" CSV - in the public domain


We posted the compiled and cleaned reference book on GitHub. Inside, everything is simple, CSV with two fields:
')

It lies here github.com/hflabs/fms-unit/releases/latest .

There are still ready tips for input forms (and free).


We assembled units to make ready service - hints for input forms. And here they are ready.

"Tips" DaData.ru can be integrated into the site, CRM or CMS and pass for caring small: the user simply enter the unit code, and the name will fill the service.


It seems everyone hates to fill in the name of the unit. We tried to alleviate the suffering of people.

Another "Tips" pull the region and the type of unit from the code, sometimes convenient. Here is a brief response specification.
TitleDescription
valueValue in one line (as shown in the list of hints)
data.codeDivision Code
data.nameThe name of the unit in the instrumental case (“by whom?”)
data.region_codeRegion Code
data.typeType of division:

  • 0 - division of the FMS;
  • 1 - Municipal Department of Internal Affairs or the Ministry of Internal Affairs of the region;
  • 2 - ATC or ATS of a district or city;
  • 3 - police station.
Up to 10,000 requests for "Tips" per day are given free of charge, these are ≈300 completed forms. More - as part of a subscription, from 5 000 ₽ per year. It works through jQuery-plugin, API or components for different CRM, CMS, "1C" and others.

Details - on dadata.ru/suggestions/outward/fms_unit/ .

Habr helped a lot with data


The first question of those who hear about the project: “Was it really collected through Habr?”. It was not only Habr that helped, but the contribution of habrazhitele is great and extensive. We are grateful and a little surprised: the first time turned to the community, and immediately such a result.

Initially, we had some groundwork. But, first, far from being a complete reference. Secondly, I wanted to check how adequate the data are to real passports.

Many sent units from their passports through a collection form when we threw a cry. They sent one and five to ten records. Heroes who are not too lazy to drive it all hands - respect.

Three people offered in a personal database of respectable size. Friendly and gratis.


Those who are worried about security: all directories were sent impersonal, no byte of personal data

Such gifts significantly moved things forward. As a result, after three weeks we collected a volume from which we are not ashamed to make a product suitable for industrial use.

The path to success - “A pile of raw data + 300 regexp + a little pitonachki”


So, the raw data is in the hands of the grocerer " Dadata " nalgeon . Further dance, he described a quote from the title. All that we have collected, has passed a series of wonderful transformations.

To begin with, the names of the divisions were normalized. Here I had to fidgetly work with a file. For example, in “live” passports, the numbers of territorial subdivisions are indicated with “No.”: “TP No. 1 V G. KHIMKI ...”. In the same way, in the majority of the collected reference books, except for one - in it all the numbers without the “No.”: “TP 1 IN G. KHIMKI ...”. I had to insert.

Slapped years. In several reference books, the names of the divisions are “spread” by years, even when they do not change with time.

500-168, . . ,2007
500-168, . . ,2008
500-168, . . ,2009
500-168, . . ,2010

We combined such records, linking them to a period: in the example above, four records turned out to be one with the dates “2007–2010”.

They collected another reference book - “2018+”. In 2018, there was a coup - now the name of the “supreme” department of the Ministry of Interior in the region is written in passports. Therefore, in a document issued in the Krasnoyarsk Territory, regardless of the code, they indicate “The Directorate of the Ministry of Internal Affairs of Russia for the Krasnoyarsk Territory”.

We took all the codes we collected, divided them into regions and gave them the same names in the 2018 style. The names were taken from the collected directories, something had to be searched on the Internet. It turned out something like that.

240-001, ,2018
240-002, ,2018
240-003, ,2018


Removed the years. It turned out that in the reference books there is a perfect commotion: there are some years, some not. It remains either to remove the years everywhere for a more complete reference book, or to leave only units over the years for the sake of what is not clear. Chose a more comprehensive reference.

Combined reference books , data in ecstasy merged together. The result was thoroughly rubbed with a rag, brushed and reminded: for example, “RA” was turned into “Republic of Altai” where it was necessary and made a dozen more such changes.

And so, the directory is ready. Use, do as for yourself (actually, for yourself and did :).

A pair of subtleties for corrosive


In the directory there are many entries with the same codes of divisions. This is due to the fact that in different years in the passports the spelling of the same department was different. We merged similar options, but left the very different ones: let the user choose how he has them in the document.

It may turn out that your passport and the directory are written a little differently. Without a minimum normalization, each unit would have such a bunch of similar options that go and find the right one. Therefore, we have reduced the "MANAGEMENT OF INTERNAL AFFAIRS" to "ATC", "CITY" and "MOUNTAIN" - to "G.", "DEPARTMENT OF PASSPORT AND VISA SERVICE" - to "OPVS", etc.


If you start typing the name, the “Clues” will also contribute

But! No law or sub-law requires that the name of the department in the documents coincide with the version in the passport. Both abbreviations and omissions are allowed. The main thing is that it is approximately similar and the rest of the details: the series, number, date, unit code.

Errors can be reported to us dadata.ru/fix/fms . Indicate the code and name of the problem record, and write in the comments what is wrong. Let's correct and lay out the updated reference book for everyone. Or send pull requests to GitHub.

Naturally, you can fix the CSV with your hands if you have a naked reference book without “Tips”. But it is not clear how everything will look if you ever pick up the next version of the directory from us.

In general, use on health:


If you share the article, help people who are looking for a directory of units of passports. Suffering enough, they will be grateful.

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


All Articles