Data analysis and reporting tool for HPDE and Time Trials programs
Project description
HPDE Analytics CLI
Data analysis and reporting tool that allows a user to connect to the MotorsportsReg (MSR) API to export data and create reports. This tool automates the extraction of event registration data from MSR and generates Excel reports for High Performance Drivers Education (HPDE) and Time Trials program analytics.
Getting Started
These instructions will help you set up the project on your local machine for development and usage.
Prerequisites
- Python 3.8 or higher
- MotorsportsReg OAuth consumer credentials
- pip (Python package installer)
Installation
Option 1: Install from PyPI (Recommended)
pip install hpde-analytics-cli
Option 2: Install from source
-
Clone the repository:
git clone https://github.com/Homan13/hpde-analytics-cli.git cd hpde-analytics-cli
-
Install the package:
pip install -e .
Configuration
-
Configure your credentials (choose one method):
Option A: Secure storage (Recommended)
hpde-analytics-cli --configureThis stores your credentials securely in your system's keyring (macOS Keychain, Windows Credential Locker, or Linux Secret Service).
Option B: Environment file (Fallback)
cp .env.example .env
Edit
.envand add your MotorsportsReg OAuth credentials:MSR_CONSUMER_KEY=your_consumer_key_here MSR_CONSUMER_SECRET=your_consumer_secret_here MSR_BASE_URL=https://api.motorsportreg.com MSR_CALLBACK_PORT=8089 -
Check credential status (optional):
hpde-analytics-cli --credential-status -
Run initial authentication:
hpde-analytics-cli --authFollow the browser prompts to authorize the application.
Usage
Export Event Data
Export all event registration data (both raw and filtered formats):
hpde-analytics-cli --export \
--org-id 11A1AAAA-2B2B-C333-4D4444444D4DD44D \
--event-id <EVENT_ID> \
--name HPDE_TT_1_2025
Parameters:
--org-id: MSR organization ID (required)--event-id: MSR event ID (required)--name: Custom name for export folder (optional)--output-dir: Custom output directory (optional, defaults tooutput/)
Generate Time Trials Report
Generate an Excel report from exported data:
hpde-analytics-cli --report \
--export-dir output/HPDE_TT_1_2025_20260110_123456 \
--name HPDE_TT_1_2025
Parameters:
--export-dir: Path to exported data folder (required)--name: Custom name for report file (optional)--report-file: Specific output path for report (optional)
Other Commands
# Configure or update API credentials (secure keyring storage)
hpde-analytics-cli --configure
# Check credential configuration status
hpde-analytics-cli --credential-status
# Re-authenticate if tokens expire
hpde-analytics-cli --auth
# Run field discovery to explore available data
hpde-analytics-cli --discover \
--org-id <ORG_ID> \
--event-id <EVENT_ID>
# Show all available options
hpde-analytics-cli --help
Report Features
The generated Time Trials report includes:
- Driver Information: Name, email, member ID
- Vehicle Details: Year/make/model (combined), color, tire brand, vehicle number
- Classification: TT class and class grouping (Max, Sport, Tuner, Unlimited)
- Participation Tracking:
- Days attended (Friday/Saturday/Sunday/combinations)
- Day count (1 Day, 2 Days, 3 Days)
- Instructor status (Yes/No)
- AYCE participation (Time Trials + Advanced HPDE)
- Participation type (TT Only, TT + Instructor, TT + AYCE, TT + Instructor + AYCE)
Pivot-Ready Columns: Class Group, Day Count, and Participation Type columns are optimized for Excel pivot table analysis to track registration trends.
Project Structure
hpde-analytics-cli/
├── .env.example # Credential template
├── .gitignore # Git exclusions
├── pyproject.toml # Package configuration
├── README.md # This file
├── hpde_analytics_cli/
│ ├── __init__.py
│ ├── main.py # CLI entry point
│ ├── auth/
│ │ ├── __init__.py
│ │ ├── credentials.py # Secure credential management
│ │ └── oauth.py # OAuth 1.0a authentication
│ ├── api/
│ │ ├── __init__.py
│ │ └── client.py # MSR API client
│ └── utils/
│ ├── __init__.py
│ ├── data_export.py # Data export to JSON/CSV
│ ├── field_discovery.py # API field enumeration
│ └── report_generator.py # Excel report generation
├── output/ # Export and report output (not in version control)
├── tokens/ # OAuth access tokens (not in version control)
└── tests/ # Unit tests
Export Structure
Each export creates two data sets:
HPDE_TT_1_2025_20260110_123456/
├── raw_data/ # Complete API responses (for reference)
│ ├── profile_full.json
│ ├── calendar_full.json
│ ├── calendar_full.csv
│ ├── entrylist_full.json
│ ├── entrylist_full.csv
│ ├── attendees_full.json
│ ├── attendees_full.csv
│ ├── assignments_full.json
│ └── assignments_full.csv
├── profile.json # Filtered data for Time Trials
├── calendar.json
├── entrylist.json
├── entrylist.csv
├── attendees.json
├── attendees.csv
├── assignments.json
├── assignments.csv
└── export_summary.json
Running the tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests with coverage
pytest
Deployment
This is a command-line tool designed to run locally. No deployment infrastructure is required.
For scheduled/automated execution:
- Consider setting up cron jobs (Linux/Mac) or Task Scheduler (Windows)
- Ensure OAuth tokens are refreshed as needed
- Store reports in a centralized location for team access
Built With
- Python 3 - Programming language
- requests - HTTP library
- requests-oauthlib - OAuth 1.0a support
- python-dotenv - Environment variable management
- openpyxl - Excel file generation
- keyring - Secure credential storage
- MotorsportsReg API - Event registration data source
Contributing
In Progress - Contribution guidelines to be developed
Versioning
This project uses Semantic Versioning (SemVer):
- MAJOR version for incompatible API changes
- MINOR version for new functionality in a backward compatible manner
- PATCH version for backward compatible bug fixes
Current Version: 2.0.0
Authors
- Kevin Homan
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- SCCA Washington DC Region for supporting the Time Trials program
- MotorsportsReg.com for providing API access
- WDCR HPDE program for combined event management
Security Notes
Important:
- Never commit
.envortokens/directory to version control - OAuth consumer secrets and access tokens must be kept confidential
- The
.gitignorefile is configured to exclude these sensitive files automatically - Use
hpde-analytics-cli --configureto store credentials securely in your system keyring
Support
For issues or questions related to this tool, contact the WDCR Time Trials administration.
For MotorsportsReg API issues, refer to the MotorsportsReg API documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hpde_analytics_cli-2.0.0.tar.gz.
File metadata
- Download URL: hpde_analytics_cli-2.0.0.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4df9e068fd05597e6d1ff7d65e18db9b2a2b3eeb3d6d44c6e461e9036b32c406
|
|
| MD5 |
36db62cfbe78e79010785cc2a8938261
|
|
| BLAKE2b-256 |
705154a4778defacba2c3d941f21dbb7e8592a750e2f2f95e3390531f081a8b7
|
Provenance
The following attestation bundles were made for hpde_analytics_cli-2.0.0.tar.gz:
Publisher:
publish.yml on Homan13/hpde-analytics-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hpde_analytics_cli-2.0.0.tar.gz -
Subject digest:
4df9e068fd05597e6d1ff7d65e18db9b2a2b3eeb3d6d44c6e461e9036b32c406 - Sigstore transparency entry: 863713371
- Sigstore integration time:
-
Permalink:
Homan13/hpde-analytics-cli@22631e718b8bc2df897f4b65063607ddcedda1e1 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Homan13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22631e718b8bc2df897f4b65063607ddcedda1e1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hpde_analytics_cli-2.0.0-py3-none-any.whl.
File metadata
- Download URL: hpde_analytics_cli-2.0.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7de060abd51b04223b2c3251c67a00b008e7f39e63ea5c654afdae0c0d95cdf
|
|
| MD5 |
bb6efe91f1ac9129ccefc7d57af96493
|
|
| BLAKE2b-256 |
4286482177851d53a0f64177c74df6339e9c24044340ee6b926913afafa513c7
|
Provenance
The following attestation bundles were made for hpde_analytics_cli-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on Homan13/hpde-analytics-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hpde_analytics_cli-2.0.0-py3-none-any.whl -
Subject digest:
c7de060abd51b04223b2c3251c67a00b008e7f39e63ea5c654afdae0c0d95cdf - Sigstore transparency entry: 863713379
- Sigstore integration time:
-
Permalink:
Homan13/hpde-analytics-cli@22631e718b8bc2df897f4b65063607ddcedda1e1 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Homan13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22631e718b8bc2df897f4b65063607ddcedda1e1 -
Trigger Event:
release
-
Statement type: