HUB
Sign inSign up

covidestim/waves

By covidestim

•Updated over 1 year ago

Image
0

435

covidestim/waves repository overview

⁠Waves

Diagram of project dataflow

This is a repository of code related to the ongoing Waves project.

⁠Dependencies:

  • 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 started

The 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:

  1. 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.

  2. Interpolates the Covidestim data to a hexagonal tiling of the US in a sensible manner.

  3. Fits a mixed model to this data in Julia.

  4. 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.

⁠The mixed-effects model

Model design overview can be found in this notebook⁠.

The current model can be summarized as follows:

  • All pairs of neighboring hexes are modeled
  • The interaction term is calculated for each month and directional pair
    • I.e., [January 2021, Hexid = 1 Hexid = 2], [January 2021, Hexid = 2 Hexid = 1] are both modeled.
  • There are some limits on which observations are included because we don't really want to model declining epidemics.
  • The model has an intercept of 0
  • The only terms in the model are lagged observations, the intercept, and the interaction term. There are no covariates.

The statement of the model is in scripts/regression.jl.

⁠Schema of key files

⁠covidestim_observations.csv
VariableTypeDescription
fipsstringFIPS code
datestring, YYYY-MM-DDDate
casesuintNumber of reported cases on date date
RtfloatCovidestim estimated $R_t$ on date date
infectionsfloatCovidestim estimated infections occurring on date date
infectionsPCfloatCovidestim estimated infections per capita occurring on date date
⁠hexid-neighbors.csv
VariableTypeDescription
istringHexid of one neighbor
jstringHexid 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
VariableTypeDescription
hexidstringHexid
fipsstringFIPS code
proportion_from_fipsfloatProportion of hexid's population that comes from FIPS code fips. Needed for interpolating rate-expressed quantities.
proportion_of_fipsfloatProportion of fips's population that lies within hexagon hexid. Needed for interpolating incidence observations.
⁠hexid-observations.csv
VariableTypeDescription
hexidstringHexid
datestring, YYYY-MM-DD formatDate
casesfloatNumber of reported cases on date date. No longer an integer, due to interpolation.
infectionsfloatCovidestim estimated infections occurring on date date.
infectionsPCfloatCovidestim estimated infections per capita occurring on date date.
RtfloatCovidestim estimated $R_t$ for date date.
⁠alphas-reformat.csv
VariableTypeDescription
istringHexid
jstringHexid
monthstringYYYY-MM-01 format
alphafloatValue of the mixed-model interaction term for i-j-month
valuefloatVestigial, always equal to alpha.
alpha_normalizedfloatNormalized alpha, calculated as $\frac{\alpha_{i,j,m}}{\mathrm{mean}(|\alpha_{i,j,m}|)} \forall (i,j,m), j = $j
⁠alphas_weekly-reformat.csv
VariableTypeDescription
istringHexid
jstringHexid
datestringYYYY-MM-DD format
weekstringweek number
alphafloatValue of the mixed-model interaction term for i-j-month
valuefloatVestigial, always equal to alpha.
alpha_normalizedfloatNormalized alpha, calculated as $\frac{\alpha_{i,j,m}}{\mathrm{mean}(|\alpha_{i,j,m}|)} \forall (i,j,m), j = $j
Tag summary
Recent tags
Content type
Image
Digest
sha256:ae11016fe…
Size
4.2 GB
Last updated
over 1 year ago
docker pull covidestim/waves:latest