
This is a repository of code related to the ongoing Waves project.
A recent Julia install. Download it here or install it through your package manager.
A few Julia packages that don't ship with the standard distribution. You can install all of these from the repository root by running:
julia scripts/deps.jl
Docker. You may need root privileges to use Docker depending on your system.
The R packages sf tidyverse docopt cli glue geojsonio. sf in
particular is a heavy package and it is common for people to experience
issues installing, see the sf docs on
installing first.
install.packages(c('sf', 'tidyverse', 'docopt', 'cli', 'glue', 'geojsonio'))
For exporting visualization-related files:
npm install -g d3-geo-projection topojson ndjson-cli
Git LFS. Run git lfs fetch && git lfs checkout from
the repository root.
makefile / Getting startedThe complete pipeline from fetching input data to producing results compatible
with the visualization code in the Observable notebooks
(vector field, interactions, modules) is specified in the
makefile. This pipeline:
Fetches Covidestim input and results from the public Covidestim API. This
produces a .csv with all the observations that will be used in the
mixed-model.
Interpolates the Covidestim data to a hexagonal tiling of the US in a sensible manner.
Fits a mixed model to this data in Julia.
Transforms the interaction coefficients from the mixed-model output into a vector field that can be visualized in Observable or another GIS-like environment.
To run the entire pipeline, after satisfying dependencies:
make data-products/geo-hexes/vectors/vectors.geojson
To see what would be run by the above command:
make -B --dry-run data-products/geo-hexes/vectors/vectors.geojson
To visualize the results in Observable, you can start by making a clone of this notebook and replacing the vectors.geojson file (located in the Files pane on the right sidebar as of June 2023) with the file you just produced.
Model design overview can be found in this notebook.
The current model can be summarized as follows:
1 Hexid = 2], [January 2021, Hexid = 2 Hexid = 1] are both modeled.0The statement of the model is in scripts/regression.jl.
covidestim_observations.csv| Variable | Type | Description |
|---|---|---|
fips | string | FIPS code |
date | string, YYYY-MM-DD | Date |
cases | uint | Number of reported cases on date date |
Rt | float | Covidestim estimated $R_t$ on date date |
infections | float | Covidestim estimated infections occurring on date date |
infectionsPC | float | Covidestim estimated infections per capita occurring on date date |
hexid-neighbors.csv| Variable | Type | Description |
|---|---|---|
i | string | Hexid of one neighbor |
j | string | Hexid of the other neighbor |
Note: for all $i,j$, $i \neq j$ there exists a $j,i$.
i, j are always unsigned integers but it is recommended to parse them as
strings.
hexid-fips-map.csv| Variable | Type | Description |
|---|---|---|
hexid | string | Hexid |
fips | string | FIPS code |
proportion_from_fips | float | Proportion of hexid's population that comes from FIPS code fips. Needed for interpolating rate-expressed quantities. |
proportion_of_fips | float | Proportion of fips's population that lies within hexagon hexid. Needed for interpolating incidence observations. |
hexid-observations.csv| Variable | Type | Description |
|---|---|---|
hexid | string | Hexid |
date | string, YYYY-MM-DD format | Date |
cases | float | Number of reported cases on date date. No longer an integer, due to interpolation. |
infections | float | Covidestim estimated infections occurring on date date. |
infectionsPC | float | Covidestim estimated infections per capita occurring on date date. |
Rt | float | Covidestim estimated $R_t$ for date date. |
alphas-reformat.csv| Variable | Type | Description |
|---|---|---|
i | string | Hexid |
j | string | Hexid |
month | string | YYYY-MM-01 format |
alpha | float | Value of the mixed-model interaction term for i-j-month |
value | float | Vestigial, always equal to alpha. |
alpha_normalized | float | Normalized alpha, calculated as $\frac{\alpha_{i,j,m}}{\mathrm{mean}(|\alpha_{i,j,m}|)} \forall (i,j,m), j = $j |
alphas_weekly-reformat.csv| Variable | Type | Description |
|---|---|---|
i | string | Hexid |
j | string | Hexid |
date | string | YYYY-MM-DD format |
week | string | week number |
alpha | float | Value of the mixed-model interaction term for i-j-month |
value | float | Vestigial, always equal to alpha. |
alpha_normalized | float | Normalized alpha, calculated as $\frac{\alpha_{i,j,m}}{\mathrm{mean}(|\alpha_{i,j,m}|)} \forall (i,j,m), j = $j |
docker pull covidestim/waves:latest