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

The Psychology module tracks mental health assessments for sleep apnea patients, focusing on depression, anxiety, and insomnia severity. These psychological factors significantly impact PAP therapy adherence and treatment outcomes. Model: Psicologia
Location: apps/exams/models.py:68-96
Depression and anxiety are common comorbidities in sleep apnea patients and can significantly reduce treatment compliance. Regular psychological screening is essential for comprehensive care.

Assessment Tools

Beck Depression Inventory

Standardized questionnaire measuring depression severity

Beck Anxiety Inventory

Standardized questionnaire measuring anxiety symptoms

Athens Insomnia Scale

Measures insomnia severity and sleep quality

Data Fields

Beck Depression Inventory

inventario_depre_beck
IntegerField
required
Beck Depression Inventory (BDI) score
  • Range: 0-63
  • Form Label: “Depresión de Beck”
  • Assessment Type: 21-item self-report questionnaire
  • Administration Time: 5-10 minutes
Score Interpretation:
Score RangeSeverityClinical Significance
0-13MinimalNo or minimal depression
14-19MildMay benefit from counseling
20-28ModerateRequires psychological intervention
29-63SevereUrgent psychiatric evaluation needed

Beck Anxiety Inventory

inventario_ansiedad_beck
IntegerField
required
Beck Anxiety Inventory (BAI) score
  • Range: 0-63
  • Form Label: “Ansiedad de Beck”
  • Assessment Type: 21-item self-report questionnaire
  • Administration Time: 5-10 minutes
Score Interpretation:
Score RangeSeverityClinical Significance
0-7MinimalNo or minimal anxiety
8-15MildMild anxiety symptoms
16-25ModerateModerate anxiety, intervention recommended
26-63SevereSevere anxiety, urgent treatment required
High anxiety scores (BAI ≥16) are strongly associated with poor CPAP adherence and mask claustrophobia. Early identification enables targeted interventions.

Athens Insomnia Scale

escala_atenas
IntegerField
required
Athens Insomnia Scale (AIS) score
  • Range: 1-10 (typically 0-24, but form indicates 1-10)
  • Form Label: “Escala Atenas (1 a 10)”
  • Assessment Type: 8-item self-report questionnaire
  • Focus: Sleep induction, awakenings, total sleep duration, sleep quality
Score Interpretation:
ScoreSeverityClinical Significance
< 6No insomniaNormal sleep patterns
≥ 6InsomniaClinically significant sleep difficulty
The Athens scale helps differentiate insomnia from sleep apnea symptoms. Some patients have both conditions, requiring combined treatment approaches.

Relationships

ingreso
ForeignKey
Links to the patient’s active admission recordRelated Name: psicologias
On Delete: CASCADE
registrado_por
ForeignKey
User (psychologist or clinician) who registered this assessmentRelated Name: psicologias_registradas
On Delete: SET_NULL
created_at
DateTimeField
Timestamp when this psychological assessment was recordedAuto-generated: Automatically set on record creation

Registration Workflow

View: register_psicologia (apps/exams/views.py:121-149)
def register_psicologia(request, patient_id):
    patient = get_object_or_404(Patient, id=patient_id)
    
    # Find patient's active admission
    ingreso_actual = patient.ingresos.filter(estado='ACTIVO').first()
    
    if request.method == 'POST':
        form = PsicologiaForm(request.POST)
        if form.is_valid():
            # Save without committing to database first
            exam = form.save(commit=False)
            
            # Link to active admission (prevents orphaned records)
            exam.ingreso = ingreso_actual
            exam.registrado_por = request.user
            
            # Now save to database
            exam.save()
            
            messages.success(
                request, 
                f'Consulta de psicología registrada para {patient.nombre} exitosamente'
            )
            return redirect('patient_clinical', patient_id=patient.id)
    else:
        form = PsicologiaForm()
    
    return render(request, 'exams/register_psicologia.html', {
        'form': form, 
        'patient': patient
    })
Active Admission Requirement:
  • Psychology assessments are linked to the current treatment cycle
  • View retrieves ingreso_actual with estado='ACTIVO'
  • Prevents data mixing between treatment cycles
Two-Stage Save Process:
  1. form.save(commit=False) creates object without database write
  2. Link object to active admission (exam.ingreso = ingreso_actual)
  3. Set registering user (exam.registrado_por = request.user)
  4. Final save to database (exam.save())
This ensures all required relationships are established before database commit, preventing integrity errors.

Clinical Applications

Impact on PAP Therapy Adherence

Depression & Adherence

High Depression Scores:
  • Reduced motivation to use CPAP
  • Poor self-care behaviors
  • Lower perceived treatment benefit
Intervention: Cognitive behavioral therapy, antidepressants if indicated

Anxiety & Adherence

High Anxiety Scores:
  • Mask claustrophobia
  • Panic with pressurized air
  • Fear of dependence on device
Intervention: Desensitization therapy, relaxation techniques, gradual pressure ramp

