removed measurement filter from query

This commit is contained in:
Ben Varick 2024-11-24 21:46:37 -06:00
parent f7c2a39889
commit d737fee89e
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo

View File

@ -4,13 +4,13 @@ library(glue)
library(ggmap)
library(sf)
# parameters needed to make connection to Database
# parameters needed to make connection to InfluxDB
token <- substr(read_file(file = 'api_keys/influxdb_madison-metro'), 1, 88)
org <- "32b7fde0efd8a3b3"
bucket <- "metro_vehicles"
days <- 3
days <- 5
influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net",
token = token,
@ -21,7 +21,6 @@ time_start <- Sys.time()
query_string <- glue('from(bucket: "{bucket}") ',
'|> range(start: -{days}d) ',
'|> filter(fn: (r) => r["_measurement"] == "vehicle_data")',
'|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")')
results <- influx_connection$query(query_string)
@ -35,6 +34,8 @@ difftime(time_end, time_start)
rm(time_end, time_start, results)
#-----
routes_categorized <- read_csv(file = "routes_categorized.csv", col_types = "cc")
metro_data <- metro_raw %>%