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:

ImageMagick – Mastering Digital Image Alchemy

https://github.com/h2non/imaginary