-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprisoner-offender-search-api.d.ts
More file actions
3471 lines (3470 loc) · 110 KB
/
Copy pathprisoner-offender-search-api.d.ts
File metadata and controls
3471 lines (3470 loc) · 110 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
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export interface paths {
'/restricted-patient-search/match-restricted-patients': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by criteria
* @description This endpoint sorts by prisonerNumber. This means that calling this endpoint to retrieve
* subsequent pages *should* return the next page of results, but this is not guaranteed.
*
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
post: operations['findRestrictedPatientsByCriteria']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/release-date-by-prison': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners who have a release date within a range, and optionally by prison
* @description This endpoint sorts by OpenSearch score and then by prisonerNumber. The score is an indication of
* how close the query matches a prisoner record, thus closest matches to the query will be returned first.
* Unfortunately sorting by score is problematic as different shards might provide different scores, thus breaking
* the paged results. Also it gives inconsistent results the higher the page number.
*
* It is thus recommended not to use paging and instead request a large page size, together with setting the
* responseFields to limit the returned response byte size (otherwise you risk hitting memory / webclient limits).
*
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
post: operations['findByReleaseDateAndPrison']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/prisoner-numbers': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by a list of prisoner numbers
* @description Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role or PRISONER_SEARCH__PRISONER__RO
*/
post: operations['findByNumbers']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/possible-matches': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Search for possible matches by criteria
* @description Search by prison number, PNC number, and/or name and date of birth, returning collated results by order of search.
* This will also search aliases for possible matches.
* Use when there is manual input, e.g. a user can select the correct match from search results.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
post: operations['findPossibleMatchesBySearchCriteria']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/match': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by criteria, to search across a list of specific prisons use /match-prisoners
* @deprecated
* @description Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
post: operations['deprecatedFindByCriteria']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/match-prisoners': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by criteria
* @description Search by prisoner identifier or name and returning results for the criteria matched first.
* Typically used when the matching data is of high quality where the first match is expected to be a near perfect match.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
post: operations['findByCriteria']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/booking-ids': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by a list of booking ids
* @description Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
post: operations['findByIds']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-detail': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Find prisoners by exact or wildcard terms for specified fields and return a paginated result set
* @description Search terms and identifiers can be provided in either or mixed case and are converted to the appropriate case.
* This endpoint will find both exact values (full term matched) or wildcards supporting the '*' and '?' symbols.
* The '*' symbol will match any number of characters e.g. firstName='J*' will match 'John', 'Jane', and 'James'.
* The '?' symbol will match any letter substituted at that position. e.g. firstName='t?ny' will match 'Tony' and 'Tiny'
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
post: operations['prisonerDetailSearch']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/physical-detail': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* *** BETA *** Physical details search for prisoners within a prison / group of prisons - returns a paginated result set
* @description BETA endpoint - subject to change. Search by physical details.
* If a cell location is provided then only one prison can be supplied, otherwise multiple prisons are allowed.
* If lenient is set to false (default) then all supplied physical details must match in order for results to be returned.
* If lenient is set to true then at least one physical detail must match.
* Searches will return results for partial string matches, so searching for an ethnicity of white will return all
* prisoners with ethnicity of White: Eng./Welsh/Scot./N.Irish/British, White: Irish etc.
* Results are ordered so that prisoners that match the most criteria are returned first, then secondary order is by
* prisoner number.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
post: operations['physicalDetailSearch']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/match-prisoners': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match for an prisoner by criteria
* @description This is a more lenient version to other match endpoints that includes alias and fuzzy date of birth matching.
* It will return the best group of matching prisoners based on the request
* Specify the request criteria to match against.
* Role required is ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH.
*/
post: operations['matchPrisoners']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/keyword': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Search for prisoners by keyword or identifiers within a list of prisons and return a paginated result set
* @description Words and identifiers can be provided in either or mixed case and will be matched against all indexed text and keyword fields.
* Identifiers within the [and, or, not, exact] terms are detected and converted to the appropriate case.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
post: operations['keywordSearch']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/global-search': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Match prisoners by criteria
* @description This endpoint sorts by OpenSearch score and then by prisonerNumber. The score is an indication of
* how close the query matches a prisoner record, thus closest matches to the query will be returned first.
* Unfortunately sorting by score is problematic as different shards might provide different scores, thus breaking
* the paged results. Also it gives inconsistent results the higher the page number.
*
* It is thus recommended not to use paging and instead request a large page size, together with setting the
* responseFields to limit the returned response byte size (otherwise you risk hitting memory / webclient limits).
*
* Requires ROLE_GLOBAL_SEARCH role or ROLE_PRISONER_SEARCH role or PRISONER_SEARCH__PRISONER__RO
*/
post: operations['globalFindByCriteria']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/attribute-search': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/**
* Search for prisoners by attributes
* @description <p>This endpoint allows you to create queries over all attributes from the <em>Prisoner</em> record. Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.</p>
* <p>The request contains a list of queries to search on one or more attributes using a list of matchers. For example attribute "lastName""
* requires a <em>StringMatcher</em> so we can query on <strong>"lastName IS Smith"</strong>. Other type matchers include <em>IntMatcher</em>, <em>BooleanMatcher</em>,
* <em>DateMatcher</em> and <em>DateTimeMatcher</em>.
* </p>
* <p>Each query can also contain a list of sub-queries. Each sub-query can be considered as a separate query in brackets.
* Combining multiple sub-queries gives us the ability to create complex searches using any combination of a prisoner's
* attributes. For example we can model nested queries such as <strong>"lastName IS Smith AND (prisonId IS MDI OR (prisonId IS OUT AND lastPrisonId IS MDI))"</strong>.
* </p>
* <p>To find all attributes that can be searched for please refer to the <em>Prisoner</em> record or get them from endpoint <a target="_blank" href="/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/Attribute search/getAttributes"><strong>GET /attribute-search/attributes</strong></a>. Attributes from lists can be
* searched for with dot notation, e.g. <strong>"attribute=aliases.firstName"</strong> or <strong>"attribute=tattoos.bodyPart"</strong>.
* Attributes from complex objects can also be searched for with dot notation, e.g. <strong>"attribute=currentIncentive.level.code"</strong>.
* </p>
* <p>Note that when searching lists of complex objects (e.g. aliases, alerts, tattoos) if you want to search for multiple attributes within the same object then you need
* to include them in the same query. For example, to search for alias "John Smith" you should search for <strong>aliases.firstName IS "John"</strong> and <strong>aliases.lastName IS "Smith"</strong> using string matchers in the same query.
* If you search for them in different queries you will receive anyone with firstName John and also anyone with lastName Smith.
* </p>
* <p>Many attributes contain reference data restricted to a fixed list of values. For example, attribute "inOutStatus" only contains values "IN", "OUT" and "TRN".
* To find which attributes use reference data and to fetch the possible attribute values see the endpoint <a target="_blank" href="/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/Reference data/referenceData"><strong>GET /reference-data/{attribute}</strong></a>.
* </p>
* <p>String attributes support advanced search techniques such as <a href="https://opensearch.org/docs/latest/query-dsl/term/fuzzy/">fuzzy search</a> matching and <a href="https://opensearch.org/docs/latest/query-dsl/term/wildcard/">wildcard search</a>. All String searches are case-insensitive (except for IS with fuzzy matching which is not supported by OpenSearch).
* <ul>
* <li>IS and IS_NOT require an exact match (wildcards ? and * will not work). E.g. If religion is "Christian" then <strong>"religion IS Christian"</strong> will match but <strong>"religion IS Christ*"</strong> will not.</li>
* <li>For IS and CONTAINS some attributes support fuzzy matching e.g. they allow spelling mistakes. Call endpoint <strong>GET /attribute-search/attributes</strong> to see which attributes support fuzzy matching. E.g. If firstName is "Jonathan" then <strong>"firstName IS Johnathon"</strong> or <strong>"firstName CONTAINS Johnathon"</strong> will match. Note that fuzzy matches for IS are case sensitive but for CONTAINS they are case insensitive.</li>
* <li>CONTAINS without wildcards (? and *) for a non-fuzzy attribute looks for the exact search term anywhere in the attribute value. E.g. If religion is "Christian" then <strong>"religion CONTAINS ist"</strong> will match.</li>
* <li>CONTAINS with wildcards ? (single character) and/or * (zero to many characters) perform a wildcard search which must match the entire attribute value. E.g. If firstName is "Jonathan" then <strong>"firstName CONTAINS Jon*"</strong> will match but <strong>"firstName CONTAINS nath*"</strong> will not.</li>
* <li>STARTSWITH checks only the prefix of the attribute value and does not support fuzzy matching or wildcards. E.g.If firstName is "Jonathan" then <strong>"firstName STARTSWITH Jon"</strong> will match but <strong>"firstName STARTSWITH Jon*"</strong> will not.</li>
* <li>IN checks that the attribute value is any of the list of Strings provided in the search term. The search term should be a comma separated list of Strings to search, E.g. "searchValue1,searchValue2,searchValue3". This only matches exactly - no fuzzy search, wildcards or case-insensitive search is supported by OpenSearch. E.g.If firstName is "Jonathan" then <strong>"firstName IN 'Jonathan,Bob,Chris'"</strong> will match but <strong>"firstName IN 'Adrian,Bob,Chris'"</strong> will not.</li>
* </ul>
* </p>
* <p>To assist with debugging queries we publish events in App Insights. To search in App Insights Log Analytics run query:
* <pre>
* AppEvents
* | where Name == 'POSAttributeSearch'
* </pre>
* </p>
* <h3>Example Requests</h3>
* <p>Note that the default "joinType" is "AND" so it could be omitted from the examples below (but is included for clarity).</p>
* <h4>Search for all prisoners in Moorland with a height between 150 and 180cm</h4>
* <br/>
* Query: <strong>"prisonId = "MDI" AND (heightCentimetres >= 150 AND heightCentimetres <= 180)"</strong>
* <br/>
* JSON request:
* <br/>
* <pre>
* {
* "joinType": "AND",
* "queries": [
* {
* "joinType": "AND",
* "matchers": [
* {
* "type": "String",
* "attribute": "prisonId",
* "condition": "IS",
* "searchTerm": "MDI"
* },
* {
* "type": "Int",
* "attribute": "heightCentimetres",
* "minValue": 150,
* "maxValue": 180
* }
* ]
* }
* ]
* }
* </pre>
* <br/>
* <h4>Search for all prisoners in a list of cells in Moorland</h4>
* Query: <strong>"prisonId = "MDI" AND cellLocation IN (1-2-001, 1-3-014, 3-1-020)</strong>
* <br/>
* JSON request:
* <br/>
* <pre>
* {
* "joinType": "AND",
* "queries": [
* {
* "joinType": "AND",
* "matchers": [
* {
* "type": "String",
* "attribute": "prisonId",
* "condition": "IS",
* "searchTerm": "MDI"
* },
* {
* "type": "String",
* "attribute": "cellLocation",
* "condition": "IN",
* "searchTerm": "1-2-001,1-3-014,3-1-020"
* }
* ]
* }
* ]
* }
* </pre>
* <br/>
* <h4>Search for all prisoners received since 1st Jan 2024 with a dragon tattoo on either their arm or shoulder</h4>
* <br/>
* Query: <strong>"(receptionDate >= 2024-01-01) AND ((tattoos.bodyPart = "arm" AND tattoos.comment CONTAINS "dragon" ) OR (tattoos.bodyPart = "shoulder" AND tattoos.comment CONTAINS "dragon"))"</strong>
* <br/>
* JSON request:
* <br/>
* <pre>
* {
* "joinType": "AND",
* "queries": [
* {
* "matchers": [
* {
* "type": "Date",
* "attribute": "receptionDate",
* "minValue": "2024-01-01"
* }
* ]
* },
* {
* "joinType": "OR",
* "subQueries": [
* {
* "joinType": "AND",
* "matchers": [
* {
* "type": "String",
* "attribute": "tattoos.bodyPart",
* "condition": "IS",
* "searchTerm": "arm"
* },
* {
* "type": "String",
* "attribute": "tattoos.comment",
* "condition": "CONTAINS",
* "searchTerm": "dragon"
* }
* ]
* },
* {
* "joinType": "AND",
* "matchers": [
* {
* "type": "String",
* "attribute": "tattoos.bodyPart",
* "condition": "IS",
* "searchTerm": "shoulder"
* },
* {
* "type": "String",
* "attribute": "tattoos.comment",
* "condition": "CONTAINS",
* "searchTerm": "dragon"
* }
* ]
* }
* ]
* }
* ]
* }
* </pre>
* <p>There have been issues raised with OpenSearch sorting in that it sometimes doesn't produce stable sorting results,
* especially with higher page numbers.
* </p>
* <p>It is thus recommended not to use paging and instead request a large page size, together with setting the
* responseFields to limit the returned response byte size (otherwise you risk hitting memory / webclient limits).
* </p>
*/
post: operations['attributeSearch']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/response-fields': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Get all available response fields
* @description This exists for developers to find all available values for responseFields parameters. Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
get: operations['responseFields']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/reference-data/{attribute}': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* *** BETA *** Reference data search
* @description BETA endpoint - reference data returned reflects the data assigned to prisoners
* rather than all the possible values. Only to be used for searching existing data purposes.
* This method will also cache all reference data results for an hour and any new data will only appear after an hour.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
get: operations['referenceData']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/reference-data/alerts/types': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* *** BETA *** Alerts reference data
* @description BETA endpoint - alerts reference data returned reflects the data assigned to prisoners
* rather than all the possible values. Only to be used for searching existing data purposes.
* This method will also cache all reference data results for an hour and any new data will only appear after an hour.
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role.
*/
get: operations['alertsReferenceData']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner/{id}': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Get prisoner by prisoner number (AKA NOMS number)
* @description Requires ROLE_PRISONER_SEARCH or ROLE_VIEW_PRISONER_DATA role or PRISONER_SEARCH__PRISONER__RO
*/
get: operations['findByPrisonNumber']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-search/prison/{prisonId}': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Get all prisoners in a prison, including restricted patients supported by a POM
* @description This endpoint sorts by OpenSearch score and then by prisonerNumber. The score is an indication of
* how close the query matches a prisoner record, thus closest matches to the query will be returned first.
* Unfortunately sorting by score is problematic as different shards might provide different scores, thus breaking
* the paged results. Also it gives inconsistent results the higher the page number.
*
* It is thus recommended not to use paging and instead request a large page size, together with setting the
* responseFields to limit the returned response byte size (otherwise you risk hitting memory / webclient limits).
*
* Requires ROLE_GLOBAL_SEARCH or ROLE_PRISONER_SEARCH role
*/
get: operations['findByPrison']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-location/scroll/{scroll-id}': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Get the next page of prisoners.
* @description To be used in conjunction with /prisoner-location/all. Uses the scroll id to get the next page of
* prisoners. Calls should be repeated until a
* `null` scroll id is then returned, indicating that no more data is available. Each call will return the scroll id,
* which should be used for the next call, rather than re-using the original scroll id.
* Note that the OpenSearch scroll will expire after 5 minutes, so if no calls are made during that time then the
* scroll id will be invalid.
* Requires PRISONER_SEARCH__PRISONER_LOCATION__RO role.
*/
get: operations['scroll']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prisoner-location/all': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Get all prisoners. This will return the first page of results and a scroll id to retrieve the next page
* @description To be used in conjunction with /prisoner-location/scroll/{scroll-id}.
* This endpoint will return the first page of results (10,000 per page) and also a scroll id.
* This scroll id can then be used to make subsequent calls to return the data.
* It is required that this call will then be followed by calls to the /scroll/{scroll-id} endpoint to retrieve all
* the rest of the data, since it opens an OpenSearch scroll that will be cleared when no more data is available.
* Requires PRISONER_SEARCH__PRISONER_LOCATION__RO role.
*/
get: operations['findAll']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/prison/{prisonId}/prisoners': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Search for prisoners within a particular prison establishment
* @description This search is optimised for clients that have a simple search term typically containing the prisoner's name
* or prisoner number. The user typically is certain the prisoner is within the establishment and knows key information
* about the prisoner.
*
* Requires ROLE_PRISONER_IN_PRISON_SEARCH or ROLE_PRISONER_SEARCH role.
*
* Sort fields supported are: firstName, lastName, prisonerNumber, dateOfBirth, cellLocation e.g "sort=firstName,lastName,desc"
*
* Examples:
*
* "/prison/BXI/prisoners?term=John&sort=firstName,lastName,desc&page=2&size=20"
* This will return all people in HMP Brixton whose first or last names begins with JOHN.
* Results will be ordered by firstName, lastName descending.
* Page 3 will be returned with a maximum of 20 results per page.
*
* "/prison/WWI/prisoners?sort=cellLocation"
* This will return all people in HMP Wandsworth.
* Results will be ordered by cell location ascending.
* Page 1 will be returned with a maximum of 10 results per page.
*
* "/prison/WWI/prisoners?cellLocationPrefix=WWI-2&term=smith"
* "/prison/WWI/prisoners?cellLocationPrefix=2&term=smith"
* This will return all people in HMP Wandsworth block 2 whose name starts with SMITH.
*
* "/prison/WWI/prisoners?cellLocationPrefix=2-A-3-001"
* This will return all people in HMP Wandsworth cell WWI-2-A-3-001
*
* "/prison/WWI/prisoners?term=A1234KJ"
* "/prison/WWI/prisoners?term=A1234KJ bananas"
* This will return the single prisoner with prisoner number A1234KJ in HMP Wandsworth.
* An empty page will be returned if not found.
*
* "/prison/WWI/prisoners?term=A J&fromDob=1956-01-01&toDob=2000-01-02"
* This will return all people in HMP Wandsworth. Born on or after 1956-01-01 and on or before 2000-01-02,
* whose name begins with A J, e.g Alan Jones born on 1956-01-01.
*
* "/prison/WWI/prisoners?alerts=TACT&alerts=PEEP"
* This will return all people in HMP Wandsworth. With the alerts TACT or PEEP.
*
* There have been issues raised with OpenSearch sorting in that it sometimes doesn't produce stable sorting results,
* especially with higher page numbers.
*
* It is thus recommended not to use paging and instead request a large page size, together with setting the
* responseFields to limit the returned response byte size (otherwise you risk hitting memory / webclient limits).
*/
get: operations['search']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/attribute-search/attributes': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/**
* Retrieve all attributes supported by the attribute search
* @description Returns all attributes that can be passed into the attribute search including their type.
*/
get: operations['getAttributes']
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
}
export type webhooks = Record<string, never>
export interface components {
schemas: {
/** @description Search Criteria for Prisoner Search */
RestrictedPatientSearchCriteria: {
/**
* @description Prisoner identifier, one of prisoner number, book number, booking ID or PNC
* @example A1234AA,
*/
prisonerIdentifier?: string
/**
* @description First Name
* @example John
*/
firstName?: string
/**
* @description Last Name
* @example Smith
*/
lastName?: string
/**
* @description List of supporting Prison Ids to restrict the search by. Unrestricted if not supplied or null
* @example [
* "MDI"
* ]
*/
supportingPrisonIds?: string[]
}
Address: {
/**
* @description The full address on a single line. No fixed address records will have the fullAddress set to 'No fixed address'. Will never be null.
* @example 1 Main Street, Crookes, Sheffield, South Yorkshire, S10 1BP, England
*/
fullAddress?: string
/**
* @description The postal code
* @example S10 1BP
*/
postalCode?: string
/**
* Format: date
* @description The date the address became active according to NOMIS. Will never be null.
* @example 2020-07-17
*/
startDate?: string
/**
* @description Whether the address is currently marked as the primary address. Will never be null.
* @example true
*/
primaryAddress?: boolean
/**
* @description No fixed address. This address record is only ever returned if it is also the primary address, otherwise it is ignored. Will never be null.
* @example true
*/
noFixedAddress?: boolean
/** @description Phone numbers linked to the address. Note the phone number contains only numbers, no whitespace. Therefore searching on 'addresses.phoneNumbers.number' should not pass any non-numeric characters. */
phoneNumbers?: components['schemas']['PhoneNumber'][]
}
BodyPartDetail: {
/**
* @description Part of the body that has the mark. From REFERENCE_CODES table where DOMAIN = BODY_PART. Allowable values extracted 08/02/2023.
* @example Head
* @enum {string}
*/
bodyPart?:
| 'Ankle'
| 'Arm'
| 'Ear'
| 'Elbow'
| 'Face'
| 'Finger'
| 'Foot'
| 'Hand'
| 'Head'
| 'Knee'
| 'Leg'
| 'Lip'
| 'Neck'
| 'Nose'
| 'Shoulder'
| 'Thigh'
| 'Toe'
| 'Torso'
/**
* @description Optional free text comment describing the mark
* @example Skull and crossbones covering chest
*/
comment?: string
}
CurrentIncentive: {
/** @description Incentive level. Will never be null. */
level?: components['schemas']['IncentiveLevel']
/**
* Format: date-time
* @description Date time of the incentive. Will never be null.
* @example 2022-11-10T15:47:24
*/
dateTime: string
/**
* Format: date
* @description Schedule new review date
* @example 2022-11-10
*/
nextReviewDate: string
}
EmailAddress: {
/**
* @description The email address. Will never be null.
* @example john.smith@gmail.com
*/
email?: string
}
Identifier: {
/**
* @description The type of identifier. Will never be null.
* @example PNC, CRO, DL, NINO
*/
type?: string
/**
* @description The identifier value. Will never be null.
* @example 12/394773H
*/
value?: string
/**
* Format: date
* @description The date the identifier was issued according to NOMIS
* @example 2020-07-17
*/
issuedDate?: string
/** @description Free text entered into NOMIS when the identifier was recorded. */
issuedAuthorityText?: string
/**
* Format: date-time
* @description The date/time the identifier was created in the system. Will never be null.
* @example 2020-07-17T12:34:56.833Z
*/
createdDateTime?: string
}
IncentiveLevel: {
/**
* @description code. Will never be null.
* @example STD
*/
code?: string
/**
* @description description. Will never be null.
* @example Standard
*/
description?: string
}
Language: {
/**
* @description A LOV from domain LANG_TYPE
* @enum {string}
*/
type?: 'PRIM' | 'SEC' | 'PREF_SPEAK' | 'PREF_WRITE'
/**
* @description The actual language code, from domain LANG
* @example ENG
*/
code?: string
/**
* @description The level of reading skill, from domain LANG_SKILLS:
* |Y Yes
* |A Average
* |D Dyslexia
* |G Good
* |N Nil
* |P Poor
* |R Refused
* @enum {string}
*/
readSkill?: 'Y' | 'N' | 'A' | 'D' | 'G' | 'P' | 'R'
/**
* @description The level of writing skill, see description for readSkill
* @enum {string}
*/
writeSkill?: 'Y' | 'N' | 'A' | 'D' | 'G' | 'P' | 'R'
/**
* @description The level of writing skill, see description for readSkill
* @enum {string}
*/
speakSkill?: 'Y' | 'N' | 'A' | 'D' | 'G' | 'P' | 'R'
/** @description Whether an interpreter requested */
interpreterRequested?: boolean
}
Offence: {
/**
* @description The statue code. Will never be null.
* @example TH68
*/
statuteCode?: string
/**
* @description The offence code. Will never be null.
* @example TH68010
*/
offenceCode?: string
/**
* @description The offence description. Will never be null.
* @example Theft from a shop
*/
offenceDescription?: string
/**
* Format: date
* @description The date of the offence
* @example 2024-05-23
*/
offenceDate?: string
/** @description Indicates this offence is for the latest NOMIS booking. Will never be null. */
latestBooking?: boolean
/**
* Format: date
* @description Start date of sentence - null if there is no associated sentence
* @example 2018-03-10
*/
sentenceStartDate?: string
/** @description Primary sentence - true if it is not a consecutive sentence, false if it is a consecutive sentence, null if no sentence found for the charge. */
primarySentence?: boolean
}
PagePrisoner: {
/** Format: int64 */
totalElements?: number
/** Format: int32 */
totalPages?: number
/** Format: int32 */
size?: number
content?: components['schemas']['Prisoner'][]
/** Format: int32 */
number?: number
first?: boolean
last?: boolean
sort?: components['schemas']['SortObject']
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
empty?: boolean
}
PageableObject: {
/** Format: int64 */
offset?: number
sort?: components['schemas']['SortObject']
/** Format: int32 */
pageSize?: number
paged?: boolean
/** Format: int32 */
pageNumber?: number
unpaged?: boolean
}
PersonalCareNeed: {
/**
* @description Problem Type, from reference data with domain 'HEALTH'
* @example MATSTAT
*/
problemType?: string
/**
* @description Problem Code, from reference data with domain 'HEALTH_PBLM'
* @example ACCU9
*/
problemCode?: string
/**
* @description Problem Status, from reference data with domain 'HEALTH_STS'
* @enum {string}
*/
problemStatus?: 'ON' | 'I' | 'EBS'
/** @description Problem Description */
problemDescription?: string
/** @description Comment */
commentText?: string
/**
* Format: date
* @description Start Date
* @example 2020-06-21
*/
startDate?: string
/**
* Format: date
* @description End Date
* @example 2025-05-11