Skip to content

Commit

Permalink
Merge pull request #115 from ciatph/dev
Browse files Browse the repository at this point in the history
v1.4.1
  • Loading branch information
ciatph authored Sep 13, 2024
2 parents 01bc0b9 + 138dd62 commit 2b40014
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 30 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Manual Trigger Workflow with loglevel & tags
#get log & tags information
on:
workflow_dispatch:
branches:
- wip/dispatch
- dev
inputs:
logLevel:
description: 'Log level'
required: true
default: 'information'
type: choice
options:
- information
- debug
- warning
- critical
tags:
description: 'Purpose of Run This Workflow?'
required: true
type: string

jobs:
print-tag:
runs-on: ubuntu-latest
steps:
- name: Print the purpose of run
run: echo ${{ inputs.tags }} purpose
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ The following dependencies are used for this project. Feel free to use other dep
- Checkout the excel file format on the `/app/data/day1.xlsx` sample file for more information
5. (Optional) Download URL for a remote excel file.
- See the `EXCEL_FILE_URL` variable on the [Installation](#installation) section.
6. (Optional) Docker
- Use Docker for localhost development
- See the [Docker Dependencies](#docker-dependencies) section for more information.

</details>

<span id="faqs"></span>
## FAQs

<details>
<summary style="color: #808080; font-size: 24px;">
<summary style="color: #808080; font-size: 22px;">
<b>What is the purpose or goal of ph-municipalities?</b>
</summary>

Expand All @@ -89,7 +92,7 @@ Its early stages were written as procedural functions within a _private backend
<br>

<details>
<summary style="color: #808080; font-size: 24px;">
<summary style="color: #808080; font-size: 22px;">
<b>Can ph-municipalities parse and extract PAGASA 10-day weather forecast data?</b>
</summary>

Expand All @@ -104,7 +107,7 @@ ph-municipalities only have class methods for parsing, extracting, listing and q
<br>

<details>
<summary style="color: #808080; font-size: 24px;" id="similar-libraries">
<summary style="color: #808080; font-size: 22px;" id="similar-libraries">
<b>Are there alternative libraries to ph-municipalities for listing Philippine provinces and municipalities?</b>
</summary>

Expand All @@ -129,15 +132,15 @@ Note, however, that these items use old and new data sources. These may not be f
<br>

<details>
<summary style="color: #808080; font-size: 24px;">
<summary style="color: #808080; font-size: 22px;">
<b>Is it possible to make ph-municipalities parse and extract PAGASA 10-day weather forecast data?</b>
</summary>

<br>

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_.
While ph-municipalites do not support parsing and extracting PAGASA 10-day weather forecast data, _you can extend the `ExcelFile` or `ExcelFactory` classes with custom logic and codes to enable parsing and extracting PAGASA 10-day weather forecast data_.

Since the `ExcelFile` or `ExcelAdapter` are [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/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](https://ciatph.github.io/ph-municipalities) to know more about the available classes, member variables, and methods.
Since the `ExcelFile` or `ExcelFactory` are JavaScript [Classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/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](https://ciatph.github.io/ph-municipalities) 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:

Expand Down Expand Up @@ -174,8 +177,8 @@ weatherForecast = parser.getWeatherData()
<br>

<details>
<summary style="color: #808080; font-size: 24px;">
<span style="color: #808080; font-size: 24px;">
<summary style="color: #808080; font-size: 22px;">
<span style="color: #808080; font-size: 22px;">
<b>How does ph-municipalities determine which provinces belong to a region?</b>
</span>
</summary>
Expand All @@ -196,18 +199,18 @@ This file contains region/province names mapping encoded manually with reference
<br>

<details>
<summary style="color: #808080; font-size: 24px;">
<span style="color: #808080; font-size: 24px;">
<b>Are the provinces and municipality list generated by ph-municipalities updated?</b>
<summary style="color: #808080; font-size: 22px;">
<span style="color: #808080; font-size: 22px;">
<b>Are the provinces and municipality lists generated by ph-municipalities updated?</b>
</span>
</summary>

<br>

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:
NO. By default, ph-municipalities use an outdated PAGASA 10-day Excel file 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:

- 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
- Providing [class methods](https://ciatph.github.io/ph-municipalities/ExcelFile.html#download) for programmatically downloading and using 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:**<br>
Expand Down Expand Up @@ -452,7 +455,7 @@ npm run list:region
Builds the class documentation into the **/docs** directory.
> [!NOTE]
> **NOTE:**<br>
> This script requires manual installation of the `jsdoc@4.0.3`, `minami@1.2.3`, and `taffydb@2.7.3` packages as **devDependencies** inside the **/app** directory.
> These libraries, only used for building the class documentation, were excluded from the final package.json to have fewer external dependencies.
> ```bash
Expand All @@ -464,7 +467,7 @@ Builds the class documentation into the **/docs** directory.
Runs the Bash script that installs the JSDoc and theme dependencies for building the class documentation only within the **development Docker environment**.
> [!NOTE]
> **NOTE:**<br>
> This script requires running from a Bash terminal - it won't work from a Windows command line terminal. It is reserved for building the documentation with Docker.
This script is used for building the class documentation from a local Docker environment along with the `npm run docs:build` NPM script.
Expand All @@ -478,7 +481,7 @@ docker exec -u root -it ph-municipalities npm run docs:build

Runs the Bash script that builds the class documentation using JSDoc only within the **development Docker environment**.

> [!NOTE]
> **NOTE:**<br>
> This script requires running from a Bash terminal - it won't work from a Windows command line terminal. It is reserved for building the documentation with Docker.
This script is used for building the class documentation from a local Docker environment along with the `npm run docs:install` NPM script.
Expand Down
12 changes: 8 additions & 4 deletions app/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ dist/
*.zip
*.tgz
*.txt
*.tgz
*.png
*.sh
*.md
*.tmp

.env.example
.eslintrc.js
.eslintrc_win.js
.gitignore
.npmignore
.eslintignore
README.md
README.tmp

# Ignore all JSON files except:
!package.json
Expand All @@ -34,7 +33,12 @@ src/examples/
docs/
diagrams/

# Docker
# Exclude the __tests__ directory except for some files
__tests__/**/*
!__tests__/provinces/**/*.js
!__tests__/classInitialization/checkClass.js

# Docker and other files
Dockerfile
.dockerignore
jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ describe('Municipalities per province count match', () => {
const missingInConfig = allProvinces.filter(item => !allProvincesConfig.includes(item))

if (missingInParsed.length > 0) {
let msg = `[WARNING]: ${missingInParsed.length} province(s) in the 10-Day Excel file are missing\n`
msg += `in the (PAGASA seasonal) config: ${arrayToString(missingInParsed)}`
let msg = `[WARNING]: ${missingInParsed.length} province(s) missing in the 10-Day Excel file\n`
msg += `but present in the (PAGASA seasonal) config: ${arrayToString(missingInParsed)}`
logger.log(msg, { color: ColorLog.COLORS.TEXT.YELLOW })
}

if (missingInConfig.length > 0) {
let msg = `[WARNING]: ${missingInConfig.length} province(s) in the (PAGASA seasonal) config are missing\n`
msg += `in the 10-Day Excel file: ${arrayToString(missingInConfig)}`
let msg = `[WARNING]: ${missingInConfig.length} province(s) in the (PAGASA seasonal) config is/are missing\n`
msg += `but available in the 10-Day Excel file: ${arrayToString(missingInConfig)}`
logger.log(msg, { color: ColorLog.COLORS.TEXT.YELLOW })
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/__tests__/provinces/updateInstances.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const updateInstances = ({
if (fromConfig.length > 0) {
uniqueProvinces = new Set(allProvinces.filter(item => !fromConfig.includes(item)))

let msg = `[WARNING]: ${fromConfig.length} province(s) in the (PAGASA seasonal) config are missing\n`
let msg = `[WARNING]: ${fromConfig.length} province(s) from the (PAGASA seasonal) config are missing \n`
msg += `in the 10-Day Excel file: ${arrayToString(fromConfig)}`

logger.log(msg)
Expand All @@ -41,8 +41,8 @@ const updateInstances = ({
// Provinces present in the 10-Day Excel file but missing in the config (PAGASA seasonal) file
if (fromExcel.length > 0) {
uniqueExcelProvinces = new Set(allExcelProvinces.filter(item => !fromExcel.includes(item)))
let msg = `[WARNING]: ${fromExcel.length} province(s) in the 10-Day Excel file are missing\n`
msg += `in the (PAGASA seasonal) config: ${arrayToString(fromExcel)}`
let msg = `[WARNING]: ${fromExcel.length} province(s) present in the 10-Day Excel file\n`
msg += `but missing in the (PAGASA seasonal) config: ${arrayToString(fromExcel)}`
logger.log(msg)
}

Expand Down
2 changes: 2 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const ExcelFile = require('./src/classes/excel')
const ExcelFactory = require('./src/classes/excelfactory')
const Schema = require('./src/classes/schema')
const ColorLog = require('./src/classes/colorlog')

module.exports = {
ColorLog,
ExcelFile,
ExcelFactory,
Schema
Expand Down
4 changes: 2 additions & 2 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ph-municipalities",
"version": "1.4.0",
"version": "1.4.1",
"description": "List and write the `municipalities` of Philippines provinces or regions into JSON files",
"main": "index.js",
"engines": {
Expand Down

0 comments on commit 2b40014

Please sign in to comment.