AlertaDengue / AlertaDengue/AlertTools

Improve sql queries : case aggregation

Đang mở
#11 10 bình luận 0 reaction 4 người được giao Được @luabida nhận Xem trên GitHub
help wanted
Ngôn ngữ chính
R
Star
1
Fork
0
Merge trung bình
11 ngày 23 phút
Pull request đã merge (30 ngày)
1

Mô tả

# Problem

Currently, line list of cases are queried and then aggregated. In order to include group_by in the sql query, we need to
compute the epiweek.

# Why do that

To optimize consultation, this is also useful for the webpage

# current code (AlertTools::getCases.R)

```R
comando <- paste("SELECT * from \"Municipio\".\"Notificacao\" WHERE dt_digita <= '",lastday,
"' AND dt_digita >= '",firstday, "' AND municipio_geocodigo IN (", sqlcity,
") AND cid10_codigo IN(", sqlcid,")", sep="")

dd <- dbGetQuery(datasource,comando)

dd$se_sin_pri <- epiweek(as.Date(dd$dt_sin_pri, format = "%Y-%m-%d"))
dd <- dd %>%
mutate(ano_sinpri = epiyear(dt_sin_pri),
SE = ano_sinpri*100+se_sin_pri)

casos <- dd %>%
group_by(municipio_geocodigo, SE) %>%
summarise(
casos = length(classi_fin),
cas_prov = sum(classi_fin != 5, na.rm = TRUE),
cas_lab = sum(classi_fin != 5 & criterio == 1 , na.rm = TRUE))
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.