Repository navigation
Data Import
The data import system allows importing race results from CSV files or Google Sheets scorecards.
Select Season
→ Select Matchday (or create inline)
→ Select Import Type (Regular / Playoff)
→ Select Source (CSV / Google Sheets)
→ Upload/Configure
→ Preview results
→ Execute import
Execute is all or nothing. A parse error in any row, an unknown team, an existing match without Overwrite, a driver that cannot be assigned, or a matchday of another season rejects the whole import. The message lists every detected error and the database stays unchanged, including races an overwrite would have replaced.
Imported results are scored with the points table of their matchday's phase. A playoff import that names its matchday by label finds or creates that matchday in the playoff phase, so its legs are scored and ranked as playoff races. A phase without a race scoring rejects the import.
The import also checks its target before it writes anything. A playoff matchup must belong to the selected season, and its two teams must be the teams on every scorecard. A selected matchday must lie in the matchup's playoff phase. A playoff matchday is only accepted together with its playoff matchup. Every scorecard of a playoff import lists exactly the matchup's two teams, and a sub-team counts for its parent team. Overwrite never replaces the legs of another playoff matchup on the same matchday.
Scorecards of the same two teams on one matchday form one pairing, whichever team block comes first. The first leg decides the pairing's home team; a later leg that lists the teams the other way round is stored as a reversed leg. A re-import in either block order counts as the existing pairing, both for the duplicate warning and for Overwrite.
| Column | Description | Example |
|---|---|---|
| Team | Team name | CTC Alpha |
| PSN ID | Driver's PlayStation Network ID | RacerX_99 |
| Position | Finishing position (1-based) | 3 |
| Quali | Qualifying position (1-based) | 1 |
| FL | Fastest lap flag (1 = yes, 0 = no) | 0 |
- Comma (
,) - Semicolon (
;) - Tab
Team,PSN ID,Position,Quali,FL
CTC Alpha,RacerX_99,1,2,1
CTC Alpha,SpeedDemon,4,1,0
CTC Bravo,NightRider,2,3,0
CTC Bravo,TurboKing,3,4,0The Google Sheets scorecard uses a two-team-block layout with a variable number of drivers per team:
| Team A Name | | | | |
| PSN ID | Position | Quali | FL | |
| Driver1 | 1 | 2 | 1 | |
| Driver2 | 4 | 1 | 0 | |
| | | | | |
| Team B Name | | | | |
| PSN ID | Position | Quali | FL | |
| Driver3 | 2 | 3 | 0 | |
| Driver4 | 3 | 4 | 0 | |
- Create a Google Cloud project in the Google Cloud Console
- Enable the Google Sheets API (APIs & Services -> Library -> Google Sheets API)
- Create a Service Account (APIs & Services -> Credentials -> Create Credentials -> Service Account)
- Download the JSON key file and configure its path in application properties
- Share the spreadsheet with the service account email address (read access)
Paste the full Google Sheets URL. The system extracts the spreadsheet ID and reads the scorecard via the Sheets API v4.
When importing results, the system matches PSN IDs to existing drivers using a multi-step strategy:
| Step | Method | Match Condition |
|---|---|---|
| 1 | Exact match | PSN ID matches exactly |
| 2 | Case-insensitive | PSN ID matches ignoring case |
| 3 | Levenshtein distance | Similarity >= 80% |
| 4 | New driver | No match found, creates a new driver record |
This is handled by DriverMatchingService and ensures robust imports even with minor typos in PSN IDs.
- Select "Playoff" as the import type
- Choose the target playoff round and matchup
- Same CSV/Sheets format as regular imports
- Results are linked to the playoff matchup instead of a regular matchday
The matchday dropdown in the import form supports creating a new matchday directly without leaving the import flow. This allows quick imports when the matchday does not yet exist.