Skip to main content

Overview

The Odontogram is an interactive dental chart that allows dentists to visually document the status of each tooth, including cavities, restorations, extractions, and treatments. It follows the FDI World Dental Federation notation system for tooth numbering.

Tooth Numbering System

FDI Two-Digit Notation

The system uses the internationally recognized FDI notation:

Upper Teeth

Right: 18, 17, 16, 15, 14, 13, 12, 11Left: 21, 22, 23, 24, 25, 26, 27, 28

Lower Teeth

Right: 48, 47, 46, 45, 44, 43, 42, 41Left: 31, 32, 33, 34, 35, 36, 37, 38

Tooth Number Breakdown

First digit = Quadrant (1-4 for adults)
  1 = Upper Right
  2 = Upper Left  
  3 = Lower Left
  4 = Lower Right

Second digit = Tooth position (1-8)
  1 = Central Incisor
  2 = Lateral Incisor
  3 = Canine
  4 = First Premolar
  5 = Second Premolar
  6 = First Molar
  7 = Second Molar
  8 = Third Molar (Wisdom Tooth)

Database Schema

CREATE TABLE odontograms (
    id INT AUTO_INCREMENT PRIMARY KEY,
    patient_id INT NOT NULL,
    tooth_number INT NOT NULL,
    state ENUM('healthy', 'caries', 'restored', 'extracted', 'crown', 'treatment') DEFAULT 'healthy',
    notes TEXT,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY (patient_id) REFERENCES patients(id) ON DELETE CASCADE
);
The state field now stores JSON strings for complex tooth status including surface-specific treatments.

Component Architecture

Odontogram Component

The main component is located at:
src/lib/components/Odontogram.svelte
Props:
let {
  toothStates = $bindable({}),  // Object mapping tooth numbers to states
  readOnly = false,              // Disable editing for view-only mode
  onsubmitted = undefined        // Callback when changes are saved
} = $props();

ToothSVG Component

Individual teeth are rendered using:
src/lib/components/Odontology/ToothSVG.svelte
This component:
  • Renders SVG representation of tooth anatomy
  • Supports clickable surfaces (mesial, distal, occlusal, vestibular, lingual)
  • Color-codes surfaces based on status
  • Handles both general tooth state and surface-specific conditions

Tooth Status Options

General Tooth Status

Value: "" (empty string)Tooth is healthy with no treatments or conditions.
Value: "extracted"Tooth has been removed. Displayed with X mark.
Value: "crown"Tooth has a crown or cap.
Value: "treatment"Tooth is currently undergoing treatment (e.g., root canal in progress).
Value: "endodontics"Root canal treatment completed.

Surface-Specific Status

Caries

Value: "caries"Cavity or decay on this surface.

Restored

Value: "restored"Surface has been filled or restored.

Sealant

Value: "sealant"Preventive sealant applied.

Fracture

Value: "fracture"Crack or fracture on this surface.

Tooth Surfaces

Each tooth can have conditions marked on specific surfaces:
  • Mesial: Surface facing toward the front/midline
  • Distal: Surface facing toward the back
  • Occlusal: Biting/chewing surface (top)
  • Vestibular (Buccal): Surface facing the cheek/lips
  • Lingual (Palatal): Surface facing the tongue/palate
Diagram of tooth surfaces

Interactive Features

Clicking on Teeth

Whole Tooth Click:
function handleToothClick(toothNumber) {
  if (readOnly) return;
  selectedTooth = toothNumber;
  // Open modal to set general tooth status
  showTreatmentModal = true;
}
Surface Click:
function handleSurfaceClick(toothNumber, surface) {
  if (readOnly) return;
  selectedTooth = toothNumber;
  selectedSurface = surface;
  // Open modal with surface pre-selected
  showTreatmentModal = true;
}

Treatment Modal

When a tooth or surface is clicked, a modal opens with:
  1. General State Dropdown: Select overall tooth status (normal, extracted, crown, etc.)
  2. Surface Status Selectors: Mark individual surfaces as caries, restored, sealant, or fracture
  3. Notes Field: Add clinical observations or treatment details
  4. Save Button: Persist changes to database

State Management

JSON State Format

Tooth states are stored as JSON strings:
{
  "general": "crown",
  "surfaces": {
    "mesial": "restored",
    "distal": "caries",
    "occlusal": "restored",
    "vestibular": "",
    "lingual": ""
  }
}

Parsing State

