Skip to content

v1.1.0 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/components/BannerText.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
function BannerText () {
const version = process.env.RELEASE_VERSION ?? '0.0.0'
const repository = 'acap-v2'

return (
<a href={process.env.RELEASE_PAGE ?? '#'} target="_blank" rel="noreferrer">
🎉 {version}, dev branch @{process.env.COMMIT_ID ?? '123456'} is released. Read more →
🎉 {repository} - {version}, dev branch @{process.env.COMMIT_ID ?? '123456'} is released. Read more →
</a>
)
}
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/articles/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"deployment": "Deployment",
"pdf-development": "PDF Development"
"pdf-development": "PDF Development",
"provinces-municipalities": "Provinces and Municipalities",
"opensource-libraries": "Open Source Libraries"
}
25 changes: 25 additions & 0 deletions docs/pages/articles/opensource-libraries.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Callout } from 'nextra/components'

# Use of Open Source Libraries and Frameworks

## Mainstream Libraries

The ACAP, a web application built with React (NextJS), Node, and Firebase, uses mainstream, community-driven open source, well-tested, and documented Node libraries and frameworks, including but not limited to [React](https://www.npmjs.com/package/react)/[NextJS](https://nextjs.org/), [ExpressJS](https://www.npmjs.com/package/express/), [Firebase](https://www.npmjs.com/package/firebase), [Leaflet](https://www.npmjs.com/package/react-leaflet), [Axios](https://www.npmjs.com/package/axios), and lots more.

A comprehensive list of these libraries and their versions used within the project are available in the [client](/directories/client) and [server](/directories/server) `package.json` files of the ACAP project.

## Other Libraries

Besides using mainstream libraries, ACAP also uses **two (2)** newer, well-tested, and documented open-source libraries to efficiently manage specific low-impact requirements in a focused and easily extendable manner, set apart from ACAP's growing collection of internal libraries and scripts. These libraries used the open-source model to enhance collaboration and foster community contributions, ensuring that ACAP can optionally benefit from ongoing improvements and feedback, with coordination with future ACAP Maintainers.

> These libraries encourage community contributions and feedback, with their main Maintainer overseeing the development process to ensure that all updates and contributions align with the project's goals and standards. Community input is valued and considered, but final decisions regarding updates will rest with the Maintainer.

**One of these libraries**, in particular, has goals of enhancing and thoroughly testing possible [Regional Provinces / Municipalities Inconsistency](/articles/provinces-municipalities/#regional-provinces--municipalities-inconsistency) by offering tailored functionality and methods that will automatically sync PAGASA 10-day region/province/municipality names with PSGC data, resulting in less maintenance (customization) burden which is already beyond the original ACAP project timeline, project scope, and deliverables. _This initiative is essential to enhance the accuracy and reliability of the data used in the ACAP project, which is crucial for its functionality._

> Since library updates and enhancements may extend beyond the ACAP project timeline, future ACAP Maintainers and developers can choose whether to adopt its updates, continue using the current version, or adopt entirely new solutions.

These libraries, designed for compatibility and easy extension, follow semantic versioning. Their codes and logic, following safety and security practices, are available for inspection in the public NPM registry.

<Callout>
For more information about these open-source libraries and their goals and motivations within the ACAP project, kindly contact the ACAP Maintainers.
</Callout>
153 changes: 153 additions & 0 deletions docs/pages/articles/provinces-municipalities.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
import { Callout, FileTree, Steps } from 'nextra/components'

export function FAQBox({ title, children, open=false }) {
return (
<details
open={open}
className="last-of-type:mb-0 rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2 mt-4"
>
<summary>
<strong className="text-md">{title}</strong>
</summary>
<div className="nx-p-2">{children}</div>
</details>
)
}

# Provinces and Municipalities

## Data Source

ACAP uses a combination of the [PAGASA 10-day weather forecast Excel files](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast) and the [PAGASA Seasonal Forecast- Rainfall Analysis Table](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) as a data source for its region, provinces, and municipalities list.

## FAQs

<FAQBox title="Where does ACAP source its provinces and municipalities list?">
ACAP uses the provinces and municipalities list defined in the [PAGASA 10-day weather forecast Excel files](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast), initializing or updating its internal list (per region) after running the `npm run cron:tenday` NPM script.
</FAQBox>

<FAQBox title="The PAGASA 10-day weather forecast Excel files do not have region names. How does ACAP know which provinces belong to a region?">
ACAP uses the region-province grouping from the [PAGASA Seasonal Forecast](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) - Rainfall Analysis Table to determine which provinces belong to a region as a reference since it also processes provincial seasonal weather forecast information from the PAGASA Seasonal Forecast. ACAP expects province naming from the two (2) data sources (PAGASA 10-day and Seasonal weather forecasts) to match since both are data products produced by PAGASA.

ACAP initializes its province list during the [Server Setup](/installation/server-setup/#initialize-provinces-and-municipalities) stage.
</FAQBox>

<FAQBox title="Do province names from the PAGASA Seasonal Forecast data always match with the province names in the PAGASA 10-day Excel files?">
No. After more recent tests, it came to light that some province names defined in the <u>PAGASA Seasonal Forecast (Rainfall Table)</u> may not always match the province names defined in the <u>PAGASA 10-day Excel</u> files.

For example, as of _September 17, 2024_, the `"Davao Occidental"` province is present in the PAGASA Seasonal Forecast (Rainfall Table) under **Region XI (Davao Region)**. However, it is missing in the PAGASA 10-Day Excel files.

Similarly, the `"Shariff Kabunsuan"` province is available in the PAGASA 10-Day Excel files, but it is nowhere to be found in the PAGASA Seasonal Forecast (Rainfall Table).

Refer to the [Regional Provinces / Municipalities Inconsistency](#regional-provinces--municipalities-inconsistency) section for more information about possible causes of region/province/municipality naming inconsistencies.
</FAQBox>

<FAQBox title="How should ACAP approach inconsistent region/province/municipality naming conventions from the PAGASA 10-Day and Seasonal data?">

ACAP does not yet support syncing drastic national geopolitical or administrative divisions updates within the PAGSA 10-day weather forecast Excel files since it aims to use and display raw, un-altered 10-day weather forecast data "as-is" from PAGASA, including provinces and municipality names.

<Callout>
However, there are ways to update or change the region in which a province belongs, _**provided its name is present**_ in the PAGASA 10-day Excel file. Refer to the [Updating Regional Provinces](#updating-regional-provinces) section to know more about this method.
</Callout>

<Callout type="warning">
Drastic updates to the region/province/municipalities naming convention or regional/provincial grouping that will thoroughly transform the original PAGASA 10-day weather forecast Excel file contents will require customization of forked ACAP **backend** or **frontend** codes and **NPM scripts** that facilitate 10-day weather forecast updating and seasonal weather forecast uploading to accommodate custom naming or grouping needs.

Refer to the [Intensive Province/Municipalities Customizations](#intensive-provincemunicipalities-customizations) section for more information about this approach.
</Callout>
</FAQBox>

<FAQBox title="Are the regional province lists generated by the 'npm run pagasa:municipalities' script updated?">
It is not yet thoroughly tested if the regional province lists generated by ACAP's `npm run pagasa:municipalities` script are updated (synced with the latest [PSCG](https://psa.gov.ph/classification/psgc) administrative divisions) for ALL regions, except Region 5.

The `pagasa:municipalities` NPM script, which uses the [ph-municipalities](https://www.npmjs.com/package/ph-municipalities) library's **`npm run list:region`** CLI script under the hood uses a static-defined region-to-province [mapping file](https://github.com/ciatph/ph-municipalities/blob/dev/app/config/regions.json) updated on 2024 regarding the available [PAGASA Seasonal Forecast- Rainfall Analysis Table](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast).

<Callout type="warning">
It is also subject to possible outdated region/province/municipality naming content mentioned in the [Regional Provinces / Municipalities Inconsistency](#regional-provinces--municipalities-inconsistency) section.
</Callout>

Refer to the [Updating Regional Provinces](#updating-regional-provinces) section for more troubleshooting information if this script generates regional province lists with missing or extra provinces.
</FAQBox>

<FAQBox title="Why are some municipalities greyed out (disabled) from dropdown lists?">
Sometimes, ACAP users or developers may notice several greyed out (disabled) municipalities listed from the dropdown menus in the Cropping Calendar, 10-day weather forecast, or crop recommendations pages.

Inconsistent (or missing) municipality names between cropping calendars and the PAGASA 10-day weather forecast, which ACAP considers its "official" source of provinces and municipality listing, often causes municipalities to be disabled or greyed out.

<Callout>
ACAP tracks inconsistent-named municipalities between these two (2) sources to promote consistent municipality naming conventions on every successful upload of cropping calendars or run of the `npm run cron:tenday` script, flagging those which it finds inconsistent.

Since ACAP officially uses the PAGASA 10-day weather forecast municipality names, it will not find missing (or misspelled) municipality names in the cropping calendar when determining a selected municipality's crop stage(s) during recommendations generation.
</Callout>

To enable the greyed-out municipalities, upload cropping calendars that follow the PAGASA 10-day weather forecast municipality names and [cropping calendar Excel format](/post-installation/cropping-calendar/calendar-v2/#data-format). Inconsistent-named municipalities are available for viewing in the development and production **Firestore document** for reference:

```bash copy
/constant_data/diffs
```
</FAQBox>

## Regional Provinces / Municipalities Inconsistency

While ACAP Bicol (Region 5) or other regions generally may sync well with its provinces and municipalities listed from the PAGASA 10-day weather forecast Excel data source, several factors may affect its consistency in the long run.

- Updates in the Philippine geopolitical or administrative divisions in the future (usually mandated by the [Philippine Standard Geographic Code](https://psa.gov.ph/classification/psgc) (PSGC)) may take some time to reflect on the contents and naming convention within the <u>PAGASA 10-day weather forecast Excel</u> files <u>or Seasonal Forecast - Rainfall Analysis Table</u>.

- It is not yet thoroughly tested if ALL regions, provinces, and municipality names from <u>PAGASA's 10-day weather forecast Excel files</u> (`provinces and municipalities`) and their <u>Seasonal Weather Forecast - Rainfall Analysis table</u> (`regions and provinces`) are up to date with the latest Philippine administrative divisions.

## Updating Regional Provinces

This simple region-province grouping method assigns the PAGASA 10-day Excel files' provinces (and their associated municipalities) to a region without transforming or altering the original province/municipalities naming contents of the 10-day Excel files.

<Callout type="warning">
It requires target province(s) defined in the PAGASA 10-day Excel file to work.
</Callout>

<Steps>

### Confirm target provinces

1. Download and open a PAGASA 10-day weather forecast Excel file from the [PAGASA 10-Day Climate Forecast web page](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast).

2. Find the province(s) in the downloaded Excel file to add to your region.
- These province(s) may belong to other regions generated by the `npm run pagasa:municipalities` script, or they may be missing from the list but exist in the 10-day Excel files.

### Add province to a region

Add new provinces(s) to a region's list of provinces from province names confirmed on **step #1**. For example to add the `"Isabela"` province to ACAP Bicol's list of provinces, add `"Isabela"` to the server's `PROVINCES` variable in the `.env` file.

```env copy
PROVINCES=Albay,Camarines Norte,Camarines Sur,Catanduanes,Masbate,Sorsogon,Isabela
PROVINCES_ARCHIVE...
```

### Remove a province

Similarly to remove a province from a region, remove its text string from the `PROVINCES` (or `PROVINCES_ARCHIVE`) server environment variables.

### Sync new provinces

Run the script after [adding](#add-province-to-a-region) or [removing](#remove-a-province) a province from a region to update ACAP's list of provinces and municipalities.

```bash copy
npm run cron:tenday
```
</Steps>

## Intensive Province/Municipalities Customizations

For **intensive naming and grouping transformation** beyond the simple method covered in the [Updating Regional Provinces](#updating-regional-provinces) section, developers can start checking the `/server/src/scripts/cron/update_tenday_weather` **"group" of scripts**, possibly extending and overriding its **`/classes/exceladapter/index.js`** class. This class [_extends_](https://javascript.info/class-inheritance#the-extends-keyword) the **ph-municipalities** library's `ExcelFile` class for managing the PAGASA 10-day Excel provinces/municipality lists.

The `ExcelFile` class has available [class methods, functions, and constructors](https://ciatph.github.io/ph-municipalities/ExcelFile.html) dedicated and tested to parsing provinces/municipality lists from a PAGASA 10-day weather forecast Excel file, which developers can [_override_](https://javascript.info/class-inheritance#overriding-a-method) and [_extend_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends) within ACAP's existing class scripts to customize region/province/municipality grouping and naming processing.

Some parts of the **front end** may also need updating depending on the level of customization required.

<Callout type="warning">
This method will _alter_ the original (province and municipalities) naming convention of a PAGASA 10-day weather forecast Excel file. Consult and deliberate first if this is a requirement before proceeding.

Indicate notices and messages in the public ACAP front end about these changes to the PAGASA 10-day provinces and municipalities naming and grouping for transparency.
</Callout>

## References

- This page is related to the [Server Setup - Initialize provinces and municipalities](/installation/server-setup/#initialize-provinces-and-municipalities) section.
6 changes: 3 additions & 3 deletions docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ Version 2.0 and later versions may have new requirements that will thrive on new
6. Optional search engine optimization [(SEO) settings](/post-installation/google-search) with Google Search Console
7. REST APIs (NodeJS)
- New endpoints for processing cropping calendar and recommendations Excel file uploads
- Migration of the ACAP-RCMAS APIs from the (forked) mirror environment with optional activation
- Migration of the [ACAP-RCMAS REST APIs](/post-installation/acap-rcmas-api) from the (forked) mirror environment with optional activation and deployment

#### Changed

1. Public/admin seasonal recommendations and bulletin PDF generation
- Removal of the month trigger for determining the crop stage/s
- Removal of the single-month selection trigger for determining the crop stage/s
- Removal of the rainfall condition trigger
2. Public/admin 10-day recommendations and bulletin PDF generation
- Removal of the dates trigger for determining the crop stage/s
- Removal of the dates trigger within the active PAGASA 10-day date range for determining the crop stage/s
3. Deprecation of the **uploaders** group of Node Package Manager (NPM) scripts in favor of cropping calendar/recommendations Excel file upload through the UI
4. Allow creating seasonal bulletin PDFs with more than one (1) page.
5. Text blast recipients by province/municipality instead of individual selection
Expand Down
Loading
Loading