Skip to content

Commit a3edc01

Browse files
authored
Merge pull request #16 from HzaCode/review-fixes-v1.0.2
v1.0.2: runnable vignettes, sample datasets, styler formatting
2 parents 360335b + 98c50d5 commit a3edc01

File tree

125 files changed

+4547
-3466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4547
-3466
lines changed

DESCRIPTION

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: Athlytics
22
Title: Academic R Package for Sports Physiology Analysis from Local 'Strava' Data
3-
Version: 1.0.1
3+
Version: 1.0.2
44
Author: Zhiang He [aut, cre]
55
Maintainer: Zhiang He <ang@hezhiang.com>
66
Authors@R:
@@ -39,10 +39,7 @@ Suggests:
3939
testthat (>= 3.0.0),
4040
mockery,
4141
rStrava,
42-
xml2,
43-
FITfileR
44-
Remotes:
45-
grimbough/FITfileR
42+
xml2
4643
VignetteBuilder: knitr
4744
RoxygenNote: 7.3.3
4845
Roxygen: list(markdown = TRUE)

NAMESPACE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export(athlytics_palette_science)
1111
export(athlytics_palette_vibrant)
1212
export(calculate_acwr)
1313
export(calculate_acwr_ewma)
14+
export(calculate_cohort_reference)
1415
export(calculate_decoupling)
1516
export(calculate_ef)
1617
export(calculate_ef_from_stream)
@@ -30,9 +31,13 @@ export(plot_pbs)
3031
export(plot_with_reference)
3132
export(quality_summary)
3233
export(scale_athlytics)
34+
export(summarize_quality)
3335
export(theme_athlytics)
3436
import(ggplot2)
3537
importFrom(dplyr,"%>%")
38+
importFrom(dplyr,across)
39+
importFrom(dplyr,all_of)
40+
importFrom(dplyr,any_of)
3641
importFrom(dplyr,arrange)
3742
importFrom(dplyr,bind_rows)
3843
importFrom(dplyr,case_when)
@@ -48,6 +53,7 @@ importFrom(dplyr,last)
4853
importFrom(dplyr,lead)
4954
importFrom(dplyr,left_join)
5055
importFrom(dplyr,mutate)
56+
importFrom(dplyr,n)
5157
importFrom(dplyr,pull)
5258
importFrom(dplyr,recode)
5359
importFrom(dplyr,rename)
@@ -69,6 +75,7 @@ importFrom(ggplot2,ggplot)
6975
importFrom(ggplot2,labs)
7076
importFrom(ggplot2,scale_color_viridis_d)
7177
importFrom(ggplot2,scale_x_date)
78+
importFrom(ggplot2,scale_y_continuous)
7279
importFrom(ggplot2,theme)
7380
importFrom(ggplot2,theme_minimal)
7481
importFrom(lubridate,as_date)
@@ -78,6 +85,7 @@ importFrom(lubridate,date)
7885
importFrom(lubridate,days)
7986
importFrom(lubridate,duration)
8087
importFrom(lubridate,floor_date)
88+
importFrom(lubridate,hms)
8189
importFrom(lubridate,interval)
8290
importFrom(lubridate,parse_date_time)
8391
importFrom(lubridate,period)
@@ -92,7 +100,9 @@ importFrom(purrr,quietly)
92100
importFrom(readr,cols)
93101
importFrom(readr,read_csv)
94102
importFrom(rlang,"%||%")
103+
importFrom(rlang,":=")
95104
importFrom(rlang,.data)
105+
importFrom(rlang,sym)
96106
importFrom(scales,pretty_breaks)
97107
importFrom(stats,median)
98108
importFrom(stats,na.omit)
@@ -104,6 +114,8 @@ importFrom(tidyr,pivot_longer)
104114
importFrom(tidyr,pivot_wider)
105115
importFrom(tidyr,unnest)
106116
importFrom(tools,toTitleCase)
117+
importFrom(utils,head)
107118
importFrom(utils,read.csv)
119+
importFrom(utils,tail)
108120
importFrom(zoo,rollapply)
109121
importFrom(zoo,rollmean)

