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 uses Django’s built-in session-based authentication. All API endpoints require users to be logged in, enforced by the@login_required decorator.
Configuration
Authentication settings fromconfig/settings.py:172-174:
Authentication Flow
1. Login
Users must authenticate through the/users/ endpoints (handled by the users app).
The root URL
/ automatically redirects to the login page for unauthenticated users.2. Session Cookie
After successful login, Django creates a session cookie that must be included in all subsequent requests.3. Access Protected Endpoints
All patient and exam endpoints check authentication:4. Logout
Logging out destroys the session and redirects to the login page.Protected Endpoints
All endpoints in the following modules require authentication:/patients/*- All patient management endpoints/exams/*- All clinical examination endpoints/dashboard/*- Dashboard views
Request Requirements
Including Session Cookie
When making requests to protected endpoints, include the session cookie:CSRF Protection
Django’s CSRF protection is enabled. ForPOST, PUT, PATCH, and DELETE requests:
- Include the CSRF token in the request header
- Or include it in the form data as
csrfmiddlewaretoken
User Context
Authenticated users are available in views viarequest.user. This is used to track who registered clinical data:
Access Control
Currently, DataMed uses authentication without granular authorization. All authenticated users have access to all endpoints.Unauthorized Access
If a user attempts to access a protected endpoint without authentication:- Django redirects to
LOGIN_URL(/users/login/) - After successful login, redirects to
LOGIN_REDIRECT_URL(/dashboard/)
Security Considerations
Production Settings
Fromconfig/settings.py:34-48:
HTTPS Requirements
In production (Render deployment):- All requests should use HTTPS
- Session cookies are marked secure
- CSRF tokens validate origin