Skip to main content

Overview

The Templates API provides access to customizable SOAP note templates and email templates for consistent documentation and communication.

SOAP Template Object

id
string
required
Unique template identifier
title
string
required
Template display name
type
enum
required
Template type: soap, soap_specialist, formatted_dictation, dental_canine, dental_feline, radiograph, callback, tech_appointment, surgery_report, staff_meeting, rounds, lecture_note, custom
description
string
required
Template description
detailLevel
enum
default:"concise"
Detail level: concise or detailed
isDefault
boolean
default:"false"
Whether this is the default template
isBuiltIn
boolean
default:"false"
Whether this is a built-in system template
sections
TemplateSection[]
required
Array of template sections
createdAt
string
Creation timestamp
updatedAt
string
Last update timestamp

TemplateSection Object

id
string
required
Section identifier (used as key in generated content)
name
string
required
Section display name
fields
TemplateField[]
required
Array of fields in this section
order
number
required
Display order

TemplateField Object

id
string
required
Field identifier
name
string
required
Field display name
type
enum
required
Field type: text, number, date, select, checkbox, textarea
required
boolean
default:"false"
Whether field is required
options
string[]
Options for select fields
defaultValue
string
Default value
section
string
Parent section ID
order
number
required
Display order within section

Built-in Templates

Standard SOAP

{
  "id": "soap-standard",
  "title": "SOAP",
  "type": "soap",
  "description": "Standard Subjective, Objective, Assessment, Plan format for general practice",
  "detailLevel": "concise",
  "isDefault": true,
  "isBuiltIn": true,
  "sections": [
    {
      "id": "subjective",
      "name": "Subjective",
      "fields": [
        { "id": "history", "name": "History", "type": "textarea", "required": true, "order": 1 },
        { "id": "chief_complaint", "name": "Chief Complaint", "type": "text", "required": true, "order": 2 }
      ],
      "order": 1
    },
    {
      "id": "objective",
      "name": "Objective",
      "fields": [
        { "id": "vitals", "name": "Vitals", "type": "text", "required": true, "order": 1 },
        { "id": "physical_exam", "name": "Physical Examination", "type": "textarea", "required": true, "order": 2 }
      ],
      "order": 2
    },
    {
      "id": "assessment",
      "name": "Assessment",
      "fields": [
        { "id": "diagnosis", "name": "Diagnosis", "type": "text", "required": true, "order": 1 },
        { "id": "ddx", "name": "Differential Diagnoses", "type": "textarea", "required": false, "order": 2 }
      ],
      "order": 3
    },
    {
      "id": "plan",
      "name": "Plan",
      "fields": [
        { "id": "treatment", "name": "Treatment Plan", "type": "textarea", "required": true, "order": 1 },
        { "id": "medications", "name": "Medications", "type": "textarea", "required": false, "order": 2 },
        { "id": "follow_up", "name": "Follow-up", "type": "text", "required": false, "order": 3 }
      ],
      "order": 4
    }
  ]
}

Dental Examination (Canine)

{
  "id": "dental-canine",
  "title": "Canine Dental Chart",
  "type": "dental_canine",
  "description": "Comprehensive dental examination chart for dogs",
  "detailLevel": "detailed",
  "sections": [
    {
      "id": "dental_exam",
      "name": "Dental Examination",
      "fields": [
        { "id": "tooth_chart", "name": "Tooth Chart", "type": "textarea" },
        { "id": "periodontal_grade", "name": "Periodontal Disease Grade", "type": "select", "options": ["0", "1", "2", "3", "4"] }
      ],
      "order": 1
    },
    {
      "id": "findings",
      "name": "Findings",
      "fields": [
        { "id": "calculus", "name": "Calculus Present", "type": "checkbox" },
        { "id": "gingivitis", "name": "Gingivitis", "type": "checkbox" },
        { "id": "missing_teeth", "name": "Missing Teeth", "type": "text" },
        { "id": "fractured_teeth", "name": "Fractured Teeth", "type": "text" }
      ],
      "order": 2
    },
    {
      "id": "treatment",
      "name": "Treatment Performed",
      "fields": [
        { "id": "cleaning", "name": "Dental Cleaning", "type": "checkbox" },
        { "id": "extractions", "name": "Extractions", "type": "text" },
        { "id": "other_procedures", "name": "Other Procedures", "type": "textarea" }
      ],
      "order": 3
    },
    {
      "id": "recommendations",
      "name": "Home Care Recommendations",
      "fields": [
        { "id": "brushing_frequency", "name": "Brushing Frequency", "type": "select", "options": ["Daily", "3x/week", "Weekly"] },
        { "id": "dental_chews", "name": "Dental Chews Recommended", "type": "checkbox" },
        { "id": "recheck_date", "name": "Recheck Date", "type": "date" }
      ],
      "order": 4
    }
  ]
}

