Skip to content

Commit 8d23e12

Browse files
committed
updated 2019-nCoV to COVID-19 with a few extra cases
1 parent 83a9a65 commit 8d23e12

File tree

5 files changed

+94
-34
lines changed

5 files changed

+94
-34
lines changed

README.Rmd

+84-24
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,31 @@ library(tidyverse)
1717
library(lubridate)
1818
library(coarseDataTools)
1919
library(gridExtra)
20+
library(ggpubr)
21+
# devtools::install_github("salauer/activemonitr")
22+
library(activeMonitr)
2023
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
2124
2225
set.seed(1)
2326
2427
## read in coronavirus data
25-
ncov <- read_csv("data/nCoV-IDD-traveler-data.csv") %>%
26-
rename(EL_date=EL, ER_date=ER, SL_date=SL, SR_date=SR) %>%
27-
## change dates to restrict exposure to after December 1
28-
## add times where missing
29-
# if EL is missing or before 1 Dec 2019, use 1 Dec 2019
30-
mutate(EL_date=ifelse(is.na(EL_date),"2019-12-01 00:00:00", EL_date) %>%
31-
ymd_hms() %>%
32-
if_else(. < ymd_hms("2019-12-01 00:00:00"),
33-
ymd_hms("2019-12-01 00:00:00"), .),
34-
# if SR is missing, use PR
35-
SR_date=ifelse(ymd_hms(SR_date) %>% is.na,
36-
PR, SR_date) %>%
37-
ymd_hms(),
28+
ncov_raw <- read_csv("data/nCoV-IDD-traveler-data.csv") %>%
29+
rename(EL_date=EL, ER_date=ER, SL_date=SL, SR_date=SR)
30+
31+
## change dates to restrict exposure to after 1 December 2019
32+
## add other times where missing
33+
ncov_ELSR <- ncov_raw %>%
34+
# if EL is missing or before 1 Dec 2019, use 1 Dec 2019
35+
mutate(EL_date=ifelse(is.na(EL_date),"2019-12-01 00:00:00", EL_date) %>%
36+
ymd_hms() %>%
37+
if_else(. < ymd_hms("2019-12-01 00:00:00"), ymd_hms("2019-12-01 00:00:00"), .),
38+
# if SR is missing, use PR
39+
SR_date=ifelse(ymd_hms(SR_date) %>% is.na, PR, SR_date) %>%
40+
ymd_hms(),
3841
# SR_fever is only for cases with confirmed fever dates
39-
SR_fever=ymd_hms(SR_fever)) %>%
42+
SR_fever=ymd_hms(SR_fever))
43+
44+
ncov <- ncov_ELSR %>%
4045
# if ER is missing, use SR; if SL is missing, use EL
4146
mutate(ER_date=if_else(is.na(ER_date), SR_date, ymd_hms(ER_date)),
4247
ER_date=if_else(ER_date>SR_date, SR_date, ER_date),
@@ -77,16 +82,64 @@ ncov <- read_csv("data/nCoV-IDD-traveler-data.csv") %>%
7782
7883
## Now lets divide data sets by observation type
7984
## only fevers
80-
ncov_fever <- ncov %>%
81-
filter(!is.na(SL_fever) | !is.na(SR_fever))
85+
ncov_fever <- ncov %>% filter(!is.na(SL_fever) | !is.na(SR_fever))
86+
ncov_mild <- ncov %>% filter(is.na(SL_fever) & is.na(SR_fever))
8287
8388
## only travel outside of China
84-
ncov_foreign <- ncov %>%
85-
filter(COUNTRY.DEST != "China" | PROVINCE.DEST %in% c("HongKong", "Macau"))
89+
ncov_foreign <- ncov %>% filter(COUNTRY.DEST != "China" | PROVINCE.DEST %in% c("HongKong", "Macau"))
8690
8791
## only fevers outside of China
88-
ncov_foreign_fever <- ncov_foreign %>%
89-
filter(!is.na(SL_fever) | !is.na(SR_fever))
92+
ncov_foreign_fever <- ncov_foreign %>% filter(!is.na(SL_fever) | !is.na(SR_fever))
93+
94+
## only cases within mainland China
95+
ncov_mainland <- ncov %>% filter(COUNTRY.DEST == "China" & !(PROVINCE.DEST %in% c("HongKong", "Macau")))
96+
97+
## only cases with a defined EL
98+
ncov_EL <- ncov_raw %>%
99+
filter(!is.na(EL_date)) %>%
100+
# if EL is missing or before 1 Dec 2019, use 1 Dec 2019
101+
mutate(EL_date=ymd_hms(EL_date),
102+
# if SR is missing, use PR
103+
SR_date=ifelse(ymd_hms(SR_date) %>% is.na, PR, SR_date) %>%
104+
ymd_hms(),
105+
# SR_fever is only for cases with confirmed fever dates
106+
SR_fever=ymd_hms(SR_fever)) %>%
107+
# if ER is missing, use SR; if SL is missing, use EL
108+
mutate(ER_date=if_else(is.na(ER_date), SR_date, ymd_hms(ER_date)),
109+
SL_date=if_else(is.na(SL_date), EL_date, ymd_hms(SL_date)),
110+
SL_fever=if_else(is.na(SL_fever) & !is.na(SR_fever),
111+
SL_date, ymd_hms(SL_fever))) %>%
112+
# calculate days since 1 Dec 2019
113+
mutate(EL=difftime(EL_date, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
114+
as.numeric(),
115+
ER=difftime(ER_date, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
116+
as.numeric(),
117+
SL=difftime(SL_date, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
118+
as.numeric(),
119+
SR=difftime(SR_date, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
120+
as.numeric(),
121+
SL_fever=difftime(SL_fever, ymd_hms("2019-12-01 00:00:00"),
122+
units="days") %>%
123+
as.numeric(),
124+
SR_fever=difftime(SR_fever, ymd_hms("2019-12-01 00:00:00"),
125+
units="days") %>%
126+
as.numeric(),
127+
PL=difftime(PL, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
128+
as.numeric(),
129+
PR=difftime(PR, ymd_hms("2019-12-01 00:00:00"), units="days") %>%
130+
as.numeric(),
131+
E_int=ER-EL,
132+
S_int=SR-SL,
133+
S_fever_int=SR_fever-SL_fever,
134+
max_inc_int=SR-EL,
135+
min_inc_int=SL-ER) %>%
136+
# remove any entries missing EL, ER, SL, or SR
137+
filter(!is.na(EL_date), !is.na(ER_date), !is.na(SL_date), !is.na(SR_date)) %>%
138+
# remove entries that haven't been reviewed by two people
139+
filter(!is.na(REVIEWER2)) %>%
140+
# remove entries with exposure/onset intervals less than 0
141+
# remove entries where ER greater than SR or EL greater than SL
142+
filter(E_int > 0, S_int > 0, ER<=SR, SL>=EL, EL>0)
90143
91144
backer_params <- read_csv("data/backer-params.csv")
92145
```
@@ -277,9 +330,9 @@ Updated: `r date()`
277330

278331
[Read the medRxiv preprint](https://www.medrxiv.org/content/10.1101/2020.02.02.20020016v1)
279332

280-
Our lab has been collecting data (freely available at [`data/nCoV-IDD-traveler-data.csv`](https://github.com/HopkinsIDD/ncov_incubation/blob/master/data/nCoV-IDD-traveler-data.csv)) on the exposure and symptom onset for novel coronavirus (nCoV-2019) cases that have been confirmed outside of the Hubei province.
333+
Our lab has been collecting data (freely available at [`data/nCoV-IDD-traveler-data.csv`](https://github.com/HopkinsIDD/ncov_incubation/blob/master/data/nCoV-IDD-traveler-data.csv)) on the exposure and symptom onset for novel coronavirus (COVID-19) cases that have been confirmed outside of the Hubei province.
281334
These cases have been confirmed either in other countries or in regions of China with no known local transmission.
282-
We search for news articles and reports in both English and Chinese and abstract the data necessary to estimate the incubation period of nCoV-2019.
335+
We search for news articles and reports in both English and Chinese and abstract the data necessary to estimate the incubation period of COVID-19.
283336
Two team members independently review the full text of each case report to ensure that data is correctly input.
284337
Discrepancies are resolved by discussion and consensus.
285338

@@ -310,15 +363,21 @@ dat_sum <- ncov %>%
310363
SLnew = SL-ER,
311364
SRnew = SR-ER,
312365
Smid = (SLnew + SRnew)/2,
366+
PLnew = PL-ER,
367+
PRnew = PR-ER,
368+
Pmid = (PLnew + PRnew)/2,
313369
UID=reorder(UID, SR-EL))
314370
315371
ggplot(dat_sum, aes(y=factor(UID))) +
316372
geom_segment(aes(x=ELnew, xend=ERnew, yend=factor(UID)),
317373
color="#0072B2", size=2, alpha=.25) +
318374
geom_segment(aes(x=SLnew, xend=SRnew, yend=factor(UID)),
319375
size=2, color="#CC0000", alpha=.25) +
376+
geom_segment(aes(x=PLnew, xend=PRnew, yend=factor(UID)),
377+
size=2, color="#00a841", alpha=.25) +
320378
geom_point(aes(x=Emid, y=factor(UID)), size=0.5, color="#0072B2") +
321379
geom_point(aes(x=Smid, y=factor(UID)), size=0.5, color="#CC0000") +
380+
geom_point(aes(x=Pmid, y=factor(UID)), size=0.5, color="#00a841") +
322381
geom_segment(aes(x=Emid, xend=Smid, yend=factor(UID)), size=0.33, color="#999999") +
323382
#ggtitle("Exposure and symptom onset windows") +
324383
scale_x_continuous("Days from last possible exposure") +
@@ -327,6 +386,7 @@ ggplot(dat_sum, aes(y=factor(UID))) +
327386
theme(axis.text.y = element_blank(),
328387
axis.ticks.y= element_blank(),
329388
axis.text.x=element_text(color="black"))
389+
330390
```
331391

332392
The bars where the exposure and symptom onset windows completely overlap are frequently travelers from Wuhan who were symptomatic on arrival to another country, that did not release further details.
@@ -338,7 +398,7 @@ The necessary components for estimating the incubation period are left and right
338398
We use explicit dates and times when they are reported in the source documents, however when they are not available, we make the following assumptions:
339399

340400
- For cases without a reported right-bound on symptom onset time (SR), we use the time that the case is first presented to a hospital or, lacking that, the time that the source document was published
341-
- For cases without an EL, we use 2019 December 1, which was the onset date for the first reported nCoV-2019 case; though we will test this assumption later
401+
- For cases without an EL, we use 2019 December 1, which was the onset date for the first reported COVID-19 case; though we will test this assumption later
342402
- For cases without an ER, we use the SR
343403
- For cases without an SL, we use the EL
344404

@@ -483,7 +543,7 @@ ggplot(data=all_sens_plot,
483543
aes(y=est, ymin=CIlow, ymax=CIhigh, x=as.factor(qtile), color=type)) +
484544
geom_errorbar(height=0.2, position=position_dodge(0.9)) +
485545
geom_point(position=position_dodge(0.9)) +
486-
scale_y_continuous("Incubation time, in days (with 95% CIs)", limits=c(0,21)) +
546+
scale_y_continuous("Incubation time, in days (with 95% CIs)") +
487547
scale_x_discrete("Estimate quantile") +
488548
scale_color_manual("Est\ntype",
489549
values=cbbPalette[c(1,6,4,7)]) +

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Real-time estimation of the novel coronavirus incubation time
44
=============================================================
55

6-
Updated: Thu Feb 27 16:26:31 2020
6+
Updated: Thu Feb 27 19:18:17 2020
77

88
[Read the medRxiv
99
preprint](https://www.medrxiv.org/content/10.1101/2020.02.02.20020016v1)
@@ -36,11 +36,11 @@ Quick links:
3636
Data summary
3737
------------
3838

39-
There are 175 cases from 48 countries and provinces outside of Hubei,
40-
China. Of those 64 are known to be female (37%) and 107 are male (61%).
41-
The median age is about 44.5 years (IQR: 34-55). 76 cases are from
42-
Mainland China (43%), while 99 are from the rest of the world (57%). 98
43-
cases presented with a fever (56%).
39+
There are 181 cases from 49 countries and provinces outside of Hubei,
40+
China. Of those 69 are known to be female (38%) and 108 are male (60%).
41+
The median age is about 44.5 years (IQR: 34-55.5). 81 cases are from
42+
Mainland China (45%), while 100 are from the rest of the world (55%). 99
43+
cases presented with a fever (55%).
4444

4545
<img src="README_files/figure-markdown_strict/data-summary-1.png" alt="This figure displays the exposure and symptom onset windows for each case in our dataset, relative to the right-bound of the exposure window (ER). The blue bars indicate the the exposure windows and the red bars indicate the symptom onset windows for each case. Purple areas are where those two bars overlap." />
4646
<p class="caption">
@@ -268,28 +268,28 @@ distributions.
268268
<tr class="odd">
269269
<td style="text-align: left;">JHU-IDD</td>
270270
<td style="text-align: center;">log-normal</td>
271-
<td style="text-align: right;">175</td>
271+
<td style="text-align: right;">181</td>
272272
<td style="text-align: right;">1.65</td>
273273
<td style="text-align: right;">0.40</td>
274274
</tr>
275275
<tr class="even">
276276
<td style="text-align: left;">JHU-IDD</td>
277277
<td style="text-align: center;">gamma</td>
278-
<td style="text-align: right;">175</td>
278+
<td style="text-align: right;">181</td>
279279
<td style="text-align: right;">6.34</td>
280280
<td style="text-align: right;">0.89</td>
281281
</tr>
282282
<tr class="odd">
283283
<td style="text-align: left;">JHU-IDD</td>
284284
<td style="text-align: center;">Weibull</td>
285-
<td style="text-align: right;">175</td>
285+
<td style="text-align: right;">181</td>
286286
<td style="text-align: right;">2.55</td>
287287
<td style="text-align: right;">6.38</td>
288288
</tr>
289289
<tr class="even">
290290
<td style="text-align: left;">JHU-IDD</td>
291291
<td style="text-align: center;">Erlang</td>
292-
<td style="text-align: right;">175</td>
292+
<td style="text-align: right;">181</td>
293293
<td style="text-align: right;">7.00</td>
294294
<td style="text-align: right;">0.82</td>
295295
</tr>
Loading
Loading
Loading

0 commit comments

Comments
 (0)