fit icon indicating copy to clipboard operation
fit copied to clipboard

activity: structured activity file type

Open ktye opened this issue 7 years ago • 1 comments

Currently, after decoding you basically get a flat activity file. This closly represents the fit file protocol. But an application might be more interested in a tree-structure of the activity, e.g.

type StructuredActivityFile {
  Sessions []StructuredSession
}
type StructuredSession{
  Lap []*StructuredLap
}
type StructuredLap {
  LapMsg // Copy or reference of original lap for summary information
  Records []*RecordMsg // Contains only data records which were during this lap.
 // maybe also others, such as events, ...
}

This could be calculated in a post-processing step as a method of ActivityFile by

 func (a *ActivityFile) StructuredActivity() StructuredActivity {...}

I guess it's only neccessary to compare timestamps to build the tree.

What do you think of this? Or is the scope of the package to represent the fit protocol closly, leaving all higher level functionality for other packages?

ktye avatar Jul 24 '16 20:07 ktye

Yes, I agree this could be useful, and the method signature looks about right. Maybe it should also be possible to specify if the Activity should be "cloned", or to just keep the references to the original ActivityFile, so that any changes are reflected for both structures.

I would like to have this as a post-processing step. I already have an earlier draft of some other post-processing functionality (determining time zones based for local timestamps based on GPS-coordinates). I will put this in a separate package because it uses an external dependency, and I don´t want the core fitpackage to have any external deps. I don`t think your suggestion needs any external dependencies, so it may be possible to place it in the core package.

tormoder avatar Jul 30 '16 21:07 tormoder