# nachodll/gbv_eq_db architecture

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

- Interactive diagram: https://gitdiagram.com/nachodll/gbv_eq_db
- Repository: https://github.com/nachodll/gbv_eq_db

## Overview

GBV_EQ_DB is a Spanish gender-based-violence indicator data platform. Its principal workflow is CLI orchestration of schema setup, source extraction, domain-specific CSV harmonisation, and PostgreSQL loading. The graph groups the many one-table ET scripts by subject while preserving the major violence, social-context, and migration branches. Raw and cleaned data are in a private companion repository; relationships among individual unsampled ET scripts are summarized from the README rather than inferred. <=

Main entry points: [`pipelines/main.py`](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/main.py) (Pipeline CLI), [`pipelines/extract_transform_data.py`](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/extract_transform_data.py) (ET dispatch), [`pipelines/load_data.py`](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/load_data.py) (CSV loader), [`pipelines/extract_transform/percepcion_social`](https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform/percepcion_social) (Survey indicators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Pipeline control"]
  node_runner["Pipeline CLI<br/>[main.py]"]
  node_schema_setup["Schema setup<br/>[create_schemas.py]"]
  node_schema_drop["Schema reset<br/>[drop_schemas.py]"]
  node_etl_dispatch["ET dispatch"]
end

subgraph group_acquisition["Source acquisition"]
  node_downloaders["Source downloaders"]
end

subgraph group_transform["Indicator transformation"]
  node_violence_et["Violence indicators"]
  node_survey_et["Survey indicators"]
  node_context_et["Social context indicators"]
  node_migration_et["Migration indicators"]
end

subgraph group_support["Shared data support"]
  node_normalization["Normalization helpers<br/>[normalization.py]"]
  node_normalization_dicts["Normalization dictionaries"]
end

subgraph group_persistence["Database loading"]
  node_db_loader["CSV loader<br/>[load_data.py]"]
  node_custom_loaders["Custom table loaders"]
end

node_operator(("Maintainer"))
node_raw_data[("Private raw data")]
node_clean_data[("Clean CSV datasets")]
node_postgres[("PostgreSQL")]

node_operator -->|"runs"| node_runner
node_runner -->|"dispatches"| node_schema_drop
node_runner -->|"dispatches"| node_schema_setup
node_runner -->|"dispatches"| node_etl_dispatch
node_runner -->|"dispatches"| node_db_loader
node_downloaders -->|"saves raw files"| node_raw_data
node_raw_data -->|"reads and transforms"| node_violence_et
node_raw_data -->|"reads and transforms"| node_survey_et
node_raw_data -->|"reads and transforms"| node_context_et
node_raw_data -->|"reads and transforms"| node_migration_et
node_etl_dispatch -->|"runs ET scripts"| node_violence_et
node_etl_dispatch -->|"runs ET scripts"| node_survey_et
node_etl_dispatch -->|"runs ET scripts"| node_context_et
node_etl_dispatch -->|"runs ET scripts"| node_migration_et
node_violence_et -->|"writes clean CSV"| node_clean_data
node_survey_et -->|"writes clean CSV"| node_clean_data
node_context_et -->|"writes clean CSV"| node_clean_data
node_migration_et -->|"writes clean CSV"| node_clean_data
node_survey_et -->|"uses"| node_normalization
node_migration_et -->|"uses"| node_normalization
node_normalization -->|"uses dictionaries"| node_normalization_dicts
node_db_loader -->|"reads CSVs"| node_clean_data
node_db_loader -->|"invokes hooks"| node_custom_loaders
node_db_loader -->|"loads tables"| node_postgres
node_custom_loaders -->|"writes specialized tables"| node_postgres

click node_runner "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/main.py"
click node_schema_setup "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/create_schemas.py"
click node_schema_drop "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/drop_schemas.py"
click node_etl_dispatch "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/extract_transform_data.py"
click node_downloaders "https://github.com/nachodll/gbv_eq_db/tree/main/downloaders"
click node_violence_et "https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform/violencia_genero"
click node_survey_et "https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform/percepcion_social"
click node_context_et "https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform"
click node_migration_et "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/extract_transform/migracion/001_et_residentes_extranjeros.py"
click node_normalization "https://github.com/nachodll/gbv_eq_db/blob/main/utils/normalization.py"
click node_normalization_dicts "https://github.com/nachodll/gbv_eq_db/blob/main/utils/normalization_dicts.py"
click node_db_loader "https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/load_data.py"
click node_custom_loaders "https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/load"

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_runner,node_schema_setup,node_schema_drop,node_etl_dispatch toneBlue
class node_downloaders,node_raw_data,node_clean_data,node_postgres toneAmber
class node_violence_et,node_survey_et,node_context_et,node_migration_et toneMint
class node_normalization,node_normalization_dicts toneRose
class node_db_loader,node_custom_loaders,node_operator toneIndigo
```

## Components

### Pipeline control

- [Pipeline CLI](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/main.py): `pipelines/main.py`
- [Schema setup](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/create_schemas.py): `pipelines/create_schemas.py`
- [Schema reset](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/drop_schemas.py): `pipelines/drop_schemas.py`
- [ET dispatch](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/extract_transform_data.py): `pipelines/extract_transform_data.py`

### Source acquisition

- [Source downloaders](https://github.com/nachodll/gbv_eq_db/tree/main/downloaders): `downloaders`

### Indicator transformation

- [Violence indicators](https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform/violencia_genero): `pipelines/extract_transform/violencia_genero`
- [Survey indicators](https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform/percepcion_social): `pipelines/extract_transform/percepcion_social`
- [Social context indicators](https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/extract_transform): `pipelines/extract_transform`
- [Migration indicators](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/extract_transform/migracion/001_et_residentes_extranjeros.py): `pipelines/extract_transform/migracion/001_et_residentes_extranjeros.py`

### Shared data support

- [Normalization helpers](https://github.com/nachodll/gbv_eq_db/blob/main/utils/normalization.py): `utils/normalization.py`
- [Normalization dictionaries](https://github.com/nachodll/gbv_eq_db/blob/main/utils/normalization_dicts.py): `utils/normalization_dicts.py`

### Database loading

- [CSV loader](https://github.com/nachodll/gbv_eq_db/blob/main/pipelines/load_data.py): `pipelines/load_data.py`
- [Custom table loaders](https://github.com/nachodll/gbv_eq_db/tree/main/pipelines/load): `pipelines/load`

### Other components

- **Maintainer**
- **Private raw data**
- **Clean CSV datasets**
- **PostgreSQL**

## Connections

- Maintainer → Pipeline CLI: runs
- Pipeline CLI → Schema reset: dispatches (evidence: `pipelines/main.py`)
- Pipeline CLI → Schema setup: dispatches (evidence: `pipelines/main.py`)
- Pipeline CLI → ET dispatch: dispatches (evidence: `pipelines/main.py`)
- Pipeline CLI → CSV loader: dispatches (evidence: `pipelines/main.py`)
- Source downloaders → Private raw data: saves raw files
- Private raw data → Violence indicators: reads and transforms
- Private raw data → Survey indicators: reads and transforms (evidence: `pipelines/extract_transform/percepcion_social/001_et_barometros_generales.py`)
- Private raw data → Social context indicators: reads and transforms
- Private raw data → Migration indicators: reads and transforms (evidence: `pipelines/extract_transform/migracion/001_et_residentes_extranjeros.py`)
- ET dispatch → Violence indicators: runs ET scripts
- ET dispatch → Survey indicators: runs ET scripts
- ET dispatch → Social context indicators: runs ET scripts
- ET dispatch → Migration indicators: runs ET scripts
- Violence indicators → Clean CSV datasets: writes clean CSV
- Survey indicators → Clean CSV datasets: writes clean CSV
- Social context indicators → Clean CSV datasets: writes clean CSV
- Migration indicators → Clean CSV datasets: writes clean CSV
- Survey indicators → Normalization helpers: uses (evidence: `pipelines/extract_transform/percepcion_social/001_et_barometros_generales.py`)
- Migration indicators → Normalization helpers: uses (evidence: `pipelines/extract_transform/migracion/001_et_residentes_extranjeros.py`)
- Normalization helpers → Normalization dictionaries: uses dictionaries (evidence: `utils/normalization.py`)
- CSV loader → Clean CSV datasets: reads CSVs
- CSV loader → Custom table loaders: invokes hooks (evidence: `pipelines/load_data.py`)
- CSV loader → PostgreSQL: loads tables
- Custom table loaders → PostgreSQL: writes specialized tables (evidence: `pipelines/load/load_fuentes.py`)
