Skip to content

NIPKaart/disabled-parking

Repository files navigation

alt Banner of the disabled parking project

GitHub Activity GitHub Last Commit Linting

Project Maintenance License Contributors

Forks Stargazers Issues

About

This project makes it possible to download and upload parking data from municipalities to the NIPkaart platform. If the data is regularly updated, it is possible to automate this with a docker container.

Supported cities

These are the cities currently supported:

Country City Locations Update frequency Crontab
Belgium Antwerpen 1664
Belgium Brussel 877
Belgium Liege 952
Belgium Namur 305
Germany Dresden 477
Germany Dusseldorf 327
Germany Hamburg 812 (says 813)
Germany Köln / Cologne 441
Netherlands Amersfoort 149 every monday at 03:00 0 3 * * 1
Netherlands Amsterdam 1328 every second day of the month at 03:00 0 3 2 * *
Netherlands Arnhem 88
Netherlands Den Haag 234 (says 241) every second day of the month at 02:30 30 2 2 * *
Netherlands Eindhoven 180 every second day of the month at 03:00 0 3 2 * *
Netherlands Groningen 173
Netherlands Zoetermeer 388

Development

This Python project is fully managed using the Poetry dependency manager.

You need at least:

  1. Create a .env file
cp .env.example .env
  1. Fillout the database credentials and which city you want to upload

  2. Install all packages, including all development requirements:

poetry install

Poetry creates by default an virtual environment where it installs all necessary pip packages, to enter or exit the venv run the following commands:

poetry shell
exit

Setup the pre-commit check, you must run this inside the virtual environment:

pre-commit install

Now you're all set to get started!

As this repository uses the pre-commit framework, all changes are linted and tested with each commit. You can run all checks and tests manually, using the following command:

poetry run pre-commit run --all-files
Click here to see more!

Build image

docker build -t parking-[CITY] .

Run the image

docker run parking-[CITY] -d --restart on-failure --name nipkaart-parking-[CITY]

or

docker stack deploy -c deploy/[CITY].yml parking

Crontab

Certain datasets are regularly updated, so that we can update them automatically in the NIPKaart database.

0 3 1 * * = Run every first day of the month at 03:00
30 2 2 * * = Run every second day of the month at 02:30
0 3 2 * * = Run every second day of the month at 03:00
0 3 * * 1 = Run every monday at 03:00
30 2 * * 1 = Run every monday at 02:30
0 3 * * 2 = Run every thuesday at 03:00
*/2 * * * * = Run every 2 minutes

Crontab generator: https://crontab.guru

Geocode

The value you should use for this purpose can be obtained from the ISO 3166-2 standard. This code represents a province or state within a specific country. It helps differentiate data sets for the same area when multiple datasets are combined.

SQL query

Below are the values that NIPKaart expects to get:

value required? description
id yes The ID of the parking location
country_id yes The country ID determined by NIPKaart
province_id yes The province ID determined by NIPKaart
municipality yes The municipality name
street no The street name
orientation no The orientation of the parking location
number yes The number of parking spots on that location
longitude yes The longitude of the parking location
latitude yes The latitude of the parking location
visibility yes The visibility of the parking location
created_at yes The date and time of the creation of the parking location
updated_at yes The date and time of the last update of the parking location

Contributing

Would you like to contribute to the development of this project? Then read the prepared contribution guidelines and go ahead!

Thank you for being involved! 😍

License

MIT License

Copyright (c) 2021-2024 Klaas Schoute

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.