usdigitalresponse / covid-exit-strategy

Producing data for the Covid Exit Strategy website.
https://www.covidexitstrategy.org/
GNU General Public License v3.0
13 stars 3 forks source link

Covid Exit Strategy

This repository includes the source code for generating data for covidexitstrategy.org.

There are functions for extracting the data from a variety of sources, transforming and enriching it, and then finally loading it into a Google Sheet which serves as the database backing the website.

The documents for this project are kept in Google Drive.

The data for the website currently comes from this workbook, which also includes tabs that Ryan refreshes on a regular basis with updated copied data.

The meaning of the CDC criteria (defined here) are spelled out in our interpretation in this workbook.

Posting data through these scripts

To successfully update the data in the spreadsheet, you'll need to do the following.

First, create a Google Service Account. It doesn't matter what project that service account is in, so you can create a new personal project. Create a keyfile for that Google service account and save it as service-account-key.json in the root level of this repository.

Next, add the "email address" of your service account to have permissions to the Data Sources folder of the Google Drive through the user interface which looks like this:

Finally, make sure that the Google Sheets and Drive APIs are enabled it your service account's project. Go to these links: https://console.developers.google.com/apis/library/sheets.googleapis.com?project= and https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=, replacing <project_id> with your project ID, to enable the Google Sheets and Drive APIs.

google sharing example

As you start your work you may choose to set your service account permissions for read-only until you're ready to post data.

Your service account should now be picked up automatically by these scripts with the appropriate level of access.

Configuring pre-commit hooks

To promote consistent code style and quality, we use git pre-commit hooks to automatically lint and reformat our code before every commit we make to the codebase. Pre-commit hooks are defined in .pre-commit-config.yaml.

  1. First, install pre-commit globally:

    $ brew install pre-commit
  2. Run pre-commit install to install the specific git hooks used in this repository.

Now, any time you commit code to the repository, the hooks will run on all modified files automatically. If you wish, you can force a re-run on all files with pre-commit run --all-files.