@crvouga/mockingbird-service-fullscript 1.7.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.yaml ADDED
@@ -0,0 +1,776 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Fullscript API (Mockingbird subset)
4
+ description: 'Stateful mock subset of the Fullscript API for lab ordering: per-practitioner OAuth (authorize,
5
+ token with authorization_code and refresh_token grants, revoke), clinic, embeddable session grants,
6
+ lab orders, lab-order events, expiring result PDFs, and signed webhooks. Hand-authored from the EMR
7
+ consumer (fullscript-api-client.ts, fullscript-event-model.ts, fullscript-webhook-signature.ts).
8
+
9
+ '
10
+ version: '1'
11
+ x-mockingbird-upstream:
12
+ note: Wire shapes from the consumer app's EMR backend (its Fullscript services and routers);
13
+ the vendor's API reference is behind a partner login.
14
+ servers:
15
+ - url: https://api-us-snd.fullscript.io
16
+ security:
17
+ - bearerAuth: []
18
+ paths:
19
+ /api/oauth/token:
20
+ post:
21
+ operationId: OAuthToken
22
+ description: Exchange an authorization code, or rotate a refresh token (the old refresh token stops
23
+ working).
24
+ x-mockingbird:
25
+ supported: true
26
+ parity:
27
+ enabled: true
28
+ safe: true
29
+ responses:
30
+ '200':
31
+ description: Token
32
+ content:
33
+ application/json:
34
+ schema:
35
+ $ref: '#/components/schemas/OAuthTokenResponse'
36
+ '400':
37
+ description: invalid_grant / unsupported_grant_type / invalid_request
38
+ content:
39
+ application/json:
40
+ schema:
41
+ $ref: '#/components/schemas/OAuthError'
42
+ '401':
43
+ description: invalid_client
44
+ content:
45
+ application/json:
46
+ schema:
47
+ $ref: '#/components/schemas/OAuthError'
48
+ '429':
49
+ description: Rate limited
50
+ content:
51
+ application/json:
52
+ schema:
53
+ $ref: '#/components/schemas/ApiErrors'
54
+ security: []
55
+ requestBody:
56
+ required: true
57
+ content:
58
+ application/json:
59
+ schema:
60
+ $ref: '#/components/schemas/TokenRequest'
61
+ /api/oauth/revoke:
62
+ post:
63
+ operationId: OAuthRevoke
64
+ description: 'Revoke an access or refresh token (RFC 7009: always 200).'
65
+ x-mockingbird:
66
+ supported: true
67
+ parity:
68
+ enabled: true
69
+ safe: false
70
+ responses:
71
+ '200':
72
+ description: Revoked
73
+ content:
74
+ application/json:
75
+ schema:
76
+ type: object
77
+ '401':
78
+ description: invalid_client
79
+ content:
80
+ application/json:
81
+ schema:
82
+ $ref: '#/components/schemas/OAuthError'
83
+ '429':
84
+ description: Rate limited
85
+ content:
86
+ application/json:
87
+ schema:
88
+ $ref: '#/components/schemas/ApiErrors'
89
+ '400':
90
+ description: invalid_request
91
+ content:
92
+ application/json:
93
+ schema:
94
+ $ref: '#/components/schemas/OAuthError'
95
+ security: []
96
+ requestBody:
97
+ required: true
98
+ content:
99
+ application/json:
100
+ schema:
101
+ $ref: '#/components/schemas/RevokeRequest'
102
+ /api/clinic:
103
+ get:
104
+ operationId: GetClinic
105
+ description: The token's clinic.
106
+ x-mockingbird:
107
+ supported: true
108
+ parity:
109
+ enabled: true
110
+ safe: true
111
+ responses:
112
+ '200':
113
+ description: Clinic
114
+ content:
115
+ application/json:
116
+ schema:
117
+ $ref: '#/components/schemas/ClinicResponse'
118
+ '401': &id001
119
+ description: Missing, invalid, expired or revoked access token
120
+ content:
121
+ application/json:
122
+ schema:
123
+ $ref: '#/components/schemas/ApiErrors'
124
+ '429':
125
+ description: Rate limited
126
+ content:
127
+ application/json:
128
+ schema:
129
+ $ref: '#/components/schemas/ApiErrors'
130
+ /api/clinic/embeddable/session_grants:
131
+ post:
132
+ operationId: CreateSessionGrant
133
+ description: A short-lived secret for the embedded Fullscript widget.
134
+ x-mockingbird:
135
+ supported: true
136
+ parity:
137
+ enabled: true
138
+ safe: true
139
+ responses:
140
+ '201':
141
+ description: Grant
142
+ content:
143
+ application/json:
144
+ schema:
145
+ $ref: '#/components/schemas/SessionGrant'
146
+ '401': *id001
147
+ '429':
148
+ description: Rate limited
149
+ content:
150
+ application/json:
151
+ schema:
152
+ $ref: '#/components/schemas/ApiErrors'
153
+ /api/clinic/labs/orders:
154
+ get:
155
+ operationId: ListLabOrders
156
+ description: The clinic's lab orders (optionally one patient's), paged.
157
+ x-mockingbird:
158
+ supported: true
159
+ parity:
160
+ enabled: true
161
+ safe: true
162
+ responses:
163
+ '200':
164
+ description: Page
165
+ content:
166
+ application/json:
167
+ schema:
168
+ $ref: '#/components/schemas/LabOrdersPage'
169
+ '401': *id001
170
+ '429':
171
+ description: Rate limited
172
+ content:
173
+ application/json:
174
+ schema:
175
+ $ref: '#/components/schemas/ApiErrors'
176
+ parameters:
177
+ - name: patient_id
178
+ in: query
179
+ required: false
180
+ schema:
181
+ type: string
182
+ enum:
183
+ - pat_seed_1
184
+ - pat_seed_2
185
+ - pat_missing
186
+ - name: page[number]
187
+ in: query
188
+ required: false
189
+ schema:
190
+ type: integer
191
+ minimum: 1
192
+ maximum: 3
193
+ - name: page[size]
194
+ in: query
195
+ required: false
196
+ schema:
197
+ type: integer
198
+ minimum: 1
199
+ maximum: 100
200
+ /api/clinic/labs/orders/{orderId}:
201
+ get:
202
+ operationId: GetLabOrder
203
+ description: One lab order with tests, per-test results and the aggregated result.
204
+ x-mockingbird:
205
+ supported: true
206
+ parity:
207
+ enabled: true
208
+ safe: true
209
+ responses:
210
+ '200':
211
+ description: Order
212
+ content:
213
+ application/json:
214
+ schema:
215
+ $ref: '#/components/schemas/LabOrderResponse'
216
+ '404':
217
+ description: Unknown order
218
+ content:
219
+ application/json:
220
+ schema:
221
+ $ref: '#/components/schemas/ApiErrors'
222
+ '401': *id001
223
+ '429':
224
+ description: Rate limited
225
+ content:
226
+ application/json:
227
+ schema:
228
+ $ref: '#/components/schemas/ApiErrors'
229
+ parameters:
230
+ - name: orderId
231
+ in: path
232
+ required: true
233
+ schema:
234
+ type: string
235
+ enum:
236
+ - lo_seed_1
237
+ - lo_seed_2
238
+ - lo_seed_3
239
+ - lo_missing
240
+ /api/events/lab_orders:
241
+ get:
242
+ operationId: ListLabOrderEvents
243
+ description: The clinic's lab_order.updated events, newest first by default.
244
+ x-mockingbird:
245
+ supported: true
246
+ parity:
247
+ enabled: true
248
+ safe: true
249
+ responses:
250
+ '200':
251
+ description: Page
252
+ content:
253
+ application/json:
254
+ schema:
255
+ $ref: '#/components/schemas/EventsPage'
256
+ '401': *id001
257
+ '429':
258
+ description: Rate limited
259
+ content:
260
+ application/json:
261
+ schema:
262
+ $ref: '#/components/schemas/ApiErrors'
263
+ parameters:
264
+ - name: order_by
265
+ in: query
266
+ required: false
267
+ schema:
268
+ type: string
269
+ enum:
270
+ - DESC
271
+ - ASC
272
+ - name: page[number]
273
+ in: query
274
+ required: false
275
+ schema:
276
+ type: integer
277
+ minimum: 1
278
+ maximum: 3
279
+ - name: page[size]
280
+ in: query
281
+ required: false
282
+ schema:
283
+ type: integer
284
+ minimum: 1
285
+ maximum: 100
286
+ /api/events/{eventId}:
287
+ get:
288
+ operationId: GetEvent
289
+ description: One event with its data.
290
+ x-mockingbird:
291
+ supported: true
292
+ parity:
293
+ enabled: true
294
+ safe: true
295
+ responses:
296
+ '200':
297
+ description: Event
298
+ content:
299
+ application/json:
300
+ schema:
301
+ $ref: '#/components/schemas/EventResponse'
302
+ '404':
303
+ description: Unknown event
304
+ content:
305
+ application/json:
306
+ schema:
307
+ $ref: '#/components/schemas/ApiErrors'
308
+ '401': *id001
309
+ '429':
310
+ description: Rate limited
311
+ content:
312
+ application/json:
313
+ schema:
314
+ $ref: '#/components/schemas/ApiErrors'
315
+ parameters:
316
+ - name: eventId
317
+ in: path
318
+ required: true
319
+ schema:
320
+ type: string
321
+ enum:
322
+ - evt_1
323
+ - evt_2
324
+ - evt_3
325
+ - evt_missing
326
+ /oauth/authorize:
327
+ get:
328
+ operationId: Authorize
329
+ description: 'The consent page: auto-approves as the requested (or default) practitioner and redirects
330
+ to redirect_uri with code and state.'
331
+ security: []
332
+ x-mockingbird:
333
+ supported: true
334
+ parity:
335
+ enabled: false
336
+ reason: Browser redirect flow; covered by acceptance tests.
337
+ parameters:
338
+ - name: client_id
339
+ in: query
340
+ required: true
341
+ schema:
342
+ type: string
343
+ - name: redirect_uri
344
+ in: query
345
+ required: true
346
+ schema:
347
+ type: string
348
+ - name: response_type
349
+ in: query
350
+ required: true
351
+ schema:
352
+ type: string
353
+ enum:
354
+ - code
355
+ - name: state
356
+ in: query
357
+ required: false
358
+ schema:
359
+ type: string
360
+ - name: scope
361
+ in: query
362
+ required: false
363
+ schema:
364
+ type: string
365
+ - name: practitioner_id
366
+ in: query
367
+ required: false
368
+ schema:
369
+ type: string
370
+ responses:
371
+ '302':
372
+ description: Redirect back with ?code=&state=
373
+ '400':
374
+ description: Bad request
375
+ content:
376
+ application/json:
377
+ schema:
378
+ $ref: '#/components/schemas/OAuthError'
379
+ /results/{artifactId}:
380
+ get:
381
+ operationId: GetResultPdf
382
+ description: An expiring result PDF URL (what pdf_url points at).
383
+ security: []
384
+ x-mockingbird:
385
+ supported: true
386
+ parity:
387
+ enabled: false
388
+ reason: Binary PDF behind an expiring signed URL; covered by acceptance tests.
389
+ parameters:
390
+ - name: artifactId
391
+ in: path
392
+ required: true
393
+ schema:
394
+ type: string
395
+ - name: expires
396
+ in: query
397
+ required: true
398
+ schema:
399
+ type: string
400
+ - name: signature
401
+ in: query
402
+ required: true
403
+ schema:
404
+ type: string
405
+ responses:
406
+ '200':
407
+ description: The PDF
408
+ content:
409
+ application/pdf:
410
+ schema:
411
+ type: string
412
+ format: binary
413
+ '403':
414
+ description: Expired or bad signature
415
+ '404':
416
+ description: Unknown artifact
417
+ components:
418
+ securitySchemes:
419
+ bearerAuth:
420
+ type: http
421
+ scheme: bearer
422
+ schemas:
423
+ TokenRequest:
424
+ type: object
425
+ required:
426
+ - grant_type
427
+ - client_id
428
+ - client_secret
429
+ properties:
430
+ grant_type:
431
+ type: string
432
+ enum:
433
+ - authorization_code
434
+ - refresh_token
435
+ client_id:
436
+ type: string
437
+ minLength: 1
438
+ maxLength: 64
439
+ examples:
440
+ - parity-client
441
+ client_secret:
442
+ type: string
443
+ minLength: 1
444
+ maxLength: 64
445
+ examples:
446
+ - parity-secret
447
+ code:
448
+ type: string
449
+ maxLength: 64
450
+ refresh_token:
451
+ type: string
452
+ maxLength: 200
453
+ redirect_uri:
454
+ type: string
455
+ maxLength: 200
456
+ examples:
457
+ - https://emr.example.com/v1/fullscript/oauth/callback
458
+ RevokeRequest:
459
+ type: object
460
+ required:
461
+ - client_id
462
+ - client_secret
463
+ - token
464
+ properties:
465
+ client_id:
466
+ type: string
467
+ minLength: 1
468
+ maxLength: 64
469
+ client_secret:
470
+ type: string
471
+ minLength: 1
472
+ maxLength: 64
473
+ token:
474
+ type: string
475
+ minLength: 1
476
+ maxLength: 200
477
+ OAuthTokenResponse:
478
+ type: object
479
+ required:
480
+ - oauth
481
+ properties:
482
+ oauth:
483
+ type: object
484
+ required:
485
+ - access_token
486
+ - token_type
487
+ - expires_in
488
+ - refresh_token
489
+ - scope
490
+ - created_at
491
+ - resource_owner
492
+ properties:
493
+ access_token:
494
+ type: string
495
+ x-mockingbird-volatile:
496
+ kind: token
497
+ token_type:
498
+ type: string
499
+ enum:
500
+ - Bearer
501
+ expires_in:
502
+ type: integer
503
+ refresh_token:
504
+ type: string
505
+ x-mockingbird-volatile:
506
+ kind: token
507
+ scope:
508
+ type: string
509
+ created_at: &id002
510
+ type: string
511
+ x-mockingbird-volatile:
512
+ kind: timestamp
513
+ resource_owner:
514
+ type: object
515
+ required:
516
+ - id
517
+ - type
518
+ properties:
519
+ id:
520
+ type: string
521
+ type:
522
+ type: string
523
+ enum:
524
+ - Practitioner
525
+ - Staff
526
+ clinic_id:
527
+ type: string
528
+ OAuthError:
529
+ type: object
530
+ required:
531
+ - error
532
+ properties:
533
+ error:
534
+ type: string
535
+ error_description:
536
+ type: string
537
+ ApiErrors:
538
+ type: object
539
+ required:
540
+ - errors
541
+ properties:
542
+ errors:
543
+ type: array
544
+ items:
545
+ type: object
546
+ required:
547
+ - code
548
+ - message
549
+ properties:
550
+ code:
551
+ type: string
552
+ message:
553
+ type: string
554
+ ClinicResponse:
555
+ type: object
556
+ required:
557
+ - clinic
558
+ properties:
559
+ clinic:
560
+ type: object
561
+ required:
562
+ - id
563
+ - name
564
+ properties:
565
+ id:
566
+ type: string
567
+ name:
568
+ type: string
569
+ created_at: *id002
570
+ SessionGrant:
571
+ type: object
572
+ required:
573
+ - secret_token
574
+ - expires_at
575
+ properties:
576
+ secret_token:
577
+ type: string
578
+ x-mockingbird-volatile:
579
+ kind: token
580
+ expires_at: *id002
581
+ LabOrderSummary:
582
+ type: object
583
+ required:
584
+ - id
585
+ - state
586
+ - treatment_plan_id
587
+ - patient_id
588
+ - created_at
589
+ - updated_at
590
+ properties:
591
+ id:
592
+ type: string
593
+ state:
594
+ type: string
595
+ enum: &id003
596
+ - not_purchased
597
+ - purchased
598
+ - schedule_appointment
599
+ - upcoming_appointment
600
+ - processing
601
+ - partial_results
602
+ - results_ready
603
+ - interpretation_shared
604
+ - results_amended
605
+ treatment_plan_id:
606
+ type:
607
+ - string
608
+ - 'null'
609
+ patient_id:
610
+ type: string
611
+ name:
612
+ type: string
613
+ created_at: *id002
614
+ updated_at: *id002
615
+ LabOrdersPage:
616
+ type: object
617
+ required:
618
+ - orders
619
+ - meta
620
+ properties:
621
+ orders:
622
+ type: array
623
+ items:
624
+ $ref: '#/components/schemas/LabOrderSummary'
625
+ meta: &id005
626
+ type: object
627
+ required:
628
+ - current_page
629
+ - next_page
630
+ - prev_page
631
+ - total_pages
632
+ - total_count
633
+ properties:
634
+ current_page:
635
+ type: integer
636
+ next_page:
637
+ type:
638
+ - integer
639
+ - 'null'
640
+ prev_page:
641
+ type:
642
+ - integer
643
+ - 'null'
644
+ total_pages:
645
+ type: integer
646
+ total_count:
647
+ type: integer
648
+ LabOrderResponse:
649
+ type: object
650
+ required:
651
+ - order
652
+ properties:
653
+ order:
654
+ type: object
655
+ required:
656
+ - id
657
+ - state
658
+ - treatment_plan_id
659
+ - tests
660
+ - results
661
+ - latest_aggregated_result
662
+ properties:
663
+ id:
664
+ type: string
665
+ state:
666
+ type: string
667
+ enum: *id003
668
+ treatment_plan_id:
669
+ type:
670
+ - string
671
+ - 'null'
672
+ patient_id:
673
+ type: string
674
+ name:
675
+ type: string
676
+ collection_method:
677
+ type: string
678
+ created_at: *id002
679
+ updated_at: *id002
680
+ tests:
681
+ type: array
682
+ items:
683
+ type: object
684
+ required:
685
+ - id
686
+ - name
687
+ properties:
688
+ id:
689
+ type: string
690
+ name:
691
+ type: string
692
+ lab_type:
693
+ type: string
694
+ results:
695
+ type: array
696
+ items:
697
+ type: object
698
+ required:
699
+ - id
700
+ - name
701
+ - state
702
+ - pdf_url
703
+ properties:
704
+ id:
705
+ type: string
706
+ name:
707
+ type: string
708
+ state:
709
+ type: string
710
+ pdf_url: &id004
711
+ type: string
712
+ x-mockingbird-volatile:
713
+ kind: url
714
+ latest_aggregated_result:
715
+ type:
716
+ - object
717
+ - 'null'
718
+ properties:
719
+ id:
720
+ type: string
721
+ artifact_id:
722
+ type: string
723
+ pdf_url: *id004
724
+ status:
725
+ type: string
726
+ EventSummary:
727
+ type: object
728
+ required:
729
+ - id
730
+ - type
731
+ - clinic_id
732
+ - created_at
733
+ properties:
734
+ id:
735
+ type: string
736
+ type:
737
+ type: string
738
+ enum:
739
+ - lab_order.updated
740
+ clinic_id:
741
+ type: string
742
+ created_at: *id002
743
+ EventsPage:
744
+ type: object
745
+ required:
746
+ - events
747
+ - meta
748
+ properties:
749
+ events:
750
+ type: array
751
+ items:
752
+ $ref: '#/components/schemas/EventSummary'
753
+ meta: *id005
754
+ EventResponse:
755
+ type: object
756
+ required:
757
+ - event
758
+ properties:
759
+ event:
760
+ type: object
761
+ required:
762
+ - id
763
+ - type
764
+ - clinic_id
765
+ - created_at
766
+ - data
767
+ properties:
768
+ id:
769
+ type: string
770
+ type:
771
+ type: string
772
+ clinic_id:
773
+ type: string
774
+ created_at: *id002
775
+ data:
776
+ type: object