-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
534 lines (513 loc) · 14.6 KB
/
openapi.yaml
File metadata and controls
534 lines (513 loc) · 14.6 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
openapi: 3.0.3
info:
title: HarmonyAPI - Groq-Powered Healthcare Platform
description: AI-powered healthcare provider engagement API with Groq LLM integration for medical literature analysis, risk prediction, and population health analytics
version: "2.2"
contact:
name: API Support
url: https://github.com/aandrx/harmonyAPI
license:
name: MIT
url: https://github.com/aandrx/harmonyAPI/blob/main/LICENSE
servers:
- url: http://localhost:5000
description: Development server
- url: https://hcp-engagement-api.onrender.com
description: Production server (Render)
security:
- BearerAuth: []
paths:
/auth/login:
post:
tags:
- Authentication
summary: User login
description: Authenticate user and return JWT token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
example:
username: "demo_provider"
password: "demo123"
responses:
'200':
description: Successfully authenticated
content:
application/json:
schema:
type: object
properties:
access_token:
type: string
description: JWT access token
token_type:
type: string
example: "bearer"
user:
type: object
properties:
username:
type: string
role:
type: string
specialty:
type: string
'401':
description: Authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/literature/search:
post:
tags:
- Literature
summary: Search medical literature
description: Search PubMed with AI-enhanced analysis
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LiteratureSearch'
example:
specialty: "Cardiology"
keywords: ["heart failure", "statins"]
patient_conditions: ["hypertension"]
max_results: 3
enable_ai_analysis: true
ai_model: "llama-3.1-8b-instant"
response_format: "detailed"
responses:
'200':
description: Literature search results
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "success"
data:
type: object
properties:
studies:
type: array
items:
$ref: '#/components/schemas/Study'
ai_analysis:
$ref: '#/components/schemas/AIAnalysisResult'
search_metadata:
$ref: '#/components/schemas/SearchMetadata'
'401':
$ref: '#/components/responses/UnauthorizedError'
/analytics/predict-risk:
post:
tags:
- Analytics
summary: Predict patient risk
description: Assess patient health risk using clinical rules
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PredictionRequest'
example:
patient_data:
age: 65
systolic_bp: 150
glucose: 130
cholesterol: 250
bmi: 32
smoking: 1
model_type: "risk"
responses:
'200':
description: Risk prediction results
content:
application/json:
schema:
type: object
properties:
status:
type: string
prediction:
type: object
properties:
risk_level:
type: string
enum: [low, medium, high]
risk_score:
type: number
format: float
factors:
type: array
items:
type: string
/analytics/predict-cost:
post:
tags:
- Analytics
summary: Predict treatment cost
description: Estimate treatment costs based on patient data
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PredictionRequest'
example:
patient_data:
age: 65
procedures: ["medication", "imaging"]
risk_level: "high"
model_type: "cost"
responses:
'200':
description: Cost prediction results
content:
application/json:
schema:
type: object
properties:
status:
type: string
prediction:
type: object
properties:
estimated_cost:
type: number
format: float
cost_breakdown:
type: object
/analytics/population-trends:
post:
tags:
- Analytics
summary: Analyze population trends
description: Analyze health trends across patient populations
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PopulationAnalysis'
example:
patients:
- age: 65
conditions: ["hypertension"]
- age: 72
conditions: ["diabetes", "hypertension"]
responses:
'200':
description: Population analysis results
content:
application/json:
schema:
type: object
properties:
status:
type: string
analysis:
type: object
properties:
common_conditions:
type: object
risk_distribution:
type: object
trends:
type: array
items:
type: object
/ai/analyze:
post:
tags:
- AI Analysis
summary: Analyze clinical text
description: Perform AI-powered analysis of clinical text using Groq models
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AIAnalysis'
example:
text: "65-year-old male with heart failure (EF 35%), hypertension, diabetes"
analysis_type: "clinical_implications"
model: "llama-3.1-8b-instant"
responses:
'200':
description: AI analysis results
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "success"
data:
type: object
properties:
analysis:
type: string
description: AI-generated analysis
analysis_type:
type: string
metadata:
type: object
properties:
model_used:
type: string
next_steps:
type: array
items:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
/ai/models:
get:
tags:
- AI Analysis
summary: Get available AI models
description: List all available Groq AI models
security:
- BearerAuth: []
responses:
'200':
description: Available AI models
content:
application/json:
schema:
type: object
properties:
status:
type: string
models:
type: object
additionalProperties:
type: string
example:
"llama-3.1-8b-instant": "Llama 3.1 8B Instant"
"llama-3.1-70b-versatile": "Llama 3.1 70B Versatile"
"mixtral-8x7b-32768": "Mixtral 8x7B"
"gemma2-9b-it": "Gemma 2 9B IT"
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: 'Type "Bearer {token}"'
schemas:
Login:
type: object
required:
- username
- password
properties:
username:
type: string
description: Username
example: "demo_provider"
password:
type: string
description: Password
example: "demo123"
LiteratureSearch:
type: object
required:
- specialty
properties:
specialty:
type: string
description: Medical specialty
example: "Cardiology"
keywords:
type: array
items:
type: string
description: Search keywords
example: ["heart failure", "statins"]
patient_conditions:
type: array
items:
type: string
description: Patient conditions
example: ["hypertension"]
max_results:
type: integer
default: 99
minimum: 1
maximum: 99
description: Maximum number of results (1-99)
enable_ai_analysis:
type: boolean
default: true
description: Enable AI analysis
ai_model:
type: string
default: "llama-3.1-8b-instant"
description: Groq model to use
enum:
- "llama-3.1-8b-instant"
- "llama-3.1-70b-versatile"
- "mixtral-8x7b-32768"
- "gemma2-9b-it"
response_format:
type: string
default: "detailed"
enum: ["compact", "detailed"]
description: Response format
AIAnalysis:
type: object
required:
- text
- analysis_type
properties:
text:
type: string
description: Text to analyze
example: "65-year-old male with heart failure (EF 35%), hypertension, diabetes"
analysis_type:
type: string
enum: ["summary", "relevance", "clinical_implications"]
description: Type of analysis
context:
type: object
description: Additional context for analysis
model:
type: string
default: "llama-3.1-8b-instant"
description: Groq model to use
PredictionRequest:
type: object
required:
- patient_data
- model_type
properties:
patient_data:
type: object
description: Patient EMR data
example:
age: 65
systolic_bp: 150
glucose: 130
cholesterol: 250
bmi: 32
smoking: 1
model_type:
type: string
enum: ["risk", "outcome", "cost"]
description: Type of prediction
PopulationAnalysis:
type: object
required:
- patients
properties:
patients:
type: array
items:
type: object
description: List of patient data objects
Study:
type: object
properties:
id:
type: string
description: Study ID
title:
type: string
description: Study title
journal:
type: string
description: Journal name
publication_date:
type: string
description: Publication date
relevance_score:
type: number
format: float
description: Relevance score
abstract:
type: string
description: Study abstract
url:
type: string
description: PubMed URL
authors:
type: array
items:
type: string
description: Study authors
AIAnalysisResult:
type: object
properties:
summary:
type: string
description: AI-generated summary
key_findings:
type: array
items:
type: string
description: Key findings
confidence_score:
type: number
format: float
description: Confidence score
SearchMetadata:
type: object
properties:
specialty:
type: string
keywords:
type: array
items:
type: string
total_results_returned:
type: integer
timestamp:
type: string
ErrorResponse:
type: object
properties:
status:
type: string
example: "error"
message:
type: string
description: Error message
error:
type: string
description: Error details
responses:
UnauthorizedError:
description: Authentication information is missing or invalid
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- name: Authentication
description: Authentication operations
- name: Literature
description: Medical literature and studies operations
- name: Analytics
description: Advanced analytics and predictions
- name: AI Analysis
description: AI-powered analysis operations