# juan-ruiz14/cervix-sim architecture

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

- Interactive diagram: https://gitdiagram.com/juan-ruiz14/cervix-sim
- Repository: https://github.com/juan-ruiz14/cervix-sim

## Overview

Cérvix-SIM is an educational clinical-simulation and research platform intended to study decision-making and automation bias (AOR), with an AI tutor and AOR/SUS telemetry. The available runtime source implements API endpoints for clinical actions, tutor evaluation, and telemetry; it does not show a frontend, image-case engine, or persistent database implementation. Main.py simulates tutor and database work, while api_b.py contains a router with an HTTP tutor call; no mounting of that router is shown. The graph reflects these evidence limits.

Main entry points: [`Main.py`](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py) (Tutor endpoint), [`api_b.py`](https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py) (Router tutor endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation API"]
  node_main_api["FastAPI app<br/>[Main.py]"]
  node_main_action["Clinical action<br/>[Main.py]"]
  node_main_health["Health check<br/>[Main.py]"]
  node_router_action["Router action<br/>[api_b.py]"]
end

subgraph group_tutor["Tutor Integration"]
  node_main_tutor["Tutor endpoint<br/>[Main.py]"]
  node_main_ai_helper["Simulated AI call<br/>[Main.py]"]
  node_router_tutor["Router tutor endpoint<br/>[api_b.py]"]
  node_ai_service["Tutor microservice"]
end

subgraph group_telemetry["Telemetry"]
  node_main_telemetry["Telemetry endpoint<br/>[Main.py]"]
  node_main_writer["Simulated DB writer<br/>[Main.py]"]
  node_router_telemetry["Router telemetry endpoint<br/>[api_b.py]"]
  node_router_writer["Simulated DB writer<br/>[api_b.py]"]
  node_database[("Telemetry database")]
end

node_clinician(("Learner"))

node_clinician -->|"submits action"| node_main_action
node_clinician -->|"requests guidance"| node_main_tutor
node_clinician -->|"submits metrics"| node_main_telemetry
node_clinician -->|"checks status"| node_main_health
node_main_tutor -->|"invokes simulated"| node_main_ai_helper
node_clinician -->|"submits action"| node_router_action
node_clinician -->|"requests guidance"| node_router_tutor
node_router_tutor -->|"posts state"| node_ai_service
node_clinician -->|"submits metrics"| node_router_telemetry
node_main_telemetry -->|"schedules background"| node_main_writer
node_router_telemetry -->|"schedules background"| node_router_writer
node_main_writer -.->|"simulates write"| node_database
node_router_writer -.->|"simulates write"| node_database

click node_main_api "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_main_action "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_main_health "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_router_action "https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py"
click node_main_tutor "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_main_ai_helper "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_router_tutor "https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py"
click node_main_telemetry "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_main_writer "https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py"
click node_router_telemetry "https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py"
click node_router_writer "https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.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_main_api,node_main_action,node_main_health,node_router_action toneBlue
class node_main_tutor,node_main_ai_helper,node_router_tutor,node_ai_service toneAmber
class node_main_telemetry,node_main_writer,node_router_telemetry,node_router_writer,node_database toneMint
class node_clinician toneIndigo
```

## Components

### Simulation API

- [FastAPI app](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Clinical action](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Health check](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Router action](https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py): `api_b.py`

### Tutor Integration

- [Tutor endpoint](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Simulated AI call](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Router tutor endpoint](https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py): `api_b.py`
- **Tutor microservice**

### Telemetry

- [Telemetry endpoint](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Simulated DB writer](https://github.com/juan-ruiz14/cervix-sim/blob/main/Main.py): `Main.py`
- [Router telemetry endpoint](https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py): `api_b.py`
- [Simulated DB writer](https://github.com/juan-ruiz14/cervix-sim/blob/main/api_b.py): `api_b.py`
- **Telemetry database**

### Other components

- **Learner**

## Connections

- Learner → Clinical action: submits action (evidence: `Main.py`)
- Learner → Tutor endpoint: requests guidance (evidence: `Main.py`)
- Learner → Telemetry endpoint: submits metrics (evidence: `Main.py`)
- Learner → Health check: checks status (evidence: `Main.py`)
- Tutor endpoint → Simulated AI call: invokes simulated (evidence: `Main.py`)
- Learner → Router action: submits action (evidence: `api_b.py`)
- Learner → Router tutor endpoint: requests guidance (evidence: `api_b.py`)
- Router tutor endpoint → Tutor microservice: posts state (evidence: `api_b.py`)
- Learner → Router telemetry endpoint: submits metrics (evidence: `api_b.py`)
- Telemetry endpoint → Simulated DB writer: schedules background (evidence: `Main.py`)
- Router telemetry endpoint → Simulated DB writer: schedules background (evidence: `api_b.py`)
- Simulated DB writer → Telemetry database: simulates write
- Simulated DB writer → Telemetry database: simulates write
