Script to sync data from USGS instantaneous water service.
- Rivers and states are fetched from the service url
- Rivers are grouped by state abbreviation
- Water reports are fetched and normalized for each state from USGS
- Dictionary holds river id's / new flows
- SQL insert statement is formed by iterating over river id / new flows dictionary
- Connect to postgres DB and execute insert statement
-
Install dependencies
npm i
-
Copy and fill environment variables
cp .env.sample .env
-
Run script
node index.js