lachlanjc / predictcovid

Visualize & track the 2020 COVID-19 pandemic by country.
https://predictcovid.netlify.app/
MIT License
111 stars 11 forks source link
coronavirus covid-19 covid19 dataviz prisma2 redwoodjs scraper
Banner with chart preview

Interactive COVID-19 Country Tracker

Built with RedwoodJS, an interactive visualization of the COVID-19 pandemic, charted country-to-country. Made by @lachlanjc + @zachlatta (while in isolation, of course).

Check it out live: predictcovid.netlify.app

Netlify Status

Development

Clone

git clone https://github.com/lachlanjc/predictcovid
cd covid19

Setup

We use Yarn as our package manager. To get the dependencies installed, just do this in the root directory:

yarn

Fire it up

yarn redwood dev

Your browser should open automatically to http://localhost:8910 to see the web app. Lambda functions run on http://localhost:8911 and are also proxied to http://localhost:8910/api/functions/*.

But we don’t have any data, or even a database!

Database

We’re using Prisma2, a modern DB toolkit to query, migrate and model your database.

Prisma2 is not ready for production at the moment.

To create a development database:

yarn redwood db up

This will read the schema definition in api/prisma/schema.prisma and generate a SQLite database in api/prisma/dev.db

(If you’ve made changes to the schema run yarn redwood db save to generate a migration, and yarn redwood db up to apply the migration/generate a new ORM client.)

Downloading data

First, seed the database:

yarn redwood db seed

Now, run the scraper. In one terminal, start the server (yarn rw dev), and in another, make this request:

curl http://localhost:8911/scrape

(Note: it will eventually hang, first on your curl request, & then the scraper doesn’t currently print a success message.)

You should be good to go now! Open localhost:8910 & enjoy development.


Thanks to dDara for the icon.

MIT License