/
Working with crop data

Working with crop data

crop_id in crop spreadsheets indicates the crop_id in the beta database. Keep in mind that the same crop will have different crop_ids on the dev/beta/production database. While creating migrations, crop_common_name + crop_genus + crop_specie + farm_id (farm_id will be null for all default crops) should be used as unique identifier instead of crop_id.

To get crop_common_name + crop_genus + crop_specie + farm_id of each crop, developers can use the crop_id on spreadsheets to look up individual crops in beta database. To create a migration, crop_id need to be replaced by looked up crop_common_name + crop_genus + crop_specie.

Migration example:
https://github.com/LiteFarmOrg/LiteFarm/blob/develop/packages/api/db/migration/20211109193450_update_default_crop_hs_code.js

https://github.com/LiteFarmOrg/LiteFarm/blob/develop/packages/api/db/seeds/seedData/cropHscodeByCropCommonNameV2.json

crop image batch processing tool:

https://imagemagick.org/index.php

https://github.com/h2non/imaginary

 

Related content

Navigating and querying the LiteFarm database
Navigating and querying the LiteFarm database
Read with this
Crop variables and calculations
Crop variables and calculations
More like this
Testing heuristics
Testing heuristics
Read with this
Crops V2.0
Crops V2.0
More like this
Synchronous/asynchronous responses
Synchronous/asynchronous responses
Read with this
LF-2848 Test plan
LF-2848 Test plan
More like this