# spaurhu/axioma-centro-psicologico architecture

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

- Interactive diagram: https://gitdiagram.com/spaurhu/axioma-centro-psicologico
- Repository: https://github.com/spaurhu/axioma-centro-psicologico

## Overview

Axioma is a psychological-care clinic platform with public/patient and clinical-staff portals. Patients register, view packages and appointments; staff manage patients, therapists, package assignments, scheduling, attendance, and confidential SOAP-style evolutions. When a cita is created, the scheduling service checks availability and package balance, requests a no-show prediction, and persists the appointment. The map combines documented portal capabilities with sampled backend calls; frontend-to-API wiring and some unsampled module details are not shown, so those links are marked unverified.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/lib/api.ts) (API client), [`backend/src/prisma/prisma.service.ts`](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/prisma/prisma.service.ts) (Prisma data access), [`backend/src/modulos/citas/citas.service.ts`](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/citas/citas.service.ts) (Scheduling and clinical records), [`backend/src/modulos/auth/auth.controller.ts`](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/auth/auth.controller.ts) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Web portals"]
  node_landing["Public landing<br/>[page.tsx]"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_registration["Patient registration<br/>[page.tsx]"]
  node_patient_portal["Patient portal<br/>[page.tsx]"]
  node_staff_panel["Staff panel<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_clinic["Clinical operations"]
  node_therapists["Therapist management"]
  node_patients["Patient directory"]
  node_packages["Session packages"]
  node_appointments["Appointment and SOAP API"]
  node_appointment_logic["Scheduling and clinical records<br/>[citas.service.ts]"]
  node_therapist_logic["Therapist records"]
  node_patient_logic["Patient records"]
  node_package_logic["Package assignment"]
end

subgraph group_services["Platform services"]
  node_auth_routes["Authentication routes<br/>[auth.controller.ts]"]
  node_auth_logic["Auth and registration<br/>[auth.service.ts]"]
  node_access_control["JWT and roles<br/>[jwt-auth.guard.ts]"]
  node_ml_inference["No-show inference<br/>[ml.service.ts]"]
  node_ml_training["Model training<br/>[entrenar_modelo.py]"]
end

subgraph group_data["Data and prediction"]
  node_prisma["Prisma data access<br/>[prisma.service.ts]"]
  node_postgres[("PostgreSQL")]
end

node_visitor(("Visitor / patient"))
node_staff(("Clinic staff"))

node_visitor -->|"browses"| node_landing
node_visitor -->|"registers"| node_registration
node_visitor -.->|"signs in"| node_login
node_visitor -->|"manages care"| node_patient_portal
node_staff -->|"manages clinic"| node_staff_panel
node_landing -.->|"requests data"| node_api_client
node_login -.->|"submits credentials"| node_api_client
node_registration -.->|"submits registration"| node_api_client
node_patient_portal -.->|"uses API"| node_api_client
node_staff_panel -.->|"uses API"| node_api_client
node_api_client -.->|"calls API"| node_auth_routes
node_api_client -.->|"calls API"| node_appointments
node_auth_routes -->|"delegates to"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_prisma
node_auth_routes -->|"guards profile"| node_access_control
node_therapists -->|"delegates to"| node_therapist_logic
node_therapist_logic -->|"reads and writes"| node_prisma
node_patients -->|"delegates to"| node_patient_logic
node_patient_logic -->|"reads and writes"| node_prisma
node_packages -->|"delegates to"| node_package_logic
node_package_logic -->|"reads and writes"| node_prisma
node_appointments -->|"delegates to"| node_appointment_logic
node_appointment_logic -->|"checks and persists"| node_prisma
node_appointment_logic -->|"requests prediction"| node_ml_inference
node_ml_training -.->|"provides model parameters"| node_ml_inference
node_prisma -->|"persists data"| node_postgres

click node_landing "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/page.tsx"
click node_login "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/login/page.tsx"
click node_registration "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/registro/page.tsx"
click node_patient_portal "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/paciente/page.tsx"
click node_staff_panel "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/panel/page.tsx"
click node_api_client "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/lib/api.ts"
click node_auth_routes "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/auth/auth.controller.ts"
click node_auth_logic "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/auth/auth.service.ts"
click node_access_control "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/comun/jwt-auth.guard.ts"
click node_therapists "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/psicologos/psicologos.controller.ts"
click node_patients "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/pacientes/pacientes.controller.ts"
click node_packages "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/paquetes/paquetes.controller.ts"
click node_appointments "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/citas/citas.controller.ts"
click node_appointment_logic "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/citas/citas.service.ts"
click node_therapist_logic "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/psicologos/psicologos.service.ts"
click node_patient_logic "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/pacientes/pacientes.service.ts"
click node_package_logic "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/paquetes/paquetes.service.ts"
click node_ml_inference "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/ml/ml.service.ts"
click node_ml_training "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/ml/entrenar_modelo.py"
click node_prisma "https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/prisma/prisma.service.ts"

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_landing,node_login,node_registration,node_patient_portal,node_staff_panel,node_api_client toneBlue
class node_therapists,node_patients,node_packages,node_appointments,node_appointment_logic,node_therapist_logic,node_patient_logic,node_package_logic toneAmber
class node_auth_routes,node_auth_logic,node_access_control,node_ml_inference,node_ml_training toneMint
class node_prisma,node_postgres toneRose
class node_visitor,node_staff toneIndigo
```

## Components

### Web portals

- [Public landing](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Sign-in](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/login/page.tsx): `frontend/src/app/login/page.tsx`
- [Patient registration](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/registro/page.tsx): `frontend/src/app/registro/page.tsx`
- [Patient portal](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/paciente/page.tsx): `frontend/src/app/paciente/page.tsx`
- [Staff panel](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/app/panel/page.tsx): `frontend/src/app/panel/page.tsx`
- [API client](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Clinical operations

- [Therapist management](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/psicologos/psicologos.controller.ts): `backend/src/modulos/psicologos/psicologos.controller.ts`
- [Patient directory](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/pacientes/pacientes.controller.ts): `backend/src/modulos/pacientes/pacientes.controller.ts`
- [Session packages](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/paquetes/paquetes.controller.ts): `backend/src/modulos/paquetes/paquetes.controller.ts`
- [Appointment and SOAP API](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/citas/citas.controller.ts): `backend/src/modulos/citas/citas.controller.ts`
- [Scheduling and clinical records](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/citas/citas.service.ts): `backend/src/modulos/citas/citas.service.ts`
- [Therapist records](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/psicologos/psicologos.service.ts): `backend/src/modulos/psicologos/psicologos.service.ts`
- [Patient records](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/pacientes/pacientes.service.ts): `backend/src/modulos/pacientes/pacientes.service.ts`
- [Package assignment](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/paquetes/paquetes.service.ts): `backend/src/modulos/paquetes/paquetes.service.ts`

### Platform services

- [Authentication routes](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/auth/auth.controller.ts): `backend/src/modulos/auth/auth.controller.ts`
- [Auth and registration](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/auth/auth.service.ts): `backend/src/modulos/auth/auth.service.ts`
- [JWT and roles](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/comun/jwt-auth.guard.ts): `backend/src/comun/jwt-auth.guard.ts`
- [No-show inference](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/modulos/ml/ml.service.ts): `backend/src/modulos/ml/ml.service.ts`
- [Model training](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/ml/entrenar_modelo.py): `ml/entrenar_modelo.py`

### Data and prediction

- [Prisma data access](https://github.com/spaurhu/axioma-centro-psicologico/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- **PostgreSQL**

### Other components

- **Visitor / patient**
- **Clinic staff**

## Connections

- Visitor / patient → Public landing: browses (evidence: `README.md`)
- Visitor / patient → Patient registration: registers (evidence: `README.md`)
- Visitor / patient → Sign-in: signs in
- Visitor / patient → Patient portal: manages care (evidence: `README.md`)
- Clinic staff → Staff panel: manages clinic (evidence: `README.md`)
- Public landing → API client: requests data
- Sign-in → API client: submits credentials
- Patient registration → API client: submits registration
- Patient portal → API client: uses API
- Staff panel → API client: uses API
- API client → Authentication routes: calls API
- API client → Appointment and SOAP API: calls API
- Authentication routes → Auth and registration: delegates to (evidence: `backend/src/modulos/auth/auth.controller.ts`)
- Auth and registration → Prisma data access: reads and writes (evidence: `backend/src/modulos/auth/auth.service.ts`)
- Authentication routes → JWT and roles: guards profile (evidence: `backend/src/modulos/auth/auth.controller.ts`)
- Therapist management → Therapist records: delegates to (evidence: `backend/src/modulos/psicologos/psicologos.controller.ts`)
- Therapist records → Prisma data access: reads and writes (evidence: `backend/src/modulos/psicologos/psicologos.service.ts`)
- Patient directory → Patient records: delegates to (evidence: `backend/src/modulos/pacientes/pacientes.controller.ts`)
- Patient records → Prisma data access: reads and writes (evidence: `backend/src/modulos/pacientes/pacientes.service.ts`)
- Session packages → Package assignment: delegates to (evidence: `backend/src/modulos/paquetes/paquetes.controller.ts`)
- Package assignment → Prisma data access: reads and writes (evidence: `backend/src/modulos/paquetes/paquetes.service.ts`)
- Appointment and SOAP API → Scheduling and clinical records: delegates to (evidence: `backend/src/modulos/citas/citas.controller.ts`)
- Scheduling and clinical records → Prisma data access: checks and persists (evidence: `backend/src/modulos/citas/citas.service.ts`)
- Scheduling and clinical records → No-show inference: requests prediction (evidence: `backend/src/modulos/citas/citas.service.ts`)
- Model training → No-show inference: provides model parameters (evidence: `README.md`)
- Prisma data access → PostgreSQL: persists data (evidence: `README.md`)
