This project generates a static website that reports invalid phone numbers from OpenStreetMap (OSM) data. The goal is to identify and provide an easy way to fix incorrect phone number data in OSM.
The generated site is available at https://confusedbuffalo.github.io/phone-report/ and the data there is usually updated once per day.
The project fetches data from OSM, validates phone numbers, and generates a static HTML report. The process is as follows:
- Fetch Data: For each country and its subdivisions defined in
src/data/constants.js, the project queries the Overpass API to fetch OSM elements with phone number tags. - Validate Numbers: The fetched phone numbers are validated using
libphonenumber-js. Numbers are checked for correct formatting and validity for the specific country. - 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 phone numbers, 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.).
To add a new country to the report, you need to modify countries.json. Follow these steps:
-
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.locale: The locale for formatting and language of the generated pages.divisionsordivisionMap:- Use
divisionsto specify a map of division names to their OSM relation IDs- If there is another depth of division, provide
subdivisionAdminLevelto fetch subdivisions automatically (like France). - If not then omit that key (like Belgium)
- If there is another depth of division, provide
- Use
divisionMapfor a hardcoded list of divisions and subdivisions.
- Use
-
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.jsonfor German).
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.
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.
To run the project locally and generate the reports, follow these steps:
-
Clone the repository:
git clone https://confusedbuffalo.github.io/phone-report/ cd osm-phones -
Install dependencies:
npm install
-
Run the build script:
npm start
This will generate the static site in the
public/directory. -
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.
This project is licensed under the GNU GPL v3.0. See the LICENSE file for details.