-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.json
380 lines (380 loc) · 14.6 KB
/
openapi.json
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
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/api/v1/healthcheck": {
"get": {
"summary": "Healthcheck",
"description": "**Description**\n\nHealthcheck to confirm the service endpoint is running.",
"operationId": "healthcheck_api_v1_healthcheck_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/api/v1/predict-batch": {
"post": {
"summary": "Predict Batch Api",
"description": "**Description:**\n\nGiven a csv file, predict the data rows' genre and upload the predictions\nto postgres database.\n\n**Request Body**\n- **csv_file**: Data file containing all required columns, in the correct\n data format\n\n**Response Structure**\n- **info**\n - **total_rows_uploaded** - The total number of rows detected in the\n uploaded csv.\n - **total_rows_w_na** - The number of rows with at least 1 NA field,\n which are dropped before the prediction.\n - **total_rows_added_to_db** - The total number of rows upserted to\n database. (Note that entries which already exist in the database\n will be updated).\n\n**Backend Logic**\n1. Validate dataframe (field, order, data type).\n2. Process dataframe & generate features (including the use of individual\n model's vectorizer).\n3. Generate predictions followed by simple averaging of the logits across\n models (lightgbm with the same parameter, trained using different\n fold of data).\n4. Predictions (trackid, title and predicted genre) are upserted to\n database.",
"operationId": "predict_batch_api_api_v1_predict_batch_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Client-Id",
"type": "string"
},
"name": "client-id",
"in": "header"
},
{
"required": true,
"schema": {
"title": "Client-Secret",
"type": "string"
},
"name": "client-secret",
"in": "header"
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_predict_batch_api_api_v1_predict_batch_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/src__classifier__schema__predict_batch__Model"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/genre/title-list": {
"get": {
"summary": "Title List Api",
"description": "**Description:**\n\nGet the list of titles that is classified under the selected genre.\n\n**Request Body**\n- **genre**: The genre of interest. Must be one of [\"metal\", \"folk\",\n \"jazz and blues\", \"soul and reggae\", \"classic pop and rock\", \"punk\",\n \"dance and electronica\", \"pop\"].\n\n**Response Structure**\n- **genre** - The genre queried.\n- **titles** - The list of sorted titles associated with the queried genre.",
"operationId": "title_list_api_api_v1_genre_title_list_get",
"parameters": [
{
"required": true,
"schema": {
"$ref": "#/components/schemas/Genre"
},
"name": "genre",
"in": "query"
},
{
"required": true,
"schema": {
"title": "Client-Id",
"type": "string"
},
"name": "client-id",
"in": "header"
},
{
"required": true,
"schema": {
"title": "Client-Secret",
"type": "string"
},
"name": "client-secret",
"in": "header"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/src__genre__schema__title_list__Model"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/genre/list": {
"get": {
"summary": "Genre List Api",
"description": "**Description:**\n\nGet the list of genres available in the database.\n\n**Response Structure**\n- **genre** - The full list of genre available in the database.",
"operationId": "genre_list_api_api_v1_genre_list_get",
"parameters": [
{
"required": true,
"schema": {
"title": "Client-Id",
"type": "string"
},
"name": "client-id",
"in": "header"
},
{
"required": true,
"schema": {
"title": "Client-Secret",
"type": "string"
},
"name": "client-secret",
"in": "header"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/src__genre__schema__genre_list__Model"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/": {
"get": {
"summary": "Index",
"operationId": "index__get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Body_predict_batch_api_api_v1_predict_batch_post": {
"title": "Body_predict_batch_api_api_v1_predict_batch_post",
"required": [
"csv_file"
],
"type": "object",
"properties": {
"csv_file": {
"title": "Csv File",
"type": "string",
"format": "binary"
}
}
},
"Genre": {
"title": "Genre",
"enum": [
"metal",
"folk",
"jazz and blues",
"soul and reggae",
"classic pop and rock",
"punk",
"dance and electronica",
"pop"
],
"description": "An enumeration."
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
},
"Info": {
"title": "Info",
"required": [
"total_rows_uploaded",
"total_rows_w_na",
"total_rows_added_to_db"
],
"type": "object",
"properties": {
"total_rows_uploaded": {
"title": "Total Rows Uploaded",
"type": "integer"
},
"total_rows_w_na": {
"title": "Total Rows W Na",
"type": "integer"
},
"total_rows_added_to_db": {
"title": "Total Rows Added To Db",
"type": "integer"
}
}
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"type": "string"
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
},
"src__classifier__schema__predict_batch__Model": {
"title": "Model",
"required": [
"status",
"status_code",
"info"
],
"type": "object",
"properties": {
"status": {
"title": "Status",
"type": "string"
},
"status_code": {
"title": "Status Code",
"type": "integer"
},
"info": {
"$ref": "#/components/schemas/Info"
}
}
},
"src__genre__schema__genre_list__Model": {
"title": "Model",
"required": [
"status",
"status_code",
"genre"
],
"type": "object",
"properties": {
"status": {
"title": "Status",
"type": "string"
},
"status_code": {
"title": "Status Code",
"type": "integer"
},
"genre": {
"title": "Genre",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"src__genre__schema__title_list__Model": {
"title": "Model",
"required": [
"status",
"status_code",
"genre",
"titles"
],
"type": "object",
"properties": {
"status": {
"title": "Status",
"type": "string"
},
"status_code": {
"title": "Status Code",
"type": "integer"
},
"genre": {
"title": "Genre",
"type": "string"
},
"titles": {
"title": "Titles",
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}