Skip to main content

Overview

Regenerate notes for a specific appointment using an external AI notes service in MediSync. This endpoint takes existing transcription data and processes it through an AI service to generate new clinical notes and summary content with specified templates and language preferences.
AI Notes Generation: This endpoint sends transcription data to an external AI service to regenerate clinical notes using customizable templates and language settings. The appointment’s settings are updated with the new template and language preferences.

Authentication

curl -X POST \
  'https://api.medisync.com/notes/regenerate-notes/apt_abc123?uid=doc_xyz789' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "notes_template_type": "soap_note",
    "language": "en"
  }'

Path Parameters

id
string
required
The appointment ID to regenerate notes for

Query Parameters

uid
string
required
The user ID of the healthcare provider requesting the notes regeneration

Body Parameters

notes_template_type
string
required
The template type to use for notes generation (e.g., “soap_note”, “progress_note”, “consultation_note”)
language
string
Language code for notes generation (e.g., “en”, “es”, “fr”). If not provided, will use appointment’s existing language setting.

Response

success
boolean
Indicates if the operation was successful
data
object
Object containing the regenerated notes content
error
string
Error message if the operation failed

Example Response

{
  "success": true,
  "data": {
    "notes": "S: Patient reports chest pain with exertion, denies shortness of breath\nO: VS stable, heart rate 72 bpm, BP 120/80. Physical exam unremarkable, EKG normal\nA: Atypical chest pain, likely musculoskeletal\nP: Continue monitoring, follow-up in 1 week, consider stress test if symptoms persist",
    "summary": "Chest pain evaluation with normal findings - continue monitoring and follow-up"
  }
}

Process Flow

  1. Validation: Validates appointment and template parameters
  2. Data Retrieval: Fetches appointment and transcription data
  3. Template Resolution: Uses provided template type or falls back to appointment settings
  4. External Service Call: Sends transcription data to AI notes service
  5. Database Update: Updates notes with generated content
  6. Appointment Update: Updates appointment with new template and language settings
  7. Real-time Notification: Emits appointment update event to connected clients

Behavior Notes

  • Template Fallback: If template type is not provided in request, uses the appointment’s existing notes_type setting
  • Language Fallback: If language is not provided in request, uses the appointment’s existing language setting
  • Real-time Updates: Emits appointmentUpdated event to notify connected WebSocket clients
  • Development Mode: Automatically adds ‘dev: true’ flag when running in development environment
  • External Service: Communicates with external AI service at http://127.0.0.1:8000/extract-notes/
  • Form Data: Sends data as multipart form data including appointment_id, transcription, uid, dashboard_token, template type, and language

Status Codes

  • 200 - Notes regenerated successfully
  • 400 - Missing required parameters
  • 404 - Appointment or transcription not found
  • 500 - External service error or database update failure