Skip to content

[BUG] HiTrack parser fails to parse running course activities #90

@jiaweixiao

Description

@jiaweixiao

Describe the bug
When converting "Running Course" activities, the conversion fails or produces errors during the HiTrack file parsing stage. This is because Huawei includes a training metadata block called actionSummary at the end of the raw data within the JSON attribute field.

The HiTrackFile class expects data in a specific CSV-like format (tp=...;k=...). The trailing actionSummary=[{...}] block is not valid CSV data, causing the csv.reader to encounter unexpected formatting or null lines, which disrupts the parsing loop.

Logs

2025-12-27 20:23:18,589 - INFO - main - Hitrava version 6.2.0 (build 2509.2501) started with arguments ['-j', 'motion_path_detail_data1766124
283676.json', '--output_dir', './']
2025-12-27 20:23:18,590 - INFO - main - Running on Python version 3.11.5
2025-12-27 20:23:18,639 - INFO - parse - Found one or more activities in JSON at index 0 to parse from 2025-12-12 (YYY-MM-DD)
2025-12-27 20:23:18,644 - INFO - _parse_activity - Saving activity from 2025-12-12 22:14:39.943000+00:00 to HiTrack file HiTrack_20251213_061439 for parsing
2025-12-27 20:23:18,645 - INFO - parse - Parsing file <HiTrack_20251213_061439>
2025-12-27 20:23:18,695 - ERROR - parse - Error parsing file <HiTrack_20251213_061439> at line <7062>
CSV data: []
list index out of range
2025-12-27 20:23:18,695 - ERROR - parse - Error parsing JSON file <motion_path_detail_data1766124283676.json>
('Error parsing file <%s> at line <%d>\n%s', 'HiTrack_20251213_061439', 7062)
Traceback (most recent call last):
  File "Hitrava.py", line 1018, in parse
    if line[0] == 'tp=lbs':  # Location line format: tp=lbs;k=_;lat=_;lon=_;alt=_;t=_
       ~~~~^^^
IndexError: list index out of range

Files
motion_path_detail_data1766124283676.json

Screenshots
N/A

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions