# omic/jailbreak architecture

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

- Interactive diagram: https://gitdiagram.com/omic/jailbreak
- Repository: https://github.com/omic/jailbreak

## Overview

This is an EMR extraction and research-data preparation tool. A user supplies provider credentials; the CLI reads them and dispatches to a provider bot, which retrieves portal records, parses them, transforms them toward OMOP, and loads them for research. The sampled runtime implements UW Medicine extraction and vital-sign parsing; the README describes broader anonymization, normalization, and publishing goals, while the Kaiser implementation is a separate proof of concept. The OMOP transformation and Redshift upload are incomplete in the sampled code.

Main entry points: [`src/bot/uw.js`](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js) (UW portal bot), [`src/bot/master.js`](https://github.com/omic/jailbreak/blob/master/src/bot/master.js) (Bot workflow), [`src/index.js`](https://github.com/omic/jailbreak/blob/master/src/index.js) (CLI dispatcher), [`src/util.js`](https://github.com/omic/jailbreak/blob/master/src/util.js) (Credential reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["CLI and orchestration"]
  node_credentials["Provider credentials"]
  node_cli["CLI dispatcher<br/>[index.js]"]
  node_config["Local config<br/>[config.js]"]
  node_master["Bot workflow<br/>[master.js]"]
  node_secrets["Credential reader<br/>[util.js]"]
end

subgraph group_uw["UW extraction"]
  node_uwbot["UW portal bot<br/>[uw.js]"]
  node_recordzip["Downloaded records<br/>[uw.js]"]
  node_unpack["ZIP extraction<br/>[uw.js]"]
  node_ccda["C-CDA records<br/>[uw.js]"]
end

subgraph group_transform["Data preparation"]
  node_parser["Vitals parser<br/>[uw.js]"]
  node_anonymize["Identity aliasing<br/>[master.js]"]
  node_omop["OMOP transformation<br/>[master.js]"]
  node_loader["Database loader<br/>[uw.js]"]
end

subgraph group_integrations["Providers and research"]
  node_portal["UW Medicine portal"]
  node_redshift[("Research database")]
  node_kaiser["Kaiser downloader PoC<br/>[kaiser_wa.py]"]
  node_kaiserportal["Kaiser portal"]
end

node_user(("Data donor"))
node_researchers(("Researchers"))

node_user -->|"provides"| node_credentials
node_credentials -->|"stored for"| node_secrets
node_cli -->|"loads"| node_config
node_cli -->|"reads"| node_secrets
node_cli -->|"dispatches"| node_uwbot
node_uwbot -->|"extends"| node_master
node_master -->|"calls extract"| node_uwbot
node_uwbot -->|"logs in; requests export"| node_portal
node_portal -->|"provides download"| node_recordzip
node_uwbot -->|"uncompresses"| node_unpack
node_unpack -->|"extracts files"| node_ccda
node_uwbot -->|"parses records"| node_parser
node_parser -->|"returns parsed data"| node_anonymize
node_master -->|"calls tx"| node_omop
node_omop -->|"returns queries"| node_loader
node_master -->|"calls load"| node_loader
node_loader -.->|"planned upload"| node_redshift
node_redshift -.->|"research access"| node_researchers
node_kaiser -->|"logs in; requests download"| node_kaiserportal

click node_cli "https://github.com/omic/jailbreak/blob/master/src/index.js"
click node_config "https://github.com/omic/jailbreak/blob/master/src/config.js"
click node_master "https://github.com/omic/jailbreak/blob/master/src/bot/master.js"
click node_secrets "https://github.com/omic/jailbreak/blob/master/src/util.js"
click node_uwbot "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_recordzip "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_unpack "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_ccda "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_parser "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_anonymize "https://github.com/omic/jailbreak/blob/master/src/bot/master.js"
click node_omop "https://github.com/omic/jailbreak/blob/master/src/bot/master.js"
click node_loader "https://github.com/omic/jailbreak/blob/master/src/bot/uw.js"
click node_kaiser "https://github.com/omic/jailbreak/blob/master/PoC/wa_kaiser_PoC/kaiser_wa.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_credentials,node_cli,node_config,node_master,node_secrets toneBlue
class node_uwbot,node_recordzip,node_unpack,node_ccda toneAmber
class node_parser,node_anonymize,node_omop,node_loader toneMint
class node_portal,node_redshift,node_kaiser,node_kaiserportal toneRose
class node_user,node_researchers toneIndigo
```

## Components

### CLI and orchestration

- **Provider credentials**
- [CLI dispatcher](https://github.com/omic/jailbreak/blob/master/src/index.js): `src/index.js`
- [Local config](https://github.com/omic/jailbreak/blob/master/src/config.js): `src/config.js`
- [Bot workflow](https://github.com/omic/jailbreak/blob/master/src/bot/master.js): `src/bot/master.js`
- [Credential reader](https://github.com/omic/jailbreak/blob/master/src/util.js): `src/util.js`

### UW extraction

- [UW portal bot](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`
- [Downloaded records](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`
- [ZIP extraction](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`
- [C-CDA records](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`

### Data preparation

- [Vitals parser](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`
- [Identity aliasing](https://github.com/omic/jailbreak/blob/master/src/bot/master.js): `src/bot/master.js`
- [OMOP transformation](https://github.com/omic/jailbreak/blob/master/src/bot/master.js): `src/bot/master.js`
- [Database loader](https://github.com/omic/jailbreak/blob/master/src/bot/uw.js): `src/bot/uw.js`

### Providers and research

- **UW Medicine portal**
- **Research database**
- [Kaiser downloader PoC](https://github.com/omic/jailbreak/blob/master/PoC/wa_kaiser_PoC/kaiser_wa.py): `PoC/wa_kaiser_PoC/kaiser_wa.py`
- **Kaiser portal**

### Other components

- **Data donor**
- **Researchers**

## Connections

- Data donor → Provider credentials: provides
- Provider credentials → Credential reader: stored for
- CLI dispatcher → Local config: loads
- CLI dispatcher → Credential reader: reads
- CLI dispatcher → UW portal bot: dispatches
- UW portal bot → Bot workflow: extends
- Bot workflow → UW portal bot: calls extract
- UW portal bot → UW Medicine portal: logs in; requests export
- UW Medicine portal → Downloaded records: provides download
- UW portal bot → ZIP extraction: uncompresses
- ZIP extraction → C-CDA records: extracts files
- UW portal bot → Vitals parser: parses records
- Vitals parser → Identity aliasing: returns parsed data
- Bot workflow → OMOP transformation: calls tx
- OMOP transformation → Database loader: returns queries
- Bot workflow → Database loader: calls load
- Database loader → Research database: planned upload
- Research database → Researchers: research access
- Kaiser downloader PoC → Kaiser portal: logs in; requests download
