alsterman / wellness2tcx

Convert MyWellness json to Training Center XML
7 stars 0 forks source link

Converting running data of a treadmill session #7

Open OstinatoRigore opened 4 years ago

OstinatoRigore commented 4 years ago

Hi,

Thanks for your script. I thought I clone this and make a version for converting running data to a tcx file. Unfortunately I found out I need to learn Clojure first to do this. Maybe you can create a version for running data. I bet that this would be a simple adjustment for you.

Here is a sample of a running session on a treadmill. It also uses the grade paramater (half way the treadmill raises 1 percent):

{"data":{"analitics":{"descriptor":[{"i":0,"pr":{"name":"Speed","um":"Km_h"}},{"i":1,"pr":{"name":"Grade","um":"Percent"}},{"i":2,"pr":{"name":"HDistance","um":"Meter"}}],"samples":[{"vs":[0.8,0.0,0.34555555555555562],"t":1},{"vs":[1.0,0.0,3.5702777777777768],"t":15},{"vs":[2.7000000000000015,0.0,4.1683333333333321],"t":16},{"vs":[4.9999999999999991,0.0,5.4324444444444433],"t":17},{"vs":[4.8999999999999995,0.0,9.5129999999999963],"t":20},{"vs":[4.7,0.0,10.989611111111108],"t":21},{"vs":[4.8999999999999995,0.0,36.214555555555556],"t":40},{"vs":[6.5999999999999934,0.0,37.78758333333333],"t":41},{"vs":[8.5999999999999872,0.0,39.593749999999993],"t":42},{"vs":[11.399999999999977,0.0,42.0208611111111],"t":43},{"vs":[11.299999999999978,0.0,46.042527777777757],"t":44},{"vs":[11.199999999999978,0.0,49.101777777777748],"t":45},{"vs":[12.799999999999972,0.0,1222.9957777777629],"t":421},{"vs":[12.999999999999972,0.0,1226.209999999985],"t":423},{"vs":[13.199999999999971,0.0,1230.7682222222072],"t":424},{"vs":[13.299999999999971,0.0,1234.1305555555405],"t":425},{"vs":[13.599999999999969,0.0,1237.9077499999851],"t":426},{"vs":[13.799999999999969,0.0,1241.596888888874],"t":427},{"vs":[13.899999999999968,0.0,1245.3374999999853],"t":428},{"vs":[13.999999999999968,0.0,1257.5368888888743],"t":431},{"vs":[13.799999999999969,0.0,1459.5384444444323],"t":483},{"vs":[11.599999999999977,0.0,1463.4906388888767],"t":484},{"vs":[11.399999999999977,0.0,1466.8747499999877],"t":485},{"vs":[11.299999999999978,0.0,1473.1697499999877],"t":487},{"vs":[11.199999999999978,0.0,1476.2983333333209],"t":488},{"vs":[11.399999999999977,0.0,1824.2082222222002],"t":600},{"vs":[13.699999999999969,0.0,1828.4349166666448],"t":601},{"vs":[13.799999999999969,0.0,1832.069388888867],"t":602},{"vs":[13.999999999999968,0.0,1835.4292499999781],"t":603},{"vs":[13.799999999999969,0.0,2065.8600833333157],"t":662},{"vs":[12.099999999999975,0.0,2069.6886666666487],"t":663},{"vs":[10.999999999999979,0.0,2072.8358888888715],"t":664},{"vs":[11.199999999999978,0.0,2076.3657499999827],"t":665},{"vs":[11.199999999999978,0.5,2154.9368611110913],"t":690},{"vs":[11.199999999999978,1.0,2164.363527777758],"t":693},{"vs":[11.399999999999977,1.0,2436.8138611110835],"t":781},{"vs":[14.899999999999965,1.0,2440.1028333333056],"t":782},{"vs":[14.799999999999965,1.0,2445.1760555555275],"t":783},{"vs":[14.599999999999966,1.0,2448.2688888888606],"t":784},{"vs":[14.399999999999967,1.0,2453.0849999999718],"t":785},{"vs":[14.299999999999967,1.0,2456.8049999999721],"t":786},{"vs":[13.999999999999968,1.0,2461.538638888861],"t":787},{"vs":[13.799999999999969,1.0,2675.5060277777607],"t":842},{"vs":[12.199999999999974,1.0,2678.576777777761],"t":843},{"vs":[12.099999999999975,1.0,2681.9061111110941],"t":844},{"vs":[11.999999999999975,1.0,2685.1458888888715],"t":845},{"vs":[11.699999999999976,1.0,2689.0976944444274],"t":846},{"vs":[11.599999999999977,1.0,2692.0483611110944],"t":847},{"vs":[11.499999999999977,1.0,2695.0031388888724],"t":848},{"vs":[11.299999999999978,1.0,2698.2763333333169],"t":849},{"vs":[11.199999999999978,1.0,2701.8208888888726],"t":850},{"vs":[11.399999999999977,1.0,3030.5968888888638],"t":956},{"vs":[13.099999999999971,1.0,3034.8069444444191],"t":957},{"vs":[14.299999999999967,1.0,3038.4523611110858],"t":958},{"vs":[13.999999999999968,1.0,3050.3201388888638],"t":961},{"vs":[13.799999999999969,1.0,3287.4654166666514],"t":1022},{"vs":[12.099999999999975,1.0,3291.0793333333177],"t":1023},{"vs":[11.299999999999978,1.0,3294.7550833333175],"t":1024},{"vs":[11.199999999999978,1.0,3298.0264444444283],"t":1025},{"vs":[11.699999999999976,1.0,3661.8548333333079],"t":1142},{"vs":[11.899999999999975,1.0,3668.9085277777517],"t":1144},{"vs":[14.599999999999966,1.0,3673.1433611110851],"t":1145},{"vs":[14.199999999999967,1.0,3677.1141388888627],"t":1146},{"vs":[14.099999999999968,1.0,3681.1480277777514],"t":1147},{"vs":[13.999999999999968,1.0,3684.8298055555292],"t":1148},{"vs":[13.799999999999969,1.0,3890.0202499999832],"t":1201},{"vs":[12.099999999999975,1.0,3894.0839166666497],"t":1202},{"vs":[10.299999999999981,1.0,3897.2904444444275],"t":1203},{"vs":[10.399999999999981,1.0,3905.5759444444275],"t":1206},{"vs":[10.69999999999998,1.0,3908.5847777777612],"t":1207},{"vs":[10.899999999999979,1.0,3911.50816666665],"t":1208},{"vs":[11.199999999999978,1.0,3915.1366111110947],"t":1209},{"vs":[11.299999999999978,1.0,3918.3479999999831],"t":1210},{"vs":[11.199999999999978,1.0,3921.3156388888724],"t":1211},{"vs":[11.299999999999978,1.0,4447.3346666667167],"t":1381},{"vs":[11.499999999999977,1.0,4450.363388888939],"t":1382},{"vs":[13.899999999999968,1.0,4453.7692222222722],"t":1383},{"vs":[13.999999999999968,1.0,4458.289777777828],"t":1384},{"vs":[13.799999999999969,1.0,4683.3395555555962],"t":1442},{"vs":[11.599999999999977,1.0,4686.9773333333742],"t":1443},{"vs":[11.399999999999977,1.0,4693.74902777782],"t":1445},{"vs":[11.299999999999978,1.0,4697.4748888889308],"t":1446},{"vs":[11.199999999999978,1.0,4700.5705000000426],"t":1447},{"vs":[11.199999999999978,1.0,5805.3416111114084],"t":1801}],"hr":[{"hr":54,"t":1},{"hr":53,"t":4},{"hr":52,"t":5},{"hr":53,"t":13},{"hr":54,"t":16},{"hr":55,"t":22},{"hr":57,"t":26},{"hr":58,"t":28},{"hr":59,"t":30},{"hr":60,"t":31},{"hr":61,"t":32},{"hr":60,"t":34},{"hr":61,"t":35},{"hr":63,"t":37},{"hr":62,"t":41},{"hr":63,"t":42},{"hr":65,"t":43},{"hr":68,"t":44},{"hr":70,"t":45},{"hr":71,"t":46},{"hr":73,"t":47},{"hr":75,"t":48},{"hr":76,"t":49},{"hr":78,"t":50},{"hr":79,"t":51},{"hr":80,"t":52},{"hr":81,"t":54},{"hr":82,"t":55},{"hr":83,"t":56},{"hr":84,"t":58},{"hr":85,"t":59},{"hr":86,"t":60},{"hr":87,"t":62},{"hr":88,"t":63},{"hr":90,"t":64},{"hr":93,"t":65},{"hr":94,"t":67},{"hr":95,"t":69},{"hr":97,"t":70},{"hr":98,"t":71},{"hr":100,"t":73},{"hr":99,"t":74},{"hr":100,"t":77},{"hr":99,"t":78},{"hr":98,"t":79},{"hr":97,"t":81},{"hr":98,"t":82},{"hr":99,"t":84},{"hr":100,"t":85},{"hr":101,"t":86},{"hr":102,"t":87},{"hr":101,"t":89},{"hr":102,"t":90},{"hr":103,"t":93},{"hr":104,"t":96},{"hr":105,"t":97},{"hr":104,"t":99},{"hr":105,"t":100},{"hr":106,"t":104},{"hr":107,"t":106},{"hr":108,"t":114},{"hr":107,"t":118},{"hr":108,"t":119},{"hr":109,"t":120},{"hr":110,"t":123},{"hr":111,"t":125},{"hr":112,"t":132},{"hr":113,"t":138},{"hr":114,"t":139},{"hr":115,"t":160},{"hr":114,"t":166},{"hr":113,"t":169},{"hr":112,"t":172},{"hr":113,"t":174},{"hr":112,"t":178},{"hr":111,"t":179},{"hr":110,"t":181},{"hr":111,"t":182},{"hr":112,"t":185},{"hr":113,"t":186},{"hr":114,"t":187},{"hr":115,"t":193},{"hr":116,"t":194},{"hr":117,"t":207},{"hr":116,"t":209},{"hr":117,"t":218},{"hr":116,"t":220},{"hr":115,"t":221},{"hr":116,"t":226},{"hr":117,"t":240},{"hr":118,"t":252},{"hr":117,"t":256},{"hr":118,"t":258},{"hr":119,"t":259},{"hr":118,"t":262},{"hr":119,"t":273},{"hr":120,"t":286},{"hr":121,"t":287},{"hr":122,"t":288},{"hr":121,"t":289},{"hr":120,"t":293},{"hr":119,"t":311},{"hr":118,"t":326},{"hr":119,"t":334},{"hr":120,"t":337},{"hr":119,"t":340},{"hr":120,"t":348},{"hr":119,"t":351},{"hr":120,"t":352},{"hr":121,"t":362},{"hr":120,"t":363},{"hr":121,"t":364},{"hr":120,"t":365},{"hr":121,"t":371},{"hr":122,"t":375},{"hr":121,"t":392},{"hr":122,"t":398},{"hr":123,"t":401},{"hr":122,"t":402},{"hr":123,"t":404},{"hr":122,"t":406},{"hr":123,"t":409},{"hr":122,"t":410},{"hr":123,"t":415},{"hr":124,"t":423},{"hr":126,"t":427},{"hr":125,"t":429},{"hr":126,"t":433},{"hr":125,"t":434},{"hr":126,"t":436},{"hr":127,"t":439},{"hr":128,"t":442},{"hr":129,"t":443},{"hr":128,"t":445},{"hr":129,"t":454},{"hr":128,"t":459},{"hr":129,"t":467},{"hr":128,"t":471},{"hr":129,"t":472},{"hr":130,"t":481},{"hr":131,"t":487},{"hr":130,"t":490},{"hr":131,"t":493},{"hr":130,"t":501},{"hr":129,"t":505},{"hr":128,"t":514},{"hr":127,"t":526},{"hr":126,"t":541},{"hr":125,"t":558},{"hr":124,"t":567},{"hr":123,"t":570},{"hr":122,"t":575},{"hr":123,"t":582},{"hr":124,"t":585},{"hr":125,"t":593},{"hr":124,"t":599},{"hr":125,"t":604},{"hr":124,"t":609},{"hr":125,"t":610},{"hr":126,"t":615},{"hr":127,"t":618},{"hr":128,"t":621},{"hr":129,"t":632},{"hr":130,"t":636},{"hr":131,"t":638},{"hr":130,"t":640},{"hr":131,"t":642},{"hr":132,"t":648},{"hr":131,"t":651},{"hr":132,"t":658},{"hr":131,"t":659},{"hr":132,"t":662},{"hr":133,"t":667},{"hr":132,"t":670},{"hr":133,"t":672},{"hr":132,"t":678},{"hr":131,"t":684},{"hr":130,"t":691},{"hr":131,"t":693},{"hr":130,"t":696},{"hr":129,"t":700},{"hr":128,"t":702},{"hr":129,"t":703},{"hr":128,"t":717},{"hr":129,"t":718},{"hr":128,"t":721},{"hr":129,"t":725},{"hr":128,"t":729},{"hr":129,"t":731},{"hr":128,"t":732},{"hr":127,"t":736},{"hr":126,"t":752},{"hr":127,"t":754},{"hr":126,"t":758},{"hr":127,"t":765},{"hr":126,"t":767},{"hr":125,"t":769},{"hr":126,"t":772},{"hr":127,"t":783},{"hr":128,"t":794},{"hr":129,"t":796},{"hr":130,"t":799},{"hr":131,"t":801},{"hr":132,"t":812},{"hr":133,"t":819},{"hr":134,"t":821},{"hr":133,"t":824},{"hr":134,"t":826},{"hr":135,"t":832},{"hr":136,"t":835},{"hr":135,"t":837},{"hr":134,"t":855},{"hr":135,"t":858},{"hr":134,"t":860},{"hr":133,"t":865},{"hr":132,"t":890},{"hr":131,"t":897},{"hr":130,"t":902},{"hr":131,"t":909},{"hr":130,"t":912},{"hr":131,"t":917},{"hr":130,"t":920},{"hr":129,"t":921},{"hr":128,"t":923},{"hr":129,"t":926},{"hr":128,"t":927},{"hr":129,"t":936},{"hr":128,"t":938},{"hr":129,"t":947},{"hr":130,"t":959},{"hr":131,"t":971},{"hr":132,"t":977},{"hr":133,"t":984},{"hr":134,"t":991},{"hr":135,"t":1001},{"hr":136,"t":1011},{"hr":137,"t":1028},{"hr":136,"t":1033},{"hr":137,"t":1035},{"hr":136,"t":1042},{"hr":135,"t":1051},{"hr":134,"t":1058},{"hr":133,"t":1062},{"hr":132,"t":1067},{"hr":131,"t":1069},{"hr":132,"t":1072},{"hr":133,"t":1081},{"hr":132,"t":1098},{"hr":131,"t":1104},{"hr":132,"t":1110},{"hr":131,"t":1111},{"hr":130,"t":1122},{"hr":129,"t":1130},{"hr":130,"t":1134},{"hr":129,"t":1135},{"hr":130,"t":1137},{"hr":129,"t":1139},{"hr":130,"t":1140},{"hr":129,"t":1142},{"hr":130,"t":1144},{"hr":131,"t":1147},{"hr":130,"t":1149},{"hr":129,"t":1151},{"hr":130,"t":1154},{"hr":131,"t":1157},{"hr":132,"t":1165},{"hr":133,"t":1166},{"hr":134,"t":1173},{"hr":135,"t":1184},{"hr":136,"t":1192},{"hr":137,"t":1201},{"hr":138,"t":1205},{"hr":137,"t":1210},{"hr":136,"t":1223},{"hr":135,"t":1234},{"hr":134,"t":1247},{"hr":133,"t":1253},{"hr":134,"t":1254},{"hr":133,"t":1260},{"hr":132,"t":1266},{"hr":131,"t":1274},{"hr":132,"t":1277},{"hr":131,"t":1280},{"hr":130,"t":1285},{"hr":131,"t":1291},{"hr":132,"t":1292},{"hr":131,"t":1295},{"hr":130,"t":1298},{"hr":131,"t":1299},{"hr":130,"t":1301},{"hr":131,"t":1319},{"hr":130,"t":1331},{"hr":131,"t":1339},{"hr":130,"t":1342},{"hr":129,"t":1352},{"hr":130,"t":1354},{"hr":129,"t":1356},{"hr":130,"t":1358},{"hr":131,"t":1360},{"hr":130,"t":1361},{"hr":131,"t":1374},{"hr":132,"t":1399},{"hr":133,"t":1403},{"hr":134,"t":1409},{"hr":135,"t":1412},{"hr":136,"t":1419},{"hr":137,"t":1425},{"hr":138,"t":1426},{"hr":139,"t":1428},{"hr":138,"t":1431},{"hr":139,"t":1439},{"hr":138,"t":1468},{"hr":137,"t":1474},{"hr":136,"t":1480},{"hr":137,"t":1483},{"hr":136,"t":1484},{"hr":135,"t":1486},{"hr":136,"t":1487},{"hr":135,"t":1490},{"hr":134,"t":1507},{"hr":135,"t":1510},{"hr":133,"t":1519},{"hr":132,"t":1521},{"hr":133,"t":1522},{"hr":132,"t":1523},{"hr":131,"t":1532},{"hr":132,"t":1535},{"hr":133,"t":1546},{"hr":132,"t":1549},{"hr":131,"t":1564},{"hr":132,"t":1565},{"hr":131,"t":1573},{"hr":132,"t":1582},{"hr":131,"t":1600},{"hr":132,"t":1604},{"hr":131,"t":1605},{"hr":130,"t":1610},{"hr":129,"t":1620},{"hr":130,"t":1627},{"hr":129,"t":1629},{"hr":130,"t":1633},{"hr":131,"t":1636},{"hr":132,"t":1641},{"hr":131,"t":1648},{"hr":132,"t":1649},{"hr":131,"t":1652},{"hr":132,"t":1653},{"hr":133,"t":1662},{"hr":132,"t":1663},{"hr":133,"t":1678},{"hr":134,"t":1700},{"hr":133,"t":1702},{"hr":134,"t":1703},{"hr":133,"t":1704},{"hr":132,"t":1712},{"hr":133,"t":1729},{"hr":134,"t":1745},{"hr":133,"t":1746},{"hr":134,"t":1748},{"hr":133,"t":1754},{"hr":134,"t":1761},{"hr":133,"t":1770},{"hr":134,"t":1780},{"hr":133,"t":1782},{"hr":134,"t":1798},{"hr":133,"t":1800}],"laps":[{"n":1,"totalTime":351,"totalDistance":1000.0,"lapDistance":1000.0,"lapTime":351},{"n":2,"totalTime":608,"totalDistance":2000.0,"lapDistance":1000.0,"lapTime":257},{"n":3,"totalTime":929,"totalDistance":3000.0,"lapDistance":1000.0,"lapTime":321},{"n":4,"totalTime":1250,"totalDistance":4000.0,"lapDistance":1000.0,"lapTime":321},{"n":5,"totalTime":1571,"totalDistance":5000.0,"lapDistance":1000.0,"lapTime":321},{"n":6,"totalTime":1830,"totalDistance":5805.0,"lapDistance":805.0,"lapTime":259}],"hrZones":[{"secondsInZone":93.0,"name":"Zeer licht","color":"#0085BA","upperBound":102.0,"lowerBound":85.0},{"secondsInZone":228.0,"name":"Licht","color":"#26DD70","upperBound":119.0,"lowerBound":103.0},{"secondsInZone":1390.0,"name":"Gemiddeld","color":"#FFDD00","upperBound":136.0,"lowerBound":120.0},{"secondsInZone":90.0,"name":"Zwaar","color":"#FC8F00","upperBound":153.0,"lowerBound":137.0},{"secondsInZone":0.0,"name":"Zeer zwaar","color":"#CE2929","upperBound":170.0,"lowerBound":154.0}]},"equipmentType":"Treadmill","cardioLogId":"5dfd108ee6ff17016c4c4d66","favorite":0,"name":"Run Artis: Quick Start","date":"20-12-2019","target":"Duration","nEser":204,"nAttr":375,"physicalActivityId":"6a0b6cd6-e178-e111-b0a2-001e4f3910c2","physicalActivityName":"Run Artis: Quick Start","data":[{"property":"Duration","name":"Duur","value":"30:01","uM":"min","rawValue":30.02},{"property":"HDistance","name":"Afstand","value":"5,81","uM":"km","rawValue":5.81},{"property":"Move","name":"MOVEs","value":"1017","uM":"MOVEs","rawValue":1017.0}]},"token":"MjAxOTEyMjUxMjQ1Mjl8MGFmNzI2YTIzODQ0NDUxYzlkMzQ2YTQ5ZmM1NWEzZjR8ZWMxZDM4ZDdkMzU5NDhkMGE2MGNkOGMwYjhmYjlkZjl8NHxXLiBFdXJvcGUgU3RhbmRhcmQgVGltZXxubC1OTHxkNWIzZjUzNjRjYWU0ZTUzOGZhMjllOTdhY2M4YmNkN3x8fHwxfDF8MHwxMDB8fHwwfDkzMzV8MHxjb20ubXl3ZWxsbmVzcw2.2C03D24E466A49C2F6E67543ECC0F17B5A865399","version":"1.1.107.33677","expireIn":31104000}

treadmill.txt