Skip to content

confusedbuffalo/phone-report

Repository files navigation

OpenStreetMap Phone Number, Opening Hours and Names Validator

This project generates static websites that report on issues in OpenStreetMap (OSM) data, including invalid phone numbers, invalid opening hours and incomplete names. The goal is to identify and provide an easy way to fix incorrect data in OSM.

The generated sites are available at:

The data is usually updated once per day.

How it works

The project fetches data from OSM, validates it and generates static HTML reports. The process is as follows:

  1. Fetch Data: For each country and/or its subdivisions defined in src/data/constants.js, a planet extract is downloaded and filtered to relevant objects.
  2. Validate Tags: The fetched phone numbers are validated using libphonenumber-js. Numbers are checked for correct formatting and validity for the specific country. Opening hours are validated using opening_hours.js. The names are checked to see if the main name tag exists and if it matches one of the multi-lingual names, such as name:en.
  3. Generate Reports: The results are compiled into HTML reports. A main index page lists all countries, each linking to a country-specific page. The country page, in turn, lists reports for its subdivisions. Each subdivision report details the invalid items, providing an option to fix the item directly and upload the edits in a batch as well as direct links to edit the data in various OSM editors (iD, JOSM, etc.).

How to add a new country

To add a new country to the report, you need to modify countries.json. Follow these steps:

  1. Add a new entry to the countries.json file. You will need to provide:

    • name: The name of the country.
    • countryCode: The two-letter ISO 3166-1 alpha-2 country code (regional ISO 3166-2 codes can be used on a division level).
    • locale: The locale for formatting and language of the generated pages.
    • pbfUrl: A url for an OSM pbf file for the country
    • divisions or divisionMap:
      • Use divisions to specify a map of division names to their OSM relation IDs
      • Use divisionMap for a list of divisions and subdivisions (like Germany).
  2. Add translations (optional): If the country uses a language not already present, add a new JSON file in the locales/ directory (e.g., de-DE.json for German).

Bot edit

Some of the fixes can be made without individual review if they are simply removing punctuation or adding the country code. There is an option of an ongoing automated edit which can be enabled on a country-level basis after discussion with the relevant community.

This wiki page details the process of the bot edit and which elements it would apply to. If you think such an ongoing edit would be useful and accepted in your country then open an issue to suggest it.

Contributing

Contributions are welcome! If you have suggestions for improvements or find any issues, please feel free to open an issue or submit a pull request.

How to run

To run the project locally and generate the reports, follow these steps:

  1. Clone the repository:

    git clone https://confusedbuffalo.github.io/phone-report/
    cd phone-report
  2. Install dependencies:

    npm install
  3. Run the build script:

    npm start

    This will generate the static sites in the build/ directory.

  4. Run in test mode: To do a quicker, simplified build for testing purposes, run:

    BUILD_TYPE=simplified npm start

    This will only process one subdivision for one division for one country, which is much faster than a full build, but will still download a full OSM extract for the first country in countries.json.

License

This project is licensed under the GNU GPL v3.0 or later. See the LICENSE file for details.

Files in the icons/ directory have different licenses, see the README there for more details.

Files in the poly/ directory are sourced from OpenStreetMap data via https://polygons.openstreetmap.fr/ and are licensed under the ODbl

About

Website for displaying invalid phone numbers in OpenStreetMap data

Resources

License

Stars

Watchers

Forks

Contributors