Skip to main content

Get started with Dental Odontogram

This guide will walk you through setting up and using the Dental Odontogram application for the first time.
1

Serve the application

The application requires a web server to run properly. Start a local server in the project directory:
python3 -m http.server
Or use any other web server of your choice (Node.js http-server, Apache, nginx, etc.).
2

Open the application

Navigate to the application in your browser:
http://localhost:8000
The application will load and display the odontogram interface.
3

Verify JSON data

Ensure the dientes_fdi_completo.json file is available in the same directory as the application. This file contains FDI tooth information and is required for proper functionality.The application will automatically load this data on startup.
4

Start charting

Use the UI to mark treatments, add notes, and generate reports. Select a treatment type from the left panel and click on tooth surfaces to apply treatments.

Including the scripts

To integrate the odontogram into your own HTML page, include the required scripts in this order:
<!DOCTYPE html>
<html lang="es">
<head>
    <title>Odontograma Dental Profesional</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <!-- jQuery (required) -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <!-- Odontogram plugin -->
    <script src="./jquery.odontogram.js"></script>
    
    <!-- Application styles -->
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <!-- Patient information header -->
    <header class="app-header">
        <div class="patient-info" id="patientInfo">
            <div class="patient-header">
                <span class="patient-label">Nombre del paciente:</span>
                <span class="patient-name" id="patientName">Cargando paciente...</span>
            </div>
        </div>
    </header>

    <div class="main-container" style="margin-top: 60px;">
        <!-- Odontogram canvas -->
        <div class="odontogram-container">
            <canvas id="odontogram">
                Tu navegador no soporta canvas. Por favor actualiza tu navegador.
            </canvas>
        </div>
    </div>

    <!-- Application logic -->
    <script src="./dental-app.js"></script>
    <script src="patient-display.js"></script>
</body>
</html>
The canvas element with id="odontogram" is required for the plugin to initialize properly.

Basic initialization

The odontogram is initialized when the DOM is ready. Here’s how the application initializes:
dental-app.js
/**
 * Initialize app when document is ready
 */
$(document).ready(function () {
  console.log('DOM ready, initializing dual-layer dental application...')
  initApp()
  setupEventHandlers()
})

/**
 * Initialize the odontogram with specified type
 */
function initializeOdontogram(type) {
  console.log('🦷 Initializing odontogram with type:', type)

  // Verify jQuery and plugin are available
  if (typeof $ === 'undefined') {
    console.error('❌ jQuery is not loaded')
    return
  }

  if (typeof $.fn.odontogram === 'undefined') {
    console.error('❌ Odontogram plugin is not loaded')
    return
  }

  // Get canvas element
  const $canvas = $('#odontogram')
  if ($canvas.length === 0) {
    console.error('❌ Canvas element #odontogram not found')
    return
  }

  // Clear existing instance
  $canvas.off('mousemove click').removeData('odontogram')

  // Configure odontogram options
  const options = {
    width: '900px',
    height: '450px',
    toothType: type === 'children' ? 'primary' : 'permanent',
  }

  // Initialize the odontogram
  $canvas.odontogram('init', options)
  $canvas.odontogram('clearAll')
  $canvas.odontogram('setMode', ODONTOGRAM_MODE_DEFAULT)

  console.log('✅ Odontogram initialized successfully')
}

Loading dental data

The application loads FDI tooth information from a JSON file:
dental-app.js
/**
 * Load dental data from JSON file
 */
async function loadDentalData() {
  try {
    const response = await fetch('./dientes_fdi_completo.json')
    dentalData = await response.json()
    console.log('Dental data loaded successfully')
  } catch (error) {
    console.error('Error loading dental data:', error)
  }
}

/**
 * Get tooth information by FDI number
 */
function getToothInfo(fdi) {
  if (!dentalData || !dentalData.dientes) return null
  
  const fdiNumber = parseInt(fdi)
  return dentalData.dientes.find((tooth) => tooth.fdi === fdiNumber)
}

Using the interface

Select dentition type

Choose between adult and children dentition using the radio buttons:
  • Adulto - Permanent teeth (FDI 11-48)
  • Niño - Primary teeth (FDI 51-85)

Select annotation layer

Choose which layer to annotate:
  • Prestación Preexistente (Red) - Existing treatments
  • Prestación Requerida (Blue) - Required treatments

Mark treatments

  1. Click a treatment button from the left panel
  2. Click on tooth surfaces in the odontogram to apply the treatment
  3. The treatment will be marked in red (pre-existing) or blue (required) based on your layer selection

Add notes

Click on a tooth to view its details and add clinical notes in the notes section below the odontogram.

Export data

Click the Exportar button to download a JSON file containing all treatment data:
{
  "fecha": "2026-03-03",
  "nombre": "Patient Name",
  "piezas": [
    {
      "pieza": 11,
      "condiciones": [],
      "prestacion_requerida": ["Obturación - Cara/s: vestibular, mesial"],
      "prestacion_preexistente": ["Corona"],
      "notas": "Clinical notes for this tooth"
    }
  ]
}

Generate report

Click the Descargar button to generate a professional A4 PNG report with:
  • Complete odontogram visualization
  • Treatment details for each tooth
  • Clinical notes
  • Patient information and timestamp
The download/upload functionality requires a backend endpoint at /api/upload-odontogram. See the API Reference for implementation details.

Next steps

Installation guide

Learn about dependencies and file structure

API reference

Explore the jQuery plugin API

Build docs developers (and LLMs) love