feat: implement predictive location modeling with Kalman filtering (closes #263) - #274
Merged
levibliz merged 2 commits intoAug 24, 2026
Merged
Conversation
…loses RiftCore00#263) - Add PredictiveEngine class with per-client Kalman filter (CV model) - Implement ENU coordinate transformation (lat/lon <-> local tangent plane) - Add trajectory extrapolation API with confidence ellipses - Implement geofence pre-alerts with debouncing per (clientId, fenceId) - Add anomaly detection: GPS anomaly (innovation > 3σ), kinematic anomaly - Add ETA computation with probability distribution - Support filter state persistence for session resumption - Add configuration via environment variables - Add comprehensive test suite (19 tests) - Fix pre-existing bug: duplicate tokenRefreshSchema in validator.js - Fix pre-existing bug: undefined 'sessions' variable references in server.js
levibliz
approved these changes
Aug 24, 2026
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements predictive location modeling engine with Kalman filtering, trajectory extrapolation, and anomaly detection for sub-second ETA and geofence pre-alerts.
Changes
New Module:
src/predictor.jsgetTrajectory(clientId, horizons)returns predicted positions with confidence ellipses from filter covariancecheckPreAlerts(clientId)evaluates predicted trajectory against geofences, emitsgeofence_pre_alertevents 60s before predicted entry (debounced per client/fence)gps_anomalykinematic_anomalygetETA(clientId, targetLat, targetLon)returns mean, stddev, and arrival probability functionConfiguration (
.env.example)PREDICTOR_ENABLE=truePREDICTOR_MODEL=CVPREDICTOR_PROCESS_NOISE=0.1PREDICTOR_MEASUREMENT_NOISE=5.0PREDICTOR_PRE_ALERT_HORIZON_S=60PREDICTOR_MAX_HORIZON_S=120Integration (
src/server.js)predictor.update()on eachlocation_updategps_anomaly,kinematic_anomaly)predictor.checkPreAlerts()for geofence pre-alertsTests (
tests/predictor.test.js)Bug Fixes
tokenRefreshSchemadeclaration invalidator.jssessionsvariable references inserver.js(renamed tosessionManager)Acceptance Criteria Met
getTrajectoryreturns correct ENU->lat/lon transform with confidence ellipsesnpm run lintpassesCloses #263