People may not practice social distancing and/or leave the house if they don't feel like Coronavirus is close enough to them. The news is increasingly filled with reports of groups that met during quarantine, and unfortunately contributed to local outbreaks. By the time it's too close, it's too late!

We wanted to make a data-driven case to help people to understand that the best way to be supportive and a good citizen is to Stay home.

Last week, my teammate Alex did a geospatial data analysis in a Jupyter notebook to help a traveling friend understand the situation they were getting into in a Jupyter notebook. Upon realizing that this analysis might be helpful to other people, we decided to productionize the idea into full app.

What it does

In a matter of seconds, viewers will be able to know the degree to which Coronavirus cases are within driving distance just by entering their city name or zipcode.

We generate interactive "isochrone maps", a technique which visualizes the area someone can reach in 60 minutes of driving from their current location. We leveraged county shapefiles from the Census, along with county-level case data published by Texas DSHS and national level data from Johns Hopkins.

The aggregations can be recalculated daily by running a script and redeploying the backend.

How we built it

  • Geopandas/Shapely/Pandas based data pipeline generating county level summary statistics
  • Interactive LeaflefJS Map generated by Folium, displaying County Case Counts and Isochrone (Travel distance) data
  • NextJS/React frontend built with components from Semantic-UI
  • Backend is a hybrid of Darklang and Python lambda functions managed by the Serverless framework
  • Caching via AWS Cloudfront + API Gateway
  • Analytics with Datadog RUM + Google Analytics + Serverless Dashboard

Challenges we ran into

  • Incorporating outputs from a Python script into a react-based application
  • Bringing page loading performance down to a consistently manageable duration
  • Normalizing addresses so that we could make the most of limited geocoding/route-finding credits

Accomplishments that we're proud of

  • Setting up a complete full stack application with a scalable + cost-manageable lambda architecture
  • Making the page accessible through mobile responsiveness, generating shareable links to avoid the need for extra typing, and cards/links for ease of sharing on social media
  • Getting the response time down from 10 seconds to under a second through server-side rendering + heavy caching on the backend, while conserving usage of external APIs
  • First time using Darklang for a non-tutorial application

What we learned

  • Keeping the UI simple and clean is challenging, it's tempting to add more UI elements than are necessary after you've spent a while looking at the data.
  • Deploying infrastructure on AWS may take longer than you think
  • A microservice/lambda architecture is a decent way to make the elements of a Jupyter notebook reusable, as it enables Python and Javascript code to be combined without too much effort.

What's next for LoveTexans: Covid Cases Near You

  • Incorporating data from more states in the US (not every state has data available at the county level that we know of, yet)
  • Improving address recommendations, possibly with Algolia, to reduce incidences of cases with 0 matches
  • Scaling up the data pipeline to allow for more granular searches (e.g. using travel radii different from 1 hour)
  • Localization to support viewers in other languages
  • Hosting the code which can rebuild the data files + redeploy the application daily (rather than running locally)

Built With

Share this project: