Analysis API
API endpoints and SDK methods for video analysis
Analysis API
The Analysis API provides detailed information about the video analysis process and results. This page documents both the REST API endpoints and the corresponding SDK methods.
Analysis Process
The NomadicML analysis process involves several stages:
- Video Processing: The video is prepared for analysis (decoding, frame extraction)
- Object Detection: AI models identify and track objects in the video
- Event Detection: The system identifies significant driving events
- Context Analysis: Each event is analyzed in context
- Report Generation: A comprehensive analysis is compiled
Get Analysis Status
Check the current status of a video’s analysis.
SDK Method
Method Parameters
Parameter | Type | Required | Description |
---|---|---|---|
video_id | string | Yes | ID of the video |
Return Value
HTTP Request
Headers:
Query Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)
Get Full Analysis
Retrieve the complete analysis for a video.
SDK Method
Method Parameters
Parameter | Type | Required | Description |
---|---|---|---|
video_id | string | Yes | ID of the video |
Return Value
HTTP Request
Headers:
Query Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)
Wait for Analysis Completion
Wait for a video analysis to complete.
SDK Method
Method Parameters
Parameter | Type | Required | Description |
---|---|---|---|
video_id | string | Yes | ID of the video |
timeout | integer | No | Maximum wait time in seconds (default: 600) |
poll_interval | integer | No | Time between status checks in seconds (default: 5) |
Return Value
For single video:
For multiple videos:
Analysis Status Codes
The analysis status can be one of the following:
Status | Description |
---|---|
uploading | Video is being uploaded |
uploading_failed | Upload failed |
uploaded | Upload completed |
processing | Video is being processed |
analyzing | Analysis is in progress |
completed | Analysis completed |
failed | Analysis failed |
not_found | Video not found |
Understanding Progress Information
The status response includes progress information:
The stage
field can be one of:
preprocessing
: Initial video processingdetection
: Object detectiontracking
: Object trackingevent_detection
: Event detectionevent_analysis
: Event analysissummarization
: Final summary generation
Analysis Metrics
The analysis results include various metrics about the video:
General Metrics
safety_score
: Overall safety rating (0-100)dmv_compliance_score
: Compliance with DMV rules (0-100)
Detailed Metrics
Multiple Video Analyses
Get analysis results for multiple videos.
SDK Method
Method Parameters
Parameter | Type | Required | Description |
---|---|---|---|
video_ids | list | Yes | List of video IDs |
Return Value
Error Handling
The API returns standard HTTP status codes and the SDK raises specific exceptions:
APIError
: General API errorsAnalysisError
: Issues during video analysisNomadicMLError
: Base class for all SDK errors
Common error codes specific to the Analysis API:
analysis_not_found
: The requested analysis doesn’t existanalysis_in_progress
: Analysis is still in progressanalysis_failed
: Analysis failed to completeinvalid_analysis_parameters
: Invalid analysis parameters provided
Example error handling:
Using Analysis Results
Here’s a example of how to process and use the analysis results: