forked from koala73/worldmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntelligenceService.openapi.yaml
More file actions
729 lines (729 loc) · 29.7 KB
/
IntelligenceService.openapi.yaml
File metadata and controls
729 lines (729 loc) · 29.7 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
openapi: 3.1.0
info:
title: IntelligenceService API
version: 1.0.0
paths:
/api/intelligence/v1/get-risk-scores:
get:
tags:
- IntelligenceService
summary: GetRiskScores
description: GetRiskScores retrieves composite instability and strategic risk assessments.
operationId: GetRiskScores
parameters:
- name: region
in: query
description: Optional region filter. Empty returns all tracked regions.
required: false
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/GetRiskScoresResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/get-pizzint-status:
get:
tags:
- IntelligenceService
summary: GetPizzintStatus
description: GetPizzintStatus retrieves Pentagon Pizza Index and GDELT tension pair data.
operationId: GetPizzintStatus
parameters:
- name: include_gdelt
in: query
description: Whether to include GDELT tension pairs in the response.
required: false
schema:
type: boolean
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/GetPizzintStatusResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/classify-event:
get:
tags:
- IntelligenceService
summary: ClassifyEvent
description: ClassifyEvent classifies a real-world event using AI (Groq).
operationId: ClassifyEvent
parameters:
- name: title
in: query
description: Event title or headline.
required: false
schema:
type: string
- name: description
in: query
description: Event description or body text.
required: false
schema:
type: string
- name: source
in: query
description: Event source (e.g., "reuters", "acled").
required: false
schema:
type: string
- name: country
in: query
description: Country context (ISO 3166-1 alpha-2).
required: false
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ClassifyEventResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/get-country-intel-brief:
get:
tags:
- IntelligenceService
summary: GetCountryIntelBrief
description: GetCountryIntelBrief generates an AI intelligence brief for a country (OpenRouter).
operationId: GetCountryIntelBrief
parameters:
- name: country_code
in: query
description: ISO 3166-1 alpha-2 country code.
required: false
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/GetCountryIntelBriefResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/search-gdelt-documents:
get:
tags:
- IntelligenceService
summary: SearchGdeltDocuments
description: SearchGdeltDocuments searches the GDELT 2.0 Doc API for news articles.
operationId: SearchGdeltDocuments
parameters:
- name: query
in: query
description: Search query string.
required: false
schema:
type: string
- name: max_records
in: query
description: Maximum number of articles to return (1-250).
required: false
schema:
type: integer
format: int32
- name: timespan
in: query
description: Time span filter (e.g., "15min", "1h", "24h").
required: false
schema:
type: string
- name: tone_filter
in: query
description: |-
Tone filter appended to query (e.g., "tone>5" for positive, "tone<-5" for negative).
Left empty to skip tone filtering.
required: false
schema:
type: string
- name: sort
in: query
description: 'Sort mode: "DateDesc" (default), "ToneDesc", "ToneAsc", "HybridRel".'
required: false
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/SearchGdeltDocumentsResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/deduct-situation:
post:
tags:
- IntelligenceService
summary: DeductSituation
description: DeductSituation performs AI-powered situational analysis and deduction.
operationId: DeductSituation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeductSituationRequest'
required: true
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/DeductSituationResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Error:
type: object
properties:
message:
type: string
description: Error message (e.g., 'user not found', 'database connection failed')
description: Error is returned when a handler encounters an error. It contains a simple error message that the developer can customize.
FieldViolation:
type: object
properties:
field:
type: string
description: The field path that failed validation (e.g., 'user.email' for nested fields). For header validation, this will be the header name (e.g., 'X-API-Key')
description:
type: string
description: Human-readable description of the validation violation (e.g., 'must be a valid email address', 'required field missing')
required:
- field
- description
description: FieldViolation describes a single validation error for a specific field.
ValidationError:
type: object
properties:
violations:
type: array
items:
$ref: '#/components/schemas/FieldViolation'
description: List of validation violations
required:
- violations
description: ValidationError is returned when request validation fails. It contains a list of field violations describing what went wrong.
GetRiskScoresRequest:
type: object
properties:
region:
type: string
description: Optional region filter. Empty returns all tracked regions.
description: GetRiskScoresRequest specifies parameters for retrieving risk scores.
GetRiskScoresResponse:
type: object
properties:
ciiScores:
type: array
items:
$ref: '#/components/schemas/CiiScore'
strategicRisks:
type: array
items:
$ref: '#/components/schemas/StrategicRisk'
description: GetRiskScoresResponse contains composite risk scores and strategic assessments.
CiiScore:
type: object
properties:
region:
type: string
description: Region or country identifier.
staticBaseline:
type: number
maximum: 100
minimum: 0
format: double
description: Static baseline score (0-100).
dynamicScore:
type: number
maximum: 100
minimum: 0
format: double
description: Dynamic real-time score (0-100).
combinedScore:
type: number
maximum: 100
minimum: 0
format: double
description: Combined weighted score (0-100).
trend:
type: string
enum:
- TREND_DIRECTION_UNSPECIFIED
- TREND_DIRECTION_RISING
- TREND_DIRECTION_STABLE
- TREND_DIRECTION_FALLING
description: |-
TrendDirection represents the directional movement of a metric over time.
Used in markets, GDELT tension scores, and risk assessments.
components:
$ref: '#/components/schemas/CiiComponents'
computedAt:
type: integer
format: int64
description: 'Last computation time, as Unix epoch milliseconds.. Warning: Values > 2^53 may lose precision in JavaScript'
description: CiiScore represents a Composite Instability Index score for a region or country.
CiiComponents:
type: object
properties:
newsActivity:
type: number
maximum: 100
minimum: 0
format: double
description: News activity signal contribution (0-100).
ciiContribution:
type: number
maximum: 100
minimum: 0
format: double
description: CII index contribution (0-100).
geoConvergence:
type: number
maximum: 100
minimum: 0
format: double
description: Geographic convergence score (0-100).
militaryActivity:
type: number
maximum: 100
minimum: 0
format: double
description: Military activity contribution (0-100).
description: CiiComponents represents the contributing factors to a CII score.
StrategicRisk:
type: object
properties:
region:
type: string
description: Country or region identifier.
level:
type: string
enum:
- SEVERITY_LEVEL_UNSPECIFIED
- SEVERITY_LEVEL_LOW
- SEVERITY_LEVEL_MEDIUM
- SEVERITY_LEVEL_HIGH
description: |-
SeverityLevel represents a three-tier severity classification used across domains.
Maps to existing TS unions: 'low' | 'medium' | 'high'.
score:
type: number
maximum: 100
minimum: 0
format: double
description: Risk score (0-100).
factors:
type: array
items:
type: string
description: Risk factors contributing to the assessment.
trend:
type: string
enum:
- TREND_DIRECTION_UNSPECIFIED
- TREND_DIRECTION_RISING
- TREND_DIRECTION_STABLE
- TREND_DIRECTION_FALLING
description: |-
TrendDirection represents the directional movement of a metric over time.
Used in markets, GDELT tension scores, and risk assessments.
description: StrategicRisk represents a strategic risk assessment for a country or region.
GetPizzintStatusRequest:
type: object
properties:
includeGdelt:
type: boolean
description: Whether to include GDELT tension pairs in the response.
description: GetPizzintStatusRequest specifies parameters for retrieving PizzINT and GDELT data.
GetPizzintStatusResponse:
type: object
properties:
pizzint:
$ref: '#/components/schemas/PizzintStatus'
tensionPairs:
type: array
items:
$ref: '#/components/schemas/GdeltTensionPair'
description: GetPizzintStatusResponse contains Pentagon Pizza Index and GDELT tension data.
PizzintStatus:
type: object
properties:
defconLevel:
type: integer
maximum: 5
minimum: 1
format: int32
description: DEFCON-style level (1-5).
defconLabel:
type: string
description: Human-readable DEFCON label.
aggregateActivity:
type: number
format: double
description: Aggregate activity score.
activeSpikes:
type: integer
format: int32
description: Number of active spike locations.
locationsMonitored:
type: integer
format: int32
description: Total monitored locations.
locationsOpen:
type: integer
format: int32
description: Currently open locations.
updatedAt:
type: integer
format: int64
description: 'Last data update time, as Unix epoch milliseconds.. Warning: Values > 2^53 may lose precision in JavaScript'
dataFreshness:
type: string
enum:
- DATA_FRESHNESS_UNSPECIFIED
- DATA_FRESHNESS_FRESH
- DATA_FRESHNESS_STALE
description: DataFreshness represents how current the data is.
locations:
type: array
items:
$ref: '#/components/schemas/PizzintLocation'
description: PizzintStatus represents the Pentagon Pizza Index status (proxy for late-night DC activity).
PizzintLocation:
type: object
properties:
placeId:
type: string
description: Google Places ID.
name:
type: string
description: Location name.
address:
type: string
description: Street address.
currentPopularity:
type: integer
format: int32
description: Current popularity score (0-200+).
percentageOfUsual:
type: integer
format: int32
description: Percentage of usual activity. Zero if unavailable.
isSpike:
type: boolean
description: Whether activity constitutes a spike.
spikeMagnitude:
type: number
format: double
description: Spike magnitude above baseline. Zero if no spike.
dataSource:
type: string
description: Data source identifier.
recordedAt:
type: string
description: Recording timestamp as ISO 8601 string.
dataFreshness:
type: string
enum:
- DATA_FRESHNESS_UNSPECIFIED
- DATA_FRESHNESS_FRESH
- DATA_FRESHNESS_STALE
description: DataFreshness represents how current the data is.
isClosedNow:
type: boolean
description: Whether the location is currently closed.
lat:
type: number
format: double
description: Latitude of the location.
lng:
type: number
format: double
description: Longitude of the location.
description: PizzintLocation represents a single monitored pizza location near the Pentagon.
GdeltTensionPair:
type: object
properties:
id:
type: string
description: Pair identifier.
countries:
type: array
items:
type: string
description: Country pair (ISO 3166-1 alpha-2 codes).
label:
type: string
description: Human-readable label (e.g., "US-China").
score:
type: number
maximum: 100
minimum: 0
format: double
description: Tension score (0-100).
trend:
type: string
enum:
- TREND_DIRECTION_UNSPECIFIED
- TREND_DIRECTION_RISING
- TREND_DIRECTION_STABLE
- TREND_DIRECTION_FALLING
description: |-
TrendDirection represents the directional movement of a metric over time.
Used in markets, GDELT tension scores, and risk assessments.
changePercent:
type: number
format: double
description: Percentage change from previous period.
region:
type: string
description: Geographic region.
description: GdeltTensionPair represents a bilateral tension score between two countries from GDELT.
ClassifyEventRequest:
type: object
properties:
title:
type: string
minLength: 1
description: Event title or headline.
description:
type: string
description: Event description or body text.
source:
type: string
description: Event source (e.g., "reuters", "acled").
country:
type: string
description: Country context (ISO 3166-1 alpha-2).
required:
- title
description: ClassifyEventRequest specifies an event to classify using AI.
ClassifyEventResponse:
type: object
properties:
classification:
$ref: '#/components/schemas/EventClassification'
description: ClassifyEventResponse contains the AI-generated event classification.
EventClassification:
type: object
properties:
category:
type: string
description: Event category (e.g., "military", "economic", "social").
subcategory:
type: string
description: Event subcategory.
severity:
type: string
enum:
- SEVERITY_LEVEL_UNSPECIFIED
- SEVERITY_LEVEL_LOW
- SEVERITY_LEVEL_MEDIUM
- SEVERITY_LEVEL_HIGH
description: |-
SeverityLevel represents a three-tier severity classification used across domains.
Maps to existing TS unions: 'low' | 'medium' | 'high'.
confidence:
type: number
maximum: 1
minimum: 0
format: double
description: Classification confidence (0.0 to 1.0).
analysis:
type: string
description: Brief AI-generated analysis.
entities:
type: array
items:
type: string
description: Related entities identified.
description: EventClassification represents an AI-generated classification of a real-world event.
GetCountryIntelBriefRequest:
type: object
properties:
countryCode:
type: string
pattern: ^[A-Z]{2}$
description: ISO 3166-1 alpha-2 country code.
required:
- countryCode
description: GetCountryIntelBriefRequest specifies which country to generate a brief for.
GetCountryIntelBriefResponse:
type: object
properties:
countryCode:
type: string
description: ISO 3166-1 alpha-2 country code.
countryName:
type: string
description: Country name.
brief:
type: string
description: AI-generated intelligence brief text.
model:
type: string
description: AI model used for generation.
generatedAt:
type: integer
format: int64
description: 'Brief generation time, as Unix epoch milliseconds.. Warning: Values > 2^53 may lose precision in JavaScript'
description: GetCountryIntelBriefResponse contains an AI-generated intelligence brief for a country.
SearchGdeltDocumentsRequest:
type: object
properties:
query:
type: string
minLength: 1
description: Search query string.
maxRecords:
type: integer
maximum: 250
minimum: 1
format: int32
description: Maximum number of articles to return (1-250).
timespan:
type: string
description: Time span filter (e.g., "15min", "1h", "24h").
toneFilter:
type: string
description: |-
Tone filter appended to query (e.g., "tone>5" for positive, "tone<-5" for negative).
Left empty to skip tone filtering.
sort:
type: string
description: 'Sort mode: "DateDesc" (default), "ToneDesc", "ToneAsc", "HybridRel".'
required:
- query
description: SearchGdeltDocumentsRequest specifies filters for searching GDELT news articles.
SearchGdeltDocumentsResponse:
type: object
properties:
articles:
type: array
items:
$ref: '#/components/schemas/GdeltArticle'
query:
type: string
description: Echo of the search query.
error:
type: string
description: Error message if the search failed.
description: SearchGdeltDocumentsResponse contains GDELT article search results.
GdeltArticle:
type: object
properties:
title:
type: string
description: Article headline.
url:
type: string
description: Article URL.
source:
type: string
description: Source domain name.
date:
type: string
description: Publication date string.
image:
type: string
description: Article image URL.
language:
type: string
description: Article language code.
tone:
type: number
format: double
description: GDELT tone score (negative = negative tone, positive = positive tone).
description: GdeltArticle represents a single article from the GDELT document API.
DeductSituationRequest:
type: object
properties:
query:
type: string
geoContext:
type: string
DeductSituationResponse:
type: object
properties:
analysis:
type: string
model:
type: string
provider:
type: string