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
Releases are automated by release-please
from Conventional Commit messages on main.
Version numbers are owned by that automation and should never be edited by hand.
To see the version you have installed:
hpde-analytics-cli --version
For the current release and full history, see Releases and CHANGELOG.md.
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.
Metadata
Release files for hpde-analytics-cli 6.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hpde_analytics_cli-6.0.7.tar.gz | 50.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hpde_analytics_cli-6.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.8 kB
Release files / hpde_analytics_cli-6.0.7.tar.gz
| Download URL | hpde_analytics_cli-6.0.7.tar.gz |
|---|---|
| Size | 50.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83c8de3b7974a9cbdce7f78a0b593c071597b7d472dd6ded03745653a6b3f8c5
|
|
BLAKE2b-256 checksum How to use checksums |
05eb88308ff22830b73da9e28d78c78cf01f523818ff2a149ee2802888c734d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / hpde_analytics_cli-6.0.7-py3-none-any.whl
| Download URL | hpde_analytics_cli-6.0.7-py3-none-any.whl |
|---|---|
| Size | 38.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f6fcaa0a47184d6148e04af8bf0089f2f67613c309bec9dfd5fdbaa0e70a5f9
|
|
BLAKE2b-256 checksum How to use checksums |
ce0279b2d56e2425762b28fcf463ec097ec835865df97921885ed52010630099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logSecurity for hpde-analytics-cli 6.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for hpde_analytics_cli-6.0.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.