{ "openapi": "3.1.0", "info": { "title": "PillChecker API", "description": "Medication interaction checker", "version": "0.1.0" }, "paths": { "/health": { "get": { "summary": "Health Check", "description": "Basic health check to verify the API is running.", "operationId": "health_check_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/health/data": { "get": { "summary": "Data Health Check", "description": "Check the status of the drug interaction data source.", "operationId": "data_health_check_health_data_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/analyze": { "post": { "summary": "Analyze", "operationId": "analyze_analyze_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyzeRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyzeResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/interactions": { "post": { "summary": "Check Interactions", "operationId": "check_interactions_interactions_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InteractionsRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InteractionsResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/cache/clear": { "post": { "tags": [ "admin" ], "summary": "Clear Cache", "description": "Clear all in-memory caches. Requires API key authentication.", "operationId": "clear_cache_admin_cache_clear_post", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } } }, "components": { "schemas": { "AnalyzeDataSources": { "properties": { "ner_model": { "type": "string", "title": "Ner Model" } }, "type": "object", "required": [ "ner_model" ], "title": "AnalyzeDataSources" }, "AnalyzeRequest": { "properties": { "text": { "type": "string", "maxLength": 5000, "minLength": 1, "title": "Text", "examples": [ "BRUFEN Ibuprofen 400 mg Film-Coated Tablets" ] } }, "type": "object", "required": [ "text" ], "title": "AnalyzeRequest" }, "AnalyzeResponse": { "properties": { "drugs": { "items": { "$ref": "#/components/schemas/DrugResult" }, "type": "array", "title": "Drugs" }, "raw_text": { "type": "string", "title": "Raw Text" }, "data_sources": { "anyOf": [ { "$ref": "#/components/schemas/AnalyzeDataSources" }, { "type": "null" } ] }, "note": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Note" } }, "type": "object", "required": [ "drugs", "raw_text" ], "title": "AnalyzeResponse" }, "DrugResult": { "properties": { "rxcui": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Rxcui" }, "name": { "type": "string", "title": "Name" }, "dosage": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Dosage" }, "form": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Form" }, "source": { "type": "string", "title": "Source" }, "confidence": { "type": "number", "title": "Confidence" }, "needs_confirmation": { "type": "boolean", "title": "Needs Confirmation", "default": false } }, "type": "object", "required": [ "rxcui", "name", "dosage", "form", "source", "confidence" ], "title": "DrugResult" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "InteractionResult": { "properties": { "drug_a": { "type": "string", "title": "Drug A" }, "drug_b": { "type": "string", "title": "Drug B" }, "severity": { "type": "string", "title": "Severity" }, "description": { "type": "string", "title": "Description" }, "management": { "type": "string", "title": "Management" }, "uncertain": { "type": "boolean", "title": "Uncertain", "default": false } }, "type": "object", "required": [ "drug_a", "drug_b", "severity", "description", "management" ], "title": "InteractionResult" }, "InteractionsDataSources": { "properties": { "drugbank_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Drugbank Version" }, "severity_classifier": { "type": "string", "title": "Severity Classifier" } }, "type": "object", "required": [ "severity_classifier" ], "title": "InteractionsDataSources" }, "InteractionsRequest": { "properties": { "drugs": { "items": { "type": "string", "maxLength": 200, "minLength": 1 }, "type": "array", "minItems": 2, "title": "Drugs", "examples": [ [ "ibuprofen", "warfarin" ] ] } }, "type": "object", "required": [ "drugs" ], "title": "InteractionsRequest" }, "InteractionsResponse": { "properties": { "interactions": { "items": { "$ref": "#/components/schemas/InteractionResult" }, "type": "array", "title": "Interactions" }, "safe": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Safe" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error" }, "data_sources": { "anyOf": [ { "$ref": "#/components/schemas/InteractionsDataSources" }, { "type": "null" } ] }, "limitations": { "items": { "type": "string" }, "type": "array", "title": "Limitations", "default": [ "Checks pairwise interactions only \u2014 multi-drug cascades are not detected", "Does not account for patient-specific factors (age, weight, renal/hepatic function, genetics)", "Coverage depends on DrugBank database scope (~19,800 drugs)", "Not a substitute for professional medical advice" ] } }, "type": "object", "required": [ "interactions", "safe" ], "title": "InteractionsResponse" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }