Skip to main content

Find valuable gems 💎 in your tracked sport 🚴 activity!

Project description

sportgems

Sportgems finds valuable gems 💎 in your tracked sport 🚴 activity!

What is it?

Sportgems is a tiny library which lets you efficiently parse your activity data. It will search and find your fastest sections. It will determine the start, end and speed of whatever fastest sections you are interested, e.g. 1km, 2km and 10km. This repo is a tiny rust reincarnation of the C++ implementation of the sportgems algorithm.

Sportgems is (or will be) used in workoutizer to find your fastest 1km (and other 💎) in all your activities and ultimately visualize it.

Get Started

Sportgems is bundled in a python package using pyo3. Simply install it with pip:

pip install sportgems

In order to search for gems 💎 in your activity, you need to pass the coordinates as list of tuples of floats (lat, lon) and the timestamps as a list of floats as seconds since the Unix epoch:

from sportgems import find_gems

fastest_1km = 1000      # in meter
coordinates = [(48.123, 9.35), (48.123, 9.36), (48.123, 9.37), (48.123, 9.38)]
times = [1608228953.8, 1608228954.8, 1608228955.8, 1608228956.8]

result = find_gems(fastest_1km, times, coordinates)

The result will be a tuple consisting of (int, int, float) where

  • the first element is the start index
  • the second element is the end index of the fastest section
  • the last element is the found velocity In the above example this would lead to
found_section = result[0]
start_index = result[1]
end_index = result[2]
velocity = result[3]

print(f"Found fastest {int(fastest_1km / 1000)}km: ")
print(f"Fastest section ranges from index {start_index} to {end_index} with a velocity of {velocity}m/s.")

which prints

The fastest 1km is from index 1 to 2 with a velocity of 743.0908195788583m/s.

How does it work?

The following diagram illustrates how the core algorithm (implemented in gem_finder.cpp) works:

Running the tests

In order to run the rust unit tests simply run

cargo test

To run the python test, which obviously also covers the import of the python package you first need to install the requirements

pip install -r requirements.txt

and subsequently run the tests

pytest tests/

Contributing

Contributions are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sportgems-0.2.3-cp39-none-win_amd64.whl (81.9 kB view details)

Uploaded CPython 3.9Windows x86-64

sportgems-0.2.3-cp39-cp39-manylinux2014_x86_64.whl (131.1 kB view details)

Uploaded CPython 3.9

sportgems-0.2.3-cp39-cp39-macosx_10_7_x86_64.whl (125.1 kB view details)

Uploaded CPython 3.9macOS 10.7+ x86-64

sportgems-0.2.3-cp38-none-win_amd64.whl (81.9 kB view details)

Uploaded CPython 3.8Windows x86-64

sportgems-0.2.3-cp38-cp38-manylinux2014_x86_64.whl (131.1 kB view details)

Uploaded CPython 3.8

sportgems-0.2.3-cp38-cp38-macosx_10_7_x86_64.whl (125.1 kB view details)

Uploaded CPython 3.8macOS 10.7+ x86-64

sportgems-0.2.3-cp38-cp38-linux_armv7l.whl (131.9 kB view details)

Uploaded CPython 3.8

sportgems-0.2.3-cp37-none-win_amd64.whl (81.9 kB view details)

Uploaded CPython 3.7Windows x86-64

sportgems-0.2.3-cp37-cp37m-manylinux2014_x86_64.whl (131.1 kB view details)

Uploaded CPython 3.7m

sportgems-0.2.3-cp37-cp37m-macosx_10_7_x86_64.whl (125.0 kB view details)

Uploaded CPython 3.7mmacOS 10.7+ x86-64

sportgems-0.2.3-cp36-none-win_amd64.whl (82.4 kB view details)

Uploaded CPython 3.6Windows x86-64

sportgems-0.2.3-cp36-cp36m-manylinux2014_x86_64.whl (131.5 kB view details)

Uploaded CPython 3.6m

sportgems-0.2.3-cp36-cp36m-macosx_10_7_x86_64.whl (125.4 kB view details)

Uploaded CPython 3.6mmacOS 10.7+ x86-64

sportgems-0.2.3-cp36-cp36m-linux_armv7l.whl (131.9 kB view details)

Uploaded CPython 3.6m

File details

Details for the file sportgems-0.2.3-cp39-none-win_amd64.whl.

File metadata

  • Download URL: sportgems-0.2.3-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.9.0

File hashes

Hashes for sportgems-0.2.3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 bab2d866ca6eac8791afbc5a3f39c2216c0a229f5100f2dc2830ef3b0a3c478c
MD5 e8f9f4f16c026c239ced34a29b372d6f
BLAKE2b-256 ebccdb4e695ec8c771bba9070e22f6c227d0ca387717d982af8a689486c53f73

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 14f8e8e3b71412e33841cc527f4d42c4f845f3ed83374aaa20ba870d6a58c5ea
MD5 97b07127ed8c721e06dbed4dae34c937
BLAKE2b-256 bc783372d0c664185af9581146e3158dbb872e208dfe7866625998f6734c6cd0

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 89c17fc9a04c1f45150fd16b841aed4cee3e1519ff25985a2e3d6dcae2b55102
MD5 668a9bab0ac1293a02d37f6e217c6ca6
BLAKE2b-256 fd719bf082b55ecb8d28557e75649e9a93e890399b735d4e324201f457c96232

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp38-none-win_amd64.whl.

