Parse B2 meet sanction number + notes, and H2 disqualification detail#24
Open
fsalum wants to merge 2 commits into
Open
Parse B2 meet sanction number + notes, and H2 disqualification detail#24fsalum wants to merge 2 commits into
fsalum wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes three pieces of information present in Hy-Tek
.hy3files 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 existinginfo_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 existingextract()helper and default toNonewhen blank.H2 record (
h2_parser, newly registered) —H2lines 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), mirroringh1_parser. Unlike H1, it does not assert the H2 two-character code againstDisqualificationCode, 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.Schema additions
Meet.sanction_number,Meet.notes,DisqualificationInfo.info_str_detail— allOptional[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.