Overview
The/api/analyze endpoint runs the complete ClinicalPilot analysis pipeline:
- Anonymize — Remove PHI from input text
- Parse — Extract structured patient data
- Multi-Agent Debate — Clinical, Literature, Safety, and Critic agents collaborate
- Safety Panel — Parallel medication error prevention checks
- Synthesize — Generate final SOAP note with consensus
Expected latency: 15-30 seconds for complex cases
Endpoint
Request Body
Free-text clinical input (chief complaint, history, exam findings, etc.)
FHIR R4 Bundle resource (alternative to
text)Pre-parsed patient data (alternative to
text or fhir_bundle)You must provide one of:
text, fhir_bundle, or patient_contextPatientContext Schema
Response
Final SOAP note with structured clinical output
Complete debate state with all agent outputs
Medication safety analysis results
SOAPNote Schema
MedErrorPanel Schema
Example Request
Example Response
Error Responses
400 Bad Request
500 Internal Server Error
Notes
All input text is automatically anonymized before processing to remove PHI (Protected Health Information).