GNU Affero General Public License v3.0

项目介绍

sports-alliance/sports-lib 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 GNU Affero General Public License v3.0 许可证,目前获得 178 个 Star、24 次 Fork。

仓库全名
sports-alliance/sports-lib
开源许可证
GNU Affero General Public License v3.0
Star 数
178
Fork 数
24
未关闭 Issue
17

README 摘要

Sports Lib Sports Lib normalizes GPX, TCX, FIT, and service-specific JSON into shared activity and route models. It also exposes provider-neutral Health and sleep scalar data classes with canonical units, display formatting, aliases, and JSON round-trip behavior. Regression-tested using a corpus of 212,905 real-world source files. Coverage includes activity and route imports and file-type validation. This work has…

完整内容见 GitHub 原始 README 或本页 。

常见问题

sports-lib 用什么语言开发?

主要使用 TypeScript 编写,采用 GNU Affero General Public License v3.0 许可证,目前有 178 个 Star。

sports-lib 可以免费商用吗?

仓库标注的许可证为 GNU Affero General Public License v3.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 sports-lib 的源码?

可以直接克隆仓库:git clone https://github.com/sports-alliance/sports-lib.git,默认分支为 main;安装与运行步骤见仓库 README。

sports-lib 最近还在维护吗?

仓库最近一次更新为 2 天前,当前有 17 个未关闭 Issue;Star 数为 178,可作为社区活跃度的参考。

关于

A Library for processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
234
价值分
113
活跃状态
活跃

语言占比

HTML
JavaScript
TypeScript

README

Sports Lib

Sports Lib normalizes GPX, TCX, FIT, and service-specific JSON into shared activity and route models. It also exposes provider-neutral Health and sleep scalar data classes with canonical units, display formatting, aliases, and JSON round-trip behavior.

Regression-tested using a corpus of 212,905 real-world source files. Coverage includes activity and route imports and file-type validation. This work has driven compatibility fixes for vendor quirks, incomplete recordings and malformed data. Importers use evidence in the file to recover valid observations while preserving zeros, pauses and sport boundaries. See our validation guide for supported recovery examples, activity and route coverage, methodology and known limitations.

Power calculations distinguish missing readings from recorded zero watts and expose observed coverage alongside partial work. Device summaries retain priority. See power coverage and migration.

Documentation

The hosted documentation contains the supported API and all consumer guidance:

Activity R–R analysis provides gap-aware RMSSD, SDNN, pNN50, recording-quality summaries and rolling DFA alpha1. See activity R–R calculations for units, quality gates and reparse requirements.

Install

npm install @sports-alliance/sports-lib

For GPX parsing in Node.js, also install a DOM parser:

npm install @xmldom/xmldom

Quick start

import { SportsLib } from '@sports-alliance/sports-lib';
import { DOMParser } from '@xmldom/xmldom';

const event = await SportsLib.importFromGPX(gpxText, DOMParser);
const activity = event.getFirstActivity();
const distanceMetres = activity.getDistance().getValue();

See Import activities for the other supported formats and parsing options.

FIT activity imports reject files explicitly declared as monitoring, settings, courses, or other non-activity types. Use SportsLib.importRoutesFromFit for FIT courses. Completed activity_summary files retain their recorded sessions; legacy activity files without a declared file type retain recovery.

Sports Lib 23.2 requires FIT Parser ^6.2.3, recovering supported numeric fields from FIT producers that omit the endian flag in their type definitions. Correct historical imports by reparsing retained originals and refreshing affected derived summaries; installing the release does not rewrite saved data. See the FIT compatibility guide.

Package formats

Browser charts and workers can import canonical data classes, unit settings, activity types and stream utilities from @sports-alliance/sports-lib/metrics. This public entry reuses the root API’s implementations while excluding file import/export facades. It prevents unused asynchronous parser chunks from being emitted in worker builds. ESM, CommonJS and TypeScript consumers are supported; the package-root API stays compatible. No values, metric tokens, units or JSON representations change, and no reparse or migration is required. See the metrics entry guide.

Sports Lib 21 publishes module-preserving ESM for import consumers and per-module CommonJS for require consumers. The package-root API remains supported; bundlers can discard unrelated parser, exporter, geodesy, and filtering modules when an application imports focused root exports such as User, settings, or data classes. Importing the SportsLib facade retains its complete import/export feature set in the initial bundle, so startup-sensitive consumers should use focused root imports.

FIT imports keep the full decoder and semantic profile behind the existing asynchronous boundary. Synchronous device, sport, and route lookups use the lightweight canonical fit-file-parser/profile entry point instead of maintaining protocol mappings in Sports Lib.

The 21.0.3 packaging change does not alter parsed values, native JSON, or persisted metric representations. Consumers do not need to reparse source files, regenerate summaries, or migrate stored data.

评论

暂无评论