function parseToothState(stateString) {
  if (!stateString) return { general: '', surfaces: {} };
  
  if (stateString.startsWith('{')) {
    try {
      return JSON.parse(stateString);
    } catch (e) {
      return { general: stateString, surfaces: {} };
    }
  }
  
  // Legacy format: simple string
  return { general: stateString, surfaces: {} };
}

Saving State

async function saveTreatment() {
  const finalState = JSON.stringify({
    general: treatmentData.generalState,
    surfaces: treatmentData.surfaces
  });
  
  await onsubmitted({
    tooth_number: selectedTooth,
    state: finalState,
    notes: treatmentData.notes
  });
  
  toothStates[selectedTooth] = finalState;
  showTreatmentModal = false;
}

API Integration

Fetching Odontogram

GET /api/patients/{patientId}/odontogram

Response: {
  success: true,
  odontogram: [
    {
      tooth_number: 16,
      state: '{"general":"crown","surfaces":{"occlusal":"restored"}}',
      notes: 'Corona de porcelana colocada hace 2 años',
      updated_at: '2026-02-15T10:30:00Z'
    },
    ...
  ]
}

Updating Tooth Status

POST /api/patients/{patientId}/odontogram

Body: {
  tooth_number: number,
  state: string, // JSON string
  notes?: string
}

Response: {
  success: true,
  message: 'Tooth updated'
}

Visual Representation

Color Coding

Surfaces are color-coded for quick visual assessment:
const surfaceColors = {
  '': '#f8fafc',        // Healthy: Very light gray
  'caries': '#fee2e2',  // Red tint
  'restored': '#dbeafe', // Blue tint  
  'sealant': '#fef3c7',  // Yellow tint
  'fracture': '#ffe4e6'  // Pink tint
};

General Status Indicators

  • Extracted: Large X drawn across tooth
  • Crown: Crown icon or border highlight
  • Treatment: Yellow/amber border
  • Endodontics: Root canal symbol in tooth center

Read-Only Mode

View-Only Access

Users with only VIEW_ODONTOGRAM permission see a non-interactive odontogram:
<Odontogram 
  toothStates={patientOdontogram}
  readOnly={!$can('EDIT_ODONTOGRAM')}
/>
In read-only mode:
  • Tooth clicks are disabled
  • Surface clicks are disabled
  • Color coding still visible for status review
  • No treatment modal appears

Odontogram Tab

The patient profile includes a dedicated Odontogram tab:
src/lib/components/patients/tabs/OdontogramTab.svelte
Features:
  • Full odontogram display
  • Legend explaining colors and symbols
  • History of odontogram changes
  • Print/export functionality
Odontogram tab in patient profile

Permissions

Module: ClínicoView the patient’s odontogram and tooth status history.
Module: ClínicoMark and modify tooth conditions on the odontogram. Typically restricted to dentists.

Treatment Planning

Using Odontogram for Planning

The odontogram helps with:
  1. Treatment prioritization: Identify urgent cases (caries) vs. preventive care
  2. Cost estimation: Count restorations, crowns, and extractions needed
  3. Progress tracking: Compare odontograms over time to see treatment completion
  4. Patient education: Visual aid to explain needed treatments

Treatment Plan Workflow

1

Initial Assessment

Mark all current conditions during first examination.
2

Plan Treatments

Identify teeth needing restoration, extraction, or other procedures.
3

Track Progress

Update tooth status after each completed treatment.
4

Review Outcomes

Compare before/after odontograms to demonstrate care completion.

Best Practices

  • Update odontogram after every clinical visit
  • Add detailed notes for complex treatments
  • Use surface-specific marking for precision
  • Document extractions and missing teeth

Mobile Responsiveness

The odontogram requires a minimum screen width for proper tooth visualization. On mobile devices, users can:
  • Scroll horizontally to view all teeth
  • Pinch to zoom for detail
  • Rotate to landscape for better view
.odontogram-scroll-area {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.odontogram-canvas {
  min-width: 900px;
  padding: 20px;
}

Integration with Medical Records

Odontogram updates can be linked to medical records:
  • When creating a medical record about tooth extraction, update odontogram
  • Reference specific teeth in treatment notes using FDI notation
  • Generate treatment plans based on odontogram analysis
  • Track treatment completion by comparing odontogram versions
The notes field in the odontograms table can reference the medical record ID for full traceability.

Build docs developers (and LLMs) love