Repository navigation
Consolidate ActivityParser's canonical column handling - #7
Merged
Merged
Conversation
ActivityParser's canonical schema was scattered across six per-format selector/mapper attributes built in __init__, all kept in sync by hand, and FIT was the odd one out: unlike parse_tcx_gpx.py, which already renames raw XML fields to canonical names before returning, parse_fit_file.py returned raw FIT SDK field names untouched, pushing FIT-specific renaming and enhanced- column coalescing into ActivityParser itself. Moves FIT's renaming and enhanced-column coalescing down into parse_fit_file.py (mirroring parse_tcx_gpx.py), so all three low-level parsers return canonically-named columns. ActivityParser now selects/reorders against a single default column list per output (records, laps) defined once in default_columns.py, instead of six duplicated per-format attributes. Columns are exposed as mutable record_columns/lap_columns instance attributes so callers can customize selection, and a new include_all_columns flag keeps non-canonical columns instead of dropping them. Also drops metadata/provenance fields that aren't fitness data (sensor, cadence_sensor, sensor_state, event, event_type, lap_trigger, sport, sub_sport, intensity, notes) from the defaults, and unifies TCX's total_strides field under GPX's steps name. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 6, 2026
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
parse_fit_file.py(mirroringparse_tcx_gpx.py), so all three low-level parsers return canonically-named columns.ActivityParser's six duplicated per-format selector/mapper attributes with a singledefault_columns.py(DEFAULT_RECORD_COLUMNS/DEFAULT_LAP_COLUMNS), exposed as mutablerecord_columns/lap_columnsinstance attributes.include_all_columnsflag to keep non-canonical columns (FITunknown_*, namespace-qualified TCX/GPX extension columns) instead of dropping them.sensor,cadence_sensor,sensor_state,event,event_type,lap_trigger,sport,sub_sport,intensity,notes) and unifies TCX'stotal_stridesunder GPX'sstepsname.Test plan
uv run pytest— all tests passuv run pre-commit run --all-files— ruff, pyright, pytest all pass