Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fit_kit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fit_kit

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

FitKit

fit_kit is a small ruby gem wraps Rust's crate fitparse-rs to provide effecient and fast Garmin fit files parsing.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add fit_kit

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install fit_kit

Usage

test_fit_file = File.join(Dir.pwd, "example.fit")
fit_data_records = ::FitKit.parse_fit_file(test_fit_file)
# { record: [{...}, {...}], session: [{...}], lap: [..], activity: [...] }

Performance

Here is the performance parsing 4090 fit files on my M1 Mac Mini (16G, 8 Cores) took 6 seconds (in parallel):

❯ ruby app.rb
Parsing 4090 fit files...
       user     system      total        real
  0.129862   0.102642  45.192900 (  6.121117)

Code to parse a given folder (contains 4090 fit files) in parallel:

require 'fit_kit'
require 'benchmark'
require 'parallel'

def parse_concurrently
  puts "Parsing all fit files here"
  fit_files = Dir.glob("/Users/mikeli/docs/HealthFit/*.{fit,FIT}")
  puts "Parsing #{fit_files.size} fit files..."

  # Determine the number of processors
  num_processors = Parallel.processor_count

  # Parse files concurrently
  Parallel.each(fit_files, in_processes: num_processors) do |file|
    begin
      FitKit.parse_fit_file(file)
    rescue => e
      puts "Error parsing #{file}: #{e.message}"
    end
  end
end


Benchmark.bm do |x|
  x.report do
    parse_concurrently
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/29decibel/fit_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the FitKit project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc