br-g / openf1

OpenF1 API - Real-time and historical Formula 1 data
Other
380 stars 18 forks source link

Driver team colour data type inconstency #26

Closed xsampedro closed 8 months ago

xsampedro commented 8 months ago

In 2024, the data type for the team color in the drivers API has changed from string to int for some entries.

For instance, during the Bahrain Race on March 2nd, 2024, Fernando Alonso's team color is listed as an integer (229971), although other teams have their colors in hexadecimal format with letters, suggesting these should be strings.

https://api.openf1.org/v1/drivers?session_key=9472 (Bahrain Race in March 2nd, 2024)

  {
    "session_key": 9472,
    "meeting_key": 1229,
    "broadcast_name": "F ALONSO",
    "country_code": "ESP",
    "first_name": "Fernando",
    "full_name": "Fernando ALONSO",
    "headshot_url": "https://media.formula1.com/d_driver_fallback_image.png/content/dam/fom-website/drivers/F/FERALO01_Fernando_Alonso/feralo01.png.transform/1col/image.png",
    "last_name": "Alonso",
    "driver_number": 14,
    "team_colour": 229971,
    "team_name": "Aston Martin",
    "name_acronym": "ALO"
  },

I would suggest serializing all team colors as strings for consistency.

br-g commented 8 months ago

Good point! With the current system, numbers are automatically casted as such. I agree this could be an issue for some users