-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1211 lines (1131 loc) · 44.2 KB
/
openapi.yaml
File metadata and controls
1211 lines (1131 loc) · 44.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: RoadSense AI — Insights API
description: |
**Civic Signal Intelligence System**
RoadSense AI passively monitors public signals — Reddit posts, local news RSS,
YouTube comments, and weather data — and uses a multi-agent AI pipeline to detect
emerging road infrastructure damage before complaints are filed.
## How it works
1. **Ingest** — Public signals arrive via scrapers (hourly) or direct POST
2. **Translate** — AWS Translate auto-detects language and converts to English
3. **Classify** — Amazon Nova Micro determines if signal is road-related
4. **Context** — Amazon Nova Micro filters sarcasm, speculation; assigns urgency
5. **Correlate** — Titan Embeddings V2 clusters signals by geo (500m) + time (7 days)
6. **Infer** — Deterministic scoring produces confidence (0–100) and severity
7. **Explain** — Amazon Nova Lite generates human-readable incident summary
An incident is **created** when confidence > 60 and **archived** when confidence < 30.
## Authentication
All endpoints require an API key passed via the `x-api-key` header.
## Rate Limits
| Endpoint | Limit |
|-------------------|--------------------|
| POST /ingest-signal | 1,000 requests/hr |
| GET endpoints | 100 requests/min |
version: 1.0.0
contact:
name: Team Iceberg
url: https://github.com/Sujith-RMD/RoadSense-AI
license:
name: MIT
servers:
- url: https://api.roadsense.dev
description: Development server (AWS API Gateway)
tags:
- name: Signals
description: Ingest multilingual road signals for AI processing
- name: Incidents
description: Retrieve AI-generated road damage incidents
- name: Feedback
description: Ground-truth validation from municipal authorities
- name: Export
description: Bulk data export
# ─── Security ─────────────────────────────────────────────────────────────────
security:
- ApiKeyAuth: []
# ─── Paths ────────────────────────────────────────────────────────────────────
paths:
# ── Signal Ingestion ──────────────────────────────────────────────────────
/ingest-signal:
post:
operationId: ingestSignal
tags: [Signals]
summary: Ingest a new signal
description: |
Accepts a multilingual road signal and queues it for the AI pipeline.
The signal passes through:
- **PII anonymisation** — Reddit usernames, emails, phone numbers stripped
- **Deduplication** — content-hash prevents re-processing identical signals
- **Location normalisation** — coordinates normalised to `{lat, lon}` format
- **AWS Translate** — auto-detect language, translate to English
- **Classification → Intent → Correlation → Inference → Explanation**
Signals in any language are accepted. Non-English content is translated
automatically; the original text and detected language are preserved.
Weather signals (`source: "weather"`) are pre-classified without calling
Nova Micro — they skip directly to correlation.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SignalInput'
examples:
hindi_pothole:
summary: Hindi pothole report
value:
signal_id: "550e8400-e29b-41d4-a716-446655440000"
original_content: "MG Road par bahut bada gaddha hai, gaadi ka tyre fat gaya"
source: "reddit"
timestamp: "2026-02-15T10:30:00Z"
location:
latitude: 12.9752
longitude: 77.6063
address: "MG Road, Bangalore"
english_flooding:
summary: English flooding report
value:
signal_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7"
original_content: "Silk Board junction completely waterlogged, cars stalling in knee-deep water"
translated_content: "Silk Board junction completely waterlogged, cars stalling in knee-deep water"
detected_language: "en"
source: "reddit"
timestamp: "2026-02-15T16:45:00Z"
location:
latitude: 12.9178
longitude: 77.6230
address: "Silk Board Junction, Bangalore"
tamil_surface_wear:
summary: Tamil surface damage report
value:
signal_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
original_content: "சாலை முழுவதும் விரிசல், வாகனம் ஓட்ட முடியவில்லை"
source: "youtube"
timestamp: "2026-02-14T08:20:00Z"
location:
latitude: 13.0827
longitude: 80.2707
address: "Anna Salai, Chennai"
weather_alert:
summary: Weather correlation signal
value:
signal_id: "b2c3d4e5-f6a7-8901-bcde-f12345678901"
original_content: "Heavy rainfall warning: 120mm expected in next 6 hours"
translated_content: "Heavy rainfall warning: 120mm expected in next 6 hours"
detected_language: "en"
source: "weather"
timestamp: "2026-02-15T06:00:00Z"
location:
latitude: 12.9716
longitude: 77.5946
address: "Bangalore"
news_rss:
summary: News RSS article
value:
signal_id: "c3d4e5f6-a7b8-9012-cdef-123456789012"
original_content: "Pothole menace continues on Outer Ring Road; BBMP promises repair in 48 hours"
translated_content: "Pothole menace continues on Outer Ring Road; BBMP promises repair in 48 hours"
detected_language: "en"
source: "news"
timestamp: "2026-02-15T07:30:00Z"
location:
latitude: 12.9352
longitude: 77.6245
address: "Outer Ring Road, Bangalore"
responses:
'201':
description: Signal accepted and queued for AI processing
content:
application/json:
schema:
$ref: '#/components/schemas/SignalAccepted'
'400':
description: Invalid payload — missing required fields or malformed data
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
missing_content:
summary: Missing required field
value:
error: "validation_error"
message: "original_content is required"
status: 400
invalid_source:
summary: Invalid source enum
value:
error: "validation_error"
message: "source must be one of: reddit, youtube, news, weather"
status: 400
'409':
description: Duplicate signal — already ingested (content-hash match)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "duplicate_signal"
message: "Signal with identical content hash already exists"
status: 409
'429':
description: Rate limit exceeded (1,000 requests/hr)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ── Incidents ─────────────────────────────────────────────────────────────
/incidents:
get:
operationId: listIncidents
tags: [Incidents]
summary: List all incidents
description: |
Returns AI-generated road damage incidents, filtered by optional query parameters.
Each incident is created when a cluster of correlated signals reaches a
**confidence score > 60**. Incidents are auto-archived when confidence
decays below **30** due to lack of new supporting signals.
Results are sorted by `confidence_score` descending (highest confidence first).
parameters:
- name: status
in: query
required: false
description: Filter by incident status
schema:
type: string
enum: [active, confirmed, monitoring, archived]
default: active
example: active
- name: severity
in: query
required: false
description: Filter by minimum severity level
schema:
type: string
enum: [low, medium, high, critical]
example: high
- name: city
in: query
required: false
description: Filter by city name (case-insensitive partial match)
schema:
type: string
example: bangalore
- name: damage_type
in: query
required: false
description: Filter by damage type
schema:
type: string
enum: [pothole, surface_wear, flooding, general]
example: pothole
- name: min_confidence
in: query
required: false
description: Minimum confidence score (0–100)
schema:
type: integer
minimum: 0
maximum: 100
example: 60
- name: limit
in: query
required: false
description: Maximum number of incidents to return
schema:
type: integer
minimum: 1
maximum: 100
default: 50
example: 20
- name: offset
in: query
required: false
description: Pagination offset
schema:
type: integer
minimum: 0
default: 0
example: 0
responses:
'200':
description: List of incidents
content:
application/json:
schema:
type: object
properties:
incidents:
type: array
items:
$ref: '#/components/schemas/Incident'
total:
type: integer
description: Total number of incidents matching filters
example: 42
limit:
type: integer
example: 50
offset:
type: integer
example: 0
example:
incidents:
- incident_id: "INC-2026-001"
title: "Critical Road Collapse Cluster - Electronic City"
description: "High-density reports indicate road surface collapse near Electronic City Phase 1 flyover entry."
location:
latitude: 12.8401
longitude: 77.6772
address: "Electronic City Phase 1, Bengaluru"
damage_type: "pothole"
confidence_score: 92
severity_level: "critical"
status: "active"
signal_count: 23
affected_radius_meters: 165
explanation: "23 semantically similar road-damage signals clustered within 120m radius over 76 minutes."
first_reported_at: "2026-02-15T05:42:00Z"
last_updated_at: "2026-02-15T06:58:00Z"
- incident_id: "INC-2026-002"
title: "Severe Pothole Formation - MG Road"
description: "Multiple commuters report water-filled craters causing vehicle swerving near MG Road metro stretch."
location:
latitude: 12.9752
longitude: 77.6063
address: "MG Road, Bengaluru"
damage_type: "pothole"
confidence_score: 88
severity_level: "high"
status: "active"
signal_count: 19
affected_radius_meters: 130
explanation: "Spatial + temporal clustering of pothole-related signals validated by correlation agent."
first_reported_at: "2026-02-15T07:10:00Z"
last_updated_at: "2026-02-15T08:25:00Z"
total: 42
limit: 50
offset: 0
'400':
description: Invalid query parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ── Confidence ────────────────────────────────────────────────────────────
/confidence/{id}:
get:
operationId: getConfidence
tags: [Incidents]
summary: Get confidence details for an incident
description: |
Returns the current confidence score, scoring breakdown, and full
confidence history for a specific incident.
**Scoring breakdown** shows how each factor contributed:
| Factor | Max Points |
|--------------------------|-----------|
| Source diversity | 30 |
| Signal count | 20 |
| Urgency level consensus | 20 |
| Classification confidence| 20 |
| Recency | 10 |
| Weather correlation | 10 |
| **Total (clamped)** | **100** |
Confidence **decays** over time if no new signals arrive.
- 24–48h without signals: −5 points
- 48–72h: −10 points
- 72–120h: −15 points
- 120h+: −20 points
parameters:
- name: id
in: path
required: true
description: Unique incident identifier
schema:
type: string
example: "INC-2026-001"
responses:
'200':
description: Confidence details with scoring breakdown and history
content:
application/json:
schema:
$ref: '#/components/schemas/ConfidenceDetail'
example:
incident_id: "INC-2026-001"
confidence_score: 92
severity_level: "critical"
scoring_breakdown:
source_diversity: 28.0
signal_count: 20.0
urgency: 20.0
classification_confidence: 18.4
recency: 10.0
weather_correlation: 10.0
raw_total: 106.4
clamped_total: 92
confidence_history:
- timestamp: "2026-02-15T05:42:00Z"
score: 65
event: "incident_created"
- timestamp: "2026-02-15T06:10:00Z"
score: 78
event: "new_signals"
- timestamp: "2026-02-15T06:58:00Z"
score: 92
event: "new_signals"
thresholds:
creation: 60
archive: 30
'404':
description: Incident not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "not_found"
message: "No incident found with id: INC-9999-999"
status: 404
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ── Feedback ──────────────────────────────────────────────────────────────
/feedback:
post:
operationId: submitFeedback
tags: [Feedback]
summary: Submit ground-truth feedback
description: |
Municipal authorities use this endpoint to validate or dismiss
AI-detected incidents based on field inspection.
**Feedback directly adjusts confidence scores:**
| Feedback Value | Confidence Adjustment |
|------------------|-----------------------|
| `confirmed` | **+20 points** |
| `false_positive` | **−40 points** |
| `unsure` | No change |
If `false_positive` drops confidence below the archive threshold (30),
the incident is automatically archived.
If `confirmed`, the incident status changes to `confirmed`.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackInput'
examples:
confirmed:
summary: Field inspection confirms pothole
value:
incident_id: "INC-2026-001"
feedback_value: "confirmed"
resolution: "under_repair"
notes: "Pothole confirmed, ~2ft wide and 6in deep. BBMP crew dispatched."
submitted_by: "inspector_ward_42"
false_positive:
summary: No damage found on site
value:
incident_id: "INC-2026-007"
feedback_value: "false_positive"
resolution: "not_found"
notes: "Visited location, road surface is fine. Signals appear to be about a different road."
submitted_by: "inspector_ward_15"
unsure:
summary: Inconclusive inspection
value:
incident_id: "INC-2026-003"
feedback_value: "unsure"
notes: "Minor wear visible but unclear if it matches the reports. Will revisit after rain."
responses:
'200':
description: Feedback accepted and confidence score updated
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackResult'
example:
incident_id: "INC-2026-001"
feedback_value: "confirmed"
score_before: 92
score_after: 100
adjustment: 20
new_status: "confirmed"
message: "Feedback recorded. Confidence adjusted from 92 to 100 (clamped)."
'400':
description: Invalid feedback payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
missing_incident_id:
summary: Missing incident_id
value:
error: "validation_error"
message: "incident_id is required"
status: 400
invalid_feedback_value:
summary: Invalid feedback_value
value:
error: "validation_error"
message: "feedback_value must be one of: confirmed, false_positive, unsure"
status: 400
'404':
description: Incident not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ── Export ────────────────────────────────────────────────────────────────
/export:
get:
operationId: exportIncidents
tags: [Export]
summary: Export incident data
description: |
Bulk export of all incidents with full signal metadata.
Intended for analytics, reporting, and integration with municipal GIS systems.
parameters:
- name: format
in: query
required: false
description: Export format
schema:
type: string
enum: [json, csv]
default: json
example: json
- name: status
in: query
required: false
description: Filter exported incidents by status
schema:
type: string
enum: [active, confirmed, monitoring, archived]
- name: since
in: query
required: false
description: Export incidents created after this timestamp (ISO 8601)
schema:
type: string
format: date-time
example: "2026-02-01T00:00:00Z"
responses:
'200':
description: Exported incident data
content:
application/json:
schema:
type: object
properties:
exported_at:
type: string
format: date-time
example: "2026-02-15T12:00:00Z"
count:
type: integer
example: 10
incidents:
type: array
items:
$ref: '#/components/schemas/Incident'
text/csv:
schema:
type: string
description: CSV with headers — incident_id, title, latitude, longitude, address, damage_type, confidence_score, severity_level, status, signal_count, first_reported_at, last_updated_at
'400':
description: Invalid query parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ─── Components ───────────────────────────────────────────────────────────────
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-api-key
description: API key provided by the RoadSense AI platform admin
schemas:
# ── Signal Input ──────────────────────────────────────────────────────
SignalInput:
type: object
required:
- signal_id
- original_content
- source
- timestamp
properties:
signal_id:
type: string
format: uuid
description: Unique identifier for the signal (UUID v4)
example: "550e8400-e29b-41d4-a716-446655440000"
original_content:
type: string
description: Raw text content in any language (Hindi, Tamil, Telugu, etc.)
minLength: 1
maxLength: 5000
example: "MG Road par bahut bada gaddha hai, gaadi ka tyre fat gaya"
translated_content:
type: string
nullable: true
description: |
English translation. If omitted, AWS Translate auto-translates
from the detected language. If the signal is already in English,
this should match original_content.
example: "There is a large pothole on MG Road, car tyre burst"
detected_language:
type: string
nullable: true
description: |
ISO 639-1 language code. Auto-detected by AWS Translate if omitted.
Common values: en, hi, ta, te, kn, bn, mr, ml, gu, pa, ur
example: "hi"
source:
type: string
enum: [reddit, youtube, news, weather]
description: |
Origin of the signal:
- `reddit` — scraped from Indian city subreddits via PRAW
- `youtube` — video titles or comments via YouTube Data API v3
- `news` — RSS feeds from Times of India, NDTV, The Hindu, Deccan Herald
- `weather` — OpenWeatherMap rainfall/flooding alerts
example: "reddit"
timestamp:
type: string
format: date-time
description: When the signal was originally posted/published (ISO 8601)
example: "2026-02-15T10:30:00Z"
location:
$ref: '#/components/schemas/SignalLocation'
metadata:
type: object
nullable: true
description: Optional source-specific metadata
properties:
subreddit:
type: string
description: Reddit subreddit name (for reddit source)
example: "r/bangalore"
post_id:
type: string
description: Reddit post ID or YouTube video ID (for deduplication)
example: "1abc2de"
source_name:
type: string
description: Specific source name (e.g. times_of_india, ndtv, openweathermap)
example: "times_of_india"
city:
type: string
description: City extracted from source context
example: "Bangalore"
SignalLocation:
type: object
description: |
Geographic location of the signal. At least `address` should be provided.
Accepts both flat format (`latitude`/`longitude`) and nested format
(`coordinates.lat`/`coordinates.lon`) — the system normalises internally.
properties:
latitude:
type: number
format: double
description: Latitude in decimal degrees
minimum: -90
maximum: 90
example: 12.9752
longitude:
type: number
format: double
description: Longitude in decimal degrees
minimum: -180
maximum: 180
example: 77.6063
accuracy_meters:
type: integer
nullable: true
description: Location accuracy in meters (lower = more precise)
example: 100
address:
type: string
description: Human-readable address or landmark
example: "MG Road, Bangalore"
# ── Signal Accepted Response ──────────────────────────────────────────
SignalAccepted:
type: object
properties:
signal_id:
type: string
format: uuid
example: "550e8400-e29b-41d4-a716-446655440000"
status:
type: string
enum: [accepted, duplicate_skipped]
example: "accepted"
detected_language:
type: string
nullable: true
description: Language detected by AWS Translate
example: "hi"
message:
type: string
example: "Signal accepted and queued for AI processing"
# ── Processed Signal (full) ───────────────────────────────────────────
ProcessedSignal:
type: object
description: A signal after passing through the full AI pipeline
properties:
signal_id:
type: string
format: uuid
original_content:
type: string
translated_content:
type: string
nullable: true
detected_language:
type: string
source:
type: string
enum: [reddit, youtube, news, weather]
timestamp:
type: string
format: date-time
location:
$ref: '#/components/schemas/SignalLocation'
classification:
$ref: '#/components/schemas/Classification'
intent:
$ref: '#/components/schemas/Intent'
# ── Classification (Agent 1 output) ───────────────────────────────────
Classification:
type: object
description: |
Output of the Classification Agent (Amazon Nova Micro).
Determines whether the signal describes a road infrastructure problem.
properties:
is_road_related:
type: boolean
description: Whether the signal describes a road/highway/street condition issue
example: true
damage_type:
type: string
nullable: true
enum: [pothole, surface_wear, flooding, general]
description: |
Type of road damage detected:
- `pothole` — holes, craters, depressions (gaddha, khada)
- `surface_wear` — cracks, worn asphalt, uneven surface
- `flooding` — waterlogging, road underwater
- `general` — road-related but doesn't fit above
- `null` — not road-related
example: "pothole"
confidence:
type: number
format: float
minimum: 0.01
maximum: 0.99
description: |
AI confidence in the classification (0.01–0.99).
Sarcastic or speculative content receives 0.1–0.4.
Clear, direct reports receive 0.7–0.99.
Never exactly 0.0 or 1.0.
example: 0.92
reasoning:
type: string
description: One-sentence explanation from Nova Micro
example: "Direct report of pothole with specific location and vehicle damage"
# ── Intent (Agent 2 output) ───────────────────────────────────────────
Intent:
type: object
description: |
Output of the Intent & Context Agent (Amazon Nova Micro).
Determines whether the signal is a genuine problem report vs. noise.
properties:
is_problem_report:
type: boolean
description: Whether this is a genuine problem report (vs. sarcasm, speculation)
example: true
urgency_level:
type: string
enum: [low, medium, high, critical]
description: |
Assessed urgency:
- `critical` — immediate danger, accident, road blocked
- `high` — significant damage, vehicle damage, multiple complaints
- `medium` — noticeable damage, inconvenience
- `low` — minor issue, old report, vague mention
example: "high"
context_type:
type: string
enum: [direct_report, indirect_mention, news_article, weather_alert, speculation, sarcasm, ambiguous]
description: |
Type of signal context:
- `direct_report` — first-hand account
- `indirect_mention` — heard from someone else
- `news_article` — formal news reporting
- `weather_alert` — weather-based road risk
- `speculation` — guessing a problem might exist
- `sarcasm` — sarcastic complaint
- `ambiguous` — unclear intent
example: "direct_report"
confidence_modifier:
type: number
format: float
minimum: -0.4
maximum: 0.2
description: |
Adjustment applied to classification confidence:
- +0.1 to +0.2 for direct first-hand reports with specifics
- 0.0 for neutral/clear reports
- −0.1 to −0.2 for indirect mentions, speculation
- −0.3 to −0.4 for clear sarcasm or non-reports
example: 0.1
reasoning:
type: string
example: "First-hand account with specific location and damage description"
# ── Incident ──────────────────────────────────────────────────────────
Incident:
type: object
description: |
An AI-detected road infrastructure problem, created when a cluster of
correlated signals reaches confidence > 60.
required:
- incident_id
- confidence_score
- severity_level
- status
properties:
incident_id:
type: string
description: Unique incident identifier (format INC-YYYY-NNN)
example: "INC-2026-001"
title:
type: string
description: Short descriptive title
example: "Critical Road Collapse Cluster - Electronic City"
description:
type: string
description: Brief description of the detected problem
example: "High-density reports indicate road surface collapse near Electronic City Phase 1 flyover entry."
location:
type: object
properties:
latitude:
type: number
format: double
example: 12.8401
longitude:
type: number
format: double
example: 77.6772
address:
type: string
example: "Electronic City Phase 1, Bengaluru"
damage_type:
type: string
enum: [pothole, surface_wear, flooding, general]
description: Dominant damage type across clustered signals
example: "pothole"
confidence_score:
type: integer
minimum: 0
maximum: 100
description: |
Composite confidence score (0–100).
Created at > 60, archived at < 30.
Computed from source diversity, signal count, urgency,
classification confidence, recency, and weather correlation.
example: 92
severity_level:
type: string
enum: [low, medium, high, critical]
description: |
Severity classification:
- `critical` — confidence ≥ 85 OR any signal has critical urgency
- `high` — confidence ≥ 65 OR any signal has high urgency
- `medium` — confidence ≥ 45
- `low` — everything else
example: "critical"
status:
type: string
enum: [active, confirmed, monitoring, archived]
description: |
Incident lifecycle state:
- `active` — confidence > 60, no feedback yet
- `confirmed` — authority confirmed via POST /feedback
- `monitoring` — confidence 30–60, watching for new signals
- `archived` — confidence < 30 or marked false_positive
example: "active"
signal_count:
type: integer
description: Number of signals in the cluster
example: 23
affected_radius_meters:
type: integer
description: Radius of the signal cluster in meters (max 500m)
example: 165
explanation:
type: string
description: |
Human-readable AI-generated summary (Amazon Nova Lite).
Written for municipal officials — references source types,
languages, and evidence chain.
example: "23 semantically similar road-damage signals clustered within 120m radius over 76 minutes."
signal_ids:
type: array
items:
type: string
format: uuid
description: UUIDs of all contributing signals
first_reported_at:
type: string
format: date-time
description: Timestamp of the earliest signal in the cluster
example: "2026-02-15T05:42:00Z"
last_updated_at:
type: string
format: date-time
description: Timestamp of the most recent update (new signal or feedback)
example: "2026-02-15T06:58:00Z"
confidence_history:
type: array
items:
$ref: '#/components/schemas/ConfidenceHistoryEntry'
latest_feedback:
$ref: '#/components/schemas/FeedbackRecord'
# ── Confidence Detail ─────────────────────────────────────────────────
ConfidenceDetail:
type: object
properties:
incident_id: