Skip to main content

HPDE Analytics CLI

CI Python Version License: MIT

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

pip install hpde-analytics-cli

Option 2: Install from source

  1. Clone the repository:

    git clone https://github.com/Homan13/hpde-analytics-cli.git
    cd hpde-analytics-cli
    
  2. Install the package:

    pip install -e .
    

Configuration

  1. Configure your credentials (choose one method):

    Option A: Secure storage (Recommended)

    hpde-analytics-cli --configure
    

    This stores your credentials securely in your system's keyring (macOS Keychain, Windows Credential Locker, or Linux Secret Service).

    Option B: Environment file (Fallback)

    Create a .env file in the directory you run the tool from:

    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
    

    (Working from a clone, cp .env.example .env gives you a starting point.)

    Two locations are searched, in this order:

    Location Purpose
    .env in the working directory, or any parent Per-project settings
    .env in the user config directory (below) Your defaults across all directories

    The project file wins where both set the same key; the user file supplies anything it leaves out.

  2. Check credential status (optional):

    hpde-analytics-cli --credential-status
    
  3. Run initial authentication:

    hpde-analytics-cli --auth
    

    Follow 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 to output/)

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
│   ├── paths.py                  # Config, token and output path resolution
│   ├── 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)
└── tests/                        # Unit tests

File Locations

Exports and reports are written relative to the directory you run the command from, so the tool behaves the same whether installed from PyPI or run from a clone. OAuth tokens go to a per-user config directory, so they survive upgrades and stay out of your project folders.

What Location
Exports and reports ./output/ in the current directory (override with --output-dir)
Field inventory ./output/field_inventory.json (override with --output)
OAuth access token user config directory, below
.env current directory or any parent, then the user config directory

The user config directory is the native location for your platform:

Platform Path
Linux ~/.config/hpde-analytics-cli/
macOS ~/Library/Application Support/hpde-analytics-cli/
Windows %LOCALAPPDATA%\hpde-analytics-cli\

Set HPDE_CONFIG_DIR to override it. The token file is written readable only by you (mode 0600 on POSIX systems). A token left by version 6.0.7 or earlier is moved to the new location automatically on first run, so you will not need to re-authenticate.

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

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 a .env file to version control
  • OAuth consumer secrets and access tokens must be kept confidential
  • The .gitignore file is configured to exclude these sensitive files automatically
  • Use hpde-analytics-cli --configure to store credentials securely in your system keyring
  • Access tokens live outside the project in the user config directory, written mode 0600
  • Exported data contains registrant names and email addresses; output/ is gitignored, but take the same care with it that you would with any roster

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.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hpde-analytics-cli 6.0.8
File Size Uploaded Provenance
hpde_analytics_cli-6.0.8.tar.gz 55.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hpde-analytics-cli 6.0.8
File Interpreter ABI Platform
hpde_analytics_cli-6.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 96.5 kB

Release files / hpde_analytics_cli-6.0.8.tar.gz

Download URL hpde_analytics_cli-6.0.8.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
632a53bb07f53d199726d46853a1a4117f505fba0a47b22518ccada11455f00e
BLAKE2b-256 checksum
How to use checksums
632ee99466a445fa2950b34cfb867178b76df482435463324e3a48d171d8517d
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 log

Release files / hpde_analytics_cli-6.0.8-py3-none-any.whl

Download URL hpde_analytics_cli-6.0.8-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f74b9dbd4e2ed0cd6ff6a283f6e6a15efbd16928427cf231ca1f273ea59d569
BLAKE2b-256 checksum
How to use checksums
6dbf31da966f0f29c0b0a145f78ca9eaf9e5569b89a3c76915afec6cfeb6b74a
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 log

Security for hpde-analytics-cli 6.0.8

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.

Select from 2 files

Attestation for hpde_analytics_cli-6.0.8.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page