How crissdfc/medrecord works
Project type and purpose
• This is a full-stack (backend heavy) web application built on Django.
• Domain modules under apps/ (citas, facturas, historias, pacientes, usuarios) each encapsulate a piece of business logic.
• A shared/ module holds cross-cutting models and views.
• configuracion/ contains project settings, URL routing, and ASGI/WSGI entrypoints.
• Custom middleware enforces “is_active” user constraints.
File structure
• Top-level files: manage.py, requirements.txt, .gitignore.
• configuracion/: project-wide settings and request entrypoints.
• apps/: a Django “app per domain” pattern (appointments, invoices, histories, patients, users).
• shared/: reusable logic (models, admin, views) used across multiple apps.
• middleware/: custom request‐processing components.
• No separate “frontend” folder—views likely render templates or expose REST endpoints.
Core architectural components
a. External Clients
– Web browsers or API consumers
b. Edge components
– Load Balancer/Reverse Proxy (e.g., Nginx)
– WSGI/ASGI server (e.g., Gunicorn or Daphne)
c. Django application
– configuracion/ (Settings, URL router, ASGI/WSGI)
– middleware/is_active_middleware.py
– apps/* (each domain app: models, views, admin interfaces)
– shared/ (cross-cutting models, views)
d. Database
– Relational DB (PostgreSQL, MySQL, etc.)
e. (Optional) Static files/CDN, external services
Relationships and data flows
– Client → Load Balancer/Proxy → WSGI/ASGI server → Django configuracion/urls.py
– URL dispatcher → is_active_middleware → app’s view function
– View → ORM models → Database
– Admin users → /admin routes → shared/admin.py + apps/*/admin.py
– Any outbound calls (e.g., email, external APIs) from views or services
Architectural patterns and design principles
– Django’s MTV (Model-Template-View) pattern
– Domain-driven structure: one app per business capability
– Single monolithic codebase, modularized by feature
– Layered architecture: Presentation (views/templates) → Business logic (views & services) → Data access (models/ORM)