File metadata

  • Download URL: sportgems-0.2.3-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.9.0

File hashes

Hashes for sportgems-0.2.3-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 3fcc3493ea398a762ca313887e00c2166c55bd9e91f8a3a28f35abdc77074de4
MD5 d0b53a4a2b0c7ff8503182e9284889a4
BLAKE2b-256 e937ee9eabba046cb0c26a6a36576bc5d9ed092d7efeaedf4be18b624141ec11

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d198d1a301bc76cb2efbd82d91ba9935cf87aafe32da0718885decdd79f1cdc6
MD5 a71a166f41f22370a7dfecdbca51b38f
BLAKE2b-256 828737bad09f51d5582caa7be0fb2fc27cd7a295cfe18c3a4dfa80574b9b2709

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f8e3239ee54d5de98824cd6d336230f7dd2863fe74eff6a83e484ee05c409ea7
MD5 3935a0b66711c99f66281101b3f9def2
BLAKE2b-256 e6b1e68042c32c238f11bca2085f545fb4713ebd8a07980be3663e93242f5472

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp38-cp38-linux_armv7l.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp38-cp38-linux_armv7l.whl
Algorithm Hash digest
SHA256 89c4730dd739b7d5f8a5fcf598e271aac4fba0b7d3b8048c8e7ff1957e7fc2c9
MD5 2ba3f7cc513616e6f2e046e96b97b441
BLAKE2b-256 f49686521c37ed2914b387fe79c51fed9a5fb50347ad0702ca447fc0183d99f9

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp37-none-win_amd64.whl.

File metadata

  • Download URL: sportgems-0.2.3-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.9.0

File hashes

Hashes for sportgems-0.2.3-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 ca2372cd3ca41c430d6b76897b6346967c93c33e944e79fc6d45d80b736b5342
MD5 6d16a2a16c9bfed896f0f2795c8c2991
BLAKE2b-256 91129e9fa98a0823ac84a96c49cb53ab72041fd5aea2922da9af043fca84c2c9

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e730610dce1a8bbe4f571ff5535de8ccf4a37f9a4845d39254b9c91d706e6b8
MD5 06eb6ca303ba8adb41f6abebbc016d8d
BLAKE2b-256 b531b35c05ece25fd7f541b4ed3c3c6f575d0d64f54b3488255d138017978ef2

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 72e65af1b37e6e5c3ba55cde58fd96db71e43c762553f91e99dad6f116599fe2
MD5 06cc73dfec8d75ad27ed52a9045e98dc
BLAKE2b-256 70059e9920c6f222aa64717c298717e2f1213578e185a451c05beeafa7aa3fb9

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp36-none-win_amd64.whl.

File metadata

  • Download URL: sportgems-0.2.3-cp36-none-win_amd64.whl
  • Upload date:
  • Size: 82.4 kB
  • Tags: CPython 3.6, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.9.0

File hashes

Hashes for sportgems-0.2.3-cp36-none-win_amd64.whl
Algorithm Hash digest
SHA256 570f2bcf7608d0927c9ae2ac46ba168d6e92ddad7c07986c01a3893824317671
MD5 d305e12e8b8b4c95c18137b0d501543b
BLAKE2b-256 b3e521ad423504f5f219effde00820cabacc32403246553899564f32caaed753

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9761a780146db5f3e30674158075c35d2796bb6d8334734675e9b2c394f32c76
MD5 bb7435b3db75d59ebb2b3da70037c22a
BLAKE2b-256 8b3ba305ac9e923847a6847a026dbc0a9f350c95658c9d0cd908477be84a0f1e

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 0285ae6cbd671680795eed90e6a04492e61d067cdaac41e81397ad3f595e7e7c
MD5 66c079fef5669b7bbf0ea51c32e33fb4
BLAKE2b-256 2833d4fb1eda6f49c7ee0e3d8de7f71fbafb76e8b1124656b5d3462546276439

See more details on using hashes here.

File details

Details for the file sportgems-0.2.3-cp36-cp36m-linux_armv7l.whl.

File metadata

File hashes

Hashes for sportgems-0.2.3-cp36-cp36m-linux_armv7l.whl
Algorithm Hash digest
SHA256 c074cfeba21594fae964754b25d616e724bffec9dda78c6c5b504f8a3d5cd60d
MD5 4f0f519f31055418e0c925fe97db46ca
BLAKE2b-256 d26c08ea06ff0fcb0ab24688dd148e33dcc14a961ecb9ba52869b31c747b0d39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page