/
webapi-swagger.yaml
773 lines (753 loc) · 21.7 KB
/
webapi-swagger.yaml
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
openapi: 3.1.0
info:
title: FastAPI
version: 0.1.0
paths:
/api/pid-digitization/symbol-detection/{pid_id}:
post:
tags:
- pid-digitization
summary: Detect Symbols
description: >-
Detects symbols in an image and returns the bounding boxes of the
detected symbols.
param pid: The PID.
param bounding_box_inclusive_str: The bounding box of the P&ID image
without extraneous legend information.
param file: The image to detect symbols in.
return: The bounding boxes of the detected symbols.
rtype: symbol_detection.ObjectDetectionPrediction
operationId: detect_symbols_api_pid_digitization_symbol_detection__pid_id__post
parameters:
- required: true
schema:
type: string
title: Pid Id
name: pid_id
in: path
requestBody:
content:
multipart/form-data:
schema:
$ref: >-
#/components/schemas/Body_detect_symbols_api_pid_digitization_symbol_detection__pid_id__post
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/SymbolDetectionInferenceResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/text-detection/{pid_id}:
post:
tags:
- pid-digitization
summary: Detect Text
description: >-
This endpoint takes in the P&ID image id to download the original image
and recognize the texts of the image.
Additionally, it takes in the corrected symbol detected inference
results which will be stored and used to
associate a text with a symbol.
Returns the text detection inference results, which includes all text
detected and
the text and symbols associated on a P&ID image.
operationId: detect_text_api_pid_digitization_text_detection__pid_id__post
parameters:
- description: The P&ID image id
required: true
schema:
type: string
title: Pid Id
description: The P&ID image id
name: pid_id
in: path
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/SymbolDetectionInferenceResponse'
title: Corrected Symbol Detection Results
description: >-
The corrected symbol
detection
inference results
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TextDetectionInferenceResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/graph-construction/{pid_id}:
post:
tags:
- pid-digitization
summary: Detect Lines And Construct Graph
description: >-
This endpoint takes in the P&ID image id and the text response and then
will build an asset connected
graph based on the line segments, text detection results and symbol
associations.
operationId: >-
detect_lines_and_construct_graph_api_pid_digitization_graph_construction__pid_id__post
parameters:
- description: The P&ID image id
required: true
schema:
type: string
title: Pid Id
description: The P&ID image id
name: pid_id
in: path
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/GraphConstructionInferenceRequest'
title: Graph Construction Request
description: >-
The corrected text
detection
inference results
required: true
responses:
'202':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/graph-persistence/{pid_id}:
post:
tags:
- pid-digitization
summary: Persist Graph
description: >-
For the given P&ID image id, the graph output (if any) from the prior
step is persisted in the graph database.
operationId: persist_graph_api_pid_digitization_graph_persistence__pid_id__post
parameters:
- description: The P&ID image id
required: true
schema:
type: string
title: Pid Id
description: The P&ID image id
name: pid_id
in: path
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/GraphConstructionInferenceResponse'
title: Graph Persistence Request
description: >-
Persist the final
graph
into the graph database
required: true
responses:
'201':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/{inference_result_type}/{pid_id}:
get:
tags:
- pid-digitization
summary: Get Inference Results
description: |-
Gets the inference results for a given pid id and inference result type.
param pid: The PID id.
param inference_result_type: The inference result type.
return: The inference results.
rtype: symbol_detection.InferenceResponse
operationId: >-
get_inference_results_api_pid_digitization__inference_result_type___pid_id__get
parameters:
- required: true
schema:
$ref: '#/components/schemas/InferenceResult'
name: inference_result_type
in: path
- required: true
schema:
type: string
title: Pid Id
name: pid_id
in: path
responses:
'200':
description: Successful Response
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/SymbolDetectionInferenceResponse'
- $ref: '#/components/schemas/TextDetectionInferenceResponse'
- $ref: '#/components/schemas/LineDetectionInferenceResponse'
- $ref: '#/components/schemas/GraphConstructionInferenceResponse'
title: >-
Response Get Inference Results Api Pid Digitization Inference
Result Type Pid Id Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/graph-construction/{pid_id}/status:
get:
tags:
- pid-digitization
summary: Get Job Status
description: |-
Gets the inference job status for a given pid id .
param pid: The PID id.
return: The JobStatus of pid_id.
rtype: JobStatus
operationId: >-
get_job_status_api_pid_digitization_graph_construction__pid_id__status_get
parameters:
- required: true
schema:
type: string
title: Pid Id
name: pid_id
in: path
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/pid-digitization/{inference_result_type}/{pid_id}/images:
get:
tags:
- pid-digitization
summary: Get Output Inference Images
description: >-
Gets the inference output image for a given pid id and inference result
type.
param pid: The PID id.
param inference_result_type: The inference result type.
rtype: ImageResponse
The inference output image has information overlayed on the original
image
that provides user insight into what was done in the inferencing
service.
operationId: >-
get_output_inference_images_api_pid_digitization__inference_result_type___pid_id__images_get
parameters:
- required: true
schema:
type: string
title: Pid Id
name: pid_id
in: path
- required: true
schema:
$ref: '#/components/schemas/InferenceResult'
name: inference_result_type
in: path
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'':
get:
summary: Metrics
description: Endpoint that serves Prometheus metrics.
operationId: metrics_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
components:
schemas:
Body_detect_symbols_api_pid_digitization_symbol_detection__pid_id__post:
properties:
bounding_box_inclusive_str:
type: string
format: json-string
title: Bounding Box Inclusive Str
description: >-
The bounding box of the P&ID image without extraneous legend
information.This should be provided as a JSON string with the
following format: {"topX": 0.0, "topY": 0.0, "bottomX": 1.0,
"bottomY": 1.0}. The coordinates should be normalized to the range
[0, 1]. The default value is the entire image.
default:
topX: 0
topY: 0
bottomX: 1
bottomY: 1
file:
type: string
format: binary
title: File
description: The P&ID image to detect symbols in.
type: object
required:
- file
title: Body_detect_symbols_api_pid_digitization_symbol_detection__pid_id__post
BoundingBox:
properties:
topX:
type: number
title: Topx
topY:
type: number
title: Topy
bottomX:
type: number
title: Bottomx
bottomY:
type: number
title: Bottomy
type: object
required:
- topX
- topY
- bottomX
- bottomY
title: BoundingBox
description: >-
This class represents the bounding box of a symbol detected on a P&ID
image.
ConnectedSymbolsConnectionItem:
properties:
id:
type: integer
title: Id
label:
type: string
title: Label
text_associated:
type: string
title: Text Associated
bounding_box:
$ref: '#/components/schemas/BoundingBox'
flow_direction:
$ref: '#/components/schemas/FlowDirection'
segments:
items:
$ref: '#/components/schemas/BoundingBox'
type: array
title: Segments
type: object
required:
- id
- label
- text_associated
- bounding_box
- flow_direction
- segments
title: ConnectedSymbolsConnectionItem
description: This class represents a symbol that is connected to other symbols
ConnectedSymbolsItem:
properties:
id:
type: integer
title: Id
label:
type: string
title: Label
text_associated:
type: string
title: Text Associated
bounding_box:
$ref: '#/components/schemas/BoundingBox'
connections:
items:
$ref: '#/components/schemas/ConnectedSymbolsConnectionItem'
type: array
title: Connections
type: object
required:
- id
- label
- text_associated
- bounding_box
- connections
title: ConnectedSymbolsItem
description: This class represents a symbol that is connected to other symbols
FlowDirection:
type: string
enum:
- unknown
- upstream
- downstream
title: FlowDirection
description: Enum for the flow direction
GraphConstructionInferenceRequest:
properties:
image_url:
type: string
title: Image Url
image_details:
$ref: '#/components/schemas/ImageDetails'
bounding_box_inclusive:
$ref: '#/components/schemas/BoundingBox'
all_text_list:
items:
$ref: '#/components/schemas/TextRecognized'
type: array
title: All Text List
text_and_symbols_associated_list:
items:
$ref: '#/components/schemas/SymbolAndTextAssociated'
type: array
title: Text And Symbols Associated List
hough_threshold:
type: integer
title: Hough Threshold
hough_min_line_length:
type: integer
title: Hough Min Line Length
hough_max_line_gap:
type: integer
title: Hough Max Line Gap
hough_rho:
type: number
title: Hough Rho
hough_theta:
type: integer
title: Hough Theta
thinning_enabled:
type: boolean
title: Thinning Enabled
type: object
required:
- image_url
- image_details
- all_text_list
- text_and_symbols_associated_list
title: GraphConstructionInferenceRequest
description: >-
This class represents the parameters used in the Hough Transform
algorithm.
GraphConstructionInferenceResponse:
properties:
image_url:
type: string
title: Image Url
image_details:
$ref: '#/components/schemas/ImageDetails'
connected_symbols:
items:
$ref: '#/components/schemas/ConnectedSymbolsItem'
type: array
title: Connected Symbols
type: object
required:
- image_url
- image_details
- connected_symbols
title: GraphConstructionInferenceResponse
description: This class represents the container of connected symbols
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ImageDetails:
properties:
format:
type: string
title: Format
default: png
width:
type: integer
title: Width
height:
type: integer
title: Height
type: object
required:
- width
- height
title: ImageDetails
description: This class represents the details of a P&ID image.
InferenceResult:
type: string
enum:
- symbol-detection
- text-detection
- graph-construction
- line-detection
- graph-persistence
title: InferenceResult
description: Enum for the inference result type
Label:
properties:
topX:
type: number
title: Topx
topY:
type: number
title: Topy
bottomX:
type: number
title: Bottomx
bottomY:
type: number
title: Bottomy
id:
type: integer
title: Id
label:
type: string
title: Label
score:
type: number
title: Score
type: object
required:
- topX
- topY
- bottomX
- bottomY
- id
- label
title: Label
description: >-
This class represents a tagged label of a symbol detected on a P&ID
image.
LineDetectionInferenceResponse:
properties:
image_url:
type: string
title: Image Url
image_details:
$ref: '#/components/schemas/ImageDetails'
line_segments_count:
type: integer
title: Line Segments Count
line_segments:
items:
$ref: '#/components/schemas/LineSegment'
type: array
title: Line Segments
type: object
required:
- image_url
- image_details
- line_segments_count
- line_segments
title: LineDetectionInferenceResponse
description: This class represents the response of the line detection service.
LineSegment:
properties:
startX:
type: number
title: Startx
startY:
type: number
title: Starty
endX:
type: number
title: Endx
endY:
type: number
title: Endy
type: object
required:
- startX
- startY
- endX
- endY
title: LineSegment
description: This class represents the line segment detected on a P&ID image.
SymbolAndTextAssociated:
properties:
topX:
type: number
title: Topx
topY:
type: number
title: Topy
bottomX:
type: number
title: Bottomx
bottomY:
type: number
title: Bottomy
id:
type: integer
title: Id
label:
type: string
title: Label
score:
type: number
title: Score
text_associated:
type: string
title: Text Associated
type: object
required:
- topX
- topY
- bottomX
- bottomY
- id
- label
title: SymbolAndTextAssociated
description: >-
Class that represents the symbol detected properties and the text
associated within the symbol
SymbolDetectionInferenceResponse:
properties:
image_url:
type: string
title: Image Url
image_details:
$ref: '#/components/schemas/ImageDetails'
bounding_box_inclusive:
$ref: '#/components/schemas/BoundingBox'
label:
items:
$ref: '#/components/schemas/Label'
type: array
title: Label
type: object
required:
- image_url
- image_details
- label
title: SymbolDetectionInferenceResponse
description: >-
This class represents the symbol detection inference results; which
includes
all symbols detected, and the symbols and text associated on a P&ID
image.
TextDetectionInferenceResponse:
properties:
image_url:
type: string
title: Image Url
image_details:
$ref: '#/components/schemas/ImageDetails'
bounding_box_inclusive:
$ref: '#/components/schemas/BoundingBox'
all_text_list:
items:
$ref: '#/components/schemas/TextRecognized'
type: array
title: All Text List
text_and_symbols_associated_list:
items:
$ref: '#/components/schemas/SymbolAndTextAssociated'
type: array
title: Text And Symbols Associated List
type: object
required:
- image_url
- image_details
- all_text_list
- text_and_symbols_associated_list
title: TextDetectionInferenceResponse
description: >-
This class represents the text detection inference results; which
includes
all text detected, and the text and symbols associated on a P&ID image.
TextRecognized:
properties:
topX:
type: number
title: Topx
topY:
type: number
title: Topy
bottomX:
type: number
title: Bottomx
bottomY:
type: number
title: Bottomy
text:
type: string
title: Text
type: object
required:
- topX
- topY
- bottomX
- bottomY
- text
title: TextRecognized
description: |-
"
Class that represents the text detected properties
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError