How clbiggs/reloading works
1. Overall shape
- This is a single-process Flask monolith for reloading data management.
- The app is server-rendered: request handlers return Jinja2 templates, not a JSON API.
- Deployment is containerized as one Docker service with persistent SQLite storage.
2. Core runtime boundary
- src/app.py is the Flask application entry point/factory.
- src/database.py initializes the database layer.
- src/models.py defines the SQLAlchemy domain model, which is the main shared schema across the app.
3. Primary domain subsystems
- The application is organized around reloading entities: calibers, primer types, manufacturers, bullets, primers, casings, powders.
- These are managed through separate CRUD blueprints under src/routes/, each with corresponding list/form templates.
- order_lots, loads, firearms, and test_sessions are the higher-level operational subsystems built from those base entities.
4. Data relationships
- Component reference data feeds into lot tracking and recipe building.
- Order lots capture purchase details such as lot number, cost, and quantity for bullets/powder/primers.
- Loads link together the chosen component lots and load measurements.
- Firearms provide a contextual anchor for loads and chronograph test sessions.
5. Chronograph import flow
- src/routes/upload.py handles .xlsx import from Velocity Pro Radar Chronograph exports.
- src/utils/chronograph_parser.py extracts weather, shot data, and trace indicators from those spreadsheets.
- Imported data is used to create or populate test_sessions, which then become visible through the test session views.
6. Test session and summary layer
- test_sessions stores session-level metadata, shot groups, individual velocities, and associated conditions.
- src/utils/calculations.py supports computed metrics such as derived statistics and density altitude.
- summaries provides aggregate/read-only views grouped by bullet, firearm, or powder, so it acts as the reporting boundary of the app.
7. Presentation layer
- All user-facing pages live in src/templates/, organized by feature area.
- base.html and macros.html provide shared layout and reusable UI fragments.
- The UI is Bootstrap 5-based with a dark theme and responsive layout for desktop/mobile browsers.
8. Feature-to-template mapping
- Most feature directories contain an index.html for listing and a form.html for create/edit flows.
- Some entities have detail pages such as loads/view.html, order_lots/view.html, and test_sessions/view.html.
- This reflects a classic CRUD architecture with a few richer detail/report pages.
9. Infrastructure and persistence
- Data persists in SQLite at /data/reloading.db, which is mounted from a Docker volume.
- docker-compose.yml is the recommended runtime wrapper, while Dockerfile packages the app for standalone deployment.
- The README indicates Gunicorn is the production server inside the container.
10. Repo-local supporting assets
- sample_data/chronograph_exports/ contains example Excel files for exercising the import path.
- Tooling files such as .prettierignore, cspell.json, and .gitattributes suggest basic repo hygiene, but they do not materially change the runtime architecture.
Main entry points: __init__.py Routes · app.py App · summaries.py Summaries · test_sessions.py Test Sessions
Components 24
Runtime
Flask app, database, and shared domain schema
Domain
CRUD and operational reloading features
- Calibers · Reference data for cartridge calibers
src/routes/calibers.py - Primer Types · Reference data for primer categories
src/routes/primer_types.py - Manufacturers · Manufacturer reference management
src/routes/manufacturers.py - Bullets · Bullet reference management
src/routes/bullets.py - Primers · Primer reference management
src/routes/primers.py - Casings · Casing reference management
src/routes/casings.py - Powders · Powder reference management
src/routes/powders.py - Order Lots · Purchase lots with cost, quantity, and lot tracking
src/routes/order_lots.py - Loads · Load recipes built from component lots and measurements
src/routes/loads.py - Firearms · Firearm records used to anchor loads and tests
src/routes/firearms.py - Test Sessions · Chronograph sessions, shots, velocities, and conditions
src/routes/test_sessions.py - Upload · Velocity Pro Radar Chronograph spreadsheet import flow
src/routes/upload.py - Summaries · Read-only aggregation views by bullet, firearm, and powder
src/routes/summaries.py - Calculations · Derived metrics such as statistics and density altitude
src/utils/calculations.py - Parser · Extracts weather, shot data, and trace indicators from exports
src/utils/chronograph_parser.py
Templates
Server-rendered UI by feature area
- Base UI · Shared layout for all pages
src/templates/base.html - Macros · Reusable UI fragments and helpers
src/templates/macros.html - Summary Views · Aggregate report pages by bullet, firearm, and powder
src/templates/summaries/index.html
Connections 27
- App → Database: initializes · The Flask app sets up the database layer
- App → Models: uses · Request handlers share the SQLAlchemy model schema
- App → Routes: registers · The application loads the blueprint package
- Routes → Calibers: includes · Blueprint registry exposes the caliber CRUD route
- Routes → Primer Types: includes · Blueprint registry exposes the primer type CRUD route
- Routes → Manufacturers: includes · Blueprint registry exposes the manufacturer CRUD route
- Routes → Bullets: includes · Blueprint registry exposes the bullet CRUD route
- Routes → Primers: includes · Blueprint registry exposes the primer CRUD route
- Routes → Casings: includes · Blueprint registry exposes the casing CRUD route
- Routes → Powders: includes · Blueprint registry exposes the powder CRUD route
- Routes → Order Lots: includes · Blueprint registry exposes inventory lot tracking
- Routes → Loads: includes · Blueprint registry exposes load recipes
- Routes → Firearms: includes · Blueprint registry exposes firearm records
- Routes → Test Sessions: includes · Blueprint registry exposes chronograph sessions
- Routes → Upload: includes · Blueprint registry exposes spreadsheet import
- Routes → Summaries: includes · Blueprint registry exposes reporting views
- Order Lots → Loads: feeds · Purchased lots supply the load-building workflow
- Firearms → Loads: anchors · Firearm records contextualize loads
- Upload → Parser: parses · Upload flow delegates spreadsheet extraction
- Parser → Test Sessions: populates · Imported session data becomes test session records
- Test Sessions → Calculations: computes · Session views rely on derived metrics
- Summaries → Calculations: aggregates · Reports reuse calculation helpers for rollups
- App → Base UI: renders · Pages inherit the shared base layout
- App → Macros: reuses · UI fragments are shared across templates
- Summaries → Summary Views: renders · Reporting blueprint serves summary pages
- Docker → Compose: orchestrates · Compose wraps the containerized service
- Compose → Database: mounts · Persistent SQLite storage is mounted into the container