Skip to main content
Sully.ai generates clinical notes with structured JSON output, enabling direct integration with Electronic Health Record (EHR) systems. This guide covers how to extract, transform, and map JSON data to your EHR fields.

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


JSON Output from SOAP Notes

When using noteType: { 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 a result field containing the generated content.

Template JSON Structure

When you create a note with a template, the response includes the template structure with populated result fields:

Extracting Template Results

Use meaningful, consistent section IDs in your templates. This makes it easy to extract specific fields programmatically without parsing the entire structure.

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

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


Best Practices

Validate JSON Before Writing

Always validate extracted JSON before writing to your EHR:

Handle Missing/Optional Fields

Not all fields will be present in every note. Handle missing data gracefully:

Log Transformations for Audit

Maintain an audit trail of all data transformations:

Use Templates for Predictable Output

For the most predictable JSON structure, use note templates with well-defined section IDs:

Next Steps

Clinical Notes Guide

Learn about SOAP notes, custom styles, and templates

Webhooks Guide

Set up real-time notifications for your pipeline

Note Template Schema

Complete reference for template section types

Text-to-JSON API

API reference for custom JSON extraction