# mithun50/de-pulse architecture

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

- Interactive diagram: https://gitdiagram.com/mithun50/de-pulse
- Repository: https://github.com/mithun50/de-pulse

## Overview

de-Pulse is an offline, multilingual de-identification pipeline for hospital records, with a local web console for running and reviewing jobs. The main workflow ingests and parses files, learns corpus-specific clues, detects and links patient evidence, plans privacy generalizations, rewrites files, then scans and releases or quarantines outputs. The graph also preserves documented web review and evaluation capabilities. Some internal modules and web routes were not sampled; uncertain internal calls are omitted rather than inferred.

Main entry points: [`depulse/cli.py`](https://github.com/mithun50/de-pulse/blob/main/depulse/cli.py) (Pipeline runner), [`depulse/detect/engine.py`](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/engine.py) (Corpus learning), [`depulse_web/jobs.py`](https://github.com/mithun50/de-pulse/blob/main/depulse_web/jobs.py) (Run jobs), [`depulse_web/app.py`](https://github.com/mithun50/de-pulse/blob/main/depulse_web/app.py) (Console API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Pipeline orchestration"]
  node_cli["Pipeline runner<br/>[cli.py]"]
end

subgraph group_understand["Understand records"]
  node_ingest["File ingestion<br/>[ingest.py]"]
  node_model["Document model<br/>[model.py]"]
  node_learning_detection["Corpus learning<br/>[engine.py]"]
  node_field_detection["Field semantics<br/>[fields.py]"]
  node_pattern_detection["Pattern detection<br/>[patterns.py]"]
  node_name_detection["Name detection<br/>[names.py]"]
  node_date_detection["Date detection<br/>[dates.py]"]
  node_lexicon["Language lexicons<br/>[lexicon.py]"]
  node_normalization["Text normalization<br/>[textnorm.py]"]
  node_transliteration["Transliteration<br/>[translit.py]"]
end

subgraph group_privacy["Identity and privacy"]
  node_linking["Patient linking<br/>[link.py]"]
  node_crypto["Keyed pseudonyms<br/>[crypto.py]"]
  node_privacy_planning["Privacy planning<br/>[privacy.py]"]
  node_rare_values["Rare-value controls<br/>[rare.py]"]
  node_policy["Policy settings<br/>[policy.py]"]
end

subgraph group_delivery["Rewrite and release"]
  node_rewrite["Format-preserving rewrite<br/>[rewrite.py]"]
  node_leak_gate["Output leak gate<br/>[gate.py]"]
  node_quarantine[("Encrypted quarantine<br/>[crypto.py]")]
  node_release["Sanitized files and reports<br/>[cli.py]"]
end

subgraph group_console["Web console"]
  node_web_app["Console API<br/>[app.py]"]
  node_jobs["Run jobs<br/>[jobs.py]"]
  node_analysis["Run review<br/>[analysis.py]"]
  node_evaluation["Practice evaluation<br/>[evaluate.py]"]
end

node_operator(("Hospital operator"))
node_browser(("Local browser user"))

node_operator -->|"runs pipeline"| node_cli
node_cli -->|"parses files"| node_ingest
node_ingest -->|"builds documents"| node_model
node_cli -->|"learns clues"| node_learning_detection
node_cli -->|"detects fields"| node_field_detection
node_cli -->|"detects patterns"| node_pattern_detection
node_cli -->|"detects names"| node_name_detection
node_cli -->|"detects dates"| node_date_detection
node_learning_detection -->|"uses knowledge"| node_lexicon
node_learning_detection -->|"normalizes text"| node_normalization
node_learning_detection -->|"uses scripts"| node_transliteration
node_cli -->|"links patients"| node_linking
node_linking -->|"keys pseudonyms"| node_crypto
node_cli -->|"plans generalization"| node_privacy_planning
node_cli -->|"generalizes rare values"| node_rare_values
node_cli -->|"loads policy"| node_policy
node_cli -->|"rewrites files"| node_rewrite
node_cli -->|"scans output"| node_leak_gate
node_cli -->|"stores refused files"| node_quarantine
node_leak_gate -->|"passes to release"| node_release
node_cli -->|"writes outputs"| node_release
node_browser -->|"reviews runs"| node_web_app
node_web_app -->|"manages runs"| node_jobs
node_jobs -->|"starts child pipeline"| node_cli
node_web_app -->|"loads run review"| node_analysis
node_jobs -->|"reads run results"| node_analysis
node_jobs -->|"evaluates practice runs"| node_evaluation
node_browser -->|"downloads release"| node_release

click node_cli "https://github.com/mithun50/de-pulse/blob/main/depulse/cli.py"
click node_ingest "https://github.com/mithun50/de-pulse/blob/main/depulse/ingest.py"
click node_model "https://github.com/mithun50/de-pulse/blob/main/depulse/model.py"
click node_learning_detection "https://github.com/mithun50/de-pulse/blob/main/depulse/detect/engine.py"
click node_field_detection "https://github.com/mithun50/de-pulse/blob/main/depulse/detect/fields.py"
click node_pattern_detection "https://github.com/mithun50/de-pulse/blob/main/depulse/detect/patterns.py"
click node_name_detection "https://github.com/mithun50/de-pulse/blob/main/depulse/detect/names.py"
click node_date_detection "https://github.com/mithun50/de-pulse/blob/main/depulse/detect/dates.py"
click node_lexicon "https://github.com/mithun50/de-pulse/blob/main/depulse/lexicon.py"
click node_normalization "https://github.com/mithun50/de-pulse/blob/main/depulse/textnorm.py"
click node_transliteration "https://github.com/mithun50/de-pulse/blob/main/depulse/translit.py"
click node_linking "https://github.com/mithun50/de-pulse/blob/main/depulse/link.py"
click node_crypto "https://github.com/mithun50/de-pulse/blob/main/depulse/crypto.py"
click node_privacy_planning "https://github.com/mithun50/de-pulse/blob/main/depulse/privacy.py"
click node_rare_values "https://github.com/mithun50/de-pulse/blob/main/depulse/rare.py"
click node_policy "https://github.com/mithun50/de-pulse/blob/main/depulse/policy.py"
click node_rewrite "https://github.com/mithun50/de-pulse/blob/main/depulse/rewrite.py"
click node_leak_gate "https://github.com/mithun50/de-pulse/blob/main/depulse/gate.py"
click node_quarantine "https://github.com/mithun50/de-pulse/blob/main/depulse/crypto.py"
click node_release "https://github.com/mithun50/de-pulse/blob/main/depulse/cli.py"
click node_web_app "https://github.com/mithun50/de-pulse/blob/main/depulse_web/app.py"
click node_jobs "https://github.com/mithun50/de-pulse/blob/main/depulse_web/jobs.py"
click node_analysis "https://github.com/mithun50/de-pulse/blob/main/depulse_web/analysis.py"
click node_evaluation "https://github.com/mithun50/de-pulse/blob/main/depulse_web/evaluate.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_cli,node_browser toneBlue
class node_ingest,node_model,node_learning_detection,node_field_detection,node_pattern_detection,node_name_detection,node_date_detection,node_lexicon,node_normalization,node_transliteration toneAmber
class node_linking,node_crypto,node_privacy_planning,node_rare_values,node_policy toneMint
class node_rewrite,node_leak_gate,node_quarantine,node_release toneRose
class node_web_app,node_jobs,node_analysis,node_evaluation,node_operator toneIndigo
```

## Components

### Pipeline orchestration

- [Pipeline runner](https://github.com/mithun50/de-pulse/blob/main/depulse/cli.py): `depulse/cli.py`

### Understand records

- [File ingestion](https://github.com/mithun50/de-pulse/blob/main/depulse/ingest.py): `depulse/ingest.py`
- [Document model](https://github.com/mithun50/de-pulse/blob/main/depulse/model.py): `depulse/model.py`
- [Corpus learning](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/engine.py): `depulse/detect/engine.py`
- [Field semantics](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/fields.py): `depulse/detect/fields.py`
- [Pattern detection](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/patterns.py): `depulse/detect/patterns.py`
- [Name detection](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/names.py): `depulse/detect/names.py`
- [Date detection](https://github.com/mithun50/de-pulse/blob/main/depulse/detect/dates.py): `depulse/detect/dates.py`
- [Language lexicons](https://github.com/mithun50/de-pulse/blob/main/depulse/lexicon.py): `depulse/lexicon.py`
- [Text normalization](https://github.com/mithun50/de-pulse/blob/main/depulse/textnorm.py): `depulse/textnorm.py`
- [Transliteration](https://github.com/mithun50/de-pulse/blob/main/depulse/translit.py): `depulse/translit.py`

### Identity and privacy

- [Patient linking](https://github.com/mithun50/de-pulse/blob/main/depulse/link.py): `depulse/link.py`
- [Keyed pseudonyms](https://github.com/mithun50/de-pulse/blob/main/depulse/crypto.py): `depulse/crypto.py`
- [Privacy planning](https://github.com/mithun50/de-pulse/blob/main/depulse/privacy.py): `depulse/privacy.py`
- [Rare-value controls](https://github.com/mithun50/de-pulse/blob/main/depulse/rare.py): `depulse/rare.py`
- [Policy settings](https://github.com/mithun50/de-pulse/blob/main/depulse/policy.py): `depulse/policy.py`

### Rewrite and release

- [Format-preserving rewrite](https://github.com/mithun50/de-pulse/blob/main/depulse/rewrite.py): `depulse/rewrite.py`
- [Output leak gate](https://github.com/mithun50/de-pulse/blob/main/depulse/gate.py): `depulse/gate.py`
- [Encrypted quarantine](https://github.com/mithun50/de-pulse/blob/main/depulse/crypto.py): `depulse/crypto.py`
- [Sanitized files and reports](https://github.com/mithun50/de-pulse/blob/main/depulse/cli.py): `depulse/cli.py`

### Web console

- [Console API](https://github.com/mithun50/de-pulse/blob/main/depulse_web/app.py): `depulse_web/app.py`
- [Run jobs](https://github.com/mithun50/de-pulse/blob/main/depulse_web/jobs.py): `depulse_web/jobs.py`
- [Run review](https://github.com/mithun50/de-pulse/blob/main/depulse_web/analysis.py): `depulse_web/analysis.py`
- [Practice evaluation](https://github.com/mithun50/de-pulse/blob/main/depulse_web/evaluate.py): `depulse_web/evaluate.py`

### Other components

- **Hospital operator**
- **Local browser user**

## Connections

- Hospital operator → Pipeline runner: runs pipeline (evidence: `README.md`)
- Pipeline runner → File ingestion: parses files (evidence: `README.md`)
- File ingestion → Document model: builds documents (evidence: `depulse/ingest.py`)
- Pipeline runner → Corpus learning: learns clues (evidence: `README.md`)
- Pipeline runner → Field semantics: detects fields (evidence: `README.md`)
- Pipeline runner → Pattern detection: detects patterns (evidence: `README.md`)
- Pipeline runner → Name detection: detects names (evidence: `README.md`)
- Pipeline runner → Date detection: detects dates (evidence: `README.md`)
- Corpus learning → Language lexicons: uses knowledge (evidence: `depulse/detect/engine.py`)
- Corpus learning → Text normalization: normalizes text (evidence: `depulse/detect/engine.py`)
- Corpus learning → Transliteration: uses scripts (evidence: `depulse/detect/engine.py`)
- Pipeline runner → Patient linking: links patients (evidence: `README.md`)
- Patient linking → Keyed pseudonyms: keys pseudonyms (evidence: `README.md`)
- Pipeline runner → Privacy planning: plans generalization (evidence: `README.md`)
- Pipeline runner → Rare-value controls: generalizes rare values (evidence: `README.md`)
- Pipeline runner → Policy settings: loads policy (evidence: `depulse/cli.py`)
- Pipeline runner → Format-preserving rewrite: rewrites files (evidence: `README.md`)
- Pipeline runner → Output leak gate: scans output (evidence: `README.md`)
- Pipeline runner → Encrypted quarantine: stores refused files (evidence: `README.md`)
- Output leak gate → Sanitized files and reports: passes to release (evidence: `README.md`)
- Pipeline runner → Sanitized files and reports: writes outputs (evidence: `README.md`)
- Local browser user → Console API: reviews runs (evidence: `README.md`)
- Console API → Run jobs: manages runs (evidence: `depulse_web/app.py`)
- Run jobs → Pipeline runner: starts child pipeline (evidence: `depulse_web/jobs.py`)
- Console API → Run review: loads run review (evidence: `depulse_web/app.py`)
- Run jobs → Run review: reads run results (evidence: `depulse_web/jobs.py`)
- Run jobs → Practice evaluation: evaluates practice runs (evidence: `depulse_web/jobs.py`)
- Local browser user → Sanitized files and reports: downloads release (evidence: `README.md`)
