Skip to content

Commit

Permalink
Add the G0 SplitsRecord. (#8)
Browse files Browse the repository at this point in the history
The model description is taken from the sdifv3f.txt file. I'm trying to
parse a file that contains G0 records, so I need this defined.
  • Loading branch information
ericvsmith committed Jan 6, 2024
1 parent c9f7e91 commit 63618a8
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/sdif/models.py
Expand Up @@ -473,6 +473,47 @@ class RelayName:
preferred_first_name: Optional[str] = spec(107, 15)


@model(frozen=True, kw_only=True)
class SplitsRecord:
"""Identify the athletes in an event by name and USS
registration number. Identify the split distance,
number of splits and the split times of the swims.
This record is used to identify the athletes in an event and the
split times. When used, one splits record would be submitted for
each event that an athlete entered in a meet. The athlete name,
USS registration code, and split distance are required.
A split type code is required to identify the split
as an interval or cumulative time. Ten time fields are provided
to record the splits, and multiple records may be used to
complete all splits for a long-distance event.
NOTE: Splits records must be preceded by at least one D0
individual event record or one F0 relay name record. If this
record is missing, there is no way to connect the splits with
the swim.
"""

identifier: ClassVar[str] = "G0"
organization: Optional[OrganizationCode] = spec(3, 1, m2=True)
name: str = spec(16, 28, t.name_)
ussn: Optional[str] = spec(44, 12, m2=True)
sequence: int = spec(56, 1)
n_splits: int = spec(57, 2)
split_distance: int = spec(59, 4)
split_code: str = spec(63, 1)
split_time_1: Optional[Time] = spec(64, 8)
split_time_2: Optional[Time] = spec(72, 8)
split_time_3: Optional[Time] = spec(80, 8)
split_time_4: Optional[Time] = spec(88, 8)
split_time_5: Optional[Time] = spec(96, 8)
split_time_6: Optional[Time] = spec(104, 8)
split_time_7: Optional[Time] = spec(112, 8)
split_time_8: Optional[Time] = spec(120, 8)
split_time_9: Optional[Time] = spec(128, 8)
split_time_10: Optional[Time] = spec(136, 8)


@model(frozen=True, kw_only=True)
class FileTerminator:
"""Identify the logical end of file for a file
Expand Down

0 comments on commit 63618a8

Please sign in to comment.