# johnnyalex77/proyectotbc architecture

> Architecture diagram of the GitHub repository johnnyalex77/proyectotbc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johnnyalex77/proyectotbc
- Repository: https://github.com/johnnyalex77/proyectotbc

## Overview

#### Purpose and Runtime
This is a server-rendered Django system for tuberculosis (TBC) clinical operations: patient records, contacts, examinations, prevention, treatments, laboratory workflows, user roles, and operational/clinical indicators. It runs through Django’s WSGI/ASGI entry points: `manage.py`, `sistemaTBC_demo/wsgi.py`, and `sistemaTBC_demo/asgi.py`.

#### Project Composition and Routing
The project package owns settings, global routes, shared layouts, and static UI assets. Requests enter the project URL dispatcher and are delegated to domain app URL modules; views render HTML templates or perform form-backed mutations.
- `sistemaTBC_demo/settings.py`
- `sistemaTBC_demo/urls.py`
- `sistemaTBC_demo/templates/base.html`

#### Identity, Roles, and Dashboards
`usuarios` provides account/profile management, password changes, registration, and role-specific dashboards (administrator, physician, nurse, paramedic, technologist). This is the likely authorization boundary for access to clinical workflows, implemented around Django’s user/auth model plus local extensions.
- `apps/usuarios/models.py`
- `apps/usuarios/views.py`
- `apps/usuarios/templates/usuarios/dashboard_admin.html`

#### Patient and Contact Registry
`pacientes` is the core clinical subject registry, offering create/edit/detail/list/search flows. `contactos` manages associated contact records with equivalent CRUD/search screens. These app models form the central data boundary referenced by downstream clinical modules.
- `apps/pacientes/models.py`
- `apps/pacientes/views.py`
- `apps/contactos/models.py`

#### Clinical Care Lifecycle
Three domain apps capture patient-directed care events: examinations, preventive interventions, and treatment administration. Form/view/model layers handle lifecycle CRUD, while templates expose details, pending doses, calendars, follow-up, vaccination, and chemoprophylaxis workflows.
- `apps/examenes/models.py`
- `apps/prevencion/models.py`
- `apps/tratamientos/models.py`

#### Laboratory Operations
`laboratorio` manages laboratory records, quality control, indicator records, card/index (“tarjetero”) workflows, reporting, and a laboratory dashboard. Its signals indicate model changes can trigger cross-component updates, likely including indicator refreshes.
- `apps/laboratorio/models.py`
- `apps/laboratorio/signals.py`
- `apps/laboratorio/views.py`

#### Indicators, Alerts, and Reporting
`indicadores` is the analytical layer over operational data. Its services and signals separate computation/update behavior from request views; dashboard, cohort, prevention, operational, managerial-report, and alert pages present derived results.
- `apps/indicadores/services.py`
- `apps/indicadores/signals.py`
- `apps/indicadores/views.py`

#### Persistence, Administration, and Data Loading
Each domain app owns Django models and initial migrations, implying a shared Django relational database configured in project settings. Django admin modules expose operational administration. SQL and import scripts support schema/data setup and indicator loading outside request handling; group/user provisioning scripts establish access-control data.
- `sistemaTBC_demo/settings.py`
- `Script_ModeloDatos.sql`
- `Load_indicadores_data.py`

