"""FastAPI router for medical exam generation endpoints.This module defines the API routes for generating laboratory exam resultsbased on a given clinical scenario. It provides an endpoint to create astructured set of lab results.Version: 1.2"""importloggingfromfastapiimportAPIRouterfromagentsimportgenerate_lab_examsfrommodelsimportLabExamRequest,LabExamResponse# Configure logginglogger=logging.getLogger(__name__)router=APIRouter(prefix="/exams",tags=["Exams"])
[docs]@router.post("/generate-lab-exams",response_model=LabExamResponse,summary="Generate Laboratory Exams for a Scenario")defgenerate_exams_endpoint(request:LabExamRequest)->LabExamResponse:"""Generates a set of lab results based on a clinical scenario. This endpoint receives a scenario description and generates a corresponding set of lab results, including a textual interpretation for each test. Args: request: A request object containing the clinical scenario description and patient type. Returns: A response object containing the generated laboratory exams. """logger.info(f"Received request to generate lab exams: {request.model_dump()}")returngenerate_lab_exams(request)