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
In DataMed, a cycle (Ingreso) represents a patient’s enrollment period in the sleep apnea program. Each cycle tracks the patient’s progress through an 18-month treatment period, with automatic month calculation (mes_capita).DataMed uses the term “Ingreso” (cycle/enrollment) to track distinct treatment periods. All clinical data is linked to a specific cycle, allowing historical tracking when patients re-enroll.
Cycle Lifecycle
A cycle progresses through three possible states:ACTIVO (Active)
ACTIVO (Active)
Active State
- Patient is currently enrolled in the program
- Clinical data can be recorded
- Monthly billing (capitación) is calculated
- Only ONE active cycle allowed per patient
- Created automatically when registering a new patient
SUSPENDIDO (Suspended)
SUSPENDIDO (Suspended)
Suspended State
- Temporary program pause
- Clinical data recording disabled
- Can be reactivated to ACTIVO
- Can be finalized to TERMINADO
TERMINADO (Finished)
TERMINADO (Finished)
Finished State
- Cycle is permanently closed
- Requires end date and reason
- Cannot be reopened
- Historical data preserved
- Allows creation of new cycle
Cycle Month Calculation
DataMed automatically calculates which month (1-18) a patient is in:Accessing Cycle Management
Changing Cycle Status
Terminating a Cycle (ACTIVO → TERMINADO)
When finalizing a cycle, you must provide additional information:
Implementation details (see
apps/patients/views.py:change_status_entry, line 169):
Suspending a Cycle (ACTIVO → SUSPENDIDO)
URL Pattern:/patients/ingreso/estado/<entry_id>/SUSPENDIDO/
Reactivating a Cycle (SUSPENDIDO → ACTIVO)
You can reactivate a suspended cycle as long as no other cycle is currently ACTIVO for that patient.
/patients/ingreso/estado/<entry_id>/ACTIVO/
Creating a New Cycle
Patients can have multiple cycles over time, but only one can be ACTIVO at a time.When to Create a New Cycle
- Patient completes 18-month program and re-enrolls
- Patient returns after termination for a new treatment period
- Program change requires new cycle tracking
Creation Process
Implementation (see
apps/patients/views.py:create_new_entry, line 193):
Data Isolation Between Cycles
When a new cycle is created, clinical data is properly isolated:How It Works
- Old Cycle: All exams remain linked to the TERMINADO cycle
- New Cycle: Clinical history view shows only ACTIVO cycle data
- Historical Access: Previous cycle data is preserved but not displayed in current workflows
Filtering Patients by Cycle Month
In the patient list view, you can filter by mes_capita:Because
mes_capita is a property (not a database field), filtering requires iteration rather than database queries.Patient Properties for Cycle Status
The Patient model provides convenient properties:Common Scenarios
Patient Completes 18-Month Program
Patient Completes 18-Month Program
Scenario: Patient reaches month 18 and completes treatment successfullySteps:
- Change cycle status to TERMINADO
- Enter completion date and reason (e.g., “Programa completado exitosamente”)
- Cycle is archived with all clinical data preserved
- If patient re-enrolls later, create a new cycle
Patient Temporarily Leaves Program
Patient Temporarily Leaves Program
Scenario: Patient needs to pause treatment temporarilySteps:
- Change cycle status to SUSPENDIDO
- When patient returns, reactivate to ACTIVO
- Month calculation continues from original start date
- If patient won’t return, finalize to TERMINADO
Patient Drops Out
Patient Drops Out
Scenario: Patient discontinues treatment before completionSteps:
- Change cycle status to TERMINADO
- Enter discontinuation date
- Enter reason (e.g., “Abandono del programa”, “Traslado a otra ciudad”)
- Cycle is permanently closed
Program Change Required
Program Change Required
Scenario: Patient needs to switch from AOS program to another programSteps:
- Terminate current cycle with appropriate reason
- Update patient record (programa field)
- Create new cycle with new start date
- New cycle begins at Month 1
Billing Implications
Themes_capita property is used for billing calculations:
URL Reference
- Cycle Management:
/patients/follow - Change Status:
/patients/ingreso/estado/<entry_id>/<new_status>/ - Create New Cycle:
/patients/ingreso/nuevo/<patient_id>/
Technical Schema
Best Practices
Document Everything
Always provide clear, detailed reasons when terminating cycles
Regular Reviews
Periodically review suspended cycles to finalize or reactivate
Accurate Dates
Use actual dates for cycle transitions, not future dates
One Active Rule
Ensure only ONE active cycle per patient at all times
Next Steps
Record Exams
Learn how to record clinical data for active cycles
Export Data
Generate reports including cycle information