Merge branch 'feat/trajectories-and-alternative-gui' into feat/add-osm-for-trajectory

This commit is contained in:
eneller
2026-01-21 15:14:32 +01:00
2 changed files with 40 additions and 36 deletions

View File

@@ -39,7 +39,7 @@ ui <- fluidPage(
hr(),
h4("Batch Analysis"),
numericInput("batch_size", "Number of flights to analyze:", value = 10, min = 2, max = 50),
numericInput("batch_size", "Days of flights to analyze:", value = 5, min = 1, max = 30),
actionButton("batch_analyze", "Run Batch Analysis", class = "btn-warning"),
hr(),
@@ -144,6 +144,7 @@ server <- function(input, output, session) {
data.frame(
Index = i,
ICAO24 = dep[["ICAO24"]] %||% NA,
#FIXME Callsign, Origin, Destination
Callsign = dep[["callsign"]] %||% NA,
Origin = dep[["estDepartureAirport"]] %||% NA,
Destination = dep[["estArrivalAirport"]] %||% NA,
@@ -246,28 +247,9 @@ server <- function(input, output, session) {
status("Running batch analysis...")
tryCatch({
all_trajectories <- list()
n_departures <- min(length(rv$departures), input$batch_size)
withProgress(message = 'Analyzing flights', value = 0, {
for (i in 1:n_departures) {
dep <- rv$departures[[i]]
icao24 <- dep[["ICAO24"]]
dep_time <- dep[["departure_time"]]
incProgress(1/n_departures, detail = paste("Processing", icao24))
if (is.null(dep_time)) next
# Use calculate_trajectory_params from main.Rmd
params <- calculate_trajectory_params(icao24, dep_time, rv$creds)
if (!is.null(params)) {
all_trajectories[[length(all_trajectories) + 1]] <- params
}
Sys.sleep(0.3)
}
all_trajectories <- getAircraftTrajectories(rv$current_icao, time = Sys.time(), creds, days = input$batch_size)
})
if (length(all_trajectories) > 0) {