Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language problem when importing from Strava Export folder #86

Open
Oi-sin opened this issue Feb 1, 2024 · 1 comment
Open

Language problem when importing from Strava Export folder #86

Oi-sin opened this issue Feb 1, 2024 · 1 comment
Labels
status: information needed Further information is requested

Comments

@Oi-sin
Copy link

Oi-sin commented Feb 1, 2024

I did set up the Strava API which worked fine. Then I wanted to proceed with my already downloaded Strava archive as documented under https://martin-ueding.github.io/geo-activity-playground/getting-started/using-strava-api/#use-export-to-avoid-rate-limiting. I unpacked the archive to the named folder and started the server. I receive the following error:

  File "<string>", line 1, in <module>
  File "C:\Users\<username>\geo-activity-playground\geo_activity_playground\__main__.py", line 96, in main
    options.func(options)
  File "C:\Users\<username>\geo-activity-playground\geo_activity_playground\__main__.py", line 71, in <lambda>
    make_activity_repository(options.basedir),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<username>\geo-activity-playground\geo_activity_playground\__main__.py", line 109, in make_activity_repository
    import_from_strava_checkout(repository)
  File "C:\Users\<username>\geo-activity-playground\geo_activity_playground\importers\strava_checkout.py", line 31, in import_from_strava_checkout
    activities.index = activities["Activity ID"]
                       ~~~~~~~~~~^^^^^^^^^^^^^^^
  File "C:\Users\<username>\.conda\envs\geo-activity-playground\Lib\site-packages\pandas\core\frame.py", line 3893, in __getitem__
    indexer = self.columns.get_loc(key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<username>\.conda\envs\geo-activity-playground\Lib\site-packages\pandas\core\indexes\base.py", line 3798, in get_loc
    raise KeyError(key) from err
KeyError: 'Activity ID'

Looking into the code at import_from_strava_checkout(repository: ActivityRepository) I can see, that it tries to load activities.csv using English column names. Unfortunately Strava seems to localize the CSV files!!! The column names in my activities.csv look like this:

Aktivitäts-ID,Aktivitätsdatum,Name der Aktivität,Aktivitätsart,Aktivitätsbeschreibung,Verstrichene Zeit,Distanz,Max. Herzfrequenz,Relative Leistung,Pendeln,Hinweis zur Privatsphäre für Aktivitäten,Aktivitätsausrüstung,Dateiname,Sportlergewicht,Fahrradgewicht,Verstrichene Zeit,Bewegungszeit,Distanz,Höchstgeschw.,Durchschnittliche Geschwindigkeit,Höhenzunahme,Höhenunterschied,Min. Höhe,Max. Höhe,Max. Steigung,Durchschnittliche Steigung,Durchschnittliche positive Steigung,Durchschnittliche negative Steigung,Max. Tritt-/Schrittfrequenz,Durchschnittliche Trittfrequenz,Max. Herzfrequenz,Durchschnittliche Herzfrequenz,Max. Watt,Durchschnittliche Watt,Kalorien,Max. Temperatur,Durchschnittliche Temperatur,Relative Leistung,Gesamtarbeit,Anzahl Läufe,Bergaufzeit,Bergabzeit,Andere Zeit,Gefühlte Anstrengung,Art,Startzeit,Gewichtete durchschnittliche Leistung,Leistungszahl,Gefühlte Anstrengung verwenden,Gefühlte relative Leistung,Pendeln,Insgesamt gestemmtes Gewicht,Von Upload,Auf Steigung angepasste Distanz,Wetterbeobachtungszeit,Wetterlage,Wetter: Temperatur,Scheinbare Temperatur,Taupunkt,Luftfeuchtigkeit,Wetter: Druck,Windgeschwindigkeit,Windböe,Windrichtung,Niederschlagsintensität,Sonnenaufgangszeit,Sonnenuntergangszeit,Mondphase,Fahrrad,Ausrüstung,Niederschlagswahrscheinlichkeit,Niederschlagsart,Wolkendecke,Wetter: Sichtbarkeit,UV-Index,Wetter: Ozon,Sprunganzahl,Schwierigkeit insgesamt,Durchschnittlicher Flow,Markiert,Durchschnittliche Geschwindigkeit (verstrichene Zeit),Auf Schotter zurückgelegte Distanz,Neu getestete Distanz,Neu getestete Schotterdistanz,Aktivitätsanzahl,Schritte insgesamt,Medien

Further more: dates and other values are localized too as can be seen in the data of my first activity. The corresponding data starts like this
`8228026758,"09.12.2022, 15:24:49",2022-12-09 16:24,Radfahrt,.....

Is there a known way to force Strava to export the archive in English? Otherwise this import will be a pain to implement.

@martin-ueding
Copy link
Owner

That is very irritating, indeed. What we could do is that the specific column names trigger a locale dependent import for the dates. That should be doable. But I really wonder why this happens. My Strava is displayed in German, but the archive is in English. I am not sure what this is about.

How are the floating point numbers displayed in there, do they have a different separator as well? I just assume that they have a comma and added logic for that.

It is included in the 0.19.0 release. It might work, but it might also lack some logic for some other edge case.

@martin-ueding martin-ueding added the status: information needed Further information is requested label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: information needed Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants