Sport Structure Upload via Template (CSV)
Goal
Enable bulk upload of categories, leagues, and teams in the club active season from a CSV template.
This guide documents the actual implemented behavior in the sport structure screen.
Where it is used
- Screen: Sports Structure
- Button: Import CSV template
- Requirement: user with club management permissions and screen in edit mode.
Reference files
- Base template: sport_structure_import_template_en.csv
Required CSV format
Required headers (recommended order):
entity,name,category,league
Columns
entity: row type. Allowed values:categoryleagueteam
name: main entity name.category: required only whenentity=team.league: required only whenentity=team.
Validation rules
Import validates before insert:
- File must contain at least header + 1 data row.
- Columns
entityandnamemust exist. - If
entity=team,categoryandleagueare required. entityoutsidecategory|league|teamis an error.- For teams, category/league must exist:
- in the active season, or
- in the same file (if created as
category/leaguerows).
If validation errors exist, import is not executed and an error summary is shown.
Insert behavior
- New categories: inserted if they do not exist in active season (normalized name comparison).
- New leagues: same criteria.
- New teams: inserted if equivalent name+category+league combination does not exist.
- Existing records are not deleted.
- Existing names are not updated (append/partial upsert mode focused on new records).
Text normalization
Before compare/insert:
trimis applied;- multiple spaces collapse into one.
Example:
" Senior A "->"Senior A"
Valid example
entity,name,category,league
category,Senior,,
category,Youth,,
league,Gold,,
league,Silver,,
team,Senior Team A,Senior,Gold
team,Senior Team B,Senior,Silver
team,Youth Team A,Youth,Silver
Expected result:
- Categories created: 2 (if they did not exist)
- Leagues created: 2 (if they did not exist)
- Teams created: 3 (if they did not exist)
Invalid example
entity,name,category,league
team,Team without
league,Senior,
foo,Unknown entry,,
team,,Senior,Gold
team,Team with missing reference,U13,Gold
Expected errors:
teamrow withoutleague;- invalid
entity(foo); - empty
name; - non-existing category reference (
U13).
Recommended operation flow
- Download base template.
- Fill categories and leagues first.
- Fill teams referencing exact category/league names.
- Import template.
- Review creation summary.
- Retry if errors with corrected data.
Best practices
- Keep consistent names (e.g.
Youth A,Youth B). - Avoid typographic variants for the same entity.
- Load in blocks (simple structure first, then expansions).
Current scope
This import covers:
- categories
- leagues
- teams
Not covered yet:
- bulk member assignment
- player profile import
- mass update/delete
Troubleshooting
"CSV requires columns: entity,name,category,league"
Header does not match. Verify first row.
"Template has no data"
File has only header or is empty.
"team requires category and league"
Incomplete team row.
"category/league does not exist"
Add creation row in same CSV or create it in app first.