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

Add an example of working activities-export file #1

Open
gelberhut opened this issue Jul 28, 2024 · 2 comments
Open

Add an example of working activities-export file #1

gelberhut opened this issue Jul 28, 2024 · 2 comments

Comments

@gelberhut
Copy link

I try to import my samsung health activity and Garmin issues an error.
The first issue I have found is: Garmin connect experts numbers to be formatted like "123,45.98" or "123.45,98"(at least for English language):
image

But after fixing this I still get an error.
Can you please add an example of file generated by activity.py and which was accepted by garmin connect - so people can compare working example with there example, because it looks like that file generation could depend on the system region settings.

If you could also add an example of the samsung health files - this would be fantastic - because here format could also be system region specific.

@PhilippImhof
Copy link
Owner

Thanks for reaching out. This is an example for activity data that could be imported:

Activities
"Date","Calories Burned","Steps","Distance","Floors","Minutes Sedentary","Minutes Lightly Active","Minutes Fairly Active","Minutes Very Active","Activity Calories"
"2024-05-08","1234","789","0.52","2","0","8","0","0","23"
"2024-05-09","1789","3210","2.21","7","0","35","0","0","123"

Please note that the number format 1,234.56 does not mean that the comma as a thousands separator is mandatory, it just means that it can be there and will be interpreted as such, but that the decimal separator must be a point. (The numbers above do not have a thousands separator.)

Also note that importing data into Garmin connect is pretty fiddly and sometimes fails for no apparent reason at all. Sometimes, I had to retry several times with the same file, so the format must have been fine, but it still did not work at first.

If you could also add an example of the samsung health files - this would be fantastic - because here format could also be system region specific

What do you mean exactly? The file for a specific exercices? Or some of the CSV files for the general activity and health data? AFAICS the export done by Samsung Health is not region specific.

@gelberhut
Copy link
Author

gelberhut commented Jul 28, 2024

Thank you for the fast feedback. This helped me to identify the issue.
In many lines the value of Floors is "". This happens because my com.samsung.health.floors_climbed.20240302175307.csv does not have entries for these dates.
I adjusted merge function like below. This solved the issue.

def merge_data(floors, calories, activities):
    merged_data = {}
    for date, cals in calories.items():
        merged_data[date] = {"Calories Burned": cals}
        merged_data[date]["Floors"] = 0 # initiate floors with zero <-- this

    for date, f in floors.items():
        if date not in merged_data:
            merged_data[date]["Calories"] = 0
        merged_data[date]["Floors"] = f

With this change half of the files are successfully imported by garmin connect.
As the readme says, it looks like all files are imported, even when Garmin Connect showed errrors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants