# justarzun/medical-telemetry-api architecture

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

- Interactive diagram: https://gitdiagram.com/justarzun/medical-telemetry-api
- Repository: https://github.com/justarzun/medical-telemetry-api

## Overview

Medical Telemetry API is a Rails service for bearer-token-protected device telemetry ingestion and reading retrieval. A gateway calls the versioned API; authentication validates JWT claims, and telemetry is stored in MySQL. The API also exposes a health check. The publisher service is present in the source index, but the available excerpts do not establish how it is invoked. Relationships involving that service are therefore omitted.

Main entry points: [`config/routes.rb`](https://github.com/justarzun/medical-telemetry-api/blob/main/config/routes.rb) (API Routes), [`app/controllers/api/v1/telemetry_readings_controller.rb`](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/telemetry_readings_controller.rb) (Readings API), [`app/controllers/concerns/oidc_authenticatable.rb`](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/concerns/oidc_authenticatable.rb) (Bearer Auth), [`app/controllers/api/v1/base_controller.rb`](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/base_controller.rb) (API Base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_routes["API Routes<br/>[routes.rb]"]
  node_health["Health Endpoint"]
  node_readings_api["Readings API"]
  node_api_base["API Base<br/>[base_controller.rb]"]
end

subgraph group_security["Token Security"]
  node_auth_concern["Bearer Auth"]
  node_token_verifier["JWT Verifier"]
end

subgraph group_data["Telemetry Data"]
  node_reading_model["Telemetry Reading"]
  node_publisher["Telemetry Publisher"]
  node_mysql[("MySQL Store")]
end

node_gateway(("Device Gateway"))

node_gateway -->|"calls API"| node_routes
node_routes -->|"routes health"| node_health
node_routes -->|"routes readings"| node_readings_api
node_api_base -->|"includes auth"| node_auth_concern
node_readings_api -->|"stores and retrieves"| node_mysql
node_auth_concern -.->|"verifies token"| node_token_verifier
node_reading_model -.->|"persists readings"| node_mysql

click node_routes "https://github.com/justarzun/medical-telemetry-api/blob/main/config/routes.rb"
click node_health "https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/health_controller.rb"
click node_readings_api "https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/telemetry_readings_controller.rb"
click node_api_base "https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/base_controller.rb"
click node_auth_concern "https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/concerns/oidc_authenticatable.rb"
click node_token_verifier "https://github.com/justarzun/medical-telemetry-api/blob/main/app/services/oidc_token_verifier.rb"
click node_reading_model "https://github.com/justarzun/medical-telemetry-api/blob/main/app/models/telemetry_reading.rb"
click node_publisher "https://github.com/justarzun/medical-telemetry-api/blob/main/app/services/telemetry_publisher.rb"

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_routes,node_health,node_readings_api,node_api_base toneBlue
class node_auth_concern,node_token_verifier toneAmber
class node_reading_model,node_publisher,node_mysql toneMint
class node_gateway toneIndigo
```

## Components

### HTTP API

- [API Routes](https://github.com/justarzun/medical-telemetry-api/blob/main/config/routes.rb): `config/routes.rb`
- [Health Endpoint](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/health_controller.rb): `app/controllers/health_controller.rb`
- [Readings API](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/telemetry_readings_controller.rb): `app/controllers/api/v1/telemetry_readings_controller.rb`
- [API Base](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/api/v1/base_controller.rb): `app/controllers/api/v1/base_controller.rb`

### Token Security

- [Bearer Auth](https://github.com/justarzun/medical-telemetry-api/blob/main/app/controllers/concerns/oidc_authenticatable.rb): `app/controllers/concerns/oidc_authenticatable.rb`
- [JWT Verifier](https://github.com/justarzun/medical-telemetry-api/blob/main/app/services/oidc_token_verifier.rb): `app/services/oidc_token_verifier.rb`

### Telemetry Data

- [Telemetry Reading](https://github.com/justarzun/medical-telemetry-api/blob/main/app/models/telemetry_reading.rb): `app/models/telemetry_reading.rb`
- [Telemetry Publisher](https://github.com/justarzun/medical-telemetry-api/blob/main/app/services/telemetry_publisher.rb): `app/services/telemetry_publisher.rb`
- **MySQL Store**

### Other components

- **Device Gateway**

## Connections

- Device Gateway → API Routes: calls API (evidence: `README.md`)
- API Routes → Health Endpoint: routes health (evidence: `config/routes.rb`)
- API Routes → Readings API: routes readings (evidence: `config/routes.rb`)
- API Base → Bearer Auth: includes auth (evidence: `app/controllers/api/v1/base_controller.rb`)
- Readings API → MySQL Store: stores and retrieves (evidence: `README.md`)
- Bearer Auth → JWT Verifier: verifies token
- Telemetry Reading → MySQL Store: persists readings
