Documentation

Segment Evaluator & Pattern Miner

Segment Evaluator

The Segment Evaluator is a sidecar service that sits in front of the graph engine's ingest path. It evaluates configurable segment rules in real time on every transaction — automatically assigning entities to segments like "High Velocity", "New Merchant Risk", or "Fraud Ring Adjacent" based on graph signals.

ℹ️
The Segment Evaluator runs as a separate container (segment-evaluator) in the stack. It connects to the graph engine over gRPC and exposes its own HTTP API on port 8081.

How It Works

Key API Endpoints (port 8081)

MethodPathDescription
POST/ingest/evaluateIngest a transaction and re-evaluate segments for the entities involved
GET/segmentsList all defined segments
GET/segments/:name/membersList all current members of a segment
POST/segments/simulateDry-run: evaluate signals for an entity without writing segment membership
POST/segments/sweepRe-evaluate all entities against all segments (useful after rule changes)
GET/segments/signalsList all configured signals
POST/segments/node/lookupLook up which segments a specific entity belongs to
GET/POST/DELETE/config/signalsManage signal definitions
GET/POST/DELETE/config/segmentsManage segment definitions
POST/segments/config/reloadHot-reload config from TOML files without restarting
GET/healthHealth check

Querying Segments via Cypher

Once segments are assigned, you can query them like any other graph relationship:

cypher
// Find all cards in the "High Velocity" segment MATCH (c:CARD)-[:MEMBER_OF]->(s:Segment) WHERE s.external_id = "High Velocity" RETURN c.external_id AS card LIMIT 100

Pattern Miner

The Pattern Miner is a sidecar service that watches the graph engine's edge stream in real time and builds behavioral transition patterns — sequences of entities a node visited over time. These patterns power next-location prediction, impossible-travel detection, and anomaly scoring.

ℹ️
The Pattern Miner runs as a separate container (pattern-miner) and exposes its API on port 8082. It subscribes to the graph engine's WatchEdgeUpserts CDC stream over gRPC.

How It Works

Key API Endpoints (port 8082)

MethodPathDescription
GET/patterns/transitionsList all tracked transition pairs across all rules
GET/patterns/predict/:node_idPredict the most likely next entity for a given node based on historical transitions
GET/patterns/path/:node_idReturn the full transition path (sequence of entities) for a node
GET/patterns/context/:m1/:m2Return the transition context between two specific entities
GET/POST/config/rulesList or create pattern rules (which edge type to watch)
DELETE/config/rules/:watch_edgeRemove a rule
GET/POST/config/settingsManage global miner settings
POST/patterns/config/reloadHot-reload rules from TOML without restarting
GET/healthHealth check

Impossible-Travel Detection Example

bash
# Get the transition path for a card (sequence of IPs it has used) curl http://localhost:8082/patterns/path/CARD:card-001 # Predict the next likely IP for this card curl http://localhost:8082/patterns/predict/CARD:card-001