# soham192/nlpproject architecture

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

- Interactive diagram: https://gitdiagram.com/soham192/nlpproject
- Repository: https://github.com/soham192/nlpproject

## Overview

Selective Audio Redaction accepts a PCM WAV and offers a browser/API or CLI workflow to detect sensitive speech, mask it reversibly, restore it with a key, and evaluate preservation. The core pipeline uses ASR, word alignment, entity detection, sample-range mapping, and AES-GCM masking into a manifest; evaluation checks non-redacted speech and entity accuracy. The README also documents waveform/playback visualization and demo output. Edges reflect the sampled orchestrator, API routes, and UI; unsampled implementation details are represented conservatively.

Main entry points: [`src/pipeline.py`](https://github.com/soham192/nlpproject/blob/main/src/pipeline.py) (Pipeline orchestration), [`api/routes.py`](https://github.com/soham192/nlpproject/blob/main/api/routes.py) (HTTP routes), [`web/src/App.jsx`](https://github.com/soham192/nlpproject/blob/main/web/src/App.jsx) (Redaction UI), [`src/evaluate.py`](https://github.com/soham192/nlpproject/blob/main/src/evaluate.py) (Preservation evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser interface"]
  node_webapp["Redaction UI<br/>[App.jsx]"]
  node_uploadui["Upload control<br/>[Dropzone.jsx]"]
  node_waveform["Waveform view<br/>[WaveformView.jsx]"]
  node_ui_views["Result views"]
end

subgraph group_service["API service"]
  node_httpapi["HTTP routes<br/>[routes.py]"]
  node_jobs["Job queue<br/>[jobs.py]"]
end

subgraph group_pipeline["Redaction pipeline"]
  node_orchestrator["Pipeline orchestration<br/>[pipeline.py]"]
  node_asr["Speech recognition<br/>[asr.py]"]
  node_alignment["Word alignment<br/>[alignment.py]"]
  node_detection["PII detection<br/>[detect.py]"]
  node_mapping["Span mapping<br/>[mapping.py]"]
  node_timing["Stage timings<br/>[timing.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_artifacts["Audio and verification"]
  node_audioio["PCM audio I/O<br/>[audio.py]"]
  node_masking["Encrypted masking<br/>[mask.py]"]
  node_manifest["Manifest management<br/>[manifest.py]"]
  node_evaluation["Preservation evaluation<br/>[evaluate.py]"]
  node_demo["Demo outputs<br/>[demo.py]"]
end

node_operator(("User"))

node_operator -->|"uses"| node_webapp
node_uploadui -->|"provides upload"| node_webapp
node_webapp -->|"requests operations"| node_httpapi
node_webapp -->|"renders results"| node_ui_views
node_webapp -.->|"shows audio"| node_waveform
node_httpapi -->|"submits work"| node_jobs
node_jobs -->|"runs pipeline"| node_orchestrator
node_httpapi -->|"calls operations"| node_orchestrator
node_orchestrator -->|"loads audio"| node_audioio
node_orchestrator -->|"transcribes"| node_asr
node_orchestrator -->|"aligns words"| node_alignment
node_orchestrator -->|"detects entities"| node_detection
node_orchestrator -->|"maps spans"| node_mapping
node_orchestrator -.->|"masks ranges"| node_masking
node_masking -->|"stores ciphertext"| node_manifest
node_orchestrator -.->|"writes artifact"| node_manifest
node_httpapi -->|"requests evaluation"| node_evaluation
node_evaluation -->|"re-transcribes audio"| node_asr
node_evaluation -->|"aligns transcripts"| node_alignment
node_evaluation -->|"uses span metadata"| node_manifest
node_demo -->|"uses audio"| node_audioio
node_demo -->|"reads manifest"| node_manifest
node_orchestrator -->|"records stages"| node_timing
node_orchestrator -->|"uses settings"| node_config
node_httpapi -->|"loads settings"| node_config

click node_webapp "https://github.com/soham192/nlpproject/blob/main/web/src/App.jsx"
click node_uploadui "https://github.com/soham192/nlpproject/blob/main/web/src/components/Dropzone.jsx"
click node_waveform "https://github.com/soham192/nlpproject/blob/main/web/src/components/WaveformView.jsx"
click node_ui_views "https://github.com/soham192/nlpproject/tree/main/web/src/components"
click node_httpapi "https://github.com/soham192/nlpproject/blob/main/api/routes.py"
click node_jobs "https://github.com/soham192/nlpproject/blob/main/api/jobs.py"
click node_orchestrator "https://github.com/soham192/nlpproject/blob/main/src/pipeline.py"
click node_audioio "https://github.com/soham192/nlpproject/blob/main/src/audio.py"
click node_asr "https://github.com/soham192/nlpproject/blob/main/src/asr.py"
click node_alignment "https://github.com/soham192/nlpproject/blob/main/src/alignment.py"
click node_detection "https://github.com/soham192/nlpproject/blob/main/src/detect.py"
click node_mapping "https://github.com/soham192/nlpproject/blob/main/src/mapping.py"
click node_masking "https://github.com/soham192/nlpproject/blob/main/src/mask.py"
click node_manifest "https://github.com/soham192/nlpproject/blob/main/src/manifest.py"
click node_evaluation "https://github.com/soham192/nlpproject/blob/main/src/evaluate.py"
click node_demo "https://github.com/soham192/nlpproject/blob/main/src/demo.py"
click node_timing "https://github.com/soham192/nlpproject/blob/main/src/timing.py"
click node_config "https://github.com/soham192/nlpproject/blob/main/src/config.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_webapp,node_uploadui,node_waveform,node_ui_views,node_operator toneBlue
class node_httpapi,node_jobs toneAmber
class node_orchestrator,node_asr,node_alignment,node_detection,node_mapping,node_timing,node_config toneMint
class node_audioio,node_masking,node_manifest,node_evaluation,node_demo toneRose
```

## Components

### Browser interface

- [Redaction UI](https://github.com/soham192/nlpproject/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Upload control](https://github.com/soham192/nlpproject/blob/main/web/src/components/Dropzone.jsx): `web/src/components/Dropzone.jsx`
- [Waveform view](https://github.com/soham192/nlpproject/blob/main/web/src/components/WaveformView.jsx): `web/src/components/WaveformView.jsx`
- [Result views](https://github.com/soham192/nlpproject/tree/main/web/src/components): `web/src/components`

### API service

- [HTTP routes](https://github.com/soham192/nlpproject/blob/main/api/routes.py): `api/routes.py`
- [Job queue](https://github.com/soham192/nlpproject/blob/main/api/jobs.py): `api/jobs.py`

### Redaction pipeline

- [Pipeline orchestration](https://github.com/soham192/nlpproject/blob/main/src/pipeline.py): `src/pipeline.py`
- [Speech recognition](https://github.com/soham192/nlpproject/blob/main/src/asr.py): `src/asr.py`
- [Word alignment](https://github.com/soham192/nlpproject/blob/main/src/alignment.py): `src/alignment.py`
- [PII detection](https://github.com/soham192/nlpproject/blob/main/src/detect.py): `src/detect.py`
- [Span mapping](https://github.com/soham192/nlpproject/blob/main/src/mapping.py): `src/mapping.py`
- [Stage timings](https://github.com/soham192/nlpproject/blob/main/src/timing.py): `src/timing.py`
- [Runtime configuration](https://github.com/soham192/nlpproject/blob/main/src/config.py): `src/config.py`

### Audio and verification

- [PCM audio I/O](https://github.com/soham192/nlpproject/blob/main/src/audio.py): `src/audio.py`
- [Encrypted masking](https://github.com/soham192/nlpproject/blob/main/src/mask.py): `src/mask.py`
- [Manifest management](https://github.com/soham192/nlpproject/blob/main/src/manifest.py): `src/manifest.py`
- [Preservation evaluation](https://github.com/soham192/nlpproject/blob/main/src/evaluate.py): `src/evaluate.py`
- [Demo outputs](https://github.com/soham192/nlpproject/blob/main/src/demo.py): `src/demo.py`

### Other components

- **User**

## Connections

- User → Redaction UI: uses (evidence: `README.md`)
- Upload control → Redaction UI: provides upload (evidence: `web/src/App.jsx`)
- Redaction UI → HTTP routes: requests operations (evidence: `README.md`)
- Redaction UI → Result views: renders results (evidence: `web/src/App.jsx`)
- Redaction UI → Waveform view: shows audio (evidence: `README.md`)
- HTTP routes → Job queue: submits work (evidence: `api/routes.py`)
- Job queue → Pipeline orchestration: runs pipeline (evidence: `api/routes.py`)
- HTTP routes → Pipeline orchestration: calls operations (evidence: `api/routes.py`)
- Pipeline orchestration → PCM audio I/O: loads audio (evidence: `src/pipeline.py`)
- Pipeline orchestration → Speech recognition: transcribes (evidence: `src/pipeline.py`)
- Pipeline orchestration → Word alignment: aligns words (evidence: `src/pipeline.py`)
- Pipeline orchestration → PII detection: detects entities (evidence: `src/pipeline.py`)
- Pipeline orchestration → Span mapping: maps spans (evidence: `src/pipeline.py`)
- Pipeline orchestration → Encrypted masking: masks ranges (evidence: `README.md`)
- Encrypted masking → Manifest management: stores ciphertext (evidence: `README.md`)
- Pipeline orchestration → Manifest management: writes artifact (evidence: `README.md`)
- HTTP routes → Preservation evaluation: requests evaluation (evidence: `api/routes.py`)
- Preservation evaluation → Speech recognition: re-transcribes audio (evidence: `src/evaluate.py`)
- Preservation evaluation → Word alignment: aligns transcripts (evidence: `src/evaluate.py`)
- Preservation evaluation → Manifest management: uses span metadata (evidence: `src/evaluate.py`)
- Demo outputs → PCM audio I/O: uses audio (evidence: `src/demo.py`)
- Demo outputs → Manifest management: reads manifest (evidence: `src/demo.py`)
- Pipeline orchestration → Stage timings: records stages (evidence: `src/pipeline.py`)
- Pipeline orchestration → Runtime configuration: uses settings (evidence: `src/pipeline.py`)
- HTTP routes → Runtime configuration: loads settings (evidence: `api/main.py`)