NEWS.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# Athlytics 1.0.1
1+
# Athlytics 1.0.2
2+
3+
## Documentation & Review Fixes
4+
5+
* **Runnable vignettes**: Added executable demo chunks using built-in sample datasets so key plots render during `build_vignettes()`.
6+
7+
* **Sample data naming**: Renamed built-in datasets from `athlytics_sample_*` to `sample_*` and updated docs/examples accordingly.
8+
9+
* **Styling**: Ran `styler::style_pkg()` to improve formatting consistency.
10+
11+
---
12+
13+
# Athlytics 1.0.1
214

315
## Code Quality Improvements
416

@@ -8,6 +20,11 @@
820

921
* **Documentation Fixes**: Fixed Rd line width issues in `plot_with_reference()` examples.
1022

23+
* **API Naming Consistency**: Added verb-first primary APIs and kept previous names as deprecated wrappers for backward compatibility.
24+
- New: `calculate_cohort_reference()` (replaces `cohort_reference()`)
25+
- New: `summarize_quality()` (replaces `quality_summary()`)
26+
- Old names remain available but emit a deprecation warning to guide migration.
27+
1128
* **Build Configuration**: Updated `.Rbuildignore` to properly exclude development files.
1229

1330
---
@@ -81,12 +98,12 @@ For users upgrading from 0.1.x:
8198

8299
## Core Improvement: Enhanced Reliability & Testing with Simulated Data
83100

84-
This significant update enhances package reliability and ease of use by integrating `athlytics_sample_data`. This enables all examples to run offline and ensures core functionalities have undergone more rigorous, reproducible testing.
101+
This significant update enhances package reliability and ease of use by integrating sample datasets. This enables all examples to run offline and ensures core functionalities have undergone more rigorous, reproducible testing.
85102

86103
## Key Changes
87104

88-
* **Examples & Vignettes**: All Roxygen examples and key vignette examples now primarily use `athlytics_sample_data` for offline execution and clarity. Network-dependent examples are clearly separated in `\donttest{}` blocks.
89-
* **Test Suite**: Fundamentally refactored the test suite to extensively use `athlytics_sample_data` and `mockery`, improving test robustness and parameter coverage.
105+
* **Examples & Vignettes**: All Roxygen examples and key vignette examples now primarily use sample datasets for offline execution and clarity. Network-dependent examples are clearly separated in `\donttest{}` blocks.
106+
* **Test Suite**: Fundamentally refactored the test suite to extensively use sample datasets and `mockery`, improving test robustness and parameter coverage.
90107
* **Strengthened Package Quality & Compliance**: Undertook thorough package validation, leading to key enhancements for overall robustness and adherence to R packaging standards. This involved: ensuring all **function examples** are correct and reliably executable (notably addressing `strava_oauth(...)` scenarios for offline/testing contexts); providing accurate and **refined documentation for data objects** in `R/data.R`; fixing **Roxygen import directives** for precise namespace definition; improving **help file readability** through Rd line width adjustments; and optimizing package data loading by adding `LazyData: true` to `DESCRIPTION`.
91108
* **Documentation**: Minor improvements to documentation clarity and consistency (e.g., date formatting in plots, explicit naming of data frame arguments in examples).
92109

