Overview
When generating clinical notes, Sully.ai provides structured JSON alongside markdown output. This structured data makes it straightforward to:- Map to EHR fields - Extract specific data points for direct field population
- Maintain consistency - Ensure predictable output structure for automated workflows
- Validate data - Apply schemas and business rules before writing to EHR
- Audit transformations - Track data flow from note generation to EHR entry
Structured Output Options
| Approach | JSON Structure | Best For |
|---|---|---|
| SOAP Notes | Fixed structure with subjective, objective, assessment, plan | Standard clinical documentation |
| Note Templates | Custom structure matching your template sections | EHR-specific field requirements |
| Text-to-JSON | Schema-defined extraction from any text | Post-processing existing notes |
JSON Output from SOAP Notes
When usingnoteType: { type: 'soap' }, the response includes both markdown and JSON formats. The JSON provides structured access to each SOAP section.
SOAP JSON Structure
Accessing SOAP JSON Fields
JSON Output from Templates
Note templates return structured JSON matching your template section definitions. Each section includes aresult field containing the generated content.
Template JSON Structure
When you create a note with a template, the response includes the template structure with populatedresult fields:
Extracting Template Results
Text-to-JSON Utility
The text-to-JSON endpoint transforms unstructured text into structured JSON using a schema you define. This is useful for extracting specific fields from existing notes or normalizing data.Endpoint
Use Cases
- Extract specific fields from free-text clinical notes
- Normalize data from different note formats
- Pull structured data from legacy documentation
- Create custom field extractions not covered by SOAP or templates
Example: Extract Medications from Free Text
Field Mapping Patterns
Map Sully.ai JSON output to your EHR system fields. The following table shows common mappings.SOAP JSON to EHR Field Mappings
| SOAP JSON Path | EHR Field | Data Type | Notes |
|---|---|---|---|
subjective.chiefComplaint | ChiefComplaint | String | Primary reason for visit |
subjective.historyOfPresentIllness | HPI | String | Symptom narrative |
subjective.reviewOfSystems.* | ROS_* | Object | Map each system separately |
objective.vitalSigns.bloodPressure | VitalSigns.BP | String | Format: “120/80” |
objective.vitalSigns.heartRate | VitalSigns.HR | String | Beats per minute |
objective.physicalExam.* | PhysicalExam_* | Object | Map each exam section |
assessment.diagnoses[] | ProblemList | Array | Each diagnosis as separate entry |
assessment.diagnoses[].icdCode | DiagnosisCode | String | ICD-10 code if available |
assessment.clinicalImpression | ClinicalImpression | String | Assessment narrative |
plan.medications[] | MedicationOrders | Array | Each medication as order |
plan.patientEducation[] | PatientInstructions | Array | Education items |
plan.followUp | FollowUpInstructions | String | Return visit info |
Mapping Implementation
Handling Arrays vs Single Values
Some EHR systems expect single values where Sully.ai returns arrays. Handle these cases explicitly:Integration Pipeline
A production EHR integration typically follows this pipeline:Webhook-Based Pipeline
Use webhooks for production workloads to avoid polling and handle events asynchronously.Error Handling at Each Step
| Pipeline Step | Common Errors | Handling Strategy |
|---|---|---|
| Transcription | Audio format, quality issues | Notify user, request re-upload |
| Note Generation | Insufficient transcript content | Fall back to manual note entry |
| JSON Extraction | Missing expected fields | Use defaults, flag for review |
| Transformation | Schema mismatch | Log transformation errors, queue for manual mapping |
| Validation | Required fields missing | Reject with specific error message |
| EHR Write | API errors, timeouts | Retry with backoff, queue for manual entry |