Score pump failure risk with Chalk queries
This demo shows how to run sensor fusion and a fitted risk model in Chalk queries to score a simulated pump fleet. Replay the timeline and recompute a pump’s features live, then explore the code to see how it works.
Separate a developing fault from ordinary heavy load
Compare two pumps at the same time using both raw sensors and fused features.
High vibration does not always mean failure
Compare the fault scenario with a healthy pump under load at the same hour. Chalk combines vibration, workload, and temperature into the failure-risk score below.
Inspect all eight pumps
P-104 · synchronized sensor traces
10-minute summaries · 48 hFused features
as of the cursor- Vibration RMS, 1 h √ mean of squared vibration samples
- 5.39 mm/s
- Load, 1 h mean motor current ÷ rated current
- 92%
- Vibration per unit load vibration RMS ÷ load: two sensors fused
- 5.86
- Vibration trend 1 h RMS ÷ 6 h RMS
- 1.26×
- Bearing temperature slope 1 h mean vs 6 h mean
- +2.37 °C/h
Recompute P-104 at hour 36.0 with a real Chalk online query, its clock pinned to that instant. Chalk reads the raw historian, fuses the five tags and runs the model, usually in a few seconds.
Northfield Water and its pumps are fictional, and so is the sensor data, generated from a seeded simulator. The fleet view is a recorded Chalk offline query (768 rows, one per pump every 30 minutes) over that historian; “Recompute live” runs a real Chalk online query against the same feature definitions each time you press it. In this recorded simulation, the risk score crossed the alert threshold 15 hours before the faulted pump tripped. The model’s holdout AUC was 0.994 on separate simulated pumps; neither result measures performance on real equipment.
Built on Chalk
Chalk aligns sensor windows, composes features and evaluates the fitted model in one query. The example supplies the simulated historian, model coefficients and alert threshold.
Align sensors at query time
Chalk aggregates each sensor’s samples in windows ending at chalk_now. Tags sampled at different rates contribute features for the same instant.
Combine signals across sensors
Feature expressions turn vibration and motor current into vibration per unit of load, then combine that ratio with vibration trends and temperature slopes.
Score inside the query
The fitted logistic regression runs as a native Chalk expression over the fused features. The example’s risk and remaining-life estimates need no separate model server.
Replay the same definitions
Online and offline queries use the same feature code. Each replay row sets its own input time, and the sensor windows include only samples at or before that instant.
Run it on your own
You will need uv, the Chalk CLI and a Chalk environment. Clone the example, log in, deploy the feature definitions to a branch and run the offline fleet replay. The query command scores one pump at a chosen instant.
The model was fitted on a separate simulated fleet of 160 pumps. To adapt it, connect the SensorReading resolver to your historian, check the units and sensor windows, and train and evaluate the model on representative equipment data.
git clone https://github.com/chalk-ai/predictive-maintenance
cd predictive-maintenance
chalk login
# The historian, the fused features and the model, on a branch
chalk apply --branch predictive-maintenance
# Fleet risk every 30 minutes for 48 hours: one offline query
./record_run.py
# Or ask for one pump at one instant of the recorded window
chalk query --branch predictive-maintenance --in pump.id=P-104 \
--out pump.failure_risk_12h --out pump.vib_per_load_1h \
--now 2026-10-11T12:00:00ZBuild sensor features on Chalk
Pumps, turbines, compressors or vehicles: talk to an engineer about fusing your sensor data into features your models can act on.