How bellputrii/api-drilling-activity works
Activity Classifier API serves drilling-activity and casing-trip predictions, either from submitted batches or fetched well data; a realtime scheduler also fetches, predicts, and records results periodically. The prediction service uses ONNX models loaded by the core layer, while route and scheduler components persist predictions. The README describes history and model/health endpoints, but the sampled route excerpts do not show those handlers. The README says MySQL; the inspected connection code configures SQLite. Edges reflect shown calls or documented behavior; unsampled subsystem internals are not inferred.
Main entry points: connection.py Database sessions · predict_api.py Well prediction routes · realtime_scheduler.py Realtime schedulers · prediction_service.py Prediction service
Components 16
API and orchestration
- FastAPI application
app.py - Activity routes
routes/activity_route.py - Well prediction routes
routes/predict_api.py - Realtime schedulers
scheduler/realtime_scheduler.py - Drilling batch job
scheduler/drilling_scheduler.py - Casing batch job
scheduler/casing_scheduler.py - Prediction schemas
schemas/activity_schema.py
Well data ingestion
- Well data fetcher
well_client/fetch_api.py - Well field maps
well_client/mapping.py
Prediction runtime
- Prediction service
services/prediction_service.py - ONNX model loader
core/loader.py - Model configuration
core/config.py
Prediction history
- Database sessions
database/connection.py - Prediction records
database/models.py - SQLite activity store
activity.db
Other components
- API client
Connections 28
- API client → FastAPI application: sends requests
readme.md - FastAPI application → Activity routes: registers routes
app.py - FastAPI application → Well prediction routes: registers routes
app.py - FastAPI application → Realtime schedulers: starts schedulers
app.py - Activity routes → Prediction schemas: validates input
routes/activity_route.py - Activity routes → Prediction service: requests predictions
routes/activity_route.py - Activity routes → Database sessions: gets session
routes/activity_route.py - Activity routes → Prediction records: creates records
routes/activity_route.py - Well prediction routes → Well data fetcher: fetches well data
routes/predict_api.py - Well prediction routes → Well field maps: maps fields
routes/predict_api.py - Well prediction routes → Prediction service: requests predictions
routes/predict_api.py - Well prediction routes → Database sessions: gets session
routes/predict_api.py - Well prediction routes → Prediction records: creates records
routes/predict_api.py - Realtime schedulers → Well data fetcher: fetches well data
scheduler/realtime_scheduler.py - Realtime schedulers → Well field maps: maps fields
scheduler/realtime_scheduler.py - Realtime schedulers → Prediction service: requests predictions
scheduler/realtime_scheduler.py - Realtime schedulers → Database sessions: opens sessions
scheduler/realtime_scheduler.py - Realtime schedulers → Prediction records: creates records
scheduler/realtime_scheduler.py - Drilling batch job → Prediction service: requests predictions
scheduler/drilling_scheduler.py - Drilling batch job → Database sessions: opens sessions
scheduler/drilling_scheduler.py - Drilling batch job → Prediction records: creates records
scheduler/drilling_scheduler.py - Casing batch job → Prediction service: requests predictions
scheduler/casing_scheduler.py - Casing batch job → Database sessions: opens sessions
scheduler/casing_scheduler.py - Casing batch job → Prediction records: creates records
scheduler/casing_scheduler.py - Prediction service → ONNX model loader: uses loaded models
services/prediction_service.py - ONNX model loader → Model configuration: loads paths
core/loader.py - Database sessions → SQLite activity store: connects to
database/connection.py - Prediction records → Database sessions: uses base
database/models.py