R/Athlytics-package.R

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#' @keywords internal
2+
"_PACKAGE"
3+
4+
#' Athlytics: Academic R Package for Sports Physiology Analysis
5+
#'
6+
#' @description
7+
#' Athlytics is an open-source computational framework for longitudinal analysis
8+
#' of exercise physiology metrics using local Strava data exports. Designed for
9+
#' personal analysis and sports science applications, this package provides
10+
#' standardized functions to calculate and visualize key physiological indicators.
11+
#'
12+
#' @section Main Functions:
13+
#' **Data Loading:**
14+
#' \itemize{
15+
#' \item \code{\link{load_local_activities}}: Load activities from Strava export ZIP or directory
16+
#' \item \code{\link{parse_activity_file}}: Parse individual FIT/TCX/GPX files
17+
#' }
18+
#'
19+
#' **Training Load Analysis:**
20+
#' \itemize{
21+
#' \item \code{\link{calculate_acwr}}: Calculate Acute:Chronic Workload Ratio
22+
#' \item \code{\link{calculate_acwr_ewma}}: ACWR using exponentially weighted moving averages
23+
#' \item \code{\link{calculate_exposure}}: Calculate training load exposure metrics
24+
#' }
25+
#'
26+
#' **Physiological Metrics:**
27+
#' \itemize{
28+
#' \item \code{\link{calculate_ef}}: Calculate Efficiency Factor (EF)
29+
#' \item \code{\link{calculate_decoupling}}: Calculate cardiovascular decoupling
30+
#' \item \code{\link{calculate_pbs}}: Calculate personal bests
31+
#' }
32+
#'
33+
#' **Visualization:**
34+
#' \itemize{
35+
#' \item \code{\link{plot_acwr}}, \code{\link{plot_acwr_enhanced}}: Plot ACWR trends
36+
#' \item \code{\link{plot_ef}}: Plot Efficiency Factor trends
37+
#' \item \code{\link{plot_decoupling}}: Plot decoupling analysis
38+
#' \item \code{\link{plot_exposure}}: Plot training load exposure
39+
#' \item \code{\link{plot_pbs}}: Plot personal bests progression
40+
#' }
41+
#'
42+
#' **Quality Control & Cohort Analysis:**
43+
#' \itemize{
44+
#' \item \code{\link{flag_quality}}: Flag activities based on quality criteria
45+
#' \item \code{\link{summarize_quality}}: Summarize stream quality flags
46+
#' \item \code{\link{calculate_cohort_reference}}: Generate cohort reference bands
47+
#' }
48+
#'
49+
#' @section Sample Datasets:
50+
#' The package includes simulated datasets for examples and testing:
51+
#' \itemize{
52+
#' \item \code{\link{sample_acwr}}: Sample ACWR data
53+
#' \item \code{\link{sample_ef}}: Sample Efficiency Factor data
54+
#' \item \code{\link{sample_decoupling}}: Sample decoupling data
55+
#' \item \code{\link{sample_exposure}}: Sample exposure data
56+
#' \item \code{\link{sample_pbs}}: Sample personal bests data
57+
#' }
58+
#'
59+
#' @section Getting Started:
60+
#' ```
61+
#' library(Athlytics)
62+
#'
63+
#' # Load your Strava export
64+
#' activities <- load_local_activities("path/to/strava_export.zip")
65+
#'
66+
#' # Calculate ACWR
67+
#' acwr_data <- calculate_acwr(activities, activity_type = "Run")
68+
#'
69+
#' # Visualize
70+
71+
#' plot_acwr(acwr_data)
72+
#' ```
73+
#'
74+
#' @seealso
75+
#' \itemize{
76+
#' \item Package website: \url{https://hzacode.github.io/Athlytics/}
77+
#' \item GitHub repository: \url{https://github.com/HzaCode/Athlytics}
78+
#' \item Strava: \url{https://www.strava.com/}
79+
#' }
80+
#'
81+
#' @importFrom dplyr mutate filter select group_by ungroup summarise arrange
82+
#' @importFrom dplyr left_join bind_rows n lag lead across any_of all_of
83+
#' @importFrom ggplot2 ggplot aes geom_line geom_point geom_ribbon theme_minimal
84+
#' @importFrom ggplot2 labs scale_x_date scale_y_continuous theme element_text
85+
#' @importFrom lubridate as_date ymd hms seconds_to_period
86+
#' @importFrom rlang .data := sym
87+
#' @importFrom stats na.omit sd median quantile
88+
#' @importFrom utils head tail
89+
#'
90+
#' @name Athlytics-package
91+
#' @aliases Athlytics
92+
NULL

0 commit comments

Comments
 (0)