waypoint data

waypoint data#

The waypoint data is defined at the stage level and identifies waypoint codes, order, and distance into the stage.

# Load in the required packages
import pandas as pd
from jupyterlite_simple_cors_proxy import furl, xurl

# Generate the API URL pattern
dakar_api_template = "https://www.dakar.live.worldrallyraidchampionship.com/api/{path}"

# Define the year
YEAR = 2025
# Define the category
CATEGORY = "A"
# Define the stage
STAGE = 1

# Define the API path to the stage resource
# Use a Python f-string to instantiate variable values directly
waypoint_path = f"waypoint-{YEAR}-{CATEGORY}-{STAGE}"

# Define the URL
waypoint_url = dakar_api_template.format(path=waypoint_path)

# Preview the path and the URL
waypoint_path, waypoint_url
('waypoint-2025-A-1',
 'https://www.dakar.live.worldrallyraidchampionship.com/api/waypoint-2025-A-1')
# Load in data
# Use furl() to handle CORS issues in Jupyterlite
_waypoint_df = pd.read_json(furl(waypoint_url))
_waypoint_df
_bind _origin _id _key _updatedAt _parent waypoints
0 waypoint-2025-A-1 waypoint-2025-A-1 4ae51c74af545e1d1735bdb5c3cd74ae _id 1736787077324 stage-2025-A:4ae51c74af545e1d1735bdb5c3cd74ae [{'code': '01207', 'id': 125111, 'kilometerPoi...

The response type is a single result in a list. We can more conveniently parse the results out of this dataframe as follows:

stage_code = _waypoint_df.iloc[0]["_origin"]

waypoint_df = pd.json_normalize(_waypoint_df["waypoints"].explode())
waypoint_df["year"] = YEAR
waypoint_df["stage"] = STAGE
waypoint_df["category"] = CATEGORY
waypoint_df["stage_code"] = stage_code

waypoint_df
code id kilometerPointDisplay checkpoint kilometerPoint hidden isCHR isBRP isASG isLBL groups isFirstDss Year Stage Category stage_code
0 01207 125111 39.0 1 38.83 False True False False False None NaN 2025 1 A waypoint-2025-A-1
1 01216 125112 92.0 2 91.04 False True False False False None NaN 2025 1 A waypoint-2025-A-1
2 01218 125113 122.0 3 121.18 False True False False False None NaN 2025 1 A waypoint-2025-A-1
3 01220 125114 151.0 4 150.72 False True False False False None NaN 2025 1 A waypoint-2025-A-1
4 01222 125115 182.0 5 181.18 False True False False False None NaN 2025 1 A waypoint-2025-A-1
5 01224 125116 213.0 6 212.54 False True False False False None NaN 2025 1 A waypoint-2025-A-1
6 01227 125117 244.0 7 243.32 False True False False False None NaN 2025 1 A waypoint-2025-A-1
7 01230 125119 288.0 8 287.02 False True False False False None NaN 2025 1 A waypoint-2025-A-1
8 01233 125120 330.0 9 329.07 False True False False False None NaN 2025 1 A waypoint-2025-A-1
9 01237 125121 366.0 10 365.15 True True False False False None NaN 2025 1 A waypoint-2025-A-1
10 012AS 125122 413.0 11 412.95 False False False False True None NaN 2025 1 A waypoint-2025-A-1
11 012DS 125110 0.0 0 0.00 False False False False False None True 2025 1 A waypoint-2025-A-1
12 01ASS 125123 NaN 999 NaN False False False False True None NaN 2025 1 A waypoint-2025-A-1

The waypoint data provides the distance into the stage of each waypoint, along with a wayuppint code and a waypoint ordering. The boolean flag information does not appear to be immediately useful.