CTHRU / Hitrava

Convert your Huawei Health sport activities and import them in Strava.
Other
352 stars 34 forks source link

HiZip Format modified #16

Closed Twinsen- closed 4 years ago

Twinsen- commented 4 years ago

Hi !

In my latest personal data export, it seems that the format is not the same as before. In 'Motion path detail data & description/motion path detail data.json' there is no more recordDay ! the attributes seems to be replaced with 'startTime'

Here is an example of my latest export :

HW_EXT_TRACK_SIMPLIFY@is{\"abnormalTrack\":0,\"avgHeartRate\":113,\"avgPace\":0.0,\"avgStepRate\":0,\"bestPace\":0.0,\"bestStepRate\":0,\"britishPaceMap\":{},\"britishPartTimeMap\":{},\"chiefSportDataType\":1,\"creepingWave\":0.0,\"hasTrackPoint\":false,\"isFreeMotion\":true,\"mAvgEversionExcursion\":0,\"mAvgForeFootStrikePattern\":0,\"mAvgGroundContactTime\":0,\"mAvgGroundImpactAcceleration\":0,\"mAvgHindFootStrikePattern\":0,\"mAvgSwingAngle\":0,\"mAvgWholeFootStrikePattern\":0,\"mBritishSwimSegments\":[],\"mBritishSwolfBase\":-0.1,\"mDuplicated\":0,\"mHeartrateZoneType\":2,\"mIsNewCoordinate\":false,\"mMaxAlti\":165.5,\"mMaxSpo2\":-1,\"mMinAlti\":161.7,\"mMinSpo2\":-1,\"mSwimSegments\":[],\"mSwolfBase\":-0.1,\"mTotalDescent\":0.0,\"maxHeartRate\":140,\"minHeartRate\":88,\"paceMap\":{},\"partTimeMap\":{},\"sportDataSource\":0,\"sportType\":265,\"totalCalories\":503000,\"totalDistance\":0,\"totalSteps\":0,\"totalTime\":2809000,\"trackType\":5,\"wearSportData\":{\"record_id\":21,\"max_met\":0,\"anaerobic_exercise_etraining_effect\":0,\"load_peak\":1857578,\"etraining_effect\":20,\"recovery_time\":1585,\"extra_poc\":0,\"status\":-1}}","totalDistance":0,"duplicateTrack":0,"sportType":103,"totalTime":2809000,"timeZone":"+0200","deviceCode":141644523,"paceMap":{},"totalCalories":503000,"version":1588006829048

& before :

HW_EXT_TRACK_SIMPLIFY@is{\"abnormalTrack\":0,\"avgHeartRate\":113,\"avgPace\":0.0,\"avgStepRate\":0,\"bestPace\":0.0,\"bestStepRate\":0,\"britishPaceMap\":{},\"britishPartTimeMap\":{},\"chiefSportDataType\":1,\"creepingWave\":0.0,\"hasTrackPoint\":false,\"isFreeMotion\":true,\"mAvgEversionExcursion\":0,\"mAvgForeFootStrikePattern\":0,\"mAvgGroundContactTime\":0,\"mAvgGroundImpactAcceleration\":0,\"mAvgHindFootStrikePattern\":0,\"mAvgSwingAngle\":0,\"mAvgWholeFootStrikePattern\":0,\"mBritishSwimSegments\":[],\"mBritishSwolfBase\":-0.1,\"mDuplicated\":0,\"mHeartrateZoneType\":2,\"mIsNewCoordinate\":false,\"mMaxAlti\":165.5,\"mMaxSpo2\":-1,\"mMinAlti\":161.7,\"mMinSpo2\":-1,\"mSwimSegments\":[],\"mSwolfBase\":-0.1,\"mTotalDescent\":0.0,\"maxHeartRate\":140,\"minHeartRate\":88,\"paceMap\":{},\"partTimeMap\":{},\"sportDataSource\":0,\"sportType\":265,\"totalCalories\":503000,\"totalDistance\":0,\"totalSteps\":0,\"totalTime\":2809000,\"trackType\":5,\"wearSportData\":{\"record_id\":21,\"max_met\":0,\"anaerobic_exercise_etraining_effect\":0,\"load_peak\":1857578,\"etraining_effect\":20,\"recovery_time\":1585,\"extra_poc\":0,\"status\":-1}}","endTime":1588006819000}],"deviceCode":141644523,"source":1,"recordDay":20200427,"version":1588006829048}

The log when trying to convert it :

2020-07-07 14:20:31,380 - ERROR - parse - Error parsing JSON file <./output/Motion path detail data & description/motion path detail data.json>
'recordDay'
Traceback (most recent call last):
  File "Hitrava.py", line 1131, in parse
    activity_date = dts.strptime(str(activity_dict['recordDay']), "%Y%m%d").date()
KeyError: 'recordDay'
Twinsen- commented 4 years ago

there are others changes in the files. For example, there is no more 'motionPathData' attribute :(

CTHRU commented 4 years ago

You're the (unfortunate) first to find the very recent changes. I requested my data the day before yesterday and with the recent changes in the Huawei Health application, I can't file a new request within the next 2 weeks. This leaves us with the option to either be patient or, if you wouldn't mind, to (temporarily) share your ZIP file over here.

The 'recordDay' issue can be circumvented, I'm a bit more worried about your remark of the missing 'motionPathData'.

Kooch22 commented 4 years ago

Hi,

I have the same issue and can send you my HiZip file. Do you have an email or something I can use?

Regards, Kooch

Kooch22 commented 4 years ago

Ok, just send it though my Hotmail account.

CTHRU commented 4 years ago

Got it, thanks.

Twinsen- commented 4 years ago

Got it, thanks.

Need another file ?

CTHRU commented 4 years ago

No, not for now, thank you. I took a first look, and it looks like it will be fixable. I keep you posted.

Twinsen- commented 4 years ago

Test OK !! Perfect man :)