azavea / ism-watershed-wellness-snapshot

A tool to collect and display watershed wellness indicators for the International Seaport Museum
1 stars 2 forks source link

Always show data for sensors and handle sensor errors #63

Closed fungjj92 closed 5 years ago

fungjj92 commented 5 years ago

Overview

The app will show the most up to date data, and we want that to be the case when sensor requests fail too. #20 set up initial data retrieval and this PR deepens that work by adding error handling.

The fall through process prefers in this order:

most recent real data of:

else:

The dummy values I based off of current-ish values I was seeing from each sensor but that don't have any meaning really.

Connects #59

Demo

screen shot 2019-02-27 at 1 44 14 pm

Notes

I don't feel great about it, but in order to get data from the USGS APIs when they fail, we need to supply a starting date querystring, which is the last known date that the sensor has data. I added those dates to constants. They will always work, but become outdated over time insofar that we'll poll for more data than we need. I did not find a programatic and dynamic way to discover these dates.

I plan to rebase on #62 before merge

Testing Instructions

./scripts/server and see that the redux store has real data for all 3 sensors !

Please logically step through the pollSensor action and double check what I've done.

fungjj92 commented 5 years ago

Rebased on develop including #62, and tested. Appears fine 🤞

fungjj92 commented 5 years ago

Thanks for the reviews! Beat me to commenting.

Prettier is now set up the work on save on my editor, VS Code. I had installed several Prettier plugins last week, but ultimately I needed to npm install Prettier locally for the plugin(s) to work in the editor.

I created #63 to capture the discussion of date constants.