{"id":18774686,"url":"https://github.com/firefly-cpp/sport-activities-features","last_synced_at":"2026-02-14T19:04:50.825Z","repository":{"id":37969447,"uuid":"316730912","full_name":"firefly-cpp/sport-activities-features","owner":"firefly-cpp","description":"A minimalistic toolbox for extracting features from sports activity files written in Python","archived":false,"fork":false,"pushed_at":"2026-02-11T22:06:13.000Z","size":5969,"stargazers_count":21,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-12T05:55:57.730Z","etag":null,"topics":["data-mining","machine-learning","sport-analytics","tcx-parser"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firefly-cpp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-28T12:39:31.000Z","updated_at":"2026-02-11T22:06:19.000Z","dependencies_parsed_at":"2023-11-11T21:22:12.544Z","dependency_job_id":"8f96561b-6e96-4e46-a009-851578bde8fe","html_url":"https://github.com/firefly-cpp/sport-activities-features","commit_stats":{"total_commits":450,"total_committers":18,"mean_commits":25.0,"dds":0.5688888888888889,"last_synced_commit":"8f0fc22f003f132459698f687c2c93e32214ce35"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/firefly-cpp/sport-activities-features","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firefly-cpp%2Fsport-activities-features","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firefly-cpp%2Fsport-activities-features/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firefly-cpp%2Fsport-activities-features/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firefly-cpp%2Fsport-activities-features/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firefly-cpp","download_url":"https://codeload.github.com/firefly-cpp/sport-activities-features/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firefly-cpp%2Fsport-activities-features/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-mining","machine-learning","sport-analytics","tcx-parser"],"created_at":"2024-11-07T19:39:05.680Z","updated_at":"2026-02-14T19:04:50.809Z","avatar_url":"https://github.com/firefly-cpp.png","language":"Python","funding_links":[],"categories":["Projects","Software 💻"],"sub_categories":["Wrestling 🤼‍♀️"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"200\" src=\"https://raw.githubusercontent.com/firefly-cpp/sport-activities-features/main/.github/logo/sport_activities.png\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\nsport-activities-features --- A minimalistic toolbox for extracting features from sports activity files written in Python\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"PyPI Version\" src=\"https://img.shields.io/pypi/v/sport-activities-features.svg\" href=\"https://pypi.python.org/pypi/sport-activities-features\"\u003e\n  \u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/sport-activities-features.svg\"\u003e\n  \u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/sport-activities-features.svg\"\u003e\n  \u003cimg alt=\"Fedora package\" src=\"https://img.shields.io/fedora/v/python3-sport-activities-features?color=blue\u0026label=Fedora%20Linux\u0026logo=fedora\" href=\"https://src.fedoraproject.org/rpms/python-sport-activities-features\"\u003e\n  \u003cimg alt=\"AUR package\" src=\"https://img.shields.io/aur/version/python-sport-activities-features?color=blue\u0026label=Arch%20Linux\u0026logo=arch-linux\" href=\"https://aur.archlinux.org/packages/python-sport-activities-features\"\u003e\n  \u003cimg alt=\"Packaging status\" src=\"https://repology.org/badge/tiny-repos/python:sport-activities-features.svg\" href=\"https://repology.org/project/python:sport-activities-features/versions\"\u003e\n  \u003cimg alt=\"Downloads\" src=\"https://pepy.tech/badge/sport-activities-features\" href=\"https://pepy.tech/project/sport-activities-features\"\u003e\n  \u003cimg alt=\"GitHub license\" src=\"https://img.shields.io/github/license/firefly-cpp/sport-activities-features.svg\" href=\"https://github.com/firefly-cpp/sport-activities-features/blob/master/LICENSE\"\u003e\n  \u003cimg alt=\"Documentation Status\" src=\"https://readthedocs.org/projects/sport-activities-features/badge/?version=latest\" href=\"https://sport-activities-features.readthedocs.io/en/latest/?badge=latest\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub repo size\" src=\"https://img.shields.io/github/repo-size/firefly-cpp/sport-activities-features\"\u003e\n  \u003cimg alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/w/firefly-cpp/sport-activities-features.svg\"\u003e\n  \u003cimg alt=\"Average time to resolve an issue\" src=\"http://isitmaintained.com/badge/resolution/firefly-cpp/sport-activities-features.svg\" href=\"http://isitmaintained.com/project/firefly-cpp/sport-activities-features\"\u003e\n  \u003cimg alt=\"Percentage of issues still open\" src=\"http://isitmaintained.com/badge/open/firefly-cpp/sport-activities-features.svg\" href=\"http://isitmaintained.com/project/firefly-cpp/sport-activities-features\"\u003e\n  \u003cimg alt=\"All Contributors\" src=\"https://img.shields.io/badge/all_contributors-6-orange.svg\" href=\"#-contributors\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"DOI\" src=\"https://img.shields.io/badge/DOI-10.1109/INES52918.2021.9512927-blue\" href=\"https://doi.org/10.1109/INES52918.2021.9512927\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#-detailed-insights\"\u003e🔍 Detailed insights\u003c/a\u003e •\n  \u003ca href=\"#-installation\"\u003e📦 Installation\u003c/a\u003e •\n  \u003ca href=\"#-api\"\u003e📮 API\u003c/a\u003e •\n  \u003ca href=\"#-graphical-user-interface\"\u003e💻 Graphical User Interface\u003c/a\u003e •\n  \u003ca href=\"#️-historical-weather-data\"\u003e🌦️ Historical weather data\u003c/a\u003e •\n  \u003ca href=\"#-overpass-api-open-elevation-api--opentopodata-integration\"\u003e🧩 Overpass API, Open Elevation API \u0026 OpenTopoData integration\u003c/a\u003e\n  \u003ca href=\"#-examples\"\u003e🚀 Examples\u003c/a\u003e •\n  \u003ca href=\"#-license\"\u003e🔑 License\u003c/a\u003e •\n  \u003ca href=\"#-cite-us\"\u003e📄 Cite us\u003c/a\u003e •\n  \u003ca href=\"#-further-read\"\u003e📖 Further read\u003c/a\u003e •\n  \u003ca href=\"#-related-frameworks\"\u003e🔗 Related frameworks\u003c/a\u003e •\n  \u003ca href=\"#-contributors\"\u003e🫂 Contributors\u003c/a\u003e\n\u003c/p\u003e\n\n## Unleashing the Power of Sports Activity Analysis: A Framework Beyond Ordinary Metrics 🚀\n\nPrepare to dive into the thrilling world of sports activity analysis, where hidden geographic, topological, and personalized data await their grand unveiling. In this captivating journey, we embark on a quest to extract the deepest insights from the wealth of information generated by monitoring sports activities. Brace yourself for a framework that transcends the limitations of conventional analysis techniques. 💪🔍\n\nTraditional approaches often rely on integral metrics like total duration, total distance, and average heart rate, but they fall victim to the dreaded \"overall metrics problem.\" These metrics fail to capture the essence of sports activities, omitting crucial components and leading to potentially flawed and misleading conclusions. They lack the ability to recognize distinct stages and phases of the activity, such as the invigorating warm-up, the endurance-testing main event, and the heart-pounding intervals. ⏱️🚴‍♀️📈\n\nFortunately, our sport-activities-framework rises above these limitations, revealing a comprehensive panorama of your sports activity files. This framework combines the power of identification and extraction methods to unlock a treasure trove of valuable data. Picture this :camera: : effortlessly identifying the number of hills, extracting average altitudes of these remarkable formations, measuring the total distance conquered on those inclines, and even deriving climbing ratios for a true measure of accomplishment (total distance of hills vs. total distance). But that's just the tip of the iceberg! The framework seamlessly integrates a multitude of extensions, including historical weather parsing, statistical evaluations, and ex-post visualizations that bring your data to life. 🗻📊🌦️\n\nFor those seeking to venture further, we invite you to explore the realms of scientific papers on data mining that delve into these captivating topics. Discover how our framework complements the world of generating and predicting automated sport training sessions, creating a harmonious synergy between theory and practice. 📚🔬💡\n\n* **Free software:** MIT license\n* **Python versions:** 3.8.x, 3.9.x, 3.10.x, 3.11.x, 3.12.x\n* **Documentation:** https://sport-activities-features.readthedocs.io/en/latest\n* **Tested OS:** Windows, Ubuntu, Debian, Fedora, Alpine, Arch, macOS. **However, that does not mean it does not work on others.**\n\n## 🔍 Detailed insights\n\nPrepare to be astounded by the capabilities of the sport-activities-features framework. It effortlessly handles TCX \u0026 GPX activity files and harnesses the power of the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) nodes. Presenting the range of functions at your disposal:\n\n- **Unleash the integral metrics**: From total distance to total duration and even calorie count, witness the extraction of these vital statistics with a single glance. 📏⏰🔥 ([See example](examples/integral_metrics_extraction.py))\n\n- **Conquer the peaks**: Ascend to new heights by extracting topographic features like the number of hills, their average altitudes, the total distance covered on these majestic slopes, and the thrilling climbing ratio. Prepare for a breathtaking adventure! ⛰️📈🧗‍♂️ ([See example](examples/hill_data_extraction.py))\n\n- **Embark on a visual journey**: Immerse yourself in the beauty of your accomplishments as you plot the identified hills on a mesmerizing map. Witness the landscape come alive before your eyes. 🗺️🏞️🖌️ ([See example](examples/draw_map_with_identified_hills.py))\n\n- **Embrace the rhythm of intervals**: Explore the intervals within your sports activities, uncovering their numbers, durations, distances, and heart rates. Unveil the heartbeat of your performance! 🏃‍♀️📊💓 ([See example](examples/draw_map_with_identified_intervals.py))\n\n- **Calculate the training loads**: Dive deep into the intricate world of training loads and discover the Banister TRIMP and Lucia TRIMP methods. Gain invaluable insights into optimizing your training regimen. 📈⚖️🏋️‍♂️ ([See example](examples/calculate_training_load.py))\n\n- **Weather the storm**: Unlock the power of historical weather data from external services, adding a fascinating layer of context to your sports activities. ☀️🌧️⛈️\n\n- **Unveil the secrets within coordinates**: Explore the integral metrics of your activities within specific geographical areas, uncovering valuable data on distance, heart rate, and speed. Peer into the depths of your performance! 🌍📍📉 ([See example](examples/extract_data_inside_area.py))\n\n- **Embrace randomness**: Extract activities from CSV files and indulge in the excitement of randomly selecting a specific number of activities. Embrace the element of surprise! 🎲📂🎉 ([See example](examples/extract_random_activities_from_csv.py))\n\n- **Conquer the dead ends**: Unravel the mysteries of your sports activities by identifying the dead ends. Prepare to navigate the uncharted territories of your performance! 🚧🗺️🔍 ([See example](examples/dead_end_extraction.py))\n\n- **Unlock the format**: Seamlessly convert TCX files to GPX, opening doors to even more possibilities. Adapt and conquer! ⚙️🔄✨ ([See example](examples/convert_tcx_to_gpx.py))\n\nAnd that's just the beginning! The sport-activities-framework holds countless other features, awaiting your exploration. Brace yourself for an exhilarating journey of discovery, where the ordinary becomes extraordinary, and your sports activities come alive like never before. 🌟🔥🏃‍♂️\n\nThe framework comes with two (testing) [benchmark datasets](https://github.com/firefly-cpp/sports-activity-dataset-collections), which are freely available to download from: [DATASET1](http://iztok-jr-fister.eu/static/publications/Sport5.zip), [DATASET2](http://iztok-jr-fister.eu/static/css/datasets/Sport.zip).\n\n\n## 📦 Installation\n\n### pip\n\nInstall sport-activities-features with pip:\n\n```sh\npip install sport-activities-features\n```\n\n### Alpine Linux\n\nTo install sport-activities-features on Alpine, use:\n\n```sh\n$ apk add py3-sport-activities-features\n```\n\n### Fedora Linux\n\nTo install sport-activities-features on Fedora, use:\n\n```sh\n$ dnf install python3-sport-activities-features\n```\n\n### Arch Linux\n\nTo install sport-activities-features on Arch Linux, please use an [AUR helper](https://wiki.archlinux.org/title/AUR_helpers):\n\n```sh\n$ yay -Syyu python-sport-activities-features\n```\n\n## 📮 API\n\nThere is a simple API for remote work with the sport-activities-features package available [here](https://github.com/alenrajsp/sport-activities-features-api).\n\n## 💻 Graphical User Interface\n\nThere is a simple Graphical User Interface for the sport-activities-features package available [here](https://github.com/firefly-cpp/sport-activities-features-gui).\n\n## 🌦️ Historical weather data\nWeather data parsed is collected from the [Visual Crossing Weather API](https://www.visualcrossing.com/).\nPlease note that this is an external unaffiliated service, and users must register to use the API.\nThe service has a free tier (1000 Weather reports/day) but is otherwise operating on a pay-as-you-go model.\nFor pricing and terms of use, please read the [official documentation](https://www.visualcrossing.com/weather-data-editions) of the API provider.\n\n## 🧩 Overpass API, Open Elevation API \u0026 OpenTopoData integration\nWithout performing activities, we can use the [OpenStreetMap](https://www.openstreetmap.org/) for the identification of hills,\ntotal ascent, and descent. This is done using the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API)\nwhich is a read-only API that allows querying of OSM map data. In addition to that altitude, data is retrieved by using the\n[Open-Elevation API](https://open-elevation.com/) or [OpenTopoData API](https://www.opentopodata.org/)  which are open-source and free alternatives to the Google Elevation API.\nBoth of the solutions can be used by using free publicly acessible APIs ([Overpass](https://wiki.openstreetmap.org/wiki/Overpass_API), [Open-Elevation](https://open-elevation.com/#public-api), [OpenTopoData](https://www.opentopodata.org/#public-api)) or can be self hosted on a server or as a Docker container ([Overpass](https://wiki.openstreetmap.org/wiki/Overpass_API/Installation), [Open-Elevation](https://github.com/Jorl17/open-elevation/blob/master/docs/host-your-own.md), [OpenTopoData](https://www.opentopodata.org/server/)).\n\n## 🚀 Examples\n\n### Reading files\n\n#### (*.TCX)\n```python\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n# Class for reading TCX files\ntcx_file=TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\ndata = tcx_file.extract_activity_data(tcx_exercise) # Represents data as dictionary of lists\n\n# Alternative choice\ndata = tcx_file.extract_activity_data(tcx_exercise, numpy_array= True) # Represents data as dictionary of numpy.arrays\n\n```\n\n#### (*.GPX)\n```python\nfrom sport_activities_features.gpx_manipulation import GPXFile\n\n# Class for reading GPX files\ngpx_file=GPXFile()\n\n# Read the file and generate a dictionary with \ngpx_exercise = gpx_file.read_one_file(\"path_to_the_file\")\ndata = gpx_file.extract_activity_data(gpx_exercise) # Represents data as dictionary of lists\n\n# Alternative choice\ndata = gpx_file.extract_activity_data(gpx_exercise, numpy_array= True) # Represents data as dictionary of numpy.arrays\n\n```\n\n### Extraction of topographic features\n```python\nfrom sport_activities_features.hill_identification import HillIdentification\nfrom sport_activities_features.tcx_manipulation import TCXFile\nfrom sport_activities_features.topographic_features import TopographicFeatures\nfrom sport_activities_features.plot_data import PlotData\n\n# Read TCX file\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\nactivity = tcx_file.extract_activity_data(tcx_exercise)\n\n# Detect hills in data\nHill = HillIdentification(activity['altitudes'], 30)\nHill.identify_hills()\nall_hills = Hill.return_hills()\n\n# Extract features from data\nTop = TopographicFeatures(all_hills)\nnum_hills = Top.num_of_hills()\navg_altitude = Top.avg_altitude_of_hills(activity['altitudes'])\navg_ascent = Top.avg_ascent_of_hills(activity['altitudes'])\ndistance_hills = Top.distance_of_hills(activity['positions'])\nhills_share = Top.share_of_hills(distance_hills, activity['total_distance'])\n```\n\n### Extraction of intervals\n```python\nimport sys\nsys.path.append('../')\n\nfrom sport_activities_features.interval_identification import IntervalIdentificationByPower, IntervalIdentificationByHeartrate\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n# Reading the TCX file\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\nactivity = tcx_file.extract_activity_data(tcx_exercise)\n\n# Identifying the intervals in the activity by power\nIntervals = IntervalIdentificationByPower(activity[\"distances\"], activity[\"timestamps\"], activity[\"altitudes\"], 70)\nIntervals.identify_intervals()\nall_intervals = Intervals.return_intervals()\n\n# Identifying the intervals in the activity by heart rate\nIntervals = IntervalIdentificationByHeartrate(activity[\"timestamps\"], activity[\"altitudes\"], activity[\"heartrates\"])\nIntervals.identify_intervals()\nall_intervals = Intervals.return_intervals()\n```\n\n### Parsing of Historical weather data from an external service\n```python\nfrom sport_activities_features import WeatherIdentification\nfrom sport_activities_features import TCXFile\n\n# Read TCX file\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\ntcx_data = tcx_file.extract_activity_data(tcx_exercise)\n\n# Configure visual crossing api key\nvisual_crossing_api_key = \"weather_api_key\" # https://www.visualcrossing.com/weather-api\n\n# Explanation of elements - https://www.visualcrossing.com/resources/documentation/weather-data/weather-data-documentation/\nweather = WeatherIdentification(tcx_data['positions'], tcx_data['timestamps'], visual_crossing_api_key)\nweatherlist = weather.get_weather(time_delta=30)\ntcx_weather = weather.get_average_weather_data(timestamps=tcx_data['timestamps'],weather=weatherlist)\n# Add weather to TCX data\ntcx_data.update({'weather':tcx_weather})\n```\n\nThe weather list is of the following type:\n```json\n     [\n        {\n            \"temperature\": 14.3,\n            \"maximum_temperature\": 14.3,\n            \"minimum_temperature\": 14.3,\n            \"wind_chill\": null,\n            \"heat_index\": null,\n            \"solar_radiation\": null,\n            \"precipitation\": 0.0,\n            \"sea_level_pressure\": 1021.6,\n            \"snow_depth\": null,\n            \"wind_speed\": 6.9,\n            \"wind_direction\": 129.0,\n            \"wind_gust\": null,\n            \"visibility\": 40.0,\n            \"cloud_cover\": 54.3,\n            \"relative_humidity\": 47.6,\n            \"dew_point\": 3.3,\n            \"weather_type\": \"\",\n            \"conditions\": \"Partially cloudy\",\n            \"date\": \"2016-04-02T17:26:09+00:00\",\n            \"location\": [\n                46.079871179535985,\n                14.738618675619364\n            ],\n            \"index\": 0\n        }, ...\n    ]\n```\n\n### Extraction of integral metrics\n```python\nimport sys\nsys.path.append('../')\n\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n# Read TCX file\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\nintegral_metrics = tcx_file.extract_integral_metrics(tcx_exercise)\n\nprint(integral_metrics)\n\n```\n\n### Weather data extraction\n```python\nfrom sport_activities_features.weather_identification import WeatherIdentification\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n#read TCX file\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\ntcx_data = tcx_file.extract_activity_data(tcx_exercise)\n\n\n#configure visual crossing api key\nvisual_crossing_api_key = \"API_KEY\" # https://www.visualcrossing.com/weather-api\n\n#return weather objects\nweather = WeatherIdentification(tcx_data['positions'], tcx_data['timestamps'], visual_crossing_api_key)\nweatherlist = weather.get_weather()\n```\n\n### Using Overpass queried Open Street Map nodes\n```python\nimport overpy\nfrom sport_activities_features.overpy_node_manipulation import OverpyNodesReader\n\n# External service Overpass API (https://wiki.openstreetmap.org/wiki/Overpass_API) (can be self-hosted)\noverpass_api = \"https://lz4.overpass-api.de/api/interpreter\"\n\n# External service Open Elevation API (https://api.open-elevation.com/api/v1/lookup) (can be self-hosted)\nopen_elevation_api = \"https://api.open-elevation.com/api/v1/lookup\"\n\n# OSM Way (https://wiki.openstreetmap.org/wiki/Way)\nopen_street_map_way = 164477980\n\noverpass_api = overpy.Overpass(url=overpass_api)\n\n# Get an example Overpass way\nq = f\"\"\"(way({open_street_map_way});\u003c;);out geom;\"\"\"\nquery = overpass_api.query(q)\n\n# Get nodes of an Overpass way\nnodes = query.ways[0].get_nodes(resolve_missing=True)\n\n# Extract basic data from nodes (you can, later on, use Hill Identification and Hill Data Extraction on them)\noverpy_reader = OverpyNodesReader(open_elevation_api=open_elevation_api)\n# Returns {\n#         'positions': positions, 'altitudes': altitudes, 'distances': distances, 'total_distance': total_distance\n#         }\ndata = overpy_reader.read_nodes(nodes)\n```\n\n### Extraction of data inside the area\n```python\nimport numpy as np\nimport sys\nsys.path.append('../')\n\nfrom sport_activities_features.area_identification import AreaIdentification\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n# Reading the TCX file.\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\nactivity = tcx_file.extract_activity_data(tcx_exercise)\n\n# Converting the read data to arrays.\npositions = np.array([*activity['positions']])\ndistances = np.array([*activity['distances']])\ntimestamps = np.array([*activity['timestamps']])\nheartrates = np.array([*activity['heartrates']])\n\n# Area coordinates should be given in clockwise orientation in the form of 3D array (number_of_hulls, hull_coordinates, 2).\n# Holes in area are permitted.\narea_coordinates = np.array([[[10, 10], [10, 50], [50, 50], [50, 10]],\n                             [[19, 19], [19, 21], [21, 21], [21, 19]]])\n\n# Extracting the data inside the given area.\narea = AreaIdentification(positions, distances, timestamps, heartrates, area_coordinates)\narea.identify_points_in_area()\narea_data = area.extract_data_in_area()\n```\n\n### Identify interruptions\n```python\nfrom sport_activities_features.interruptions.interruption_processor import InterruptionProcessor\nfrom sport_activities_features.tcx_manipulation import TCXFile\n\n\"\"\"\nIdentify interruption events from a TCX or GPX file.\n\"\"\"\n\n# read TCX file (also works with GPX files)\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\ntcx_data = tcx_file.extract_activity_data(tcx_exercise)\n\n\"\"\"\nTime interval = time before and after the start of an event\nMin speed = Threshold speed to trigger an event/interruption (trigger when under min_speed)\noverpass_api_url = Set to something self-hosted, or use a public instance from https://wiki.openstreetmap.org/wiki/Overpass_API\n\"\"\"\ninterruptionProcessor = InterruptionProcessor(time_interval=60, min_speed=2,\n                                              overpass_api_url=\"url_to_overpass_api\")\n\n\"\"\"\nIf classify is set to true, also discover if interruptions are close to intersections. Returns a list of [ExerciseEvent]\n\"\"\"\nevents = interruptionProcessor.events(tcx_data, True)\n```\n\n### Overpy (Overpass API) node manipulation\nGenerate TCXFile parsed like data object from overpy.Node objects\n```python\nimport overpy\nfrom sport_activities_features.overpy_node_manipulation import OverpyNodesReader\n\n# External service Overpass API (https://wiki.openstreetmap.org/wiki/Overpass_API) (can be self-hosted)\noverpass_api = \"https://lz4.overpass-api.de/api/interpreter\"\n\n# External service Open Elevation API (https://api.open-elevation.com/api/v1/lookup) (can be self-hosted)\nopen_elevation_api = \"https://api.open-elevation.com/api/v1/lookup\"\n\n# OSM Way (https://wiki.openstreetmap.org/wiki/Way)\nopen_street_map_way = 164477980\n\noverpass_api = overpy.Overpass(url=overpass_api)\n\n# Get an example Overpass way\nq = f\"\"\"(way({open_street_map_way});\u003c;);out geom;\"\"\"\nquery = overpass_api.query(q)\n\n# Get nodes of an Overpass way\nnodes = query.ways[0].get_nodes(resolve_missing=True)\n\n# Extract basic data from nodes (you can, later on, use Hill Identification and Hill Data Extraction on them)\noverpy_reader = OverpyNodesReader(open_elevation_api=open_elevation_api)\n# Returns {\n#         'positions': positions, 'altitudes': altitudes, 'distances': distances, 'total_distance': total_distance\n#         }\ndata = overpy_reader.read_nodes(nodes)\n```\n### Missing elevation data extraction\n```python\nfrom sport_activities_features import ElevationIdentification\nfrom sport_activities_features import TCXFile\n\ntcx_file = TCXFile()\ntcx_exercise = tcx_file.read_one_file(\"path_to_the_file\")\ntcx_data = tcx_file.extract_activity_data(tcx_exercise)\n\nelevations = ElevationIdentification(tcx_data['positions'])\n\"\"\"Adds tcx_data['elevation'] = eg. [124, 21, 412] for each position\"\"\"\ntcx_data.update({'elevations':elevations})\n```\n\n### Example of a visualization of the area detection\n\n![Area Figure](https://i.imgur.com/Iz8Ga3B.png)\n\n### Example of visualization of dead-end identification\n![Dead End Figure](https://imgur.com/LgZzCFS.png)\n\n## 🔑 License\n\nThis package is distributed under the MIT License. This license can be found online at \u003chttp://www.opensource.org/licenses/MIT\u003e.\n\n## Disclaimer\n\nThis framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!\n\n## 📄 Cite us\n\nI. Jr. Fister, L. Lukač, A. Rajšp, I. Fister, L. Pečnik and D. Fister, \"[A minimalistic toolbox for extracting features from sport activity files](http://iztok-jr-fister.eu/static/publications/294.pdf)\", 2021 IEEE 25th International Conference on Intelligent Engineering Systems (INES), 2021, pp. 121-126, doi: [10.1109/INES52918.2021.9512927](http://dx.doi.org/10.1109/INES52918.2021.9512927).\n\n## 📖 Further read\n\n[1] [Awesome Computational Intelligence in Sports](https://github.com/firefly-cpp/awesome-computational-intelligence-in-sports)\n\n## 🔗 Related frameworks\n\n[1] [AST-Monitor: A wearable Raspberry Pi computer for cyclists](https://github.com/firefly-cpp/AST-Monitor)\n\n[2] [TCXReader.jl: Julia package designed for parsing TCX files](https://github.com/firefly-cpp/TCXReader.jl)\n\n[3] [TCXWriter: A Tiny Library for writing/creating TCX files on Arduino](https://github.com/firefly-cpp/tcxwriter)\n\n## 🫂 Contributors\n\nThanks go to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/alenrajsp\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/27721714?v=4?s=100\" width=\"100px;\" alt=\"alenrajsp\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ealenrajsp\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=alenrajsp\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=alenrajsp\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#example-alenrajsp\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=alenrajsp\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-alenrajsp\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3Aalenrajsp\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"#maintenance-alenrajsp\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://www.iztok-jr-fister.eu/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1633361?v=4?s=100\" width=\"100px;\" alt=\"Iztok Fister Jr.\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIztok Fister Jr.\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=firefly-cpp\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3Afirefly-cpp\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=firefly-cpp\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#example-firefly-cpp\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=firefly-cpp\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-firefly-cpp\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"#mentoring-firefly-cpp\" title=\"Mentoring\"\u003e🧑‍🏫\u003c/a\u003e \u003ca href=\"#platform-firefly-cpp\" title=\"Packaging/porting to new platform\"\u003e📦\u003c/a\u003e \u003ca href=\"#maintenance-firefly-cpp\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"#data-firefly-cpp\" title=\"Data\"\u003e🔣\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/luckyLukac\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/73126820?v=4?s=100\" width=\"100px;\" alt=\"luckyLukac\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eluckyLukac\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-luckyLukac\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=luckyLukac\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3AluckyLukac\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=luckyLukac\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#example-luckyLukac\" title=\"Examples\"\u003e💡\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/rhododendrom\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3198785?v=4?s=100\" width=\"100px;\" alt=\"rhododendrom\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003erhododendrom\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=rhododendrom\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#design-rhododendrom\" title=\"Design\"\u003e🎨\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=rhododendrom\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-rhododendrom\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/lukapecnik\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/23029992?v=4?s=100\" width=\"100px;\" alt=\"Luka Pečnik\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLuka Pečnik\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=lukapecnik\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=lukapecnik\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=lukapecnik\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3Alukapecnik\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/spelap\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/19300429?v=4?s=100\" width=\"100px;\" alt=\"spelap\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003espelap\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=spelap\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://carlosal1015.github.io\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/21283014?v=4?s=100\" width=\"100px;\" alt=\"Oromion\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOromion\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-carlosal1015\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3Acarlosal1015\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/KoprivcLuka\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/45632449?v=4?s=100\" width=\"100px;\" alt=\"Luka Koprivc\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLuka Koprivc\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3AKoprivcLuka\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/garyjellyarms\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/79595804?v=4?s=100\" width=\"100px;\" alt=\"Nejc Graj\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNejc Graj\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3Agaryjellyarms\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/Mtvrt123\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/50879568?v=4?s=100\" width=\"100px;\" alt=\"MlinaricNejc\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMlinaricNejc\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3AMtvrt123\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/KukovecRok\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/33880044?v=4?s=100\" width=\"100px;\" alt=\"Tatookie\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTatookie\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=KukovecRok\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/issues?q=author%3AKukovecRok\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=KukovecRok\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#example-KukovecRok\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#maintenance-KukovecRok\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/zala-lahovnik\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/105444201?v=4?s=100\" width=\"100px;\" alt=\"Zala Lahovnik\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eZala Lahovnik\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=zala-lahovnik\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=zala-lahovnik\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/lahovniktadej\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/57890734?v=4?s=100\" width=\"100px;\" alt=\"Tadej Lahovnik\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTadej Lahovnik\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=lahovniktadej\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/HlisTilen\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/44733158?v=4?s=100\" width=\"100px;\" alt=\"HlisTilen\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHlisTilen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=HlisTilen\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/MihaMi27\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/82605811?v=4?s=100\" width=\"100px;\" alt=\"Miha Mirt\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMiha Mirt\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/firefly-cpp/sport-activities-features/commits?author=MihaMi27\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirefly-cpp%2Fsport-activities-features","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirefly-cpp%2Fsport-activities-features","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirefly-cpp%2Fsport-activities-features/lists"}