Here are steps to import posts from AirTable to FightPandemics database for different environments. These are posts meant to "bootstrap" our application with usable content for initial users, but will become less important over time.
A few notes:
ssh -i ~/.ssh/fp-review-bastion.pem [ec2-user@3.92.4.126](<mailto:ec2-user@3.92.4.126>) & change directory to project cd FightPandemicscd backendnpm run import-posts -- -1 (if it fails because of a missing new dependency install that first npm i)ssh -i ~/.ssh/fp-staging-bastion.pem [ec2-user@54.166.3.62](<mailto:ec2-user@54.166.3.62>) & change directory to project cd FightPandemicsstaging branch already (check git status), pull the latest changes git pullcd backendnpm run import-posts -- -1 (if it fails because of a missing new dependency install that first npm i)ssh -i ~/.ssh/fp-production-bastion.pem [ec2-user@ec2-52-211-223-192.eu-west-1.compute.amazonaws.com](<mailto:ec2-user@ec2-52-211-223-192.eu-west-1.compute.amazonaws.com>)ssh mongo-airtable & change directory to project cd FightPandemicsproduction branch already (check git status), pull the latest changes git pullcd backendnpm run import-posts -- -1 (if it fails because of a missing new dependency install that first npm i)Addressing Errors:
After running the script you will see details for posts that failed import and followed by an overall summary: e.g. Imported 3591 from Airtable in 30.137s. Inserted 0 new posts; updated 3591 existing posts. 23 posts failed to import.
Errors can occur due to:
title or contentpost_type , post_needs or from_whom option was added not currently in the mappingbackend/scripts/import-posts/airtable-geocoded.json fileItems 2 & 3 require someone on the data collection team to update the post in AirTable.
Item 4 requires an updating of the file to include a geocoded location for that country/state/city combination.
As writing this, there haven't been new posts added to AirTable for many months and 23 unresolved errors (some belong to category 1 and should be ignored) so it is unclear if errors will need to be addressed in the future (since we are moving ever forward to more and more user added data).