Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diegolozadev/DataMed/llms.txt

Use this file to discover all available pages before exploring further.

Overview

DataMed’s clinical records system provides a unified view of all patient clinical data, organized by admission cycle (Ingreso). Each type of clinical exam is tracked separately while maintaining relationships to the patient’s active treatment cycle.
All clinical records are automatically associated with the patient’s active Ingreso. When a new cycle begins, previous records are preserved but kept separate.

Clinical Record Types

The system tracks seven distinct types of clinical examinations and interventions:

Polysomnography

Basal and titration sleep studies with IAH tracking

Technical Monitoring

CPAP/BiPAP usage data and residual apnea tracking

Nutrition

Nutritional status, dietary habits, and caffeine intake

Psychology

Beck inventories (depression, anxiety) and Athens scale

Pulmonology

Specialist consultations and respiratory assessments

Medical Equipment

CPAP/BiPAP device and mask assignments

Follow-up Notes

Adaptation tracking and patient contact notes

Accessing Clinical Records

1

Navigate to Patient List

Go to PatientsPatient List from the main menu
2

Select Patient

Click on the patient name to open their detail view
3

Access Clinical Records

Click the Clinical History or Historia Clínica button to view all clinical records for the active admission
The clinical record view only displays data for the active Ingreso. This ensures clinical staff see relevant current-cycle data without confusion from previous cycles.

Polysomnography Studies

Sleep studies form the foundation of sleep apnea diagnosis and treatment monitoring.

Baseline Polysomnography (PSG Basal)

The baseline study establishes the patient’s sleep apnea severity before treatment:Key Metrics:
  • IAH (Apnea-Hypopnea Index): Events per hour
  • IDO (Oxygen Desaturation Index)
  • Efficiency: Sleep efficiency percentage
  • Severity: LEVE, MODERADA, GRAVE, NORMAL

Titration Polysomnography (PSG Titulación)

Titration studies determine optimal CPAP/BiPAP pressure settings:
class PolisomnografiaTitulacion(models.Model):
    fecha_titulacion: DateField
    
    # Ventilator settings
    tipo_titulacion: Choice["CPAP", "BPAP", "BPAP ST"]
    presion_ipap: Decimal(5,2)  # Inspiratory pressure
    presion_epap: Decimal(5,2)  # Expiratory pressure (BiPAP only)
    frecuencia_respiratoria: Integer  # Respiratory rate (BiPAP ST)
    
    # Mask configuration
    tipo_mascara: Choice["PILLOW NASAL", "NASAL", "ORONASAL"]
    talla_mascara: Choice["SMALL", "MEDIUM", "LARGE"]
Pressure Settings by Mode:
  • CPAP: Single pressure (IPAP only)
  • BiPAP: Dual pressure (IPAP + EPAP)
  • BiPAP ST: Dual pressure + backup rate

Technical Monitoring (Adaptación)

Monitoring sessions track patient adherence and treatment effectiveness:
1

Navigate to Monitoring Form

Click Register Adaptation from the clinical record view
2

Complete Technical Data

The form includes two tabs:
Usage Metrics:
  • Daily usage percentage
  • Days with ≥4 hours usage
  • Average daily usage hours
Clinical Effectiveness:
  • Baseline hypopnea (auto-filled from PSG Basal)
  • Residual hypopnea (current)
  • Correction percentage (auto-calculated)
Equipment Settings:
  • Ventilator mode (CPAP/BiPAP/BiPAP ST)
  • Pressure settings (IPAP/EPAP)
  • Respiratory rate (if applicable)
  • Mask type and size
  • Average EtCO2
3

Auto-filled Baseline Value

The system automatically retrieves the IAH from the most recent basal PSG:
# Baseline value auto-fill logic
psg = PolisomnografiaBasal.objects.filter(
    ingreso=ingreso_actual
).last()
valor_basal = psg.iah if psg else 0
The correction percentage is calculated as: ((Basal - Residual) / Basal) × 100A correction rate ≥70% indicates effective therapy.

Psychology Sessions

Psychological assessments use standardized instruments:

Beck Depression

Score range: 0-63Higher scores indicate more severe depression symptoms

Beck Anxiety

Score range: 0-63Measures anxiety symptom severity

Athens Insomnia

Score range: 0-24Scores ≥6 suggest insomnia

Registering Psychology Data

# Model structure
class Psicologia(models.Model):
    ingreso: ForeignKey(Ingreso)
    inventario_depre_beck: Integer  # 0-63
    inventario_ansiedad_beck: Integer  # 0-63
    escala_atenas: Integer  # 0-24
    registrado_por: ForeignKey(User)
    created_at: DateTimeField(auto_now_add=True)
