XXXCreate Relay Teams
The structure for Relay teams is relatively simple. Following a structure like below added in the same way the competitors field was added to the overall structure.
- event_id = Event identification number (unique between different events in your competition).
- name = Relay team name
- relay_team_id = Short code used to identify your team.
- runners = List of bib numbers of the runners on the team
- team_id = Name of the joint team the runners belong to in the competition, not-relay specific
JSON field Structure¶
Below is the JSON structure. It's worth noting that we wont get to see these until we've also set up events, however they will exist in our JSON if needed to be called upon.
Runners is a comma separated list of the bib numbers of the runners within quotes, these will be the bibs from the competitors list.
"relay_teams": [
{
"event_id": "27",
"name": "Hare & Hounds",
"relay_team_id": "THH",
"runners": [
"1",
"2"
],
"team_id": "THH"
},
{
"event_id": "27",
"name": "Belgrave",
"relay_team_id": "BEL",
"runners": [
"3",
"4"
],
"team_id": "BEL"
}
],
The Second part of it's structure comes within the relay event's unit results. The bib field here should match the relay_team_id or failing this the team_id.
"results": [
{
"bib": "THH",
"lane": 1,
"performance": "1:30.59",
"place": 1,
"points": 0
},
{
"bib": "BEL",
"lane": 2,
"performance": "1:32.60",
"place": 2,
"points": 0
}
],
Fully Implemented Example¶
This being the final structure page means that the example is more detailed. The competitors are set up and have their bibs and team_ids assigned. We then have the relay teams containing the bibs of the running athletes within runners, along with the linked event id. Something important of note is that we have the relay event containing the bib of the relay teams within the results. Lastly we have the teams each athlete are assigned to generally.
{
"full_name": "api-test relay teams",
"short_name": "api-test",
"slug": "api-test-slug-5",
"name_local": "api-test",
"country_id": "GBR",
"address": "Kingsmeadow, Jack Goodchild Way, Kingston Road, Kingston upon Thames, UK",
"date": "2020-08-10",
"finish_date": "2020-08-15",
"wa_rankings_category_id": "DF",
"age_groups": ["ALL"],
"basic_description": "This is an opentrack api test",
"contact_details": "example@example.com",
"organiser_id": "6b2af700-0481-4f73-b9ae-8221ae619b55",
"website": "https://example.example",
"entry_link": "https://example.example/entry",
"results_link": "https://example.example/results",
"competitors": [
{
"age_group": "NA",
"category": "NA",
"competitor_id": "1",
"date_of_birth": "1966-03-21",
"events_entered": [
{
"event_code": "4x200",
"event_id": "27",
}
],
"first_name": "Andrew",
"gender": "M",
"last_name": "Robinson",
"nationality": "GBR",
"ot_athlete_id": "44721dcd-3019-44f0-aab0-4b90eb98838d",
"team_id": "THH",
},
{
"age_group": "NA",
"category": "NA",
"competitor_id": "2",
"date_of_birth": "1967-08-22",
"events_entered": [
{
"event_code": "4x200",
"event_id": "27",
}
],
"first_name": "Andy",
"gender": "M",
"last_name": "Weir",
"nationality": "GBR",
"ot_athlete_id": "332b0c3e-da43-4be6-af18-20a70fb23912",
"team_id": "THH",
},
{
"age_group": "NA",
"category": "NA",
"competitor_id": "3",
"date_of_birth": "1989-04-26",
"events_entered": [
{
"event_code": "4x200",
"event_id": "27",
}
],
"first_name": "Gus",
"gender": "M",
"last_name": "Upton",
"nationality": "GBR",
"ot_athlete_id": "af0a1892-0c9d-4031-a4cf-690c3c37bc49",
"team_id": "BEL",
},
{
"age_group": "NA",
"category": "NA",
"competitor_id": "4",
"date_of_birth": "1999-02-25",
"events_entered": [
{
"event_code": "4x200",
"event_id": "27",
}
],
"first_name": "Ben",
"gender": "M",
"last_name": "Hassell",
"nationality": "GBR",
"ot_athlete_id": "6bd44fb9-bc01-487f-bbfb-eaf1df0ed1b4",
"team_id": "BEL",
}
],
"relay_teams": [
{
"event_id": "27",
"name": "Hare & Hounds",
"relay_team_id": "THH",
"runners": [
"1",
"2"
],
"team_id": "THH"
},
{
"event_id": "27",
"name": "Belgrave",
"relay_team_id": "BEL",
"runners": [
"3",
"4"
],
"team_id": "BEL"
}
],
"events": [
{
"age_groups": ["ALL"],
"category": "M",
"ce_score_formula": "x",
"cut_after_round": 1,
"cut_survivors": 1,
"day": 1,
"event_code": "4x200",
"event_id": "27",
"genders": "M",
"heat_time_calculation": "AUTO",
"lanes": 4,
"max_field_attempts": 6,
"name": "4x200",
"r1_time": "15:45",
"reorder_last_round": False,
"require_callroom_override": False,
"rounds": "1",
"status": "partial",
"team_types": "INHERIT",
"units": [
{
"day": 1,
"distance": 800,
"event_id": "27",
"event_name": "4x200",
"heat": 1,
"heat_name": "27 4x200",
"precision": 2,
"results": [
{
"bib": "THH",
"lane": 1,
"performance": "1:30.59",
"place": 1,
"points": 0
},
{
"bib": "BEL",
"lane": 2,
"performance": "1:32.60",
"place": 2,
"points": 0
}
],
"results_status": "provisional",
"round": 1,
"scheduled_start_time": "15:45",
"status": "finished"
}
]
}
],
"teams": [
{
"flag_url": "https://file.opentrack.run/live/clubflags/GBR/BEL.png",
"match_id": "match",
"team_id": "BEL",
"team_name": "Belgrave Harriers"
},
{
"flag_url": "https://file.opentrack.run/live/clubflags/GBR/THH.png",
"match_id": "match",
"team_id": "THH",
"team_name": "Thames Hare & Hounds"
}
]
}
Here is an example of one of the relay teams created, it has the runners, the teams, the place and the result.
Method¶
A code example can be found at https://github.com/openath/opentrack-api-examples/blob/main/results_upload/api_create_relay_teams.py.
The only change to be made to make this example runnable is to replace the EMAIL and PASSWORD string with your OpenTrack email and password that has authorisation to create competitions.