Surgery Report

{
  "id": "surgery-report",
  "title": "Surgery Report",
  "type": "surgery_report",
  "description": "Detailed surgical procedure documentation",
  "detailLevel": "detailed",
  "sections": [
    {
      "id": "preop",
      "name": "Pre-operative Assessment",
      "fields": [
        { "id": "pre_exam", "name": "Pre-operative Examination", "type": "textarea" },
        { "id": "consent", "name": "Owner Consent Obtained", "type": "checkbox" },
        { "id": "fasted", "name": "Fasting Status", "type": "select", "options": ["Fasted overnight", "Fasted 6h", "Not fasted"] }
      ],
      "order": 1
    },
    {
      "id": "anesthesia",
      "name": "Anesthesia Protocol",
      "fields": [
        { "id": "premedication", "name": "Premedication", "type": "text" },
        { "id": "induction", "name": "Induction Agent", "type": "text" },
        { "id": "maintenance", "name": "Maintenance", "type": "text" },
        { "id": "monitoring", "name": "Monitoring", "type": "textarea" }
      ],
      "order": 2
    },
    {
      "id": "procedure",
      "name": "Surgical Procedure",
      "fields": [
        { "id": "procedure_name", "name": "Procedure", "type": "text" },
        { "id": "description", "name": "Procedure Description", "type": "textarea" },
        { "id": "complications", "name": "Complications", "type": "textarea" }
      ],
      "order": 3
    },
    {
      "id": "postop",
      "name": "Post-operative Care",
      "fields": [
        { "id": "recovery", "name": "Recovery", "type": "textarea" },
        { "id": "pain_management", "name": "Pain Management", "type": "text" },
        { "id": "discharge_instructions", "name": "Discharge Instructions", "type": "textarea" },
        { "id": "suture_removal_date", "name": "Suture Removal Date", "type": "date" }
      ],
      "order": 4
    }
  ]
}

List Templates

import { builtInTemplates } from '@/data/templateData';

// Get all built-in templates
const templates = builtInTemplates;

// Filter by type
const soapTemplates = templates.filter(t => t.type.startsWith('soap'));
const dentalTemplates = templates.filter(t => t.type.includes('dental'));

Get Default Template

import { getDefaultTemplate } from '@/data/templateData';

const defaultTemplate = getDefaultTemplate();
// Returns the SOAP template marked as isDefault: true

Create Custom Template

const customTemplate: SOAPTemplate = {
  id: `custom-${Date.now()}`,
  title: 'Orthopedic Consultation',
  type: 'custom',
  description: 'Specialized template for orthopedic cases',
  detailLevel: 'detailed',
  isDefault: false,
  isBuiltIn: false,
  sections: [
    {
      id: 'history',
      name: 'Orthopedic History',
      fields: [
        { id: 'onset', name: 'Onset', type: 'text', required: true, order: 1 },
        { id: 'duration', name: 'Duration', type: 'text', required: true, order: 2 },
        { id: 'lameness_grade', name: 'Lameness Grade (1-5)', type: 'number', required: true, order: 3 }
      ],
      order: 1
    },
    {
      id: 'examination',
      name: 'Orthopedic Examination',
      fields: [
        { id: 'gait_analysis', name: 'Gait Analysis', type: 'textarea', required: true, order: 1 },
        { id: 'palpation', name: 'Palpation Findings', type: 'textarea', required: true, order: 2 },
        { id: 'rom', name: 'Range of Motion', type: 'textarea', required: false, order: 3 }
      ],
      order: 2
    },
    {
      id: 'imaging',
      name: 'Imaging',
      fields: [
        { id: 'radiographs', name: 'Radiographic Findings', type: 'textarea', required: false, order: 1 },
        { id: 'advanced_imaging', name: 'Advanced Imaging (CT/MRI)', type: 'textarea', required: false, order: 2 }
      ],
      order: 3
    },
    {
      id: 'plan',
      name: 'Treatment Plan',
      fields: [
        { id: 'conservative', name: 'Conservative Management', type: 'textarea', required: false, order: 1 },
        { id: 'surgical', name: 'Surgical Options', type: 'textarea', required: false, order: 2 },
        { id: 'referral', name: 'Specialist Referral', type: 'checkbox', required: false, order: 3 }
      ],
      order: 4
    }
  ],
  createdAt: new Date().toISOString(),
  updatedAt: new Date().toISOString()
};