Screening Recommendations

Timing: Before or immediately after basal polysomnographyPurpose:
  • Establish psychological baseline
  • Identify pre-existing mental health conditions
  • Predict adherence challenges
  • Guide therapy planning
Clinical Note: Many patients don’t realize their depression/anxiety is related to untreated sleep apnea. Symptoms often improve with successful PAP therapy.
Timing: After PAP therapy initiationPurpose:
  • Measure treatment psychological benefits
  • Identify therapy-related anxiety (e.g., mask claustrophobia)
  • Assess if adherence issues are psychologically driven
  • Adjust interventions based on response
Expected Changes: BDI and AIS scores typically improve with effective PAP therapy. If scores worsen or remain high despite good adherence, consider independent mental health disorder requiring treatment.
Timing: Throughout long-term therapyPurpose:
  • Monitor sustained psychological benefit
  • Early detection of relapse
  • Correlate mental health changes with adherence patterns
Red Flags: Rising BDI/BAI scores despite good adherence may indicate life stressors or independent psychiatric condition needing attention.

Clinical Interpretation Guidelines

Depression (BDI)

BDI Score: 0-13 (Minimal)
→ No intervention needed
→ Continue routine monitoring

BDI Score: 14-19 (Mild)
→ Brief counseling or support groups
→ Monitor adherence closely
→ Re-assess in 1 month

BDI Score: 20-28 (Moderate)
→ Formal psychological referral
→ Consider cognitive behavioral therapy
→ May benefit from antidepressant
→ Adherence intervention likely needed

BDI Score: 29-63 (Severe)
→ URGENT psychiatric evaluation
→ Screen for suicidal ideation
→ PAP adherence highly compromised
→ May need supervised therapy initiation

Anxiety (BAI)

BAI Score: 0-7 (Minimal)
→ No intervention needed
→ Good prognosis for mask tolerance

BAI Score: 8-15 (Mild)
→ Reassurance and education
→ Gradual desensitization to mask
→ Emphasize pressure ramp feature

BAI Score: 16-25 (Moderate)
→ Structured anxiety management
→ Relaxation techniques
→ Consider short-term anxiolytic
→ Smaller mask or nasal pillows
→ May need multiple mask trials

BAI Score: 26-63 (Severe)
→ Psychiatric referral
→ Address anxiety before PAP initiation
→ High risk of mask claustrophobia
→ May need sedation during initial nights
→ Consider alternative treatments if PAP intolerable

Insomnia (Athens Scale)

AIS < 6 (No Insomnia)
→ Sleep complaints likely OSA-related
→ PAP therapy should resolve symptoms

AIS ≥ 6 (Insomnia Present)
→ Comorbid insomnia diagnosis
→ May need cognitive behavioral therapy for insomnia (CBT-I)
→ Avoid sedative-hypnotics (worsen OSA)
→ PAP therapy alone may not resolve all sleep complaints
High Athens scores (≥6) suggest primary insomnia in addition to sleep apnea. These patients often report persistent sleep dissatisfaction despite excellent PAP adherence and apnea control. They require specialized insomnia treatment (CBT-I) alongside PAP therapy.

Data Retrieval

View: patient_clinical (apps/exams/views.py:29)
# Get all psychology sessions for active admission
sesiones_psicologia = Psicologia.objects.filter(
    ingreso=ingreso_actual
).order_by('-id')
Psychology assessments are filtered by the patient’s active admission and ordered by ID (most recent first) to track psychological changes over time.

Research Evidence

Research Findings:
  • 20-30% of OSA patients have clinical depression (vs. 7% general population)
  • Untreated OSA increases depression risk by 2-3x
  • Treating OSA improves depression scores in 40-60% of patients
  • Residual depression requires independent treatment
Clinical Implication: Always screen for depression in OSA patients. Many patients experience dramatic mood improvement with PAP therapy alone, but some need combined treatment.
Research Findings:
  • Moderate-severe anxiety (BAI ≥16) predicts poor CPAP adherence
  • Mask claustrophobia occurs in 5-10% of patients
  • Anxiety about suffocation is common misconception
  • Desensitization therapy improves adherence by 30-40%
Clinical Implication: Early identification of anxiety (especially claustrophobia) allows for proactive interventions like gradual mask acclimation, smaller interfaces, and psychological support.
Research Findings:
  • 30-50% of OSA patients have comorbid insomnia
  • COMISA patients have worse outcomes than OSA or insomnia alone
  • PAP therapy alone rarely resolves insomnia symptoms
  • CBT-I + PAP is optimal treatment combination
Clinical Implication: Athens scale helps identify COMISA patients who need dual treatment. Don’t assume all sleep complaints will resolve with PAP therapy.

Monitoring

Correlate psychological scores with adherence patterns

Nutrition

Rumination and eating behaviors linked to mood

Polysomnography

Sleep quality assessments complement Athens scores