Data Processing - livef1.data_processing

Data Models

Classes

BasicResult(data)

Encapsulates a basic result dataset, typically in JSON format.

class livef1.data_processing.data_models.BasicResult(data: dict)[source]

Encapsulates a basic result dataset, typically in JSON format.

Parameters:
datadict

The JSON-like data to be encapsulated within the result.

Attributes:
valuedict

The data associated with the result, stored as a dictionary (JSON-like structure).

Data Preprocessing

Classes

livef1SessionETL(session)

A class that handles Extract-Transform-Load (ETL) operations for F1 session data.

class livef1.data_processing.etl.livef1SessionETL(session)[source]

A class that handles Extract-Transform-Load (ETL) operations for F1 session data.

Parameters:
sessionSession

The session object.

Attributes:
sessionSession

The session object containing session-related information.

function_map :class:`dict`

A dictionary mapping various session data titles to their corresponding parsing functions.

Methods

aggregate_data(data)

Aggregate the cleaned data to produce gold level data.

clean_data(data)

Clean the raw data to produce silver level data.

process_bronze_level()

Process raw data to produce bronze level data.

process_gold_level()

Process silver level data to produce gold level data.

process_silver_level()

Process bronze level data to produce silver level data.

unified_parse(title, data)

Unified parsing function that selects the appropriate parser function based on the title.

aggregate_data(data)[source]

Aggregate the cleaned data to produce gold level data.

Parameters:
datalist

The cleaned data to be aggregated.

Returns:
list

The aggregated data.

clean_data(data)[source]

Clean the raw data to produce silver level data.

Parameters:
datalist

The raw data to be cleaned.

Returns:
list

The cleaned data.

process_bronze_level()[source]

Process raw data to produce bronze level data.

Returns:
BronzeResult

An object containing the bronze level data.

process_gold_level()[source]

Process silver level data to produce gold level data.

Returns:
GoldResult

An object containing the gold level data.

process_silver_level()[source]

Process bronze level data to produce silver level data.

Returns:
SilverResult

An object containing the silver level data.

unified_parse(title, data)[source]

Unified parsing function that selects the appropriate parser function based on the title.

Parameters:
titlestr

The title of the data to be parsed.

datadict

The session data to be parsed.

Returns:
Parsed data from the respective function in the function map.

Functions

parse_car_data_z(data, sessionKey)

Parses car data (z-axis) for each driver.

parse_current_tyres(data, sessionKey)

Parses current tyre data for each driver.

parse_driver_list(data, sessionKey)

Parses the driver list data.

parse_driver_race_info(data, sessionKey)

Parses driver race info data.

parse_extrapolated_clock(data, sessionKey)

Parses extrapolated clock data.

parse_hearthbeat(data, sessionKey)

Parses the heartbeat data.

parse_lap_series(data, sessionKey)

Parses lap series data for each driver.

parse_position_z(data, sessionKey)

Parses driver position (z-axis) data.

parse_race_control_messages(data, sessionKey)

Parses race control messages.

parse_session_data(data, sessionKey)

Parses session data for each driver.

parse_session_info(data, sessionKey)

Parses general session information.

parse_session_status(data, sessionKey)

Parses the session status data.

parse_team_radio(data, sessionKey)

Parses team radio data.

parse_timing_data(data, sessionKey)

Parses timing data for each driver.

parse_tlarcm(data, sessionKey)

Parses TLA RCM (Track Location Allocation Race Control Messages) data.

parse_top_three(data, sessionKey)

Parses the top three drivers' data.

parse_tyre_stint_series(data, sessionKey)

Parses the tyre stint series data, generating records for each stint.

parse_weather_data(data, sessionKey)

Parses weather data for the session.

livef1.data_processing.parse_functions.parse_basic(data, sessionKey)[source]
livef1.data_processing.parse_functions.parse_car_data_z(data, sessionKey)[source]

Parses car data (z-axis) for each driver.

Parameters:
datadict

The car data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, UTC time, driver number, and channel data.

livef1.data_processing.parse_functions.parse_current_tyres(data, sessionKey)[source]

Parses current tyre data for each driver.

Parameters:
datadict

The current tyre data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver number, and tyre-related info.

livef1.data_processing.parse_functions.parse_driver_list(data, sessionKey)[source]

Parses the driver list data.

Parameters:
datadict

The driver list data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, driver number, and driver-related info.

livef1.data_processing.parse_functions.parse_driver_race_info(data, sessionKey)[source]

Parses driver race info data.

Parameters:
datadict

The driver race info data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver number, and other race-related info.

livef1.data_processing.parse_functions.parse_extrapolated_clock(data, sessionKey)[source]

Parses extrapolated clock data.

Parameters:
datadict

The extrapolated clock data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and other clock-related info.

livef1.data_processing.parse_functions.parse_hearthbeat(data, sessionKey)[source]

Parses the heartbeat data.

Parameters:
datadict

The heartbeat data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and UTC time.

livef1.data_processing.parse_functions.parse_lap_series(data, sessionKey)[source]

Parses lap series data for each driver.

Parameters:
datadict

The lap series data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver number, lap number, and lap position.

livef1.data_processing.parse_functions.parse_pit_lane_time(data, sessionKey)[source]
livef1.data_processing.parse_functions.parse_position_z(data, sessionKey)[source]

Parses driver position (z-axis) data.

Parameters:
datadict

The driver position data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, UTC time, driver number, and z-axis position data.

livef1.data_processing.parse_functions.parse_race_control_messages(data, sessionKey)[source]

Parses race control messages.

Parameters:
datadict

The race control messages data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and message details.

livef1.data_processing.parse_functions.parse_session_data(data, sessionKey)[source]

Parses session data for each driver.

Parameters:
datadict

The session data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key and session-related info.

livef1.data_processing.parse_functions.parse_session_info(data, sessionKey)[source]

Parses general session information.

Parameters:
datadict

The session information data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and session-related information.

livef1.data_processing.parse_functions.parse_session_status(data, sessionKey)[source]

Parses the session status data.

Parameters:
datadict

The session status data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and session status.

livef1.data_processing.parse_functions.parse_team_radio(data, sessionKey)[source]

Parses team radio data.

Parameters:
datadict

The team radio data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and captured radio messages.

livef1.data_processing.parse_functions.parse_timing_data(data, sessionKey)[source]

Parses timing data for each driver.

Parameters:
datadict

The timing data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver number, and various timing metrics.

livef1.data_processing.parse_functions.parse_tlarcm(data, sessionKey)[source]

Parses TLA RCM (Track Location Allocation Race Control Messages) data.

Parameters:
datadict

The TLA RCM data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and the message content.

livef1.data_processing.parse_functions.parse_top_three(data, sessionKey)[source]

Parses the top three drivers’ data.

Parameters:
datadict

The top three data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver position, and related info.

livef1.data_processing.parse_functions.parse_tyre_stint_series(data, sessionKey)[source]

Parses the tyre stint series data, generating records for each stint.

Parameters:
datadict

The tyre stint series data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, driver number, pit count, and other stint-related info.

livef1.data_processing.parse_functions.parse_weather_data(data, sessionKey)[source]

Parses weather data for the session.

Parameters:
datadict

The weather data.

sessionKeyint

The key of the current session.

Yields:
dict

A record containing the session key, timestamp, and weather-related information.