// Save custom template to local storage
const savedTemplates = JSON.parse(localStorage.getItem('custom_templates') || '[]');
savedTemplates.push(customTemplate);
localStorage.setItem('custom_templates', JSON.stringify(savedTemplates));

Email Templates

Email Template Object

id
string
required
Template identifier
name
string
required
Template name
subject
string
required
Email subject line (supports variables)
body
string
required
Email body content (supports variables)
type
string
required
Template type (appointment_reminder, follow_up, etc.)
variables
string[]
required
Available variables for substitution

Built-in Email Templates

const emailTemplates: EmailTemplate[] = [
  {
    id: 'appointment-reminder',
    name: 'Appointment Reminder',
    subject: 'Reminder: {petName} has an appointment tomorrow',
    body: `Hi {ownerName},\n\nThis is a reminder that {petName} has an appointment scheduled for {appointmentDate} at {appointmentTime} with {vetName}.\n\nPlease arrive 10 minutes early to complete check-in.\n\nIf you need to reschedule, please call us at (555) 123-4567.\n\nThank you!\n{clinicName}`,
    type: 'appointment_reminder',
    variables: ['petName', 'ownerName', 'appointmentDate', 'appointmentTime', 'vetName', 'clinicName']
  },
  {
    id: 'follow-up',
    name: 'Post-Visit Follow-up',
    subject: 'Follow-up: How is {petName} doing?',
    body: `Hi {ownerName},\n\nWe wanted to check in and see how {petName} is doing after the visit on {visitDate}.\n\nIf you have any questions or concerns, please don't hesitate to reach out.\n\nBest regards,\n{vetName} and the team at {clinicName}`,
    type: 'follow_up',
    variables: ['petName', 'ownerName', 'visitDate', 'vetName', 'clinicName']
  },
  {
    id: 'vaccination-due',
    name: 'Vaccination Due',
    subject: '{petName} is due for vaccinations',
    body: `Hi {ownerName},\n\nOur records show that {petName} is due for the following vaccinations:\n{vaccinations}\n\nPlease call us at (555) 123-4567 to schedule an appointment.\n\nKeeping vaccinations up to date protects {petName} and other pets in the community.\n\nThank you!\n{clinicName}`,
    type: 'vaccination_reminder',
    variables: ['petName', 'ownerName', 'vaccinations', 'clinicName']
  }
];

Using Email Templates

const fillEmailTemplate = (
  template: EmailTemplate,
  variables: Record<string, string>
): { subject: string; body: string } => {
  let subject = template.subject;
  let body = template.body;

  // Replace all variables
  for (const [key, value] of Object.entries(variables)) {
    const placeholder = `{${key}}`;
    subject = subject.replace(new RegExp(placeholder, 'g'), value);
    body = body.replace(new RegExp(placeholder, 'g'), value);
  }

  return { subject, body };
};

// Example usage
const reminderTemplate = emailTemplates.find(t => t.id === 'appointment-reminder')!;
const email = fillEmailTemplate(reminderTemplate, {
  petName: 'Buddy',
  ownerName: 'John Smith',
  appointmentDate: 'December 16, 2024',
  appointmentTime: '2:30 PM',
  vetName: 'Dr. Sarah Chen',
  clinicName: 'Paw & Care Veterinary Clinic'
});

console.log(email.subject); // "Reminder: Buddy has an appointment tomorrow"

Build docs developers (and LLMs) love