Skip to content
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 .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
EXCEL_FILENAME=somefile.xlsx
EXCEL_FILENAME=somefile.xlsx
CSV_FILENAME=somefile.csv
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules/
*.zip
*.json
*.env
*.~lock.*
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ Sub item is in the same line as the unordered main item.

3. Create a `.env` file from the `.env.example` file. Replace `EXCEL_FILENAME` with a target excel file's filename relative to the `/src/01_recommendations` directory.

4. See the excel parser script's example usage on<br>
`/src/01_recommendations/index.js`
| Variable Name | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EXCEL_FILENAME | Excel file name relative to the `/src/01_recommendations` scripts directory |
| CSV_FILENAME | CSV file name relative to the `/src/02_crop_calendar` scripts |
| FIREBASE_SERVICE_ACC | The project's private key file contents, condensed into one line and minus all whitespace characters.<br><br>The service account JSON file is generated from the Firebase project's **Project Settings** page, on **Project Settings** -> **Service accounts** -> **Generate new private key** |
| FIREBASE_PRIVATE_KEY | The `private_key` entry from the service account JSON file.<br> <blockquote>**NOTE:** Take note to make sure that the value starts and ends with a double-quote on WINDOWS OS localhost. Some systems may or may not require the double-quotes (i.e., Ubuntu).</blockquote> |

## Available scripts

Expand All @@ -115,11 +119,17 @@ Check source codes for lint errors.

Fix lint errors.

### `npm run parse`
### `npm run process:recommendations`

Normalize an unconventional, complex excel file into an array of simple JS objects with columns containing messy (ordered and unordered) bullet lists converted into organized HTML list tags.
Normalize an excel file into an array of simple JS objects with columns containing messy HTML tags bullet lists.

> **WARNING:** The script does not support `-` (dash) symbols.
### `npm run process:calendar`

Normalize and upload the new cropping calendar data.

### `npm run process:details`

Normalize and upload the new municipalities and other details attached to the crop recommendations.

@ciatph<br>
20221205
Loading