# ctrlcctrlvnotfound-ops/turnos-hospital architecture

> Architecture diagram of the GitHub repository ctrlcctrlvnotfound-ops/turnos-hospital, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ctrlcctrlvnotfound-ops/turnos-hospital
- Repository: https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital

## Overview

This is a Flask web application for managing deferred healthcare referrals and appointments. Agents can maintain patient and health-center records and submit appointment requests; central staff review requests, then assign or reject them. Supabase provides persistence, and Jinja templates render the application screens. The README is empty and app.py excerpts omit some route bodies, so the graph includes only visible database operations and template relationships; unverified wiring is omitted.

Main entry points: [`app.py`](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py) (Manage centers), [`templates/instituciones.html`](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/instituciones.html) (Centers screen), [`templates/pacientes.html`](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/pacientes.html) (Patients screen), [`templates/solicitud.html`](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/solicitud.html) (Request screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask application<br/>[app.py]"]
end

subgraph group_records["Reference records"]
  node_centers["Manage centers<br/>[app.py]"]
  node_patients["Manage patients<br/>[app.py]"]
  node_institutions_view["Centers screen<br/>[instituciones.html]"]
  node_patients_view["Patients screen<br/>[pacientes.html]"]
end

subgraph group_referrals["Referral workflow"]
  node_request_form["Request form<br/>[app.py]"]
  node_submit_request["Save request<br/>[app.py]"]
  node_request_view["Request screen<br/>[solicitud.html]"]
end

subgraph group_review["Central review"]
  node_status["Request status<br/>[app.py]"]
  node_review_queue["Review queue<br/>[app.py]"]
  node_accept["Assign appointment<br/>[app.py]"]
  node_reject["Reject request<br/>[app.py]"]
  node_status_view["Status screen<br/>[estado.html]"]
  node_management_view["Management screen<br/>[gestion.html]"]
end

node_agent(("Health agent"))
node_auditor(("Central auditor"))
node_supabase[("Supabase database")]

node_agent -->|"manages"| node_centers
node_agent -->|"manages"| node_patients
node_agent -->|"opens"| node_request_form
node_auditor -->|"checks"| node_status
node_auditor -->|"reviews"| node_review_queue
node_auditor -->|"assigns"| node_accept
node_auditor -->|"rejects"| node_reject
node_centers -->|"reads and writes"| node_supabase
node_centers -->|"renders"| node_institutions_view
node_patients -->|"reads and writes"| node_supabase
node_patients -->|"renders"| node_patients_view
node_request_form -->|"reads"| node_supabase
node_request_form -->|"renders"| node_request_view
node_agent -->|"submits"| node_submit_request
node_submit_request -->|"writes patient and request"| node_supabase
node_status -->|"reads"| node_supabase
node_status -->|"renders"| node_status_view
node_review_queue -->|"reads"| node_supabase
node_review_queue -->|"renders"| node_management_view
node_accept -->|"updates request"| node_supabase
node_reject -->|"updates request"| node_supabase

click node_flask "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_centers "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_patients "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_request_form "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_submit_request "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_status "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_review_queue "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_accept "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_reject "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py"
click node_institutions_view "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/instituciones.html"
click node_patients_view "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/pacientes.html"
click node_request_view "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/solicitud.html"
click node_status_view "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/estado.html"
click node_management_view "https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/gestion.html"

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_flask toneBlue
class node_centers,node_patients,node_institutions_view,node_patients_view,node_supabase toneAmber
class node_request_form,node_submit_request,node_request_view toneMint
class node_status,node_review_queue,node_accept,node_reject,node_status_view,node_management_view toneRose
class node_agent,node_auditor toneIndigo
```

## Components

### Web interface

- [Flask application](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`

### Reference records

- [Manage centers](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Manage patients](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Centers screen](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/instituciones.html): `templates/instituciones.html`
- [Patients screen](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/pacientes.html): `templates/pacientes.html`

### Referral workflow

- [Request form](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Save request](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Request screen](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/solicitud.html): `templates/solicitud.html`

### Central review

- [Request status](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Review queue](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Assign appointment](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Reject request](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/app.py): `app.py`
- [Status screen](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/estado.html): `templates/estado.html`
- [Management screen](https://github.com/ctrlcctrlvnotfound-ops/turnos-hospital/blob/master/templates/gestion.html): `templates/gestion.html`

### Other components

- **Health agent**
- **Central auditor**
- **Supabase database**

## Connections

- Health agent → Manage centers: manages
- Health agent → Manage patients: manages
- Health agent → Request form: opens
- Central auditor → Request status: checks
- Central auditor → Review queue: reviews
- Central auditor → Assign appointment: assigns
- Central auditor → Reject request: rejects
- Manage centers → Supabase database: reads and writes
- Manage centers → Centers screen: renders
- Manage patients → Supabase database: reads and writes
- Manage patients → Patients screen: renders
- Request form → Supabase database: reads
- Request form → Request screen: renders
- Health agent → Save request: submits
- Save request → Supabase database: writes patient and request
- Request status → Supabase database: reads
- Request status → Status screen: renders
- Review queue → Supabase database: reads
- Review queue → Management screen: renders
- Assign appointment → Supabase database: updates request
- Reject request → Supabase database: updates request
