trvrb / antigen

Simulating virus evolution and epidemiology
http://bedford.io/projects/antigen/
20 stars 8 forks source link

Output case counts per day and deme #22

Open huddlej opened 2 years ago

huddlej commented 2 years ago

Description

Emit daily case counts per deme to support models like @marlinfiggins's Rt frequency dynamics models. These models consume real case counts from the CDC that have been processed to look like:

date    location    cases
2021-01-01  Alabama 3623
2021-01-02  Alabama 2499
2021-01-03  Alabama 2103
2021-01-04  Alabama 5520
2021-01-05  Alabama 4650
2021-01-06  Alabama 5108
2021-01-07  Alabama 5053
2021-01-08  Alabama 5107
2021-01-09  Alabama 2823
2021-01-10  Alabama 2056
2021-01-11  Alabama 4006

See recent state-level case counts in the USA, for a complete example.

Possible solution

Cases are already stored per deme. For example, the getCases method loops through all demes to get the total current number of cases. The out.timeseries file produced by the simulator already reports cases per day. We would need to output a similar separate file that outputs cases per deme, or modify this main output file to bin by deme and day.

thienktran commented 2 years ago

out.timeseries seems to bin by deme and day already.

image image

Is this the output that you're looking for? Or, would you like for me to modify it?

huddlej commented 2 years ago

Thanks, @thienktran! That's basically what we need; all that's missing is a wide-to-long transform on that output to match the format expected by @marlinfiggins's models. From antigen output this would look like:

date    location    cases
1   North   1000
2   North   2000
1   South   500
2   South   200

That transform doesn't need to live in antigen, necessarily. It would be easier to do in R or pandas.

thienktran commented 2 years ago

That makes sense! Thank you for clarifying, John!