# elgatosaez/bettersiryc architecture

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

- Interactive diagram: https://gitdiagram.com/elgatosaez/bettersiryc
- Repository: https://github.com/elgatosaez/bettersiryc

## Overview

Better SIRYC is a Chromium extension that enhances SIRYC for clinical work. Its main workflows are updating tab titles with patient/room/bed details and managing clinical templates in the extension settings, then inserting a matching template into a compatible Evolution or Epicrisis field. The popup summarizes saved templates and opens settings. The excerpts show the content and settings scripts using a shared template API and Chrome local storage; the README documents the user-facing flows. Extension wiring beyond those excerpts is not mapped.

Main entry points: [`options.js`](https://github.com/elgatosaez/bettersiryc/blob/master/options.js) (Template manager), [`popup.js`](https://github.com/elgatosaez/bettersiryc/blob/master/popup.js) (Extension popup), [`content-script.js`](https://github.com/elgatosaez/bettersiryc/blob/master/content-script.js) (Clinical template insertion), [`templates.js`](https://github.com/elgatosaez/bettersiryc/blob/master/templates.js) (Template definitions and migration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension_ui["Extension UI"]
  node_settings["Template manager<br/>[options.js]"]
  node_popup["Extension popup<br/>[popup.js]"]
  node_options_page["Settings page<br/>[options.html]"]
  node_popup_page["Popup page<br/>[popup.html]"]
end

subgraph group_clinical_features["Clinical enhancements"]
  node_title_enhancer["Contextual tab titles<br/>[content-script.js]"]
  node_template_inserter["Clinical template insertion<br/>[content-script.js]"]
end

subgraph group_template_domain["Template domain"]
  node_template_logic["Template definitions and migration<br/>[templates.js]"]
end

subgraph group_browser_services["Browser services"]
  node_local_storage[("Chrome local storage")]
end

node_user(("Clinician"))
node_siryc["SIRYC"]

node_user -->|"opens"| node_popup
node_user -->|"manages templates"| node_settings
node_user -->|"uses"| node_siryc
node_popup -->|"reads templates"| node_local_storage
node_popup -->|"opens settings"| node_settings
node_settings -->|"reads and writes"| node_local_storage
node_settings -->|"uses definitions and migration"| node_template_logic
node_template_inserter -->|"loads templates"| node_local_storage
node_template_inserter -->|"uses definitions and migration"| node_template_logic
node_siryc -->|"provides patient context"| node_title_enhancer
node_title_enhancer -->|"updates tab title"| node_siryc
node_siryc -->|"hosts compatible fields"| node_template_inserter
node_template_inserter -->|"inserts selected template"| node_siryc
node_settings -.->|"uses page"| node_options_page
node_popup -.->|"uses page"| node_popup_page

click node_settings "https://github.com/elgatosaez/bettersiryc/blob/master/options.js"
click node_popup "https://github.com/elgatosaez/bettersiryc/blob/master/popup.js"
click node_title_enhancer "https://github.com/elgatosaez/bettersiryc/blob/master/content-script.js"
click node_template_inserter "https://github.com/elgatosaez/bettersiryc/blob/master/content-script.js"
click node_template_logic "https://github.com/elgatosaez/bettersiryc/blob/master/templates.js"
click node_options_page "https://github.com/elgatosaez/bettersiryc/blob/master/options.html"
click node_popup_page "https://github.com/elgatosaez/bettersiryc/blob/master/popup.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_settings,node_popup,node_options_page,node_popup_page toneBlue
class node_title_enhancer,node_template_inserter toneAmber
class node_template_logic toneMint
class node_local_storage toneRose
class node_user,node_siryc toneIndigo
```

## Components

### Extension UI

- [Template manager](https://github.com/elgatosaez/bettersiryc/blob/master/options.js): `options.js`
- [Extension popup](https://github.com/elgatosaez/bettersiryc/blob/master/popup.js): `popup.js`
- [Settings page](https://github.com/elgatosaez/bettersiryc/blob/master/options.html): `options.html`
- [Popup page](https://github.com/elgatosaez/bettersiryc/blob/master/popup.html): `popup.html`

### Clinical enhancements

- [Contextual tab titles](https://github.com/elgatosaez/bettersiryc/blob/master/content-script.js): `content-script.js`
- [Clinical template insertion](https://github.com/elgatosaez/bettersiryc/blob/master/content-script.js): `content-script.js`

### Template domain

- [Template definitions and migration](https://github.com/elgatosaez/bettersiryc/blob/master/templates.js): `templates.js`

### Browser services

- **Chrome local storage**

### Other components

- **Clinician**
- **SIRYC**

## Connections

- Clinician → Extension popup: opens (evidence: `README.md`)
- Clinician → Template manager: manages templates (evidence: `README.md`)
- Clinician → SIRYC: uses (evidence: `README.md`)
- Extension popup → Chrome local storage: reads templates (evidence: `popup.js`)
- Extension popup → Template manager: opens settings (evidence: `popup.js`)
- Template manager → Chrome local storage: reads and writes (evidence: `options.js`)
- Template manager → Template definitions and migration: uses definitions and migration (evidence: `options.js`)
- Clinical template insertion → Chrome local storage: loads templates (evidence: `content-script.js`)
- Clinical template insertion → Template definitions and migration: uses definitions and migration (evidence: `content-script.js`)
- SIRYC → Contextual tab titles: provides patient context (evidence: `README.md`)
- Contextual tab titles → SIRYC: updates tab title (evidence: `content-script.js`)
- SIRYC → Clinical template insertion: hosts compatible fields (evidence: `README.md`)
- Clinical template insertion → SIRYC: inserts selected template (evidence: `content-script.js`)
- Template manager → Settings page: uses page
- Extension popup → Popup page: uses page
