ph-municipalities aims to provide a simple, organized, and flexible interface for viewing, querying, and listing Philippine provinces and municipalities using the PAGASA 10-day weather forecast Excel files as the data source.
+ +Its early stages were written as procedural functions within a private backend project for extracting 10-day weather forecast data from the PAGASA 10-day weather forecast Excel files. When the private project started gaining complexity, a need to separate the logic and management for listing the Philippine province and municipalities per region rose. Creating an independent, public OpenSource version listing the provinces and municipalities per region was decided after experiencing drawbacks and difficulties testing using similar OpenSource libraries (some of which are listed above) for that project.
+ +> ph-municipalities aim to contribute to the OpenSource community by listing ONLY Philippine provinces and municipalities names, using PAGASA's 10-day weather forecast Excel files, which are publicly accessible to everyone. + +While ph-municipalities use a PAGASA 10-day weather forecast Excel file as a data source for its provinces and municipalities list, NO, it cannot parse and extract PAGASA 10-day weather forecast data.
+ +ph-municipalities only have class methods for parsing, extracting, listing and querying provinces and municipalities names data from a PAGASA 10-day weather forecast Excel file. Refer to the ExcelFile class documentation for more information about its available methods.
+ +Yes, several OpenSource libraries and projects similar to ph-municipalities exist, which you can use in its place to list Philippine provinces and municipalities.
+ +Here is a list of several of these libraries and code repositories. +Note, however, these items use old and new data sources. These may not be for you if you require using provinces and municipalities names data from the PAGASA 10-day weather forecast Excel files.
+ + + +While ph-municipalites do not support parsing and extracting PAGASA 10-day weather forecast data, you can extend the ExcelFile or ExcelAdapter classes with custom logic and codes to enable parsing and extracting PAGASA 10-day weather forecast data.
+ +Since the ExcelFile or ExcelAdapter are classes (functions in disguise, not true OOP, but inheritance still works), you can extend them with class inheritance, overriding or creating new class methods to accommodate processing the PAGASA 10-day weather forecast data. Refer to the ph-municipalities class documentation to know more about the available classes, member variables, and methods.
+ +An example of extending the classes to parse PAGASA 10-day weather forecast data may go along the lines of:
+ +```javascript +const { ExcelFile } = require('ph-municipalities') + +class PAGASATendayParser extends ExcelFile { + /* Override constructor if neccessary + constructor (params) { + super(params) + + // Custom class initialization logic here + } + */ + + getWeatherData () { + // Note: this.#data contains the "raw" original Excel rows data as JSON with weather data + + const weatherData = this.#data.reduce((list, row, index) => { + // Write logic to parse and extract weather data here + }, []) + + return weatherData + } +} + +const parser = new PAGASATendayParser() +weatherForecast = parser.getWeatherData() + +``` + +NO. By default, ph-municipalities use an outdated PAGASA 10-day Excel file by default for its local data source, downloaded on August 8, 2022. However, it also provides several ways for using updated PAGASA 10-day Excel files as data sources by:
+ +- Prompting to download an updated PAGASA 10-day Excel file using the [Interactive CLI Scripts](#interactive-cli-scripts) +- Providing [class methods](https://ciatph.github.io/ph-municipalities/ExcelFile.html#download) to programmatically download and use a remote PAGASA 10-day Excel file +- Allowing to override the default region - province list settings during class initialization (See [Class Usage - Using a Custom Configuration File](#using-a-custom-configuration-file)) + +> **_NOTE:_** +> Overall, the provinces and municipality list rely on the latest contents of a [PAGASA 10-day Excel file](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast) and manual configuration of region/province names mapping in the `/app/config/regions.json` file (See [Class Usage - Using a Custom Configuration File](#using-a-custom-configuration-file)). It is not yet known and tested if these are in sync with the latest regions, provinces, and municipalities in the more standard and canon [Philippine Standard Geographic Code (PSGC)](https://psa.gov.ph/classification/psgc) data. + +