ACAP 1.0 Crop Recommendations
Introduction
ACAP 1.0 usesĀ NPM scriptsĀ to parse, validate, and upload recommendations data from a local Excel file. Similar to theĀ ACAP 1.0 cropping calendar data, only developers can upload recommendations by running the NPM script on a terminal.
This section describes methods for uploading the local recommendations dataset for the older ACAP 1.0. Its last stable version is Release/Tag version v9.5.6 (opens in a new tab),Ā accessible in theĀ climate-services-webportal-v1 and acap-v2 code repositories.
Follow thisĀ link to view recommendations dataset upload instructions for the latestĀ ACAP 2.0.
Data Format
ACAP 1.0 requires initial recommendations data in an Excel file, following the format and structure defined in theĀ /server/src/scripts/data/recommendations_html_acap_bicol.xlsx
or the mock_recommendations_html_v2.xlsx
Ā samples. This Excel file has tabs containing formatted recommendations data, with crop stages and weather forecast rainfall conditions, for the seasonal, 10-day, and severe cyclone weather crop recommendations.
- recommendations_html_acap_bicol.xlsx
- mock_recommendations_html_v2.xlsx
The crop stage labels in the Excel columns should match the crop stage codes defined in the ACAP 1.0 cropping calendar raw CSV file to ensure the correct association of crop stages with target recommendations.
Upload Recommendations
ACAP 1.0 uploads its recommendations dataset to the Firestore database using NPM scripts, accessible only to developers.
Prepare recommendations data
-
Prepare the recommendations dataset in an Excel file similar to the recommendations samples described in the Data Format section.
-
Put the EXCEL file in the
/server/src/scripts/uploaders/recommendations
directory.
- recommendations_html_acap_bicol.xlsx
Use a target environment
Open the server .env
file. Update the FIREBASE_SERVICE_ACC
and FIREBASE_PRIVATE_KEY
keys with the development or production key values.
Run the NPM Script
This script only works for ACAP 1.0, whose last stable version isĀ v9.5.6. It has no backward compatibility for ACAP 2.0 and later versions and thus may fail to work as expected.
-
Navigate to the
/server
directory from a terminal. -
Run the command, replacing
recommendations_html_acap_bicol.xlsx
with the filename of a recommendations EXCEL file placed in the directory specified in the Prepare recommendations data step:npm run upload:recommendations --localfilename=recommendations_html_acap_bicol.xlsx
-
Ensure running the script from step #3 is completed successfully.