-
Notifications
You must be signed in to change notification settings - Fork 6
/
apiary.apib
7658 lines (5940 loc) · 376 KB
/
apiary.apib
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
FORMAT: 1A
HOST: http://ehealth.edenlabllc.com/
# eHealth API
This is a API documentation for Ukrainian Health Services government institution back-end, that should provide:
* Master Patients Index (MPI)
* Global Medical Institutions and Doctors Registries
* Partnership Relation Managementine (PRM) module that describes business relations between this 3 entities.
Project development is fully transparent, you can find it's source code on GitHub:
* [eHealth API and issue tracker](https://github.com/edenlabllc/ehealth.api)
* [Master Patient Index](https://github.com/edenlabllc/mpi.api)
* [Partnership Relation Management](https://github.com/edenlabllc/prm.api)
<!-- * [Reference Implementation of Hospital Information System UI](https://github.com/edenlabllc/prm.web) -->
This API design in based on [Nebo #15 API Design Manifest](http://docs.apimanifest.apiary.io/).
## Docs Structure
This document contains both internal and public (usually `/api/..`) API specifications. If you plan to use it as outside API consumer - please refer only to sections that marked as `Public`.
<!--
## Patination
We apply cursor based pagination..
## Autentification
We use three-legged oAuth authentication, RFC..
-->
## Context Switching for end-users
Since Doctor may have multiple work-placreates, you MUST fetch list of possible work-contexts and apply `legal_entity_id` filter on each request, where this parameter is available.
Thus you will make sure that end-user understand from which context entities are managed.
If our API returns only one work context, you are free to hide context picker.
## Contribution Guidelines
TODO.
## Submitting Issues
To submit issues you should use [Issue Tracking Repo](https://github.com/edenlabllc/ehealth.api), issues in all other repositories are used to plan backlog and non-related issued will be closed.
# Group Internal. Authorization Provider
For security purposes eHealth doesn't allow proxying passwords or to perform any sort back-end authorization. You should always redirect your customers (eg. doctors, we call them "consumers") to the Login UI.
After obtaining `access_token` all subsequent requests should be made with `Authorization: Bearer base64(access_token:)` header.
## Login UI [/oauth]
### Show Login UI [GET /oauth/ui{?client_id,redirect_url,scope,response_type}]
This method renders response login page. It's structure can differ by required scopes and security measures enabled by project (they can change).
For security purposes, we will set `X-Frame-Options: deny` header that will disallow opening this page in an iframe.
+ Parameters
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ `redirect_url`: http://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ response_type: code (enum, required) - Response type, only `code` is supported.
+ Response 200 (text/html; charset=UTF-8)
+ Headers
X-CSRF-Token: my-csrf-token
## oAuth Codes [/oauth/codes]
### Issues oAuth Code Grant [POST /oauth/codes]
API consumer **back-end** should use this method exchange Code Grant to Access Token.
+ Request (application/json)
+ Headers
X-CSRF-Token: `my-csrf-token`
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ login: gandalf (string, required) - Consumer login.
+ password: secret (string, required) - Consumer password.
+ timestamp: 1489583714 (number, optional) - Timestamp when request was made. If timestamp was made more than 15 minutes ago, corresponding error will be returned. Required only if `signature` is present.
+ signature: signature (string, optional) - `login + bcrypt(password) + timestamp` string signed with a consumer's private key. Required for some scopes.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ code: 299383828 (string, required) - oAuth code grant
## oAuth Tokens [/oauth/tokens]
### Exchange oAuth Code Grant to Access Token [POST]
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ client_secret: `mis-001-secret-key` (string, required) - Medical Information System secret key issued upon integration request. Used to identify application developer.
+ code: 299383828 (string, required) - oAuth code grant.
+ `grant_type`: authorization_code (string, fixed) - oAuth Grant Type. Currently only `authorization_code` is supported.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Access_Token)
### Get oAuth Access Token details [GET /oauth/tokens/{access_token}]
This method is designed to be used only by eHealth API gateway.
+ Parameters
+ access_token: `my-oauth-token` (string, required) - oAuth access token.
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Access_Token)
### Set an oAuth Access Token MSP Context [PATCH /oauth/tokens/{access_token}]
This method is designed to be used only by eHealth API gateway.
+ Parameters
+ access_token: `my-oauth-token` (string, required) - oAuth access token.
+ Request (application/json)
+ Attributes
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Access_Token)
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
### Get token to change the password [POST /oauth/tokens]
This method is designed to give the user a possibility to receive a token in ordr to change a password.
+ Request (application/json)
+ Attributes (object)
+ client_id: `b3ae990b-3322-49a9-80ac-27684204ece4` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ email: `[email protected]` (string, required) - user's email
+ password: 299383828 (string, required) - current expired password
+ scope: `user: change_password` (string, required)
+ `grant_type`: change_password (string, fixed) - oAuth Grant Type.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Access_Token_1)
## oAuth Invites [/oauth/invites]
### Create user invite [POST]
+ Request (application/json)
+ Attributes
+ email: [email protected] (string, required)
+ data (object)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ email: [email protected] (string, required)
+ expires_at: `2017-08-19T00:00:00.000Z` (string, required) - ISO Datetime.
+ Response 404 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta)
+ code: 404 (number)
+ error (Response__Error)
+ type: NOT_FOUND (string)
+ message: `Object not found` (string)
+ Response 400 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta)
+ code: 400 (number)
+ error (Response__Error)
+ type: USER_EXISTS (string)
+ message: `User already exists` (string)
### Confirm user invite [POST /oauth/invites/{id}/actions/approve]
+ Request (application/json)
+ Attributes
+ password: password (string, required)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (object)
+ user_id: 60f523a7-c223-4b12-b5a7-b82a53bba94f (string, required)
+ Response 404 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta)
+ code: 404 (number)
+ error (Response__Error)
+ type: NOT_FOUND (string)
+ message: `Object not found` (string)
+ Response 400 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta)
+ code: 400 (number)
+ error (Response__Error)
+ type: EXPIRED (string)
+ message: `User already exists` (string)
## oAuth Users [/oauth/users]
### Get User [GET /oauth/users{?id,email}]
+ Parameters
+ id: 60f523a7-c223-4b12-b5a7-b82a53bba94f (string, optional)
+ email: [email protected] (string, optional)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (object)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
### Request Password Recovery [POST /credentials_recovery_requests]
This method will send password recovery email to a User. Request from this email should be used in
[Reset User password]() method.
+ Request (application/json)
+ Attributes
+ `credentials_recovery_request` (object)
+ email (string)
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (object)
+ is_active: true (boolean)
+ expires_at: `2017-04-20T19:14:13Z` (string) - Expiration datetime in ISO 8601 format
### Reset User Password [PATCH /credentials_recovery_requests/{id}/actions/reset_password]
+ Parameters
+ id: `request-1380df72-275a-11e7-93ae-92361f002671` (string, required)
+ Request (application/json)
+ Attributes
+ user (object)
+ password: `notASecret1` (string, required) - User password. At least 6 characters.
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (`User_Response`)
# Group Internal. Master Patients Index
## Persons [/persons]
### Get Patient by ID [GET /persons/{id}]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`Person_Full`)
### Create or Update person [POST]
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Attributes (Person_Request)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Person_Full`)
### Search for a Person [GET /api/persons{?first_name,last_name,second_name,birth_date,tax_id,phone_number,birth_certificate,birth_place,page,page_size}]
This method allows to search for a Person (MPI) without disclosing personal data.
Method returns only **requested** parameters and those from the search, birth place and second name in addition for manual identification on MSP side.
+ Parameters
+ first_name: Петро (string, required)
+ last_name: Іванов (string, required)
+ second_name: Миколайович (string, optional)
+ birth_date: `1991-08-19T00:00:00.000Z` (string, required) - ISO Datetime.
+ tax_id: 3126509816 (string, optional)
+ phone_number: `+380508887700` (string, optional)
+ `birth_certificate`: 123456 (string, optional) - birth_certificate is optional parameter for search
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`Person_Short`])
+ Response 403 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta, fixed-type)
+ code: 403 (number)
+ error (Response__Error, fixed-type)
+ type: `too_many_results`
+ message: `This API method returns only exact match results, please retry with more specific search result` (string)
### Search for a Person internal [GET /api/persons_internal{?type,number,page,page_size}]
This method allows to search for a Person (MPI) knowing person's document number.
+ Parameters
+ type: passport (string, required)
+ number: `CM123456` (string, required)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Response 200 (application/json)
+ Attributes (Response_Collection_V2)
+ data (array[`Person_Short`])
## Merge Candidates [/merge_candidates]
### Get merge candidates [GET /merge_candidates{?id,person_id,master_person_id,status,limit,starting_after,ending_before}]
+ Parameters
+ id: `8aa4d353-a58f-45f6-b5ce-a89a9cc39391` (string, optional) - Unique record identifier
+ person_id: `50320ee5-2bca-472c-a1a0-28e2e003ec2a` (string, optional) - Merge candidate identifier
+ `master_person_id`: `cb553981-4b7f-45ec-8f73-f77faf2dcb22` (string, optional) - Master person identifier
+ status: NEW (enum, optional) - Record status. Default: NEW
- NEW
- MERGED
+ limit: 20 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`Merge_Candidate`])
### Merge candidate [POST /merge_candidates/{id}/actions/merge]
1. Check current candidate status (status == NEW). If status != NEW - respond with 409 (invalid status)
2. Update mpi.person is_active to false
3. Update mpi.merge_candidates record status to MERGED
+ Parameters
+ id: `8aa4d353-a58f-45f6-b5ce-a89a9cc39391` (string, optional) - Unique record identifier
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`Merge_Candidate`)
# Group Internal. IL DB
### Get Declaration requests List [GET /declaration_requests{?tax_id,employee_id,legal_entity_id,status,page,page_size}]
Methods returns list of declaration requests by combination of patient_id, doctor_id, msp_id.
+ Parameters
+ tax_id: `3381275610` (string, optional) - MPI ID of a patient.
+ employee_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MPI ID of a doctor.
+ `legal_entity_id`: `A7C1ABD7-4472-42CB-9C39-3F3AB1F1F4FD` (string, optional) - MSP ID.
+ status: active (string, optional) - Declaration request current status.
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`crud_Declaration_request_get`])
### Update declaration requests [PATCH /declaration_requests/]
This method to update the declaration request status.
+ Request (application/json)
+ Attributes
+ `declaration_requests` (array[`declaration_request_patch`])
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (array[`crud_Declaration_request_get`])
### Get Declaration documents list [GET /declarations/{id}/documents{?page,page_size}]
Service to get list of signed URLs with the read access for all the documents attached to the declaration request using declaration identifier
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`media_content`])
# Group Internal. OPS DB
## Declarations [/declarations]
### Create Declaration [POST]
Method to register new declaration record
+ Request (application/json)
+ Attributes (Declaration)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_Declaration_get`)
### Update declaration [PATCH /declaration/{id}]
This method to update the declaration status.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_Declaration_patch)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_Declaration_get`)
### Get Declaration Details by ID [GET /declarations/{id}]
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_Declaration_get`)
### Get Declarations List [GET /declarations{?person_id,employee_id,legal_entity_id,division_id,status,page,page_size}]
Methods returns list of declarations by combination of patient_id, doctor_id, msp_id.
Response will contain only records that you have access to.
+ Parameters
+ person_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MPI ID of a patient.
+ employee_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MPI ID of a doctor.
+ `legal_entity_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ division_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ status: active (text, optional) - Search only for active or disabled declarations.
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection_V2)
+ data (array[`crud_Declaration_get`])
### Terminate declarations by employee or person [PATCH /declarations/terminate]
1. One parameter of `employee_id` and `person_id` must be set
2. Search active declarations by `employee_id` or `person_id`
3. Update declarations status to TERMINATED
**Scopes required:** `declaration:terminate`
+ Request (application/json)
+ Attributes (object)
+ employee_id: `73ebee6e-b9d9-41b0-b2ad-ab7704d5306e` (string, optional)
+ person_id: `50320ee5-2bca-472c-a1a0-28e2e003ec2a` (string, optional)
+ reason_description: `Згідно постанови 1 від 10.01.2017` (string, optional)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`nhs_declaration_list`])
# Group Internal. Partner Relationship Management
## Dictionaries [/dictionaries]
### Get dictionaries [GET /dictionaries{?name}]
+ Parameters
+ name: DOCUMENT_TYPE (string, optional)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (array[`Dictionary`])
### Update dictionary [PATCH /dictionaries/{name}]
+ Parameters
+ name: DOCUMENT_TYPE (string, required)
+ Request (application/json)
+ Attributes (Dictionary)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (array[`Dictionary`])
## Party [/party]
### Create new party [POST]
Method to create new party record.
+ Request (application/json)
+ Attributes (object)
+ party(`crud_party_post`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ party(`crud_party_get`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
### Update party [PATCH /party/{id}]
This method to update the employee info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (object)
+ party(`crud_party_post`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ party(`crud_party_get`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
### Search for party [GET /party{?first_name,last_name,second_name,birth_date,no_tax_id,tax_id,phone_number,page,page_size}]
Methods returns list of parties.
+ Parameters
+ first_name: Петро (string, optional)
+ last_name: Іванов (string, optional)
+ second_name: Миколайович (string, optional)
+ birth_date: `1991-08-19T00:00:00.000Z` (string, optional) - ISO Datetime.
+ no_tax_id: false (boolean, optional)
+ tax_id: 3126509816 (string, optional)
+ phone_number: `+380508887700` (string, optional)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array)
+ (object)
+ party(`crud_party_get`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
### Get party details [GET /party/{id}]
Methods returns party details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (object)
+ party(`crud_party_get`)
+ users(array)
+ (object)
+ user_id: `2de19358-0062-4f14-8a50-9dff015ed165` (string, required)
## Employees [/employees]
### Create new employee [POST]
Method to create new employee record for the MSP.
+ Request (application/json)
+ Attributes (crud_employee_post)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (crud_employee_get)
### Update employee [PUT /employees/{id}]
This method to update the employee info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_employee_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (crud_employee_get)
### Search for an Employee [GET /employees{?party_id,no_tax_id,legal_entity_id,division_id,employee_type,status,page,page_size}]
Methods returns list of employees.
+ Parameters
+ `party_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - user_id of a doctor.
+ `no_tax_id`: true (boolean, optional)
+ `legal_entity_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ division_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - division ID.
+ `employee_type`: DOCTOR (string) - `Dictionary: EMPLOYEE_TYPE`
+ status: APPROVED (enum)
- NEW
- APPROVED
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[crud_employee_get])
### Get Employee details [GET /employees/{id}]
Methods returns employee details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_employee_get`)
### Get Employee Request by ID [GET /employee_requests/{id}]
This service should be used for internal services/processes. Used without `access_token`
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Details)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ urgent (object, optional)
+ user_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
### Approve Employee Request [POST /employee_requests/{id}/approve]
This service should be used for approve employee request (set status on APPROVED).
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Details)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
### Reject Employee Request [POST /employee_requests/{id}/reject]
This service should be used for reject employee request (set status on REJECTED).
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Details)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
### Create User via Employee Request [POST /employee_requests/{id}/user{?password}]
This service should be used for internal services/processes. Used without `access_token`
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes
+ password: `qwerty` (string, required)
+ Response 201 (application/json)
+ Headers
Location: /users/10
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (`User_Response`)
## Legal Entities [/legal_entities]
### Get Legal Entities List [GET /legal_entities{?edrpou,type,status,legal_form,owner_property_type,page,page_size}]
+ Parameters
+ edrpou: 5432345432 (string, optional)
+ type (enum, optional)
- MSP
+ status: VERIFIED (enum, optional)
- VERIFIED
- NOT_VERIFIED
+ owner_property_type: state (enum, optional)
- STATE
- PRIVATE
+ legal_form: `ПІДПРИЄМЕЦЬ-ФІЗИЧНА ОСОБА` (enum, optional)
- ПІДПРИЄМЕЦЬ-ФІЗИЧНА ОСОБА
- АКЦІОНЕРНЕ ТОВАРИСТВО
- ВІДКРИТЕ АКЦІОНЕРНЕ ТОВАРИСТВО
- ЗАКРИТЕ АКЦІОНЕРНЕ ТОВАРИСТВО
- РЕЛІГІЙНА ОРГАНІЗАЦІЯ
- ІНШІ ОРГАНІЗАЦІЙНО-ПРАВОВІ ФОРМИ
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[crud_legal_entity_get])
### Get Legal Entity Details by ID [GET /legal_entities/{id}]
+ Parameters
+ id: `1341234` (string)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
### Create Legal Entity [POST]
+ Request (application/json)
+ Attributes (crud_legal_entity_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
### Update Legal Entity [PATCH /legal_entities/{id}]
+ Parameters
+ id: `24352342` (string, required)
+ Request (application/json)
+ Attributes (crud_legal_entity_patch)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
## Divisions [/divisions]
### Create new division [POST]
Method to create new division record.
+ Request (application/json)
+ Attributes (`Division`)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_division_get`)
### Update division [PATCH /divisions/{id}]
This method to update the division info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (`Division`)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_division_get`)
### Search Divisions [GET /divisions/{?type,legal_entity_id,name,page,page_size}]
Methods returns list of legal entity divisions.
+ Parameters
+ type: clinic (string, optional)
+ `legal_entity_id`: 314083428 (string, optional)
+ name: Клініка (string, optional)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`crud_division_get`])
### Get division details [GET /divisions/{id}]
Methods returns Division details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_division_get`)
## Ukrainian medical registry records [/ukr_med_registry]
Registry of all the MSP's that has the `state` ownership type
### Create new ukr_med_registry record [POST]
Method to create new ukr_med_registry record.
+ Request (application/json)
+ Attributes (`crud_ukr_med_registry_post`)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_ukr_med_registry_get`)
### Update ukr_med_registry record [PATCH /ukr_med_registry/{id}]
This method to update the ukr_med_registry info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_ukr_med_registry_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (crud_ukr_med_registry_get)
### Search for the ukr_med_registry record [GET /ukr_med_registry{?edrpou}]
Methods returns list of ukr_med_registry records.
+ Parameters
+ edrpou: 123456 (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`crud_ukr_med_registry_get`])
### Get the ukr_med_registry details [GET /ukr_med_registry/{id}]
Methods returns ukr_med_registry details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_ukr_med_registry_get`)
# Group Internal. Portal and Reports
## MainStats [/reports/stats]
### Get Main Stats [GET /reports/stats/]
Methods returns agregated numbers of declarations, doctors and msp.
Total statistis are calculated on the date that is transmitted in the current date
**Detailed spec:**
```json
{
"data": {
"declarations": 100, -- select count(*) from declarations where inserted_at <= to_date and status in('active', 'pending_verification')
"msps": 2, -- select count(*) from legal_entities where type ='MSP' and inserted_at between start_date and to_date and is_active = true and status='ACTIVE'
"doctors": 15 -- select count(*) from employees where inserted_at between start_date and to_date and is_active = 'true' and employee_type = 'DOCTOR' and status = 'APPROVED'
"pharmacies": 2 -- select count(*) from legal_entities where type ='PHARMACY' inserted_at between start_date and to_date and is_active = 'true' and status='ACTIVE'
"pharmacists": 6 -- select count(*) from employees where inserted_at between start_date and to_date and is_active = 'true' and employee_type = 'PHARMACIST' and status = 'APPROVED'
},
}
```
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (object, optional)
+ declarations: 100 (number, required)
+ msps: 2 (number, required)