The USDA Nutrition database is delivered in a not very convenient set of files with weird CSV encoding.
Follow this steps to migrate it to a postgreSQL database.
-
Clone this repo and navigate to the created folder.
-
Download the USDA files from their website. The files should be under a section called Download SRxx files.
-
Unzip the files in the db/usda_files folder.
-
Run the migration script
chmod +x ./scripts/migrate.sh && ./scripts/migrate.sh
Stack Overflow discussion that pointed me in the direction to create this migration script.
- Be able to change the name of the DB on the migration scripts
- Fix primary keys