GithubHelp home page GithubHelp logo

lachlanjc / predictcovid Goto Github PK

View Code? Open in Web Editor NEW
112.0 8.0 11.0 1.16 MB

Visualize & track the 2020 COVID-19 pandemic by country.

Home Page: https://predictcovid.netlify.app/

License: MIT License

JavaScript 90.54% CSS 4.11% HTML 5.35%
dataviz covid19 redwoodjs scraper coronavirus prisma2 covid-19

predictcovid's Introduction

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

predictcovid's People

Contributors

lachlanjc avatar peterp avatar zachlatta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predictcovid's Issues

Normalize by country population

Hello,
it would be cool if we could normalize the figures by e.g. by infections per million inhabitants.
Italy has ~60 million inhabitants. Comparing against the U.S. (~300 million inhabitants) by total figures doesn't make much sense imho.

prisma Schema Parsing no such argument

I'm trying to get a local running version of this, but I can't get the database up.

  1. I changed the datasource in schema.prisma to sqlite which was mentioned in another issue.
  2. I ran yarn redwood db up

The error I'm getting is:

Error: Schema parsing
error: No such argument.
  -->  schema.prisma:29
   | 
28 |   id                Int     @id @default(autoincrement())
29 |   date              Day     @relation(fields: [dayId], references: [id])
   | 
error: No such argument.
  -->  schema.prisma:30
   | 
29 |   date              Day     @relation(fields: [dayId], references: [id])
30 |   country           Country @relation(fields: [countryId], references: [id])
   | 

Validation Error Count: 2

Any advice would be great! I'd love to help with #4 too.

Can't setup dev sqlite database

Hi,

I do not know yarn and nodejs. So I installed both of them and modules were instralled by after. The issue I'm facing is when I'm running : yarn redwood db seed

it tells me :

PrismaClientUnknownRequestError:
Invalid db.country.create() invocation in
C:\Users\albel\Documents\covid19\api\prisma\seeds.js:64:22

   60 }
   61
   62 async function main() {
   63   await asyncForEach(countries, async (country) => {
→  64     await db.country.create(

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: C:.Country"))) })
    at PrismaClientFetcher.request (C:\Users\albel\Documents\covid19\node_modules\@prisma\client\index.js:90:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Seeding your database... [completed]
Done in 1.86s.

the schema.prisma looks like this

datasource DS {
  provider = "sqlite"
  url = "file:dev.db"
}

generator photonjs {
  provider = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

model Day {
  id Int @id @default(autoincrement())
  date DateTime @unique
  createdAt DateTime @default(now())
  counts DailyCount[]
}

model Country {
  id Int @id @default(autoincrement())
  iso String @unique
  worldometersSlug String @unique
  name String
  createdAt DateTime @default(now())
  dailyCounts DailyCount[]
}

model DailyCount {
  id Int @id @default(autoincrement())
  date Day
  country Country
  totalCases Int
  newCases Int
  currentlyInfected Int
  totalDeaths Int
  newDeaths Int
}

How can I add a new country ?

Any insight on what I doing wrong ?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.