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.

This guide will walk you through setting up DataMed and registering your first sleep apnea patient.

Prerequisites

Before you begin, ensure you have:
  • Python 3.9 or higher installed
  • pip (Python package manager)
  • Git for cloning the repository
1

Clone the repository

git clone <your-datamed-repo-url>
cd datamed
2

Install dependencies

Install all required packages from requirements.txt:
pip install -r requirements.txt
For development, DataMed uses SQLite by default. No additional database setup is required.
3

Configure environment variables

Create a .env file in the project root:
SECRET_KEY=your-secret-key-here
The SECRET_KEY is only required for production. In development mode, a default key is used automatically.
4

Run database migrations

Set up the database schema:
python manage.py migrate
5

Create a superuser

Create an admin account to access the system:
python manage.py createsuperuser
Follow the prompts to set up your username, email, and password.
6

Start the development server

python manage.py runserver
The application will be available at http://localhost:8000

Register Your First Patient

Once the server is running, you can register your first patient in the sleep apnea program.
1

Log in to the system

Navigate to http://localhost:8000/users/login/ and enter your superuser credentials.After successful login, you’ll be redirected to the dashboard at /dashboard/.
2

Navigate to patient registration

Go to /patients/create/ or click the patient registration link in the navigation menu.
3

Fill in patient information

The patient registration form includes the following required fields:
nombre = "Juan"                    # First name
apellido = "Pérez"                 # Last name
tipo_documento = "CC"              # Document type (CC, TI, CE, PA, PE, RC)
documento = "1234567890"           # Unique document number
fecha_nacimiento = "1980-05-15"   # Birth date (YYYY-MM-DD)
genero = "M"                       # Gender (M, F, O)
The documento field must be unique across all patients. The system will prevent duplicate registrations.
4

Save the patient record

Click the submit button to create the patient record. Upon successful creation, you’ll be redirected to the patient detail page at /patients/<patient_id>/.

Create a Program Entry

After registering a patient, you need to create an active program entry (ingreso) to track their participation in the sleep apnea program.
The entry system tracks patient status through the 18-month capita program with three states: ACTIVO, SUSPENDIDO, and TERMINADO.
To create an entry, navigate to:
/patients/ingreso/nuevo/<patient_id>/
Provide:
  • fecha_inicio: Start date of the program entry
  • estado: Status (defaults to ACTIVO)
  • motivo: Optional reason/notes for the entry
The system automatically calculates the current month of the capita program (1-18) based on the start date.

View the Dashboard

Navigate to /dashboard/ to see:
  • Overview of active patients
  • Program statistics
  • Patient follow-up information
  • Quick access to patient records

Next Steps

Installation Guide

Detailed setup for production environments

Patient Management

Learn about patient model fields and relationships

Exam Management

Manage sleep study exams and results

Dashboard Features

Explore analytics and reporting capabilities

Common Issues

If you see DEBUG = False errors during development, ensure the RENDER environment variable is NOT set. The system automatically enables debug mode when RENDER is absent.

Database Connection Error

In development, DataMed uses SQLite by default. Ensure the project has write permissions for creating db.sqlite3.

Static Files Not Loading

Run python manage.py collectstatic to collect static files. In development mode, Django serves static files automatically.

Login Redirects to Wrong Page

Check your LOGIN_REDIRECT_URL setting in config/settings.py. The default is dashboard.

Build docs developers (and LLMs) love