🐛 fixed the credentials bug for documentation

This commit is contained in:
lukasadrion
2026-01-20 23:36:07 +01:00
parent 387e1caa7f
commit 86a9e4163f

View File

@@ -10,7 +10,7 @@ date: "`r Sys.Date()`"
knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(echo = TRUE)
``` ```
```{r preamble, message=FALSE} ```{r preamble, message=FALSE, include=FALSE}
# Load Libraries # Load Libraries
library(dplyr) library(dplyr)
library(lubridate) library(lubridate)
@@ -24,8 +24,8 @@ library(trajr)
library(shiny) library(shiny)
``` ```
# Openskies API Functions
```{r opensky, include=FALSE} ```{r opensky, include=FALSE}
# Openskies API Functions
time_now <- Sys.time() time_now <- Sys.time()
creds <- getCredentials( creds <- getCredentials(
@@ -52,8 +52,9 @@ getAircraftTrack <- function(icao, time, creds) {
} }
``` ```
## Trajectory Conversion Functions
```{r trajectory-functions, include=FALSE} ```{r trajectory-functions, include=FALSE}
# Trajectory Conversion Functions
# Convert route to distance in meters # Convert route to distance in meters
getRouteDistance <- function(route_df) { getRouteDistance <- function(route_df) {
lat_ref <- route_df$lat[1] lat_ref <- route_df$lat[1]
@@ -165,8 +166,9 @@ calculate_trajectory_params <- function(icao, departure_time, creds) {
} }
``` ```
## Statistical Helper Functions
```{r stat-functions, include=FALSE} ```{r stat-functions, include=FALSE}
# Statistical Helper Functions
# Get parameter names and labels for trajectory statistics # Get parameter names and labels for trajectory statistics
getTrajectoryParams <- function() { getTrajectoryParams <- function() {
list( list(
@@ -202,8 +204,9 @@ calculateStatsSummary <- function(trajectory_stats_df) {
} }
``` ```
## Visualization Functions
```{r viz-functions, include=FALSE} ```{r viz-functions, include=FALSE}
# Visualization Functions
# Create boxplots for trajectory statistics # Create boxplots for trajectory statistics
createBoxplots <- function(trajectory_stats_df) { createBoxplots <- function(trajectory_stats_df) {
p <- getTrajectoryParams() p <- getTrajectoryParams()
@@ -313,10 +316,12 @@ This section demonstrates how to use all functions defined above. Each step is e
The `getCredentials()` function loads API credentials from environment variables. The `getCredentials()` function loads API credentials from environment variables.
```{r demo-credentials} ```r
creds <- getCredentials() creds <- getCredentials(
has_creds <- nzchar(creds$client_id) && nzchar(creds$client_secret) client_id = Sys.getenv("OPENSKY_CLIENT_ID"),
cat("Credentials loaded:", has_creds, "\n") client_secret = Sys.getenv("OPENSKY_CLIENT_SECRET")
)
``` ```
## Step 2: Fetch Airport Departures ## Step 2: Fetch Airport Departures