openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: EventPulse AI - Traffic Planning Intelligence Platform API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: dashboard description: Dashboard summary and KPI endpoints - name: events description: Event data and risk assessment - name: violations description: Violation data and hotspot analysis - name: heatmap description: Geospatial heatmap data - name: analytics description: Historical analytics and trends - name: resources description: Resource deployment recommendations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /dashboard/summary: get: operationId: getDashboardSummary tags: [dashboard] summary: Get dashboard KPI summary description: Returns overall KPI metrics for the dashboard responses: "200": description: Dashboard summary content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /events: get: operationId: getEvents tags: [events] summary: List events description: Returns paginated list of events with optional filters parameters: - name: event_type in: query schema: type: string - name: priority in: query schema: type: string - name: status in: query schema: type: string - name: event_cause in: query schema: type: string - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: List of events content: application/json: schema: $ref: "#/components/schemas/EventListResponse" /events/{id}/risk: get: operationId: getEventRisk tags: [events] summary: Get event risk assessment description: Returns risk score and assessment for a specific event parameters: - name: id in: path required: true schema: type: string responses: "200": description: Risk assessment content: application/json: schema: $ref: "#/components/schemas/RiskAssessment" "404": description: Event not found /events/{id}/violations-forecast: get: operationId: getViolationsForecast tags: [events] summary: Get predicted violations for event location description: Returns predicted violation types and probabilities near event location parameters: - name: id in: path required: true schema: type: string responses: "200": description: Violations forecast content: application/json: schema: $ref: "#/components/schemas/ViolationForecast" "404": description: Event not found /events/{id}/resource-recommendation: get: operationId: getResourceRecommendation tags: [resources] summary: Get resource deployment recommendations description: Returns recommended resource allocation for managing an event parameters: - name: id in: path required: true schema: type: string responses: "200": description: Resource recommendation content: application/json: schema: $ref: "#/components/schemas/ResourceRecommendation" "404": description: Event not found /violations: get: operationId: getViolations tags: [violations] summary: List violations description: Returns paginated list of violations with optional filters parameters: - name: violation_type in: query schema: type: string - name: police_station in: query schema: type: string - name: vehicle_type in: query schema: type: string - name: limit in: query schema: type: integer default: 100 - name: offset in: query schema: type: integer default: 0 responses: "200": description: List of violations content: application/json: schema: $ref: "#/components/schemas/ViolationListResponse" /violations/hotspots: get: operationId: getViolationHotspots tags: [violations] summary: Get violation hotspot locations description: Returns top violation hotspot locations with counts and severity parameters: - name: limit in: query schema: type: integer default: 50 responses: "200": description: Violation hotspots content: application/json: schema: type: array items: $ref: "#/components/schemas/ViolationHotspot" /heatmap/violations: get: operationId: getHeatmapViolations tags: [heatmap] summary: Get violation heatmap data description: Returns aggregated lat/lng points for violation heatmap rendering responses: "200": description: Heatmap data content: application/json: schema: $ref: "#/components/schemas/HeatmapData" /heatmap/events: get: operationId: getHeatmapEvents tags: [heatmap] summary: Get event heatmap data description: Returns event locations for map rendering with metadata responses: "200": description: Event heatmap data content: application/json: schema: $ref: "#/components/schemas/EventHeatmapData" /analytics/violation-trends: get: operationId: getViolationTrends tags: [analytics] summary: Get violation trends over time description: Returns monthly violation counts grouped by type responses: "200": description: Violation trends content: application/json: schema: type: array items: $ref: "#/components/schemas/ViolationTrend" /analytics/event-stats: get: operationId: getEventStats tags: [analytics] summary: Get event statistics description: Returns event counts grouped by type, priority, and cause responses: "200": description: Event statistics content: application/json: schema: $ref: "#/components/schemas/EventStats" /analytics/zone-summary: get: operationId: getZoneSummary tags: [analytics] summary: Get zone-level summary description: Returns violations and events grouped by police station/zone responses: "200": description: Zone summary content: application/json: schema: type: array items: $ref: "#/components/schemas/ZoneSummary" /analytics/vehicle-violations: get: operationId: getVehicleViolations tags: [analytics] summary: Get violations by vehicle type description: Returns violation counts broken down by vehicle type responses: "200": description: Vehicle violation breakdown content: application/json: schema: type: array items: $ref: "#/components/schemas/VehicleViolationStat" /analytics/hourly-violations: get: operationId: getHourlyViolations tags: [analytics] summary: Get hourly violation distribution description: Returns violation count distribution by hour of day responses: "200": description: Hourly distribution content: application/json: schema: type: array items: $ref: "#/components/schemas/HourlyViolationStat" components: schemas: HealthStatus: type: object properties: status: type: string required: - status DashboardSummary: type: object required: - totalEvents - totalViolations - highRiskEvents - activeEvents - plannedEvents - unplannedEvents - topViolationType - topZone - avgEventDurationHours properties: totalEvents: type: integer totalViolations: type: integer highRiskEvents: type: integer activeEvents: type: integer plannedEvents: type: integer unplannedEvents: type: integer topViolationType: type: string topZone: type: string avgEventDurationHours: type: number Event: type: object required: - id - event_type - latitude - longitude - address - event_cause - priority - status - start_datetime properties: id: type: string event_type: type: string latitude: type: number longitude: type: number address: type: string event_cause: type: string priority: type: string status: type: string start_datetime: type: string end_datetime: type: ["string", "null"] requires_road_closure: type: boolean police_station: type: ["string", "null"] corridor: type: ["string", "null"] duration_hours: type: ["number", "null"] EventListResponse: type: object required: - data - total - limit - offset properties: data: type: array items: $ref: "#/components/schemas/Event" total: type: integer limit: type: integer offset: type: integer RiskAssessment: type: object required: - event_id - risk_level - impact_score - factors properties: event_id: type: string risk_level: type: string enum: [Low, Medium, High] impact_score: type: number factors: type: array items: $ref: "#/components/schemas/RiskFactor" RiskFactor: type: object required: - name - weight - value properties: name: type: string weight: type: number value: type: string ViolationForecast: type: object required: - event_id - predictions - radius_km properties: event_id: type: string radius_km: type: number predictions: type: array items: $ref: "#/components/schemas/ViolationPrediction" ViolationPrediction: type: object required: - violation_type - probability - risk_level - historical_count properties: violation_type: type: string probability: type: number risk_level: type: string enum: [Low, Medium, High] historical_count: type: integer ResourceRecommendation: type: object required: - event_id - personnel - barricades - tow_vehicles - priority_zones - rationale properties: event_id: type: string personnel: type: integer barricades: type: integer tow_vehicles: type: integer priority_zones: type: array items: type: string rationale: type: string Violation: type: object required: - id - latitude - longitude - location - vehicle_type - violation_type - created_datetime - police_station properties: id: type: string latitude: type: number longitude: type: number location: type: string vehicle_type: type: string violation_type: type: string created_datetime: type: string police_station: type: string junction_name: type: ["string", "null"] validation_status: type: ["string", "null"] ViolationListResponse: type: object required: - data - total - limit - offset properties: data: type: array items: $ref: "#/components/schemas/Violation" total: type: integer limit: type: integer offset: type: integer ViolationHotspot: type: object required: - location - latitude - longitude - count - severity_score - top_violation - police_station properties: location: type: string latitude: type: number longitude: type: number count: type: integer severity_score: type: number top_violation: type: string police_station: type: string HeatmapPoint: type: object required: - lat - lng - weight properties: lat: type: number lng: type: number weight: type: number HeatmapData: type: object required: - points - total properties: points: type: array items: $ref: "#/components/schemas/HeatmapPoint" total: type: integer EventMapPoint: type: object required: - id - lat - lng - event_type - event_cause - priority - status - address properties: id: type: string lat: type: number lng: type: number event_type: type: string event_cause: type: string priority: type: string status: type: string address: type: string EventHeatmapData: type: object required: - points - total properties: points: type: array items: $ref: "#/components/schemas/EventMapPoint" total: type: integer ViolationTrend: type: object required: - month - total - wrong_parking - no_parking - other properties: month: type: string total: type: integer wrong_parking: type: integer no_parking: type: integer other: type: integer EventStats: type: object required: - byType - byPriority - byCause - byStatus properties: byType: type: array items: $ref: "#/components/schemas/StatItem" byPriority: type: array items: $ref: "#/components/schemas/StatItem" byCause: type: array items: $ref: "#/components/schemas/StatItem" byStatus: type: array items: $ref: "#/components/schemas/StatItem" StatItem: type: object required: - name - count properties: name: type: string count: type: integer ZoneSummary: type: object required: - zone - violations - events - severity_score properties: zone: type: string violations: type: integer events: type: integer severity_score: type: number VehicleViolationStat: type: object required: - vehicle_type - count - percentage properties: vehicle_type: type: string count: type: integer percentage: type: number HourlyViolationStat: type: object required: - hour - count properties: hour: type: integer count: type: integer