Beck Depression Inventory:
  • 0-13: Minimal depression
  • 14-19: Mild depression
  • 20-28: Moderate depression
  • 29-63: Severe depression
Beck Anxiety Inventory:
  • 0-7: Minimal anxiety
  • 8-15: Mild anxiety
  • 16-25: Moderate anxiety
  • 26-63: Severe anxiety
Athens Insomnia Scale:
  • < 6: No clinically significant insomnia
  • ≥ 6: Probable insomnia disorder

Nutrition Sessions

Nutritional assessments track metabolic health and dietary factors affecting sleep:
class Nutricion(models.Model):
    estado_nutricional: Choice[
        "DESNUTRICIÓN",
        "EUTRÓFICO",
        "SOBREPESO",
        "OBESIDAD I",
        "OBESIDAD II",
        "OBESIDAD III"
    ]
    carbohidratos_pct: Decimal(5,2)  # Carb % of diet
    rumiacion: Choice["SI", "NO"]  # Nighttime eating
    cafeina: Decimal(5,2)  # Daily caffeine (mg)

Pulmonology Consultations

Specialist consultations are tracked with minimal structured data:
class Neumologia(models.Model):
    fecha_consulta: DateField
    medico_tratante: CharField(100)
    especialidad: CharField(200)
    # Additional notes typically in clinical narrative
Pulmonology records serve as timestamps for specialist involvement. Detailed consultation notes are typically maintained in external clinical notes or physical records.

Medical Equipment Assignment

Tracking CPAP/BiPAP equipment assigned to patients:
1

Access Equipment Form

Click Register Medical Equipment from the clinical record view
2

Complete Equipment Details

class EquipoMedico(models.Model):
    # Mask configuration
    tipo_mascara_eq_medico: Choice["PILLOW NASAL", "NASAL", "ORONASAL"]
    referencia_mascara: CharField(100)
    talla_mascara: Choice["SMALL", "MEDIUM", "LARGE"]
    
    # Device information
    marca_equipo: Choice["BMC", "RESMED", "PHILIPS RESPIRONICS", ...]
    serial_equipo: CharField(100)  # Unique device identifier
    modo_ventilatorio: Choice["CPAP", "BiPAP", "BiPAP ST"]
3

Track Device Assignment

Equipment records include:
  • Serial number for inventory tracking
  • Assignment timestamp
  • Associated user who assigned equipment
  • BMC: Budget-friendly Chinese manufacturer
  • ResMed: Premium Australian devices
  • Philips Respironics: High-end with recall history
  • Sefan: Regional brand
  • Resvent: Mid-range option
  • Curative: Local distributor brand
  • Prisma: Specialty devices
  • DeVilbiss: Legacy brand

Clinical Record View

The unified clinical record view displays all exam types in chronological order:

Data Organization

# View logic for active cycle only
ingreso_actual = patient.ingresos.filter(estado='ACTIVO').first()

if ingreso_actual:
    monitoreos = Monitoreo.objects.filter(
        ingreso=ingreso_actual
    ).order_by('-id')
    sesiones_psicologia = Psicologia.objects.filter(
        ingreso=ingreso_actual
    ).order_by('-id')
    # ... similar for all exam types
Critical Design Principle: By filtering all clinical records by the active Ingreso, the system ensures that when a new 18-month cycle begins, staff see a clean slate without confusion from previous cycle data.

Audit Trail

All clinical records include automatic audit fields:
FieldTypePurpose
ingresoForeignKeyLinks to specific admission cycle
registrado_porForeignKey(User)User who created the record
created_atDateTimeFieldTimestamp of record creation
To find all records created by a specific user:
# Find all monitoring records by user
user_records = Monitoreo.objects.filter(
    registrado_por=request.user
).select_related('ingreso__paciente')

Best Practices

The baseline polysomnography should be the first clinical record entered, as its IAH value is referenced by monitoring sessions for correction percentage calculation.
Perform and record the titration study before assigning CPAP/BiPAP equipment to ensure correct pressure settings are documented.
Schedule technical monitoring at:
  • Week 2: Initial adaptation check
  • Month 1: First monthly review
  • Months 3, 6, 9, 12, 15, 18: Quarterly reviews
Always record device serial numbers for:
  • Warranty tracking
  • Recall management
  • Inventory control
  • Insurance documentation

Next Steps

Exam Tracking

Learn how to monitor exam completion across capita months

Follow-Up System

Understand the follow-up tracking and alert system

Build docs developers (and LLMs) love