# jibyte/artic-etl-analytics-api architecture

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

- Interactive diagram: https://gitdiagram.com/jibyte/artic-etl-analytics-api
- Repository: https://github.com/jibyte/artic-etl-analytics-api

## Overview

This is a FastAPI service for ingesting Art Institute of Chicago artworks, staging raw records in MongoDB, transforming and loading them into a MySQL warehouse, and exposing analytics and cross-store auditing. The main workflow is an API request routed to ETL extraction and then transformation; separate endpoints reset the pipeline, profile one record across both stores, or analyze a warehouse column. The excerpts show these calls and storage operations. Other README capabilities are represented where documented; unsampled implementation details are not inferred.

Main entry points: [`app/main.py`](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/main.py) (FastAPI application), [`app/controllers/etl_controller.py`](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/controllers/etl_controller.py) (ETL routes), [`app/database.py`](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/database.py) (Connection layer), [`app/models/entidad_sql.py`](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/models/entidad_sql.py) (Artwork model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Layer"]
  node_app["FastAPI application<br/>[main.py]"]
  node_etl_routes["ETL routes<br/>[etl_controller.py]"]
  node_analytics_routes["Analytics routes"]
  node_schemas["Request responses<br/>[schemas.py]"]
  node_config["Settings<br/>[config.py]"]
end

subgraph group_etl["ETL Pipeline"]
  node_etl_extract["Artwork extraction<br/>[etl_service.py]"]
  node_etl_transform["Transform and load<br/>[etl_service.py]"]
  node_etl_reset["Pipeline reset<br/>[etl_service.py]"]
end

subgraph group_storage["Data Stores"]
  node_database["Connection layer<br/>[database.py]"]
  node_mongo[("MongoDB staging")]
  node_mysql[("MySQL warehouse")]
  node_artwork_model["Artwork model<br/>[entidad_sql.py]"]
end

subgraph group_analytics["Analytics"]
  node_analytics_profile["Dual-store profile"]
  node_analytics_column["Column statistics"]
end

node_caller(("API caller"))
node_art_api["Art Institute API"]

node_caller -->|"sends request"| node_app
node_app -->|"registers routes"| node_etl_routes
node_app -->|"registers routes"| node_analytics_routes
node_app -->|"creates tables"| node_database
node_app -->|"loads model"| node_artwork_model
node_etl_routes -->|"calls extraction"| node_etl_extract
node_etl_routes -->|"calls transformation"| node_etl_transform
node_etl_routes -->|"calls reset"| node_etl_reset
node_analytics_routes -->|"calls profile"| node_analytics_profile
node_analytics_routes -->|"calls analysis"| node_analytics_column
node_etl_routes -->|"validates responses"| node_schemas
node_analytics_routes -->|"validates responses"| node_schemas
node_etl_extract -->|"fetches pages"| node_art_api
node_etl_extract -->|"upserts records"| node_mongo
node_etl_transform -->|"reads documents"| node_mongo
node_etl_transform -->|"upserts rows"| node_mysql
node_etl_transform -->|"builds records"| node_artwork_model
node_etl_reset -->|"truncates table"| node_mysql
node_etl_reset -->|"deletes documents"| node_mongo
node_analytics_profile -->|"reads record"| node_mongo
node_analytics_profile -->|"queries record"| node_mysql
node_analytics_profile -->|"queries model"| node_artwork_model
node_analytics_column -->|"queries column"| node_mysql
node_analytics_column -->|"inspects columns"| node_artwork_model
node_database -->|"loads settings"| node_config
node_database -->|"connects staging"| node_mongo
node_database -->|"creates engine"| node_mysql
node_artwork_model -->|"uses base"| node_database

click node_app "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/main.py"
click node_etl_routes "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/controllers/etl_controller.py"
click node_analytics_routes "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/controllers/analitica_controller.py"
click node_schemas "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/views/schemas.py"
click node_config "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/config.py"
click node_etl_extract "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py"
click node_etl_transform "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py"
click node_etl_reset "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py"
click node_database "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/database.py"
click node_artwork_model "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/models/entidad_sql.py"
click node_analytics_profile "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/analitica_service.py"
click node_analytics_column "https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/analitica_service.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_app,node_etl_routes,node_analytics_routes,node_schemas,node_config toneBlue
class node_etl_extract,node_etl_transform,node_etl_reset toneAmber
class node_database,node_mongo,node_mysql,node_artwork_model,node_caller,node_art_api toneMint
class node_analytics_profile,node_analytics_column toneRose
```

## Components

### API Layer

- [FastAPI application](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/main.py): `app/main.py`
- [ETL routes](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/controllers/etl_controller.py): `app/controllers/etl_controller.py`
- [Analytics routes](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/controllers/analitica_controller.py): `app/controllers/analitica_controller.py`
- [Request responses](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/views/schemas.py): `app/views/schemas.py`
- [Settings](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/config.py): `app/config.py`

### ETL Pipeline

- [Artwork extraction](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py): `app/services/etl_service.py`
- [Transform and load](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py): `app/services/etl_service.py`
- [Pipeline reset](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/etl_service.py): `app/services/etl_service.py`

### Data Stores

- [Connection layer](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/database.py): `app/database.py`
- **MongoDB staging**
- **MySQL warehouse**
- [Artwork model](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/models/entidad_sql.py): `app/models/entidad_sql.py`

### Analytics

- [Dual-store profile](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/analitica_service.py): `app/services/analitica_service.py`
- [Column statistics](https://github.com/jibyte/artic-etl-analytics-api/blob/main/app/services/analitica_service.py): `app/services/analitica_service.py`

### Other components

- **API caller**
- **Art Institute API**

## Connections

- API caller → FastAPI application: sends request (evidence: `README.md`)
- FastAPI application → ETL routes: registers routes (evidence: `app/main.py`)
- FastAPI application → Analytics routes: registers routes (evidence: `app/main.py`)
- FastAPI application → Connection layer: creates tables (evidence: `app/main.py`)
- FastAPI application → Artwork model: loads model (evidence: `app/main.py`)
- ETL routes → Artwork extraction: calls extraction (evidence: `app/controllers/etl_controller.py`)
- ETL routes → Transform and load: calls transformation (evidence: `app/controllers/etl_controller.py`)
- ETL routes → Pipeline reset: calls reset (evidence: `app/controllers/etl_controller.py`)
- Analytics routes → Dual-store profile: calls profile (evidence: `app/controllers/analitica_controller.py`)
- Analytics routes → Column statistics: calls analysis (evidence: `app/controllers/analitica_controller.py`)
- ETL routes → Request responses: validates responses (evidence: `app/controllers/etl_controller.py`)
- Analytics routes → Request responses: validates responses (evidence: `app/controllers/analitica_controller.py`)
- Artwork extraction → Art Institute API: fetches pages (evidence: `app/services/etl_service.py`)
- Artwork extraction → MongoDB staging: upserts records (evidence: `app/services/etl_service.py`)
- Transform and load → MongoDB staging: reads documents (evidence: `app/services/etl_service.py`)
- Transform and load → MySQL warehouse: upserts rows (evidence: `app/services/etl_service.py`)
- Transform and load → Artwork model: builds records (evidence: `app/services/etl_service.py`)
- Pipeline reset → MySQL warehouse: truncates table (evidence: `app/services/etl_service.py`)
- Pipeline reset → MongoDB staging: deletes documents (evidence: `app/services/etl_service.py`)
- Dual-store profile → MongoDB staging: reads record (evidence: `app/services/analitica_service.py`)
- Dual-store profile → MySQL warehouse: queries record (evidence: `app/services/analitica_service.py`)
- Dual-store profile → Artwork model: queries model (evidence: `app/services/analitica_service.py`)
- Column statistics → MySQL warehouse: queries column (evidence: `app/services/analitica_service.py`)
- Column statistics → Artwork model: inspects columns (evidence: `app/services/analitica_service.py`)
- Connection layer → Settings: loads settings (evidence: `app/database.py`)
- Connection layer → MongoDB staging: connects staging (evidence: `app/database.py`)
- Connection layer → MySQL warehouse: creates engine (evidence: `app/database.py`)
- Artwork model → Connection layer: uses base (evidence: `app/models/entidad_sql.py`)
