Correlation Routes
RESTful API endpoints for analyzing entity correlations and causal relationships between traffic, weather, and accidents using Neo4j graph analysis.
Base Pathโ
/api/correlation
Endpoints Summaryโ
| Method | Endpoint | Description |
|---|---|---|
| GET | /accident-weather | Weather-accident correlation |
| GET | /traffic-patterns | Traffic pattern correlation |
| GET | /entity-relationships | Entity relationship graph |
| GET | /causal-analysis | Causal factor analysis |
Endpointsโ
GET /api/correlation/accident-weatherโ
Analyze correlation between weather conditions and accidents.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
from | string | Start date |
to | string | End date |
weatherType | string | Weather filter |
Response:
{
"success": true,
"data": {
"correlations": [
{
"weatherCondition": "rain",
"accidentIncrease": 45,
"confidence": 0.87,
"sampleSize": 150
},
{
"weatherCondition": "fog",
"accidentIncrease": 62,
"confidence": 0.79,
"sampleSize": 45
}
],
"topFactors": [
{ "factor": "wet_road", "impact": 0.42 },
{ "factor": "visibility", "impact": 0.35 },
{ "factor": "wind_speed", "impact": 0.15 }
]
}
}
GET /api/correlation/entity-relationshipsโ
Get relationship graph for an entity.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
entityId | string | Yes | Entity URN |
depth | number | No | Traversal depth (default: 2) |
types | string | No | Relationship types (comma-separated) |
Response:
{
"success": true,
"data": {
"nodes": [
{ "id": "urn:ngsi-ld:RoadAccident:001", "type": "Accident" },
{ "id": "urn:ngsi-ld:Camera:nearby-001", "type": "Camera" },
{ "id": "urn:ngsi-ld:WeatherObserved:001", "type": "Weather" }
],
"edges": [
{ "source": "RoadAccident:001", "target": "Camera:nearby-001", "type": "NEAR_TO" },
{ "source": "RoadAccident:001", "target": "WeatherObserved:001", "type": "OCCURRED_DURING" }
]
}
}
Related Documentationโ
- Neo4jService - Graph database
- GraphInvestigatorAgent - Advanced analysis
- Accident Routes - Accident data