Data Sourcing One-Liners#
To simplify the retrieval of data from the API, I have bundled a set of simple functions for retrieving each type of data from the live data API.
from dakar_rallydj.getter import DakarAPIClient
dakar = DakarAPIClient(
use_cache=True,
backend='memory',
#cache_name='dakar_cache',
expire_after=3600 # Cache for 1 hour
)
dakar.get_category()
| position | updatedAt | refueling | label | kmGoal | mapDisplay | lastStage | promotionalDisplay | reference | shortLabel | ... | _origin | _id | _key | _updatedAt | _parent | isPointCat | ar | en | es | fr | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 3 | 2025-01-06T12:11:14+01:00 | 1 | A | NaN | True | 12 | True | 2025-A | cat.name.A | ... | category-2025 | 63b4f5da4591200d0a4cc239245eb03a | label | 1737386137350 | millesime:28a3b2a601a2028494b004bb95233853 | NaN | سيارات | Car | Coche | Auto |
| 0 | 8 | 2025-01-06T12:12:00+01:00 | 0 | F | 1000.0 | True | 12 | True | 2025-F | cat.name.F | ... | category-2025 | 0a0fb4dfc03bcb6b0e9c940b5a09ae05 | label | 1737386137350 | millesime:28a3b2a601a2028494b004bb95233853 | 1.0 | DAKAR FUTURE MISSION 1000 | DAKAR FUTURE MISSION 1000 | DAKAR FUTURE MISSION 1000 | DAKAR FUTURE MISSION 1000 |
| 2 | 7 | 2025-01-06T12:11:52+01:00 | 0 | K | NaN | True | 12 | True | 2025-K | cat.name.K | ... | category-2025 | b0b0b0087d69431d87d04800e254c7c3 | label | 1737386137350 | millesime:28a3b2a601a2028494b004bb95233853 | 1.0 | Classic | Classic | Classic | Classic |
| 3 | 0 | 2025-01-05T20:25:31+01:00 | 1 | M | NaN | True | 12 | True | 2025-M | cat.name.M | ... | category-2025 | e377e0f7b61dcf8217845dc4fac8cc5d | label | 1737386137350 | millesime:28a3b2a601a2028494b004bb95233853 | NaN | دراجة | Bike | Moto | Moto |
4 rows × 22 columns
dakar.get_groups().head()
| position | shortLabel | reference | label | tinyLabel | promotionalDisplay | _bind | _origin | _id | _parent | color | ar | en | es | fr | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 8 | 0 | cat.name.A_T1 | 2025-A-T1 | T1 | ULT | True | allGroups-2025 | categoryGroup-2025-A | b49155b3f5670d2a907aa01e319876b8 | category-2025:63b4f5da4591200d0a4cc239245eb03a | #EBBC4E | Ultimate | Ultimate | Ultimate | Ultimate |
| 7 | 1 | cat.name.A_T2 | 2025-A-T2 | T2 | STK | True | allGroups-2025 | categoryGroup-2025-A | 4dac064bf100bc806b91e7f2e7758297 | category-2025:63b4f5da4591200d0a4cc239245eb03a | #C7C9C7 | Stock | Stock | Stock | Stock |
| 5 | 4 | cat.name.A_T3 | 2025-A-T3 | T3 | CHG | True | allGroups-2025 | categoryGroup-2025-A | 15f329900afa29e3e6b099ae681ebe12 | category-2025:63b4f5da4591200d0a4cc239245eb03a | #E04E39 | Challenger | Challenger | Challenger | Challenger |
| 6 | 5 | cat.name.A_T4 | 2025-A-T4 | T4 | SSV | True | allGroups-2025 | categoryGroup-2025-A | 423ea731fdcba5cda62c8334985889b0 | category-2025:63b4f5da4591200d0a4cc239245eb03a | #A7C6ED | SSV | SSV | SSV | SSV |
| 9 | 6 | cat.name.A_T5 | 2025-A-T5 | T5 | TRK | True | allGroups-2025 | categoryGroup-2025-A | f1a437ac1135c9d9a5e33f5096f95259 | category-2025:63b4f5da4591200d0a4cc239245eb03a | #2D2926 | شاحنة | Truck | Camión | Camion |
dakar.get_clazz().head()
| refueling | promotionalDisplay | reference | label | position | shortLabel | _bind | _id | _parent | $group | color | tinyLabel | ar | en | es | fr | category | categoryClazz | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | True | 2025-A-T1-+ | + | 4 | cat.name.A_T1_+ | allClazz-2025-A | 96c0869600e0013dbf5f86f60e5c4da4 | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | NaN | NaN | T1+: Prototype Cross-Country Cars 4x4 | T1+: Prototype Cross-Country Cars 4x4 | T1+: Prototype Cross-Country Cars 4x4 | T1+ : Voitures Tout-terrain Prototypes 4x4 | A | 2025-A-T1 |
| 1 | 0 | True | 2025-A-T1-1 | 1 | 0 | cat.name.A_T1_1 | allClazz-2025-A | f666973e89db183ecfefc75c3af8ffb1 | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | NaN | NaN | T1.1 Prototype Cross-Country Cars 4x4 | T1.1 Prototype Cross-Country Cars 4x4 | T1.1 Prototype Cross-Country Cars 4x4 | T1.1 : Voitures Tout-terrain Prototypes 4x4 | A | 2025-A-T1 |
| 2 | 0 | True | 2025-A-T1-2 | 2 | 1 | cat.name.A_T1_2 | allClazz-2025-A | f00d7ec8d2d96e9cf11aa515109376cf | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | NaN | NaN | T1.2 Prototype Cross-Country Cars 4x2 | T1.2 Prototype Cross-Country Cars 4x2 | T1.2 Prototype Cross-Country Cars 4x2 | T1.2 : Voitures Tout-terrain Prototypes 4x2 | A | 2025-A-T1 |
| 3 | 0 | True | 2025-A-T1-3 | 3 | 2 | cat.name.A_T1_3 | allClazz-2025-A | f071b5dbfd586a4ba46100196a98a9c4 | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | NaN | NaN | T1.3 FIA: النتيجة | T1.3: SCORE | T1.3 : SCORE | T1.3 : SCORE | A | 2025-A-T1 |
| 4 | 0 | True | 2025-A-T1-U | U | 3 | cat.name.A_T1_U | allClazz-2025-A | 1501ebcbaf3ad27e72aecfba7faa8037 | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | categoryGroup-2025-A:b49155b3f5670d2a907aa01e3... | NaN | NaN | T1.U: "Ultimate" Prototype Cross-Country Cars | T1.U: "Ultimate" Prototype Cross-Country Cars | T1.U: "Ultimate" Prototype Cross-Country Cars | T1.U : Voitures Tout-Terrain Prototypes "Ultim... | A | 2025-A-T1 |
# Alternatively, get multiple categories
# Optionally specify category (A. F, K, M)
dakar.get_clazz(category=["A", "M"])["category"].unique()
array(['A', 'M'], dtype=object)
withdrawals_df, withdrawn_competitors_df, withdrawn_teams_df = dakar.get_withdrawals(category=["A", "M"])
# Allowed: ["A", "K", "M"]
withdrawals_df.head()
| stage | bib | reason | _category | |
|---|---|---|---|---|
| 0 | 1 | 14 | 1 | M |
| 1 | 1 | 20 | 1 | M |
| 2 | 2 | 76 | 1 | M |
| 3 | 2 | 78 | 1 | M |
| 4 | 2 | 110 | 1 | M |
withdrawn_competitors_df.head()
| bib | name | firstName | lastName | role | gender | nationality | profil | profil_sm | podium | aid | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | R. BRANCH | ROSS | BRANCH | P | m | bwa | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | f075b646-46d2-4940-9328-f8b9a439207c |
| 1 | 7 | P. QUINTANILLA | PABLO | QUINTANILLA | P | m | chl | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | f3831eeb-5041-473f-9946-7159ff91ac96 |
| 2 | 12 | B. COX | BRADLEY | COX | P | m | zaf | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 02c66146-3da3-428d-acaa-6d0d2df66a25 |
| 3 | 13 | M. MICHEK | MARTIN | MICHEK | P | m | cze | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | e43901a2-b4af-4aa7-9209-9c607b4c5c95 |
| 4 | 14 | S. BÜHLER | SEBASTIAN | BÜHLER | P | m | deu | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 9593e310-2cbe-4ab6-a9c7-b9363b09bcf0 |
withdrawn_teams_df.head()
| team.bib | team.brand | team.model | team.vehicle | team.vehicleImg | team.clazz | team.w2rc | |
|---|---|---|---|---|---|---|---|
| 0 | 1 | HERO | 450 RALLY | HERO MOTOSPORTS TEAM RALLY | NaN | 93764f5096cda167a6cd5a9a9469f428 | True |
| 1 | 7 | HONDA | CRF 450 RALLY | MONSTER ENERGY HONDA HRC | https://img.aso.fr/core_app/img-motorSports-da... | 93764f5096cda167a6cd5a9a9469f428 | True |
| 2 | 12 | KTM | 450 RALLY REPLICA | BAS WORLD KTM RACING TEAM | https://img.aso.fr/core_app/img-motorSports-da... | 93764f5096cda167a6cd5a9a9469f428 | True |
| 3 | 13 | KTM | 450 RALLY REPLICA | Orion - Moto Racing Group | https://img.aso.fr/core_app/img-motorSports-da... | 93764f5096cda167a6cd5a9a9469f428 | False |
| 4 | 14 | HERO | 450 RALLY | HERO MOTOSPORTS TEAM RALLY | https://img.aso.fr/core_app/img-motorSports-da... | 93764f5096cda167a6cd5a9a9469f428 | True |
dakar.get_waypoints().head()
# Query uses a single category and a single stage
| id | kilometerPoint | code | checkpoint | kilometerPointDisplay | hidden | isCHR | isBRP | isASG | isLBL | year | stage | category | stage_code | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 11 | 125110 | 0.00 | 012DS | 0 | 0.0 | False | False | False | False | False | 2025 | 1 | A | waypoint-2025-A-1 |
| 0 | 125111 | 38.83 | 01207 | 1 | 39.0 | False | True | False | False | False | 2025 | 1 | A | waypoint-2025-A-1 |
| 1 | 125112 | 91.04 | 01216 | 2 | 92.0 | False | True | False | False | False | 2025 | 1 | A | waypoint-2025-A-1 |
| 2 | 125113 | 121.18 | 01218 | 3 | 122.0 | False | True | False | False | False | 2025 | 1 | A | waypoint-2025-A-1 |
| 3 | 125114 | 150.72 | 01220 | 4 | 151.0 | False | True | False | False | False | 2025 | 1 | A | waypoint-2025-A-1 |
# Optionally specify a single category (A. F, K, M)
stages_df, sectors_df, stage_surfaces_df, section_surfaces_df, surfaces_df = dakar.get_stages()
stages_df.head()
| stage_code | stage | date | startDate | endDate | isCancelled | generalDisplay | isDelayed | marathon | length | type | timezone | stageWithBonus | mapCategoryDisplay | podiumDisplay | _bind | ar | en | es | fr | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0P000 | 0 | 2025-01-03 00:00:00+03:00 | 2025-01-03T00:00:00+03:00 | 2025-01-03T00:00:00+03:00 | 0.0 | 0.0 | 0.0 | 0.0 | 77.0 | PRO | Asia/Riyadh | 0.0 | NaN | cs | stage-2025-A | BISHA | BISHA | BISHA | BISHA |
| 1 | 01000 | 1 | 2025-01-04 00:00:00+03:00 | 2025-01-04T00:00:00+03:00 | 2025-01-04T00:00:00+03:00 | 0.0 | 1.0 | 0.0 | 0.0 | 499.0 | STA | Asia/Riyadh | 0.0 | A | ce | stage-2025-A | بيشة > بيشة | BISHA > BISHA | BISHA > BISHA | BISHA > BISHA |
| 2 | 02000 | 2 | 2025-01-05 00:00:00+03:00 | 2025-01-05T00:00:00+03:00 | 2025-01-06T00:00:00+03:00 | 0.0 | 1.0 | 0.0 | 0.0 | 1058.0 | STA | Asia/Riyadh | 0.0 | M | ce | stage-2025-A | بيشة > بيشة | BISHA > BISHA | BISHA > BISHA | BISHA > BISHA |
| 3 | 03000 | 3 | 2025-01-07 00:00:00+03:00 | 2025-01-07T00:00:00+03:00 | 2025-01-07T00:00:00+03:00 | 0.0 | 1.0 | 0.0 | 0.0 | 963.0 | STA | Asia/Riyadh | 0.0 | A | ce | stage-2025-A | بيشة > الحناكية | BISHA > AL HENAKIYAH | BISHA > AL HENAKIYAH | BISHA > AL HENAKIYAH |
| 4 | 04000 | 4 | 2025-01-08 00:00:00+03:00 | 2025-01-08T00:00:00+03:00 | 2025-01-08T00:00:00+03:00 | 0.0 | 1.0 | 0.0 | 1.0 | 588.0 | STA | Asia/Riyadh | 0.0 | A | ce | stage-2025-A | الحناكية > العلا | AL HENAKIYAH > ALULA | AL HENAKIYAH > ALULA | AL HENAKIYAH > ALULA |
sectors_df.head()
| stage_code | code | id | sector_number | powerStage | length | startTime | type | arrivalTime | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 01000 | 01100 | 23803 | 1 | False | 86 | 2025-01-04T04:30:00+00:00 | LIA | 2025-01-04T06:25:00+00:00 |
| 1 | 01000 | 01200 | 23804 | 2 | False | 413 | 2025-01-04T06:25:00+00:00 | SPE | 2025-01-04T10:35:00+00:00 |
| 2 | 02000 | 02100 | 23805 | 1 | False | 45 | 2025-01-05T03:25:00+00:00 | LIA | 2025-01-05T04:40:00+00:00 |
| 3 | 02000 | 02200 | 23806 | 2 | False | 967 | 2025-01-05T04:40:00+00:00 | SPE | 2025-01-05T13:00:00+00:00 |
| 4 | 02000 | 02300 | 23807 | 3 | False | 46 | 2025-01-05T13:00:00+00:00 | LIA | 2025-01-05T14:00:00+00:00 |
stage_surfaces_df.head()
| code | percentage | color | type | |
|---|---|---|---|---|
| 0 | 01200 | 18 | #753a05 | dirt track |
| 1 | 01200 | 18 | #753a05 | dirt track |
| 2 | 01200 | 28 | #1dc942 | gravel track |
| 3 | 01200 | 53 | #efc07c | sand |
| 4 | 01200 | 18 | #753a05 | dirt track |
section_surfaces_df.head()
| code | section | start | finish | color | type | |
|---|---|---|---|---|---|---|
| 0 | 01200 | 1 | 0 | 27 | #efc07c | sand |
| 1 | 01200 | 2 | 27 | 32 | #753a05 | dirt track |
| 2 | 01200 | 3 | 32 | 32 | #1dc942 | gravel track |
| 3 | 01200 | 4 | 32 | 41 | #efc07c | sand |
| 4 | 01200 | 5 | 41 | 42 | #753a05 | dirt track |
surfaces_df
| type | text_en | text_fr | text_es | text_ar | |
|---|---|---|---|---|---|
| 0 | dirt track | Dirt Track | Piste terre | Pista de tierra | الحجارة |
| 1 | gravel track | Gravel Track | Piste empierrée | Tierra | التراب |
| 2 | sand | Sand | Sable | Arena | الرمال |
| 3 | asphalt road | Asphalt Road | Goudron | Asfalto | الزفت |
| 4 | dunes | Dunes | Dunes | Dunas | الكثبان |
long_results_df, long_results2_df, teams_df, competitors_df = dakar.get_scores()
# Takes a single category and a single stage
long_results_df.head()
| _id | team.bib | type | waypoint | metric | value_0 | value_1 | year | category | stage | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | lastScore-2025-A-1-427 | 427 | cg | 01216 | position | 128 | 128 | 2025 | A | 1 |
| 1 | lastScore-2025-A-1-634 | 634 | cg | 01216 | position | 194 | 194 | 2025 | A | 1 |
| 2 | lastScore-2025-A-1-330 | 330 | cg | 01216 | position | 53 | 53 | 2025 | A | 1 |
| 3 | lastScore-2025-A-1-243 | 243 | cg | 01216 | position | 60 | 60 | 2025 | A | 1 |
| 4 | lastScore-2025-A-1-404 | 404 | cg | 01216 | position | 65 | 65 | 2025 | A | 1 |
long_results2_df.head()
| _id | team.bib | metric | value_0 | value_1 | year | category | stage | |
|---|---|---|---|---|---|---|---|---|
| 0 | lastScore-2025-A-1-427 | 427 | position | 125 | 125 | 2025 | A | 1 |
| 1 | lastScore-2025-A-1-634 | 634 | position | 196 | 197 | 2025 | A | 1 |
| 2 | lastScore-2025-A-1-330 | 330 | position | 43 | 43 | 2025 | A | 1 |
| 3 | lastScore-2025-A-1-243 | 243 | position | 50 | 50 | 2025 | A | 1 |
| 4 | lastScore-2025-A-1-404 | 404 | position | 34 | 34 | 2025 | A | 1 |
teams_df.head()
| team.bib | team.clazz | team.brand | team.model | team.vehicle | team.vehicleImg | team.w2rc | |
|---|---|---|---|---|---|---|---|
| 0 | 427 | 9a68ed3c41c5c7a1642df5d93458baa6 | BRP | CAN-AM MAVERICK R | BTR | https://img.aso.fr/core_app/img-motorSports-da... | False |
| 1 | 634 | ec2f26ebeb14824160c7204618a5780d | DAF | FAV 85 MX | TIBAU TEAM | https://img.aso.fr/core_app/img-motorSports-da... | False |
| 2 | 330 | a0a6386a4b9a61b73b036a50966345c0 | TAURUS | T3 MAX | NASSER RACING | https://img.aso.fr/core_app/img-motorSports-da... | False |
| 3 | 243 | f00d7ec8d2d96e9cf11aa515109376cf | MD | OPTIMUS | MD RALLYE SPORT | https://img.aso.fr/core_app/img-motorSports-da... | False |
| 4 | 404 | 9a68ed3c41c5c7a1642df5d93458baa6 | BRP | CAN-AM MAVERICK R | CAN-AM FACTORY TEAM | https://img.aso.fr/core_app/img-motorSports-da... | False |
competitors_df.head()
| team.bib | name | firstName | lastName | role | gender | nationality | profil | profil_sm | podium | aid | year | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 427 | B. LEPIETRE | BENOIT | LEPIETRE | P | m | fra | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 110add16-df63-4b90-9494-bc3db7d02662 | 2025 |
| 1 | 427 | R. RELMY-MADINSKA | RODRIGUE | RELMY-MADINSKA | C | m | fra | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 63cb271c-1c74-4f07-82b4-c3df3c425aa7 | 2025 |
| 2 | 634 | J. ESTEVE ORO | JORDI | ESTEVE ORO | P | m | esp | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 36106f23-d545-47b9-8565-983cce7550d3 | 2025 |
| 3 | 634 | F. PARDO | FRANCESC | PARDO | C | m | esp | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 43c1ce16-ccee-4ac2-ae16-b89e82a43183 | 2025 |
| 4 | 634 | J. PUJOL FORNOS | JORDI | PUJOL FORNOS | M | m | esp | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | https://img.aso.fr/core_app/img-motorSports-da... | 7700b503-68b6-4aca-a63a-96047071c2e9 | 2025 |
The next chapter shows how we can create an enricher around the teams_df that annotates it, based on team.bib and team.clazz, with additional vehicle category and class data. The following example uses a predefined function for using that technique.
from dakar_rallydj.enrichers import derive_clazz_metadata
derive_clazz_metadata(teams_df, dakar.get_clazz(), dakar.get_groups()).head()
| team.bib | reference | categoryClazz | clazz_label | tinyLabel | label | color | group_label | |
|---|---|---|---|---|---|---|---|---|
| 0 | 200 | 2025-A-T1-+ | 2025-A-T1 | T1+: Prototype Cross-Country Cars 4x4 | ULT | T1 | #EBBC4E | Ultimate |
| 1 | 201 | 2025-A-T1-+ | 2025-A-T1 | T1+: Prototype Cross-Country Cars 4x4 | ULT | T1 | #EBBC4E | Ultimate |
| 2 | 202 | 2025-A-T1-+ | 2025-A-T1 | T1+: Prototype Cross-Country Cars 4x4 | ULT | T1 | #EBBC4E | Ultimate |
| 3 | 203 | 2025-A-T1-+ | 2025-A-T1 | T1+: Prototype Cross-Country Cars 4x4 | ULT | T1 | #EBBC4E | Ultimate |
| 4 | 204 | 2025-A-T1-+ | 2025-A-T1 | T1+: Prototype Cross-Country Cars 4x4 | ULT | T1 | #EBBC4E | Ultimate |