|
|
|
@ -7,6 +7,10 @@ if (is.null(as.list(environment())$osem_boxes_ts))
|
|
|
|
|
|
|
|
|
|
b = osem_boxes()
|
|
|
|
|
|
|
|
|
|
# for $`active` computations
|
|
|
|
|
diffNow = (opensensmapr:::utc_date(Sys.time()) - b$lastMeasurement) %>% as.numeric(unit='hours')
|
|
|
|
|
neverActive = b[is.na(b$lastMeasurement), ] %>% nrow()
|
|
|
|
|
|
|
|
|
|
# only keep aggregated data
|
|
|
|
|
b_agg = data.frame(time = Sys.time(), boxcount = nrow(b))
|
|
|
|
|
b_agg$model = b$model %>% table() %>% as.list() %>% list()
|
|
|
|
@ -14,6 +18,14 @@ b_agg$exposure = b$exposure %>% table() %>% as.list() %>% list()
|
|
|
|
|
b_agg$geometry = b %>% osem_as_sf() %>% st_geometry() %>% list()
|
|
|
|
|
b_agg$phenomena = b %>% osem_phenomena() %>% list()
|
|
|
|
|
|
|
|
|
|
b_agg$active = list(
|
|
|
|
|
'never' = neverActive,
|
|
|
|
|
'1h' = nrow(b[diffNow <= 1, ]) - neverActive,
|
|
|
|
|
'1d' = nrow(b[diffNow <= 24, ]) - neverActive,
|
|
|
|
|
'30d' = nrow(b[diffNow <= 720, ]) - neverActive,
|
|
|
|
|
'365d' = nrow(b[diffNow <= 8760, ]) - neverActive
|
|
|
|
|
) %>% list()
|
|
|
|
|
|
|
|
|
|
# combine with existing time series
|
|
|
|
|
osem_boxes_ts = rbind(b_agg, osem_boxes_ts)
|
|
|
|
|
|
|
|
|
|