diff --git a/README.md b/README.md index 0d37f02..1b7f2c5 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ Pre-compiled windows binaries are available for download in the latest [Releases ## Class Documentation -- Class and methods documentation are available at https://ciatph.github.io/ph-municipalities. -- The documentation website's HTML files are available in the [`gh-pages`](https://github.com/ciatph/ph-municipalities/tree/gh-pages) branch of this repository. -- Class source codes are available at https://github.com/ciatph/ph-municipalities. +- Class and methods documentation are available at [https://ciatph.github.io/ph-municipalities](https://ciatph.github.io/ph-municipalities). +- Class source codes are available at the [ph-municipalities](https://github.com/ciatph/ph-municipalities) GitHub repository. +- The documentation website's HTML files are available in the [`gh-pages`](https://github.com/ciatph/ph-municipalities/tree/gh-pages) branch of the GitHub repository. - Refer to the [Building the Class Documentation](#building-the-class-documentation) section for more information about updating and building the class documentation. ## Requirements @@ -66,6 +66,156 @@ The following dependencies are used for this project. Feel free to use other dep +## FAQs + +
+ +What is the purpose or goal of ph-municipalities? + + +
+ +

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. + +
+ +
+ +
+ +Can ph-municipalities parse and extract PAGASA 10-day weather forecast data? + + +
+ +

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.

+ +
+ +
+ +
+ +Are there alternative libraries to ph-municipalities for listing Philippine provinces and municipalities? + + +
+ +

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.

+ + + +
+ +
+ +
+ +Is it possible to make ph-municipalities parse and extract PAGASA 10-day weather forecast data? + + +
+ +

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() + +``` + +
+ +
+ +
+ + + How does ph-municipalities determine which provinces belong to a region? + + + +
+ +The PAGASA 10-day Excel files only contain province and municipality names linked with weather data - _it has no region information_. Therefore, ph-municipalities link the province names in the 10-day Excel files to region/province names defined in the `/app/config/regions.json` file to determine which region they belong to. + +### The `/app/config/regions.json` file + +This file contains region/province names mapping encoded manually with reference from the region and province names listed in the [PAGASA Seasonal Forecast website's](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) Forecast Analysis Rainfall table. + +> **_NOTE:_**
+> The region/province mapping defined in this file may become outdated as time passes. ph-municipalities users are encouraged to [Use a Custom Configuration File](#using-a-custom-configuration-file), defining new region/province name mappings following the file's current format if they will notice region to province inconsistencies in the generated municipality lists. + +
+ +
+ +
+ + + Are the provinces and municipality list generated by ph-municipalities updated? + + + +
+ +

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. + +
+ +
+ ## Table of Contents
@@ -77,6 +227,7 @@ Click to expand the table of contents - [ph-municipalities](#ph-municipalities) - [Class Documentation](#class-documentation) - [Requirements](#requirements) +- [FAQs](#faqs) - [Table of Contents](#table-of-contents) - [Installation](#installation) - [Installation Using Docker](#installation-using-docker) diff --git a/app/src/classes/excel/index.js b/app/src/classes/excel/index.js index ab73c88..502770b 100644 --- a/app/src/classes/excel/index.js +++ b/app/src/classes/excel/index.js @@ -48,7 +48,7 @@ class ExcelFile { } /** - * Other app settings and configurations + * Other class settings and configurations * @type {Object.} */ #options = {