Formula E Racing Data System delivered real-time telemetry streaming for Dragon Racingβs Formula E operations. This production system solved critical file locking issues while providing live race data to racing engineers during high-stakes Formula E competitions.
A real-time streaming system that connects Formula Eβs official Al Kamel data feeds directly to SQL Server, enabling Excel runsheets to function as live dashboards without file conflicts.
π Codebase Size:
βββ Total Python Files: 2 core modules (AlKamelClient.py, db.py)
βββ Lines of Code: ~440 lines total
β βββ AlKamelClient.py: ~361 lines (main client implementation)
β βββ db.py: ~440 lines (database operations)
βββ Django Models: 7+ model files for data structure
βββ SQL Schema: 3 SQL files (schema, triggers/views, utilities)
ποΈ Code Complexity & Architecture:
βββ Classes: 3 main classes
β βββ JsonSocket: Base SSL connection (16 methods)
β βββ JsonClient: Protocol implementation (8 methods)
β βββ NoneDict: Custom dictionary with graceful None handling
βββ Database Functions: 8+ specialized functions
β βββ Session management, participant tracking, live events, telemetry
βββ Error Handling: Exponential backoff decorators using @backoff.on_exception
β‘ Protocol Implementation:
βββ Message Types: 6 core commands (LOGIN, JOIN, LEAVE, PING, ACK, JSON)
βββ Data Channels: 5+ subscribed channels
β βββ timing.session.info, timing.session.entry, timing.liveEvents.fl
βββ JSON Message Parsing: Custom delimiter handling (\r\n)
βββ Buffer Management: Sophisticated message buffering for partial receives
ποΈ Database Integration:
βββ SQL Operations: 15+ database functions
βββ Upsert Patterns: INSERT/UPDATE logic for real-time data
βββ Table Relationships: Multi-level hierarchy (sessions β participants β drivers)
βββ Data Types: Handles JSON fields, timestamps, foreign keys, enums
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
def parse_msg(self, message):
command_id, message_id, channel, data = message.split(MESSAGE_DELIM)[0].split(':', 3)
if len(data):
data = json.loads(data)
return {'command_id': command_id, 'message_id': message_id, 'channel': channel, 'data': data}
Formula E Race Data Flow:
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Al Kamel SSL β β Python Client β β SQL Server β
β Data Servers βββββΊβ JSON Parser βββββΊβ Live Views β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
Live Telemetry Protocol Handler Excel Runsheets
β’ Timing Data β’ Channel Manager β’ Monaco.xlsx
β’ Energy Levels β’ Connection Pool β’ Paris.xlsx
β’ GPS Positions β’ Exponential Backoff β’ Multi-Team Access
Al Kamel V2 Protocol Integration
-- Real-Time Data Upsert Pattern
def timing_session_info(cursor, d):
cursor.execute("SELECT 1 FROM [dbo].[timing_session] WHERE id = ?", [d['sessionDbId']])
if not cursor.fetchone():
-- INSERT new session with live data
cursor.execute("""
INSERT INTO [dbo].[timing_session]
(id, name, type, status, start_time, end_time)
VALUES (?, ?, ?, ?, ?, ?)
""", session_data)
else:
-- UPDATE existing session
cursor.execute("""
UPDATE [dbo].[timing_session]
SET status = ?, current_lap = ?, elapsed_time = ?
WHERE id = ?
""", update_data)
Challenge: Multiple racing engineers couldnβt access Excel files simultaneously during races
Solution: Database-centric architecture where Excel connects to SQL Server as live datasource
Challenge: Network interruptions during critical race operations
Solution: Self-healing connection system with exponential backoff
class NoneDict(dict):
def __getitem__(self, key):
return dict.get(self, key)
@backoff.on_exception(backoff.expo, ConnectionError, max_tries=8)
def establish_ssl_connection(self):
return ssl.wrap_socket(socket.connect((host, port)))
Challenge: Processing live telemetry from 20+ Formula E cars simultaneously
Solution: Optimized channel subscription and database upsert patterns
Technical Specifications:
βββ SSL Security # Certificate handling and secure connections
βββ Protocol Compliance # 60-page Al Kamel V2 specification implementation
βββ Database Performance # Optimized SQL Server views and upsert operations
βββ Connection Resilience # Exponential backoff and automatic reconnection
βββ Multi-Team Support # Concurrent Excel access without conflicts
Built complete Al Kamel V2 Protocol client from 60-page specification:
Formula E Racing Data System demonstrates enterprise software capabilities in high-stakes environments:
This project showcases the ability to deliver enterprise-grade systems under extreme performance requirements, working with proprietary protocols in high-stakes racing environments where reliability and real-time performance are absolutely critical.
Your racing engineers are manually updating spreadsheets during a Formula E race. Critical strategic decisions are delayed by 60 seconds. Energy management calculations are based on outdated competitor data. Meanwhile, other teams with automated data feeds are making faster, more informed decisions that could determine race outcomes.
βDirect Pipeline to Formula Eβs Official Race Dataβ
Traditional racing teams relied on delayed broadcast feeds or manual timing. Our Al Kamel V2 Protocol implementation delivered:
The Result: Dragon Racing engineers had live competitor data faster than most Formula E teams.
βEliminated File Locking While Maintaining Excel Workflowsβ
Racing teams needed their familiar Excel runsheets but without file conflicts. Our SQL Server integration delivered:
The Magic: Multiple racing engineers could access live race data simultaneously in their preferred Excel environment.
βBulletproof Reliability During Critical Race Operationsβ
Network interruptions during Formula E races could cost championship points. Our resilience system delivered:
The Power: Zero downtime during critical Formula E racing operations.
Production Components:
βββ Python SSL Client # Secure Al Kamel protocol implementation
βββ Real-time JSON Parser # Message framing and data extraction
βββ SQL Server Integration # Live database views for Excel connectivity
βββ Connection Resilience # Exponential backoff and automatic recovery
βββ Multi-Channel Manager # Dynamic subscription to timing/telemetry streams
βββ Excel Datasource Layer # Seamless integration with existing workflows
Scenario: Formula E race weekend with 20 competitors, energy management critical
Traditional Process:
With Racing Data System:
Race Weekend Management:
Dragon Racing relied on this system for mission-critical Formula E racing operations, proving the platformβs reliability and performance in high-stakes competitive environments.
Formula E Racing Data System proves that enterprise software must perform under extreme conditions. This project demonstrates:
Formula E Racing Data System: Where enterprise software engineering meets the speed and precision of professional motorsport.