Main entry points: [`apps/pacientes/models.py`](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/pacientes/models.py) (Patient registry), [`apps/indicadores/services.py`](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/services.py) (Indicator computation), [`sistemaTBC_demo/urls.py`](https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/urls.py) (Global URL dispatcher), [`apps/usuarios/views.py`](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/views.py) (Account dashboards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Django Runtime"]
  node_entrypoints{{"WSGI / ASGI entry points<br/>Django entrypoints<br/>[wsgi.py]"}}
  node_manage["Management CLI<br/>Django command runner<br/>[manage.py]"]
  node_settings["Project settings<br/>Django configuration<br/>[settings.py]"]
  node_router["Global URL dispatcher<br/>Django routing<br/>[urls.py]"]
  node_base_layout["Shared base layout<br/>HTML template<br/>[base.html]"]
  node_database[("Shared clinical database<br/>relational persistence")]
  node_data_sql["Schema setup SQL<br/>database script"]
end

subgraph group_identity["Identity &amp; Access"]
  node_users_models["Users and roles<br/>Django models<br/>[models.py]"]
  node_users_views["Account dashboards<br/>Django views<br/>[views.py]"]
  node_admin_dashboard["Administrator dashboard<br/>HTML template"]
end

subgraph group_registry["Clinical Registry"]
  node_patients["Patient registry<br/>Django models and views<br/>[models.py]"]
  node_patient_views["Patient workflows<br/>Django views<br/>[views.py]"]
  node_contacts["Contact registry<br/>Django models<br/>[models.py]"]
end

subgraph group_care["Care &amp; Laboratory"]
  node_exams["Examinations<br/>Django models<br/>[models.py]"]
  node_prevention["Prevention<br/>Django models<br/>[models.py]"]
  node_treatments["Treatment administration<br/>Django models<br/>[models.py]"]
  node_laboratory["Laboratory operations<br/>Django models and views<br/>[models.py]"]
  node_lab_signals["Laboratory change signals<br/>Django signals<br/>[signals.py]"]
end

subgraph group_analytics["Indicators &amp; Reporting"]
  node_indicator_services["Indicator computation<br/>analytics services<br/>[services.py]"]
  node_indicator_signals["Indicator update signals<br/>Django signals<br/>[signals.py]"]
  node_indicator_views["Indicators and alerts<br/>Django views<br/>[views.py]"]
  node_indicator_loader["Indicator data loader<br/>data import script"]
end

node_entrypoints -->|"loads"| node_settings
node_manage -->|"uses"| node_settings
node_settings -->|"configures"| node_database
node_entrypoints -->|"dispatches requests"| node_router
node_router -->|"routes account flows"| node_users_views
node_router -->|"routes registry flows"| node_patient_views
node_router -->|"routes analytics pages"| node_indicator_views
node_users_views -->|"authenticates and manages"| node_users_models
node_users_views -->|"renders"| node_admin_dashboard
node_users_models -->|"persists"| node_database
node_patient_views -->|"manages"| node_patients
node_patients -->|"associates"| node_contacts
node_patients -->|"subject of"| node_exams
node_patients -->|"subject of"| node_prevention
node_patients -->|"subject of"| node_treatments
node_patients -->|"subject of"| node_laboratory
node_patients -->|"persists"| node_database
node_contacts -->|"persists"| node_database
node_exams -->|"persists"| node_database
node_prevention -->|"persists"| node_database
node_treatments -->|"persists"| node_database
node_laboratory -->|"persists"| node_database
node_lab_signals -.->|"triggers refresh"| node_indicator_services
node_indicator_signals -.->|"updates"| node_indicator_services
node_indicator_services -->|"reads and writes derived data"| node_database
node_indicator_views -->|"presents results"| node_indicator_services
node_indicator_loader -->|"loads data for"| node_indicator_services
node_data_sql -->|"initializes"| node_database
node_base_layout -.->|"shared by"| node_users_views

click node_entrypoints "https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/wsgi.py"
click node_manage "https://github.com/johnnyalex77/proyectotbc/blob/main/manage.py"
click node_settings "https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/settings.py"
click node_router "https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/urls.py"
click node_base_layout "https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/templates/base.html"
click node_users_models "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/models.py"
click node_users_views "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/views.py"
click node_admin_dashboard "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/templates/usuarios/dashboard_admin.html"
click node_patients "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/pacientes/models.py"
click node_patient_views "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/pacientes/views.py"
click node_contacts "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/contactos/models.py"
click node_exams "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/examenes/models.py"
click node_prevention "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/prevencion/models.py"
click node_treatments "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/tratamientos/models.py"
click node_laboratory "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/laboratorio/models.py"
click node_lab_signals "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/laboratorio/signals.py"
click node_indicator_services "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/services.py"
click node_indicator_signals "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/signals.py"
click node_indicator_views "https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/views.py"
click node_data_sql "https://github.com/johnnyalex77/proyectotbc/blob/main/Script_ModeloDatos.sql"
click node_indicator_loader "https://github.com/johnnyalex77/proyectotbc/blob/main/Load_indicadores_data.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entrypoints,node_manage,node_settings,node_router,node_base_layout,node_database,node_data_sql toneBlue
class node_users_models,node_users_views,node_admin_dashboard toneAmber
class node_patients,node_patient_views,node_contacts toneMint
class node_exams,node_prevention,node_treatments,node_laboratory,node_lab_signals toneRose
class node_indicator_services,node_indicator_signals,node_indicator_views,node_indicator_loader toneIndigo
```

## Components

### Django Runtime

- [WSGI / ASGI entry points](https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/wsgi.py): Django entrypoints · Serves synchronous and asynchronous Django requests. · `sistemaTBC_demo/wsgi.py`
- [Management CLI](https://github.com/johnnyalex77/proyectotbc/blob/main/manage.py): Django command runner · `manage.py`
- [Project settings](https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/settings.py): Django configuration · Configures the shared relational database and installed applications. · `sistemaTBC_demo/settings.py`
- [Global URL dispatcher](https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/urls.py): Django routing · Delegates requests to domain application routes. · `sistemaTBC_demo/urls.py`
- [Shared base layout](https://github.com/johnnyalex77/proyectotbc/blob/main/sistemaTBC_demo/templates/base.html): HTML template · `sistemaTBC_demo/templates/base.html`
- **Shared clinical database**: relational persistence · Stores domain models, users, and derived operational records.
- [Schema setup SQL](https://github.com/johnnyalex77/proyectotbc/blob/main/Script_ModeloDatos.sql): database script · `Script_ModeloDatos.sql`

### Identity & Access

- [Users and roles](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/models.py): Django models · Extends Django identity with local profiles and roles. · `apps/usuarios/models.py`
- [Account dashboards](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/views.py): Django views · Provides account flows and role-specific dashboards. · `apps/usuarios/views.py`
- [Administrator dashboard](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/usuarios/templates/usuarios/dashboard_admin.html): HTML template · `apps/usuarios/templates/usuarios/dashboard_admin.html`

### Clinical Registry

- [Patient registry](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/pacientes/models.py): Django models and views · Central clinical subject records with CRUD and search. · `apps/pacientes/models.py`
- [Patient workflows](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/pacientes/views.py): Django views · `apps/pacientes/views.py`
- [Contact registry](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/contactos/models.py): Django models · Stores patient-associated contact records. · `apps/contactos/models.py`

### Care & Laboratory

- [Examinations](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/examenes/models.py): Django models · Captures patient examination events. · `apps/examenes/models.py`
- [Prevention](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/prevencion/models.py): Django models · Captures vaccination and chemoprophylaxis interventions. · `apps/prevencion/models.py`
- [Treatment administration](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/tratamientos/models.py): Django models · Captures treatment lifecycle, doses, and follow-up. · `apps/tratamientos/models.py`
- [Laboratory operations](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/laboratorio/models.py): Django models and views · Manages laboratory records, quality control, reporting, and tarjetero workflows. · `apps/laboratorio/models.py`
- [Laboratory change signals](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/laboratorio/signals.py): Django signals · Triggers cross-component updates when laboratory models change. · `apps/laboratorio/signals.py`

### Indicators & Reporting

- [Indicator computation](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/services.py): analytics services · Computes and refreshes derived clinical and operational indicators. · `apps/indicadores/services.py`
- [Indicator update signals](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/signals.py): Django signals · `apps/indicadores/signals.py`
- [Indicators and alerts](https://github.com/johnnyalex77/proyectotbc/blob/main/apps/indicadores/views.py): Django views · Presents dashboards, cohorts, reports, and alerts. · `apps/indicadores/views.py`
- [Indicator data loader](https://github.com/johnnyalex77/proyectotbc/blob/main/Load_indicadores_data.py): data import script · Loads indicator data outside request handling. · `Load_indicadores_data.py`

## Connections

- WSGI / ASGI entry points → Project settings: loads
- Management CLI → Project settings: uses
- Project settings → Shared clinical database: configures
- WSGI / ASGI entry points → Global URL dispatcher: dispatches requests
- Global URL dispatcher → Account dashboards: routes account flows
- Global URL dispatcher → Patient workflows: routes registry flows
- Global URL dispatcher → Indicators and alerts: routes analytics pages
- Account dashboards → Users and roles: authenticates and manages
- Account dashboards → Administrator dashboard: renders
- Users and roles → Shared clinical database: persists
- Patient workflows → Patient registry: manages
- Patient registry → Contact registry: associates
- Patient registry → Examinations: subject of
- Patient registry → Prevention: subject of
- Patient registry → Treatment administration: subject of
- Patient registry → Laboratory operations: subject of
- Patient registry → Shared clinical database: persists
- Contact registry → Shared clinical database: persists
- Examinations → Shared clinical database: persists
- Prevention → Shared clinical database: persists
- Treatment administration → Shared clinical database: persists
- Laboratory operations → Shared clinical database: persists
- Laboratory change signals → Indicator computation: triggers refresh
- Indicator update signals → Indicator computation: updates
- Indicator computation → Shared clinical database: reads and writes derived data
- Indicators and alerts → Indicator computation: presents results
- Indicator data loader → Indicator computation: loads data for
- Schema setup SQL → Shared clinical database: initializes
- Shared base layout → Account dashboards: shared by
