hpde-analytics-cli 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,309 @@
1
+ Metadata-Version: 2.4
2
+ Name: hpde-analytics-cli
3
+ Version: 1.0.0
4
+ Summary: Data analysis and reporting tool for HPDE and Time Trials programs
5
+ Author-email: Kevin Homan <homan13@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Homan13/hpde-analytics-cli
8
+ Project-URL: Documentation, https://github.com/Homan13/hpde-analytics-cli#readme
9
+ Project-URL: Repository, https://github.com/Homan13/hpde-analytics-cli.git
10
+ Project-URL: Issues, https://github.com/Homan13/hpde-analytics-cli/issues
11
+ Keywords: motorsports,hpde,time-trials,motorsportreg,analytics,reporting
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.28.0
28
+ Requires-Dist: requests-oauthlib>=1.3.0
29
+ Requires-Dist: python-dotenv>=1.0.0
30
+ Requires-Dist: openpyxl>=3.1.0
31
+ Requires-Dist: keyring>=24.0.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
35
+ Requires-Dist: black>=23.0.0; extra == "dev"
36
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
37
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
38
+ Requires-Dist: isort>=5.12.0; extra == "dev"
39
+ Requires-Dist: bandit>=1.7.0; extra == "dev"
40
+ Requires-Dist: safety>=2.3.0; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # HPDE Analytics CLI
44
+
45
+ [![CI](https://github.com/Homan13/hpde-analytics-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Homan13/hpde-analytics-cli/actions/workflows/ci.yml)
46
+ [![Python Version](https://img.shields.io/pypi/pyversions/hpde-analytics-cli)](https://pypi.org/project/hpde-analytics-cli/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+
49
+ 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.
50
+
51
+ ## Getting Started
52
+
53
+ These instructions will help you set up the project on your local machine for development and usage.
54
+
55
+ ### Prerequisites
56
+
57
+ - Python 3.8 or higher
58
+ - MotorsportsReg OAuth consumer credentials
59
+ - pip (Python package installer)
60
+
61
+ ### Installation
62
+
63
+ #### Option 1: Install from PyPI (Recommended)
64
+
65
+ ```bash
66
+ pip install hpde-analytics-cli
67
+ ```
68
+
69
+ #### Option 2: Install from source
70
+
71
+ 1. Clone the repository:
72
+ ```bash
73
+ git clone https://github.com/Homan13/hpde-analytics-cli.git
74
+ cd hpde-analytics-cli
75
+ ```
76
+
77
+ 2. Install the package:
78
+ ```bash
79
+ pip install -e .
80
+ ```
81
+
82
+ ### Configuration
83
+
84
+ 1. Configure your credentials (choose one method):
85
+
86
+ **Option A: Secure storage (Recommended)**
87
+ ```bash
88
+ hpde-analytics-cli --configure
89
+ ```
90
+ This stores your credentials securely in your system's keyring (macOS Keychain, Windows Credential Locker, or Linux Secret Service).
91
+
92
+ **Option B: Environment file (Fallback)**
93
+ ```bash
94
+ cp .env.example .env
95
+ ```
96
+ Edit `.env` and add your MotorsportsReg OAuth credentials:
97
+ ```
98
+ MSR_CONSUMER_KEY=your_consumer_key_here
99
+ MSR_CONSUMER_SECRET=your_consumer_secret_here
100
+ MSR_BASE_URL=https://api.motorsportreg.com
101
+ MSR_CALLBACK_PORT=8089
102
+ ```
103
+
104
+ 2. Check credential status (optional):
105
+ ```bash
106
+ hpde-analytics-cli --credential-status
107
+ ```
108
+
109
+ 3. Run initial authentication:
110
+ ```bash
111
+ hpde-analytics-cli --auth
112
+ ```
113
+ Follow the browser prompts to authorize the application.
114
+
115
+ ## Usage
116
+
117
+ ### Export Event Data
118
+
119
+ Export all event registration data (both raw and filtered formats):
120
+
121
+ ```bash
122
+ hpde-analytics-cli --export \
123
+ --org-id 11A1AAAA-2B2B-C333-4D4444444D4DD44D \
124
+ --event-id <EVENT_ID> \
125
+ --name HPDE_TT_1_2025
126
+ ```
127
+
128
+ **Parameters:**
129
+ - `--org-id`: MSR organization ID (required)
130
+ - `--event-id`: MSR event ID (required)
131
+ - `--name`: Custom name for export folder (optional)
132
+ - `--output-dir`: Custom output directory (optional, defaults to `output/`)
133
+
134
+ ### Generate Time Trials Report
135
+
136
+ Generate an Excel report from exported data:
137
+
138
+ ```bash
139
+ hpde-analytics-cli --report \
140
+ --export-dir output/HPDE_TT_1_2025_20260110_123456 \
141
+ --name HPDE_TT_1_2025
142
+ ```
143
+
144
+ **Parameters:**
145
+ - `--export-dir`: Path to exported data folder (required)
146
+ - `--name`: Custom name for report file (optional)
147
+ - `--report-file`: Specific output path for report (optional)
148
+
149
+ ### Other Commands
150
+
151
+ ```bash
152
+ # Configure or update API credentials (secure keyring storage)
153
+ hpde-analytics-cli --configure
154
+
155
+ # Check credential configuration status
156
+ hpde-analytics-cli --credential-status
157
+
158
+ # Re-authenticate if tokens expire
159
+ hpde-analytics-cli --auth
160
+
161
+ # Run field discovery to explore available data
162
+ hpde-analytics-cli --discover \
163
+ --org-id <ORG_ID> \
164
+ --event-id <EVENT_ID>
165
+
166
+ # Show all available options
167
+ hpde-analytics-cli --help
168
+ ```
169
+
170
+ ## Report Features
171
+
172
+ The generated Time Trials report includes:
173
+
174
+ - **Driver Information**: Name, email, member ID
175
+ - **Vehicle Details**: Year/make/model (combined), color, tire brand, vehicle number
176
+ - **Classification**: TT class and class grouping (Max, Sport, Tuner, Unlimited)
177
+ - **Participation Tracking**:
178
+ - Days attended (Friday/Saturday/Sunday/combinations)
179
+ - Day count (1 Day, 2 Days, 3 Days)
180
+ - Instructor status (Yes/No)
181
+ - AYCE participation (Time Trials + Advanced HPDE)
182
+ - Participation type (TT Only, TT + Instructor, TT + AYCE, TT + Instructor + AYCE)
183
+
184
+ **Pivot-Ready Columns**: Class Group, Day Count, and Participation Type columns are optimized for Excel pivot table analysis to track registration trends.
185
+
186
+ ## Project Structure
187
+
188
+ ```
189
+ hpde-analytics-cli/
190
+ ├── .env.example # Credential template
191
+ ├── .gitignore # Git exclusions
192
+ ├── pyproject.toml # Package configuration
193
+ ├── README.md # This file
194
+ ├── hpde_analytics_cli/
195
+ │ ├── __init__.py
196
+ │ ├── main.py # CLI entry point
197
+ │ ├── auth/
198
+ │ │ ├── __init__.py
199
+ │ │ ├── credentials.py # Secure credential management
200
+ │ │ └── oauth.py # OAuth 1.0a authentication
201
+ │ ├── api/
202
+ │ │ ├── __init__.py
203
+ │ │ └── client.py # MSR API client
204
+ │ └── utils/
205
+ │ ├── __init__.py
206
+ │ ├── data_export.py # Data export to JSON/CSV
207
+ │ ├── field_discovery.py # API field enumeration
208
+ │ └── report_generator.py # Excel report generation
209
+ ├── output/ # Export and report output (not in version control)
210
+ ├── tokens/ # OAuth access tokens (not in version control)
211
+ └── tests/ # Unit tests
212
+ ```
213
+
214
+ ## Export Structure
215
+
216
+ Each export creates two data sets:
217
+
218
+ ```
219
+ HPDE_TT_1_2025_20260110_123456/
220
+ ├── raw_data/ # Complete API responses (for reference)
221
+ │ ├── profile_full.json
222
+ │ ├── calendar_full.json
223
+ │ ├── calendar_full.csv
224
+ │ ├── entrylist_full.json
225
+ │ ├── entrylist_full.csv
226
+ │ ├── attendees_full.json
227
+ │ ├── attendees_full.csv
228
+ │ ├── assignments_full.json
229
+ │ └── assignments_full.csv
230
+ ├── profile.json # Filtered data for Time Trials
231
+ ├── calendar.json
232
+ ├── entrylist.json
233
+ ├── entrylist.csv
234
+ ├── attendees.json
235
+ ├── attendees.csv
236
+ ├── assignments.json
237
+ ├── assignments.csv
238
+ └── export_summary.json
239
+ ```
240
+
241
+ ## Running the tests
242
+
243
+ ```bash
244
+ # Install development dependencies
245
+ pip install -e ".[dev]"
246
+
247
+ # Run tests with coverage
248
+ pytest
249
+ ```
250
+
251
+ ## Deployment
252
+
253
+ This is a command-line tool designed to run locally. No deployment infrastructure is required.
254
+
255
+ **For scheduled/automated execution:**
256
+ - Consider setting up cron jobs (Linux/Mac) or Task Scheduler (Windows)
257
+ - Ensure OAuth tokens are refreshed as needed
258
+ - Store reports in a centralized location for team access
259
+
260
+ ## Built With
261
+
262
+ * [Python 3](https://www.python.org/) - Programming language
263
+ * [requests](https://requests.readthedocs.io/) - HTTP library
264
+ * [requests-oauthlib](https://requests-oauthlib.readthedocs.io/) - OAuth 1.0a support
265
+ * [python-dotenv](https://pypi.org/project/python-dotenv/) - Environment variable management
266
+ * [openpyxl](https://openpyxl.readthedocs.io/) - Excel file generation
267
+ * [keyring](https://pypi.org/project/keyring/) - Secure credential storage
268
+ * [MotorsportsReg API](https://www.motorsportreg.com/) - Event registration data source
269
+
270
+ ## Contributing
271
+
272
+ _In Progress - Contribution guidelines to be developed_
273
+
274
+ ## Versioning
275
+
276
+ This project uses [Semantic Versioning (SemVer)](https://semver.org/):
277
+ - **MAJOR** version for incompatible API changes
278
+ - **MINOR** version for new functionality in a backward compatible manner
279
+ - **PATCH** version for backward compatible bug fixes
280
+
281
+ **Current Version:** 1.0.0
282
+
283
+ ## Authors
284
+
285
+ * **Kevin Homan** - *Initial work and project lead* - WDCR Time Trials Chief Competition Director
286
+
287
+ ## License
288
+
289
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
290
+
291
+ ## Acknowledgments
292
+
293
+ * SCCA Washington DC Region for supporting the Time Trials program
294
+ * MotorsportsReg.com for providing API access
295
+ * WDCR HPDE program for combined event management
296
+
297
+ ## Security Notes
298
+
299
+ **Important:**
300
+ - Never commit `.env` or `tokens/` directory to version control
301
+ - OAuth consumer secrets and access tokens must be kept confidential
302
+ - The `.gitignore` file is configured to exclude these sensitive files automatically
303
+ - Use `hpde-analytics-cli --configure` to store credentials securely in your system keyring
304
+
305
+ ## Support
306
+
307
+ For issues or questions related to this tool, contact the WDCR Time Trials administration.
308
+
309
+ For MotorsportsReg API issues, refer to the [MotorsportsReg API documentation](https://www.motorsportreg.com/).
@@ -0,0 +1,17 @@
1
+ hpde_analytics_cli/__init__.py,sha256=QOjN1k_Z-s0ism1i7pUs0tsCjRd6VSWpoGDgElnJrVg,155
2
+ hpde_analytics_cli/main.py,sha256=AbOHB-VzbRdauvA52HzWJSt6Qv-VwjqBkASfOCc_wmo,10896
3
+ hpde_analytics_cli/api/__init__.py,sha256=k2-F6JHYc0PHvA0rtXe_YR2Wb061oLQrdQKfDWJ2X0A,25
4
+ hpde_analytics_cli/api/client.py,sha256=dP0hwdvexO0Xx4HnJl7ZQHdC8w44nJJfCKO1FSg2nVA,11024
5
+ hpde_analytics_cli/auth/__init__.py,sha256=JZtDNIw89a9G2SrMLRYrEFqQtk1Igfwyxck6SupGAec,35
6
+ hpde_analytics_cli/auth/credentials.py,sha256=Dui5yGJ36I63GpHWO_fnEIujlcdY8yNPJf-Cv3mH46w,8986
7
+ hpde_analytics_cli/auth/oauth.py,sha256=z1FyyP4sgQ-lrVviQnx9yYwvAni9bq-EcvLHPu_Fy54,18243
8
+ hpde_analytics_cli/utils/__init__.py,sha256=7SnbxpxKENK-2ecUL5NfnZ9okGI7COKYw4WF46172HM,23
9
+ hpde_analytics_cli/utils/data_export.py,sha256=YwTG3BzCU-Em4NWhFkZ09SKQfW6TH-cD7ycv0IrS1Mo,14910
10
+ hpde_analytics_cli/utils/field_discovery.py,sha256=q7j18FZc3ALpUEgzO2NrCjukPBoTczcDP3heIejZ2lE,11508
11
+ hpde_analytics_cli/utils/report_generator.py,sha256=XsdHTb_dztyoOlXl2EOxY-QaIExEzCROcd7_a-PebSk,16489
12
+ hpde_analytics_cli-1.0.0.dist-info/licenses/LICENSE,sha256=YWrPQuzsINsFZBZt31deynKl3wd57ZEaWFcHqd-rLjE,1089
13
+ hpde_analytics_cli-1.0.0.dist-info/METADATA,sha256=aXqeZA1k9h1hytdB1MXgoLtyCQqppjhTuh-9cHqmZ84,10342
14
+ hpde_analytics_cli-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ hpde_analytics_cli-1.0.0.dist-info/entry_points.txt,sha256=Z32MqYmmZVoznx3JGQ6ksCiGC9XWhHHfXiz3HKvz57c,68
16
+ hpde_analytics_cli-1.0.0.dist-info/top_level.txt,sha256=yHOC5jvB9nlYGaNUMC0C9UC27rVNy8D4stPKHOobSmA,19
17
+ hpde_analytics_cli-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hpde-analytics-cli = hpde_analytics_cli.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kevin Homan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ hpde_analytics_cli