# vodan-development/safevoice architecture

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

- Interactive diagram: https://gitdiagram.com/vodan-development/safevoice
- Repository: https://github.com/vodan-development/safevoice

## Overview

SafeVoice is a Streamlit application for submitting human-trafficking reports and turning them into RDF triples stored in AllegroGraph. A source enters a report, which the app saves as raw JSON and passes to the pipeline. The pipeline cleans and anonymizes the data, maps it to N-Triples, uploads the file, and archives successful submissions; users can then view and filter archived reports. The README documents the major workflow, while the sampled source shows the key calls and file operations. The report-form domains are represented in the UI node rather than split into speculative components.

Main entry points: [`src/orchestrator/pipeline.py`](https://github.com/vodan-development/safevoice/blob/main/src/orchestrator/pipeline.py) (Workflow orchestrator), [`app.py`](https://github.com/vodan-development/safevoice/blob/main/app.py) (Report UI), [`src/transform/mapper.py`](https://github.com/vodan-development/safevoice/blob/main/src/transform/mapper.py) (RDF mapper), [`src/cleaning/cleaner.py`](https://github.com/vodan-development/safevoice/blob/main/src/cleaning/cleaner.py) (Cleaning and anonymization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Report submission"]
  node_report_ui["Report UI<br/>[app.py]"]
  node_dropdowns["Form options<br/>[UI_drop_downs.csv]"]
end

subgraph group_processing["Data processing"]
  node_pipeline["Workflow orchestrator<br/>[pipeline.py]"]
  node_cleaner["Cleaning and anonymization<br/>[cleaner.py]"]
  node_cdm_schema["CDM schema"]
  node_mapper["RDF mapper<br/>[mapper.py]"]
  node_mapping_config["YARRRML mapping<br/>[yml_mapping.yml]"]
end

subgraph group_storage["Files and storage"]
  node_raw_reports["Raw JSON reports"]
  node_intermediate_nt["Staged N-Triples"]
  node_ingest["RDF ingestion<br/>[ingest.py]"]
  node_allegrograph[("AllegroGraph")]
  node_processed_nt["Processed N-Triples"]
end

subgraph group_review["Report review"]
  node_processed_json["Archived JSON reports"]
end

node_source(("Report source"))

node_source -->|"submits report"| node_report_ui
node_report_ui -->|"loads options"| node_dropdowns
node_report_ui -->|"writes JSON"| node_raw_reports
node_report_ui -->|"runs pipeline"| node_pipeline
node_pipeline -->|"cleans data"| node_cleaner
node_cleaner -->|"reads schema"| node_cdm_schema
node_pipeline -->|"creates triples"| node_mapper
node_mapper -->|"loads mapping"| node_mapping_config
node_mapper -->|"writes N-Triples"| node_intermediate_nt
node_pipeline -->|"uploads file"| node_ingest
node_ingest -->|"loads triples"| node_allegrograph
node_pipeline -->|"archives N-Triples"| node_processed_nt
node_pipeline -->|"moves JSON"| node_raw_reports
node_pipeline -->|"archives JSON"| node_processed_json
node_report_ui -->|"reads reports"| node_processed_json

click node_report_ui "https://github.com/vodan-development/safevoice/blob/main/app.py"
click node_dropdowns "https://github.com/vodan-development/safevoice/blob/main/config/UI_drop_downs.csv"
click node_raw_reports "https://github.com/vodan-development/safevoice/tree/main/data/raw/raw_json_record"
click node_pipeline "https://github.com/vodan-development/safevoice/blob/main/src/orchestrator/pipeline.py"
click node_cleaner "https://github.com/vodan-development/safevoice/blob/main/src/cleaning/cleaner.py"
click node_cdm_schema "https://github.com/vodan-development/safevoice/blob/main/config/CDM%20-%20Human%20Trafficking%20Sources%20EEPA.csv"
click node_mapper "https://github.com/vodan-development/safevoice/blob/main/src/transform/mapper.py"
click node_mapping_config "https://github.com/vodan-development/safevoice/blob/main/config/yml_mapping.yml"
click node_intermediate_nt "https://github.com/vodan-development/safevoice/tree/main/data/intermediate"
click node_ingest "https://github.com/vodan-development/safevoice/blob/main/src/storage/ingest.py"
click node_processed_nt "https://github.com/vodan-development/safevoice/tree/main/data/processed/processed_nt_file"
click node_processed_json "https://github.com/vodan-development/safevoice/tree/main/data/processed/processed_json_record"

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_report_ui,node_dropdowns toneBlue
class node_pipeline,node_cleaner,node_cdm_schema,node_mapper,node_mapping_config toneAmber
class node_raw_reports,node_intermediate_nt,node_ingest,node_allegrograph,node_processed_nt toneMint
class node_processed_json toneRose
class node_source toneIndigo
```

## Components

### Report submission

- [Report UI](https://github.com/vodan-development/safevoice/blob/main/app.py): `app.py`
- [Form options](https://github.com/vodan-development/safevoice/blob/main/config/UI_drop_downs.csv): `config/UI_drop_downs.csv`

### Data processing

- [Workflow orchestrator](https://github.com/vodan-development/safevoice/blob/main/src/orchestrator/pipeline.py): `src/orchestrator/pipeline.py`
- [Cleaning and anonymization](https://github.com/vodan-development/safevoice/blob/main/src/cleaning/cleaner.py): `src/cleaning/cleaner.py`
- [CDM schema](https://github.com/vodan-development/safevoice/blob/main/config/CDM%20-%20Human%20Trafficking%20Sources%20EEPA.csv): `config/CDM - Human Trafficking Sources EEPA.csv`
- [RDF mapper](https://github.com/vodan-development/safevoice/blob/main/src/transform/mapper.py): `src/transform/mapper.py`
- [YARRRML mapping](https://github.com/vodan-development/safevoice/blob/main/config/yml_mapping.yml): `config/yml_mapping.yml`

### Files and storage

- [Raw JSON reports](https://github.com/vodan-development/safevoice/tree/main/data/raw/raw_json_record): `data/raw/raw_json_record`
- [Staged N-Triples](https://github.com/vodan-development/safevoice/tree/main/data/intermediate): `data/intermediate`
- [RDF ingestion](https://github.com/vodan-development/safevoice/blob/main/src/storage/ingest.py): `src/storage/ingest.py`
- **AllegroGraph**
- [Processed N-Triples](https://github.com/vodan-development/safevoice/tree/main/data/processed/processed_nt_file): `data/processed/processed_nt_file`

### Report review

- [Archived JSON reports](https://github.com/vodan-development/safevoice/tree/main/data/processed/processed_json_record): `data/processed/processed_json_record`

### Other components

- **Report source**

## Connections

- Report source → Report UI: submits report (evidence: `README.md`)
- Report UI → Form options: loads options (evidence: `app.py`)
- Report UI → Raw JSON reports: writes JSON (evidence: `app.py`)
- Report UI → Workflow orchestrator: runs pipeline (evidence: `app.py`)
- Workflow orchestrator → Cleaning and anonymization: cleans data (evidence: `src/orchestrator/pipeline.py`)
- Cleaning and anonymization → CDM schema: reads schema (evidence: `README.md`)
- Workflow orchestrator → RDF mapper: creates triples (evidence: `src/orchestrator/pipeline.py`)
- RDF mapper → YARRRML mapping: loads mapping (evidence: `src/transform/mapper.py`)
- RDF mapper → Staged N-Triples: writes N-Triples (evidence: `src/transform/mapper.py`)
- Workflow orchestrator → RDF ingestion: uploads file (evidence: `src/orchestrator/pipeline.py`)
- RDF ingestion → AllegroGraph: loads triples (evidence: `src/storage/ingest.py`)
- Workflow orchestrator → Processed N-Triples: archives N-Triples (evidence: `src/orchestrator/pipeline.py`)
- Workflow orchestrator → Raw JSON reports: moves JSON (evidence: `src/orchestrator/pipeline.py`)
- Workflow orchestrator → Archived JSON reports: archives JSON (evidence: `src/orchestrator/pipeline.py`)
- Report UI → Archived JSON reports: reads reports (evidence: `app.py`)
