A lot of people had amazing suggestions on the COVID-19 visualization and I implemented many of them to make the visualization as useful to as many people as possible. One specific suggestion -- to allow the visualization to "remember" your previous choice -- was added with a quick bit of code to use a cookie to remember your previously selected county and state.
Even though this feature was added nearly two weeks ago, I was never entirely happy with it. Specifically, when a cookie is used, all of the data stored in the cookie is sent to the server every time a page is loaded. For this site, that is absolutely not needed -- the highlighting of a selected country on the COVID-19 visualization is done inside of your web browser and not by the server. I was certain there was a way to do this better: How can I store user settings without needing to send the data to the server?
The goal of my second 91-DIVOC project was to explore the storage options available for "remembering" user preferences without a database. I found that every modern browser supports three ways:
sessionStorage, stores data for the current session but lost when the browser is closed
localStorage, stores data with no expiration date and persists when the browser is closed
localStorage is the winner -- a large amount of data can be stored, the data is private (never sent to the server), and
persists for a long time. But how can I build something to explore this technology?
Reflecting on the past week, I found myself caring less and less on the depressing global statistics and focusing more on the cases and deaths in the communities where I have people I love. The University of Illinois is located in Champaign County, Illinois and, as April 5, 2020, the cases have started to explode -- 400% growth, from 11 to 55 cases, all in the past week.
My second project was to create a COVID-19 tool that shows only the data from the locations that means the most to you:
If you have never created something that has had user preferences saved locally -- not without a database or other infrastructure -- this was surprisingly easy. It's worth getting it a shot and I hope you go start creating! :)