Giter Site home page Giter Site logo

covid-smsexperiment's Introduction

RI COVID Vaccination Text Messages Experiment, May--Jun 2021

Overview

If you work for The Policy Lab and have access to final_data_one_line_per_individual.csv, then make all should recreate all of the results after you setup the python and R environments as described below. We do not share this file on github because it contains potentially personally identifying information.

However, if you want to go beyond inspecting our code and would like to play with some data (just not the ZCTA level data), you can do so by editing 020_effects_on_vaccinations.Rmd to ignore final_data_one_line_per_individual.csv and instead to use dat_indiv.csv which is built from aggregated counts. If you have trouble doing so, feel free to leave an Issue here and someone from The Policy Lab should respond.

Requirements

Software

To run the code in this repository, you will need Python 3.8+ and R 4.0.2+ pre-installed.

In Python, we use poetry to manage our dependencies. In R, we use renv. To install these dependency managers, you can run (assumes Mac or Linux; see tools' documentation for other operating systems):

curl -sSL https://install.python-poetry.org | python3 -
Rscript -e 'if(!requireNamespace("remotes")){install.packages("remotes");remotes::install_github("rstudio/renv")} else {remotes::install_github("rstudio/renv")}'

Once these are installed, you can install all dependencies with

poetry install
Rscript -e 'renv::restore()'

Alternatively, the included Dockerfile will create a working environment with all these dependencies already installed.

Census API

In order to run some of this code, you will also need a Census API Key. Once you have the key, copy the .env.sample file to .env and fill in your API key in the specified location.

Code layout

Our code can generally be divided into four sections:

  • Random sampling strategy
  • Preparation of data for analysis
  • Actual analysis
  • Tests

The first two take place in Jupyter notebooks using Python (src/notebooks/100_sampling and src/notebooks/200_analysis). The last takes place in R at src/R.

100_sampling

To recreate our week-over-week sampling strategy, run the notebooks in src/notebooks/100_sampling. These may be accessed through a Jupyter notebook which you can start by running poetry run jupyter notebook.

200_analysis

To recreate our data preparation, run the notebooks in src/notebooks/200_analysis. These may be accessed through a Jupyter notebook which you can start by running poetry run jupyter notebook.

300_wrangling

There is a little bit of prework to convert the output of the Python scripts to that expected by the R scripts. This is automatically run by make all.

400_analysis

To make the report and all associated figures (each in their own file src/R/400_analysis/output). These are all automatically run by make all.

See the Makefile for the dependencies between files.

Tests

Several tests have been written in the tests folder. They may be run with poetry run py.test.

License

MIT

covid-smsexperiment's People

Contributors

jwbowers avatar khwilson avatar

Stargazers

Arya avatar

Watchers

 avatar James Cloos avatar  avatar

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.