GithubHelp home page GithubHelp logo

ckaytev / fias2es Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 6 KB

Импорт адресов из ГАР БД ФИАС в elasticsearch

License: MIT License

Python 100.00%
address elasticsearch fias gar python

fias2es's Introduction

Импорт адресов из ГАР БД ФИАС в elasticsearch

Позволяет получить адреса всех домов конкретного региона и сохранить их в БД elasticsearch

На входе - полная разархивированная выгрузка ГАР БД ФИАС с официального сайта

На выходе индекс в elastic, следующего содержания:

{
    "_index": "fias",
    "_id": "24722081",
    "_score": 0.0947784,
    "_source": {
        "region": "автономный округ Чукотский",
        "town": "село Омолон",
        "street": "улица Клубная",
        "house": "дом 8Б",
        "extra_house": "корпус 2",
        "leftover": "сельское поселение Омолон",
        "muni": "Муниципальный район Билибинский"
    }
}

Установка и запуск:

  1. Перед запуском убедитесь, что проект имеет следующую структуру:
├── data
│   ├── 16
│   │   ├── AS_ADDR_OBJ_*.XML
│   │   ├── AS_HOUSES_*.XML
│   │   └── AS_MUN_HIERARCHY_*.XML
│   ├── 87
│   │   ├── AS_ADDR_OBJ_*.XML
│   │   ├── AS_HOUSES_*.XML
│   │   └── AS_MUN_HIERARCHY_*.XML
│   ├── AS_ADDHOUSE_TYPES_*.XML
│   ├── AS_ADDR_OBJ_TYPES_*.XML
│   ├── AS_HOUSE_TYPES_*.XML
│   └── AS_OBJECT_LEVELS_*.XML
├── docker-compose.yml
├── fias2es
│   ├── fias_mapping.json
│   ├── fias_parser.py
│   └── upload_elastic.py
├── main.py
├── README.md
└── requirements.txt
  1. Запустить elastic и kibana

docker-compose up -d

  1. Установить зависимости

pip install -r requirements.txt

  1. Разобрать адреса региона и положить их в БД

python main.py --region_id=87

Струтура проекта

  • fias_mapping.json - описание индекса для elastic
  • fias_parser.py - парсер ГАР БД ФИАС
  • upload_elastic.py - загрузчик датафрейма в elastic

Благодарность

Скрипты написаны на основании поста на Хабре, а также следующих проектов:

Планы по развитию

  • автоматический загрузчик обновлений с сайта (сейчас в ручном режиме)
  • api для поиска адресов в elastic

fias2es's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.