Chuyển tới nội dung chính

Pattern Routes

RESTful API endpoints for querying traffic congestion patterns, hotspots, and traffic flow observations from Stellio and Fuseki.

Base Path

/api/patterns

Endpoints Summary

MethodEndpointDescription
GET/List all patterns
GET/:idGet pattern by ID
GET/hotspotsGet congestion hotspots
GET/road-segment/:idGet patterns for road

Endpoints

GET /api/patterns

List all traffic patterns.

Query Parameters:

ParameterTypeDefaultDescription
limitnumber100Maximum results
congestionLevelstring-Filter: low, moderate, high, severe
roadSegmentstring-Filter by road segment ID

Response:

{
"success": true,
"data": [
{
"id": "urn:ngsi-ld:TrafficPattern:001",
"roadSegment": "urn:ngsi-ld:RoadSegment:nguyen-hue",
"location": {
"latitude": 10.7731,
"longitude": 106.7030
},
"averageSpeed": 25.5,
"vehicleCount": 150,
"occupancy": 0.75,
"congestionLevel": "high",
"observedAt": "2025-11-29T10:30:00.000Z"
}
]
}

GET /api/patterns/hotspots

Get current congestion hotspots.

Response:

{
"success": true,
"data": [
{
"location": { "latitude": 10.77, "longitude": 106.70 },
"roadSegment": "Nguyen Hue Boulevard",
"congestionLevel": "severe",
"averageSpeed": 8.5,
"delayMinutes": 25,
"affectedLength": 1.5
}
],
"meta": {
"totalHotspots": 5,
"timestamp": "2025-11-29T10:30:00.000Z"
}
}

Congestion Levels

LevelSpeed ReductionDescription
low0-25%Free flow
moderate25-50%Light congestion
high50-75%Heavy congestion
severe75-100%Gridlock

References