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 patient management system handles the complete lifecycle of sleep apnea patients, from registration through 18-month capita cycles with automatic state tracking and clinical data organization.
All patient data is organized by Ingreso (admission cycles). Each patient can have multiple cycles throughout their treatment history.

Patient States

The system tracks three distinct patient states within each admission cycle:

ACTIVO

Patient is currently enrolled and receiving treatment

SUSPENDIDO

Treatment temporarily paused (e.g., waiting for equipment)

TERMINADO

Capita cycle completed or treatment discontinued

Creating a New Patient

1

Access Patient Creation

Navigate to PatientsCreate Patient in the main navigation menu
2

Complete Patient Information

Fill in the required demographic and clinical information:
  • Personal Information: Name, document type & number, date of birth, gender
  • Contact Details: Department, city, zone (urban/rural), phone numbers
  • Administrative: Health entity (Ecopetrol, Sanitas), civil status, socioeconomic stratum
3

Set Admission Date

The fecha_inicio_programa (program start date) automatically creates an active Ingreso:
# Automatic Ingreso creation on patient save
Ingreso.objects.create(
    paciente=patient,
    fecha_inicio=fecha_ingreso,
    estado='ACTIVO'
)
4

Confirm Creation

Click Save to create the patient. The system confirms with a success message and redirects to the patient list.
When a patient is created, their capita cycle automatically starts at Month 1 based on the admission date.
The patient list view provides powerful filtering and search capabilities:

Search Filters

The patient list supports three filter types:Text Search - Searches across:
  • First name (nombre)
  • Last name (apellido)
  • Document number (documento)
Capita Month Filter - Filter patients by their current capita month (1-18):
# Capita month is calculated from admission date
@property
def mes_capita(self):
    hoy = date.today()
    meses = (hoy.year - self.fecha_inicio.year) * 12 + \
            (hoy.month - self.fecha_inicio.month) + 1
    
    if meses < 1: return 1
    if meses > 18: return 18
    return meses
Active Status Filter - By default, only shows patients with ACTIVO status

Pagination

The system displays 10 patients per page to optimize performance and improve usability. Search filters persist across page navigation.

Editing Patient Information

1

Access Patient Details

Click on any patient name in the patient list to open their detail view
2

Update Information

Modify any patient field as needed. The form pre-populates with current data including:
  • Demographic information
  • Clinical measurements
  • Current admission date
3

Update Admission Date

If the admission date is modified, the system automatically updates the active Ingreso:
# Admission date update logic
nueva_fecha = form.cleaned_data.get('fecha_inicio_programa')
if ingreso_actual:
    ingreso_actual.fecha_inicio = nueva_fecha
    ingreso_actual.save()
4

Save Changes

Click Update to save changes. The system confirms and returns to the patient list.

18-Month Capita Cycle

Each patient admission operates on an 18-month capita cycle:

Months 1-6

Initial diagnostic phase with baseline polysomnography and equipment titration

Months 7-12

Regular monitoring and therapy adjustments

Months 13-18

Maintenance phase with quarterly follow-ups

Capita Calculation

The current capita month is automatically calculated based on the admission date:
  • Month 1: Admission month
  • Month 18: Final month of capita cycle
  • After Month 18: Patient remains at month 18 until cycle is closed
The capita month calculation is critical for follow-up scheduling and ensuring patients receive timely interventions.

Patient Properties

Each patient has several computed properties available throughout the system:
@property
def esta_activo(self):
    # Returns True if patient has an active admission
    return self.ingresos.filter(estado='ACTIVO').exists()

Data Model

The Patient model includes comprehensive fields organized by category:

Core Fields

FieldTypeDescription
nombreCharField(100)Patient first name
apellidoCharField(100)Patient last name
tipo_documentoChoiceRC, TI, CC, CE, PA, PE
documentoCharField(20)Unique document identifier
fecha_nacimientoDateFieldDate of birth
generoChoiceM, F, O

Location & Contact

FieldTypeDescription
departamentoChoiceColombian department (32 options)
ciudadChoiceCity within department
zonaChoiceURBANA or RURAL
telefonoCharField(20)Landline number
celularCharField(20)Mobile number

Clinical Data

FieldTypeDescription
pesoDecimal(5,2)Weight in kilograms
alturaDecimal(4,2)Height in meters
perimetro_abdominalDecimal(5,2)Abdominal perimeter (cm)
cuelloDecimal(5,2)Neck circumference (cm)
diagnostico_clinicoChoiceG47.3 - Sleep Apnea
programaChoicePROGRAMA AOS or PROGRAMA INSOMNIO

Administrative

FieldTypeDescription
entidad_saludChoiceHealth entity (Ecopetrol, Sanitas)
estado_civilChoiceMarital status
estratoIntegerSocioeconomic stratum (1-6)
valor_capitaDecimal(10,2)Default: 259,783 COP
medico_remitenteCharField(100)Referring physician
especialidadCharField(100)Physician specialty

Best Practices

Before registering any clinical exam or follow-up, ensure the patient has an active admission:
ingreso_actual = patient.ingresos.filter(estado='ACTIVO').first()
if not ingreso_actual:
    # Handle no active admission case
Schedule follow-ups and interventions based on the patient’s current capita month to ensure compliance with program protocols.
When changing patient status to TERMINADO, always include:
  • End date (fecha_fin)
  • Reason for termination (motivo)
Keep anthropometric measurements current by updating them during each clinical visit, as these affect treatment decisions.

Next Steps

Clinical Records

Learn how to register exams and clinical data for patients

Follow-Up System

Understand how to track patient follow-ups and state transitions

Build docs developers (and LLMs) love