Skip to content

Parse B2 meet sanction number + notes, and H2 disqualification detail#24

Open
fsalum wants to merge 2 commits into
SwimComm:masterfrom
fsalum:feat/b2-h2-meet-dq-fields
Open

Parse B2 meet sanction number + notes, and H2 disqualification detail#24
fsalum wants to merge 2 commits into
SwimComm:masterfrom
fsalum:feat/b2-h2-meet-dq-fields

Conversation

@fsalum

@fsalum fsalum commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Exposes three pieces of information present in Hy-Tek .hy3 files that the parser did not previously surface:

  • Meet.sanction_number — the LSC sanction token in the B2 record tail (e.g. WI2023-236S, NC26062APTT).
  • Meet.notes — the free-text meet note in the B2 record (e.g. "Hosted by NCAP and Sponsored by TYR").
  • DisqualificationInfo.info_str_detail — the specific infraction description from the H2 record (e.g. "Alternating Kick - fly"), which the parser did not read at all. The existing info_str (from H1) holds the generic category (e.g. "Stroke Infraction swimmer #3"); this complements it with the specific reason.

Details

B2 record (b2_parser) — in addition to the masters/type/course flags already parsed, the B2 line carries a free-text note (cols 3–47) and a sanction token in the tail (cols 109–128, after the fee field). Both are read with the existing extract() helper and default to None when blank.

H2 record (h2_parser, newly registered)H2 lines were unhandled. Each carries the detailed infraction text for the preceding disqualification. The new parser attaches that text to the active DQ slot of the last entry (finals → swimoff → prelim), mirroring h1_parser. Unlike H1, it does not assert the H2 two-character code against DisqualificationCode, since that code is a stroke/leg sub-classification rather than the DQ code. It is a safe no-op when no DQ slot is set.

B22026 YMCA SCY Time Trials ... 010105Y1  0.00  NC26062APTT   → notes + sanction="NC26062APTT"
H163Stroke Infraction swimmer #3    → info_str        (H1, generic)
H21AAlternating Kick - fly          → info_str_detail (H2, specific)

Schema additions

Meet.sanction_number, Meet.notes, DisqualificationInfo.info_str_detail — all Optional[str] = None, so existing consumers are unaffected.

Tests

  • test_b_meet_parsers.py: notes + sanction extraction incl. blank/no-sanction cases, against real B2 records.
  • test_h_dq_parsers.py: H2 detail attaches to the correct DQ slot (finals/swimoff/prelim), empty-detail → None, and no-DQ no-op.

fsalum added 2 commits July 5, 2026 14:53
The B2 secondary meet-info line carries a free-text meet note (columns
3-47) and an LSC sanction token in the tail (columns 109-128, after the
fee field). Expose them as Meet.notes and Meet.sanction_number, read via
the existing extract() helper and defaulting to None when blank. Also
adds DisqualificationInfo.info_str_detail (used by the H2 parser). All
new schema fields are Optional and default to None.
H2 lines carry the specific infraction description for the preceding
disqualification (e.g. "Alternating Kick - fly"), complementing the H1
generic category already stored in info_str. Add h2_parser (registered
for "H2") that attaches the detail text to the active DQ slot of the last
entry (finals -> swimoff -> prelim, mirroring h1_parser) via
DisqualificationInfo.info_str_detail. Unlike H1 it does not assert the H2
two-character code against DisqualificationCode (that code is a
stroke/leg sub-classification, not the DQ code), and it is a safe no-op
when no DQ slot is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant