generated from ministryofjustice/govuk-frontend-express
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenapi.json
More file actions
564 lines (564 loc) · 27.7 KB
/
openapi.json
File metadata and controls
564 lines (564 loc) · 27.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
{
"openapi": "3.1.0",
"info": {
"title": "Case Review Documents API",
"description": "Search pre-existing case documents",
"version": "1.0.0",
"license": {
"name": "MIT"
},
"contact": {
"name": "API Support",
"email": "IET@cica.gov.uk"
}
},
"servers": [
{
"url": "/api"
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "Search"
},
{
"name": "Documents"
}
],
"paths": {
"/search": {
"get": {
"tags": ["Search"],
"summary": "Search documents for a given case",
"description": "Gets all matching occurrences of text from case documents",
"operationId": "getSearchResults",
"parameters": [
{
"$ref": "#/components/parameters/query"
},
{
"$ref": "#/components/parameters/pageNumber"
},
{
"$ref": "#/components/parameters/itemsPerPage"
},
{
"$ref": "#/components/parameters/onBehalfOf"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "json-schemas/api/_search_{query}_{pageNumber}_{itemsPerPage}/get/res/200.json"
},
"example": {
"data": {
"type": "search-results",
"id": "08dbd0d2-6cee-49e5-a55f-35b31ac4aa9e",
"attributes": {
"query": "gabapentin",
"results": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 10.590174,
"hits": [
{
"_index": "page_chunks",
"_id": "38de7490-785c-5eaa-b49d-ffbfe5afb99c_p6_c4",
"_score": 10.590174,
"_source": {
"chunk_id": "38de7490-785c-5eaa-b49d-ffbfe5afb99c_p6_c4",
"ingested_doc_id": "38de7490-785c-5eaa-b49d-ffbfe5afb99c",
"chunk_text": "28-Nov-2022 Gabapentin 600mg tablets Acute Medication (Past) 56 tablet - Take ONE tablet at NIGHT 26-Sept-2022 Gabapentin 600mg tablets Acute Medication (Past) 56 tablet - Take ONE tablet at NIGHT 05-Aug-2022 Gabapentin 600mg tablets Acute Medication (Past) 56 tablet - Take ONE tablet at NIGHT 28-Nov-2022 Gabapentin 600mg tablets Repeat Medication (Past) 56 tablet - Take ONE tablet at NIGHT 08-Jun-2022 Gabapentin 600mg tablets Acute Medication (Past) 56 tablet - Take ONE tablet at NIGHT",
"source_file_name": "Case1_TC19_50_pages_brain_injury.pdf",
"page_count": 50,
"page_number": 6,
"chunk_index": 4,
"chunk_type": "LAYOUT_TEXT",
"confidence": 0.0067822265625,
"bounding_box": {
"width": 0.4132622182369232,
"height": 0.12280497141182423,
"left": 0.0894956961274147,
"top": 0.7214852571487427,
"right": 0.5027579143643379,
"bottom": 0.8442902285605669
},
"embedding": null,
"case_ref": "25-711111",
"received_date": "2025-10-06",
"correspondence_type": "TC19",
"character_count": 491,
"word_count": 75
}
}
]
}
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
},
"/document/{documentId}/page/{pageNumber}/metadata": {
"get": {
"tags": ["Documents"],
"summary": "Get page metadata from OpenSearch",
"description": "Returns page metadata including correspondence_type, dimensions, and S3 URI for a specific document page",
"operationId": "getPageMetadata",
"parameters": [
{
"name": "documentId",
"in": "path",
"required": true,
"description": "The UUID of the document",
"schema": {
"type": "string",
"format": "uuid"
},
"example": "55b2ea3c-3eae-54f7-b81d-292db7c84be7"
},
{
"name": "pageNumber",
"in": "path",
"required": true,
"description": "The page number to retrieve metadata for",
"schema": {
"type": "integer",
"minimum": 1
},
"example": 6
},
{
"name": "crn",
"in": "query",
"required": true,
"description": "Case reference number",
"schema": {
"type": "string",
"pattern": "^\\d{2}-[78]\\d{5}$"
},
"example": "26-711111"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"correspondence_type": {
"type": ["string", "null"],
"description": "Type of correspondence document"
},
"page_count": {
"type": "number",
"description": "Total number of pages in document"
},
"page_num": {
"type": "number",
"description": "Current page number in document"
},
"imageUrl": {
"type": "string",
"description": "S3 URI for the page image"
},
"text": {
"type": "string",
"description": "Full text extracted from the page"
}
}
}
}
},
"example": {
"data": {
"correspondence_type": "TC19 - ADDITIONAL INFO REQUEST",
"page_count": 50,
"page_num": 6,
"imageUrl": "s3://document-page-bucket/26-711111/55b2ea3c-3eae-54f7-b81d-292db7c84be7/pages/6.png",
"text": "28-Nov-2022 Gabapentin 600mg tablets"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
},
"/document/{documentId}/page/{pageNumber}/chunks": {
"get": {
"tags": ["Documents"],
"summary": "Get page chunks with bounding boxes",
"description": "Returns page chunks with bounding boxes for rendering overlays on a specific document page",
"operationId": "getPageChunks",
"parameters": [
{
"name": "documentId",
"in": "path",
"required": true,
"description": "The UUID of the document",
"schema": {
"type": "string",
"format": "uuid"
},
"example": "55b2ea3c-3eae-54f7-b81d-292db7c84be7"
},
{
"name": "pageNumber",
"in": "path",
"required": true,
"description": "The page number to retrieve chunks for",
"schema": {
"type": "integer",
"minimum": 1
},
"example": 6
},
{
"name": "crn",
"in": "query",
"required": true,
"description": "Case reference number",
"schema": {
"type": "string",
"pattern": "^\\d{2}-[78]\\d{5}$"
},
"example": "26-711111"
},
{
"name": "searchTerm",
"in": "query",
"required": false,
"description": "Optional search term to filter chunks by content",
"schema": {
"type": "string"
},
"example": "acute"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/vnd.api+json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "page-chunks"
},
"id": {
"type": "string",
"description": "Unique identifier for this page chunks resource"
},
"attributes": {
"type": "object",
"properties": {
"chunks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"chunk_id": {
"type": "string",
"description": "Unique identifier for the chunk"
},
"chunk_type": {
"type": "string",
"description": "Type of chunk (e.g., LAYOUT_HEADER, LAYOUT_TEXT)",
"example": "LAYOUT_TEXT"
},
"chunk_index": {
"type": "integer",
"description": "Index of the chunk on the page"
},
"chunk_text": {
"type": "string",
"description": "Text content of the chunk for accessibility"
},
"bounding_box": {
"type": "object",
"properties": {
"left": {
"type": "number",
"description": "Left offset (0-1 normalized)"
},
"top": {
"type": "number",
"description": "Top offset (0-1 normalized)"
},
"width": {
"type": "number",
"description": "Width (0-1 normalized)"
},
"height": {
"type": "number",
"description": "Height (0-1 normalized)"
},
"right": {
"type": "number",
"description": "Right offset (0-1 normalized)"
},
"bottom": {
"type": "number",
"description": "Bottom offset (0-1 normalized)"
}
}
}
}
},
"description": "Array of chunks for the page"
}
}
}
}
}
}
},
"example": {
"data": {
"type": "page-chunks",
"id": "55b2ea3c-3eae-54f7-b81d-292db7c84be7-6",
"attributes": {
"chunks": [
{
"chunk_id": "chunk-1",
"chunk_type": "LAYOUT_HEADER",
"chunk_index": 0,
"chunk_text": "Page header text",
"bounding_box": {
"left": 0.09,
"top": 0.04,
"width": 0.82,
"height": 0.12,
"right": 0.91,
"bottom": 0.16
}
}
]
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"parameters": {
"query": {
"name": "query",
"in": "query",
"required": true,
"description": "The query that results in the specific search results instance",
"schema": {
"type": "string",
"minLength": 2,
"maxLength": 200,
"x-errorMessage": {
"minLength": "Search terms must be 2 characters or more",
"maxLength": "Search terms must be 200 characters or less"
}
},
"example": "this is a valid search query"
},
"pageNumber": {
"name": "pageNumber",
"in": "query",
"required": false,
"description": "Page number of search results",
"schema": {
"type": "integer",
"min": 1
},
"example": 2
},
"itemsPerPage": {
"name": "itemsPerPage",
"in": "query",
"required": false,
"description": "Number of items per page of search results",
"schema": {
"type": "integer",
"min": 1,
"max": 100
},
"example": 2
},
"onBehalfOf": {
"name": "On-Behalf-Of",
"in": "header",
"required": true,
"description": "Specify the owner of the resource.",
"schema": {
"$ref": "./json-schemas/models/definitions/case-reference-number.json"
},
"example": "25-711111"
}
},
"responses": {
"BadRequest": {
"description": "There is an issue with the request",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/400.json"
},
"example": {
"errors": [
{
"status": 400,
"title": "400 Bad Request",
"detail": "Request JSON is malformed"
}
]
}
}
}
},
"UnauthorizedError": {
"description": "Access token is missing or invalid",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/401.json"
},
"example": {
"errors": [
{
"status": 401,
"detail": "No authorization token was found"
}
]
}
}
}
},
"Forbidden": {
"description": "The JWT doesn't permit access to this endpoint",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/403.json"
},
"example": {
"errors": [
{
"status": 403,
"title": "403 Forbidden",
"detail": "Insufficient scope"
}
]
}
}
}
},
"NotFound": {
"description": "The specified resource was not found",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/404.json"
},
"example": {
"errors": [
{
"status": 404,
"title": "404 Not Found",
"detail": "Resource /api/v1/questionnaires/2d7caf89-2c72-469f-b19d-17f2a22270b6/sections/answers does not exist"
}
]
}
}
}
},
"Conflict": {
"description": "Conflict",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/409.json"
},
"example": {
"errors": [
{
"status": 409,
"title": "409 conflict",
"detail": "Submission resource with ID \"68653be7-877f-4106-b91e-4ba8dac883f3\" already exists"
}
]
}
}
}
}
}
}
}