Skip to content

COVID19Tracking/website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

As of March 7, 2021 we are no longer collecting new dataLearn about available federal data.


COVID Tracking Project

The COVID Tracking Project collects information from 50 U.S. states, the District of Columbia, and 5 other U.S. territories to provide the most comprehensive testing data we can collect for the novel coronavirus, SARS-CoV-2.

This repository is for the project's website: https://covidtracking.com/.

History

A full write-up on the history of the website is availble in the HISTORY.md file.

Documentation

Additional documentation can be found at our documentation and Storybook website.

Development

The website is built on GatsbyJS. If you are not familiar with Gatsby, we suggest checking out their excellent documentation.

Install

First, you'll need the Gatsby command line interface installed globally:

npm install -g gatsby-cli

Then, install all dependencies by running:

yarn install

The website is built from two separate data sources: our own API for COVID data, and Contentful for content. To download the most recent COVID data and setup a .env file with a copy of read-only API keys to Contentful, run:

yarn setup

You can also run yarn setup:api-repo if you just want to download data and not touch the .env file.

To run the website locally, use:

yarn develop

The project takes 8-10 minutes to build.

The site is now running at http://localhost:8000. Any changes you make to code is live-updated. There is a GraphQL preview tool available at http://localhost:8000/___graphql to see what data is exposed to the website.

Note that any changes you make while running Gatsby will automatically checked with ESLint, so check your console as you save files.

Organization

Components live in src/components and are organized as follows:

  • /charts - Visualizations
  • /common - Components that are used more than once and those that are used across different parts of the website
  • /layout - Components that control the layout of the website (i.e. headers and footers)
  • /pages - Components that are only used once or have a defined scope to a particular part of the website (i.e. StateGrade has to do with states) belong in their respective directory in /pages
  • /utils - Utilities. (If a particular component doesn't have any associated styles, there's a good chance it's a utility.)

Testing

We use Jest for automated testing, and all test files for Gatsby are located in ./src/__tests__. Test files are structured following their related components. To run tests, use yarn test.

When you make a change to an interface, you will need to update the Jest snapshot for tests to complete successfully:

yarn test:update

Before pushing your local branch to the repository, make sure to run yarn test:dev. This will make sure the project is linted and all tests pass. Make sure that every test passes. Pull requests are automatically checked against these same tests.

Storybook

View our Storybook

All common components throughout the site are documented in Storybook. You can find all our component stories in /src/stories.

To preview the storybook locally, just run:

yarn storybook

The storybook is now available at http://localhost:6006.

How to contribute

No matter how you choose to help, we would love to have you as part of the project. Check our Contributing Guide for information on how to file issues and make pull requests.