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

Error reporting left/right balance #14

Closed
grimbough opened this issue Mar 7, 2021 · 1 comment
Closed

Error reporting left/right balance #14

grimbough opened this issue Mar 7, 2021 · 1 comment

Comments

@grimbough
Copy link
Owner

If it helps, I did the update as I was trying to track down why session$left_right_balance is returned as a chr NA. This value is returned correctly as a numeric from the python package fitdecode, using a cycling fit file generated by a Garmin 820. I believe that message_index may also have this issue.

Originally posted by @CraigMohn in #13 (comment)

@grimbough
Copy link
Owner Author

It's possible to see this behaviour in the Garmin 530 file distributed with the package, and affected the left/right balance in both the session and the individual records.

library(FITfileR)
edge530_file <- system.file("extdata", "Activities", "garmin-edge530-ride.fit", 
                            package = "FITfileR")
edge530 <- readFitFile(edge530_file)
edge530_session <- getMessagesByType(edge530, "session")
edge530_records <- records(edge530)

packageVersion("FITfileR")
#> [1] '0.1.1'
edge530_session$left_right_balance
#> [1] NA
table(edge530_records$record_4$left_right_balance, useNA="always")
#> right  <NA> 
#>    20  7043 

This should now be fixed in the current version.

packageVersion("FITfileR")
#> [1] '0.1.3'
edge530_session$left_right_balance
#> [1] 50.29
#> attr(,"units")
#> [1] "percentage"
#> attr(,"side")
#> [1] "right"
summary(edge530_records$record_4$left_right_balance)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>    0.00   49.00   51.00   50.01   52.00  100.00

The cause of the problem was that the left/right balance isn't just stored as a decimal value, but rather as an integer that encodes both the balance and the side (if known). FITfileR didn't known how to process this datatype, hence the NA.

There's quite a lot of data types encoded in specific ways like this, which I haven't had time to add support for (or have never encountered). If you encountered anymore data types that are NA when you know it shouldn't be please open another issue and I'll prioritise it.

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

1 participant