removed measurement filter from query
This commit is contained in:
		
							parent
							
								
									f7c2a39889
								
							
						
					
					
						commit
						d737fee89e
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -4,13 +4,13 @@ library(glue) | ||||||
| library(ggmap) | library(ggmap) | ||||||
| library(sf) | 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) | token <- substr(read_file(file = 'api_keys/influxdb_madison-metro'), 1, 88) | ||||||
| org <- "32b7fde0efd8a3b3" | org <- "32b7fde0efd8a3b3" | ||||||
| bucket <- "metro_vehicles" | bucket <- "metro_vehicles" | ||||||
|    |    | ||||||
| 
 | 
 | ||||||
| days <- 3 | days <- 5 | ||||||
| 
 | 
 | ||||||
| influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net", | influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net", | ||||||
|                                 token = token, |                                 token = token, | ||||||
|  | @ -21,7 +21,6 @@ time_start <- Sys.time() | ||||||
| 
 | 
 | ||||||
| query_string <- glue('from(bucket: "{bucket}") ', | query_string <- glue('from(bucket: "{bucket}") ', | ||||||
|                      '|> range(start: -{days}d) ', |                      '|> range(start: -{days}d) ', | ||||||
|                      '|> filter(fn: (r) => r["_measurement"] == "vehicle_data")', |  | ||||||
|                      '|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")') |                      '|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")') | ||||||
| 
 | 
 | ||||||
| results <- influx_connection$query(query_string) | results <- influx_connection$query(query_string) | ||||||
|  | @ -35,6 +34,8 @@ difftime(time_end, time_start) | ||||||
| rm(time_end, time_start, results) | rm(time_end, time_start, results) | ||||||
| 
 | 
 | ||||||
| #-----  | #-----  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| routes_categorized <- read_csv(file = "routes_categorized.csv", col_types = "cc") | routes_categorized <- read_csv(file = "routes_categorized.csv", col_types = "cc") | ||||||
| 
 | 
 | ||||||
| metro_data <- metro_raw %>% | metro_data <- metro_raw %>% | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue