# sathishcb/sk-harvard-artifacts-collection architecture

> Architecture diagram of the GitHub repository sathishcb/sk-harvard-artifacts-collection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sathishcb/sk-harvard-artifacts-collection
- Repository: https://github.com/sathishcb/sk-harvard-artifacts-collection

## Overview

The product is a Streamlit workflow for collecting Harvard Art Museums records, previewing and inserting normalized artifact data, then exploring it with 25 SQL analyses. The graph separates collection, persistence, and analytics. The sampled app and helper modules show the principal calls; the README documents the broader workflow and schema. The schema file itself was not excerpted, so its relationship is based on the documented table design and the sampled schema-loading code.

Main entry points: [`app.py`](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py) (Streamlit app), [`api.py`](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/api.py) (Async API collector), [`database.py`](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py) (Schema loader), [`schema.sql`](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/schema.sql) (Artifact tables)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Streamlit Experience"]
  node_app["Streamlit app<br/>[app.py]"]
  node_preview["Data preview<br/>[app.py]"]
  node_query_ui["Query interface<br/>[app.py]"]
  node_results["Query results<br/>[app.py]"]
end

subgraph group_collection["Artifact Collection"]
  node_config["Credentials config<br/>[config.py]"]
  node_collector["Async API collector<br/>[api.py]"]
end

subgraph group_persistence["SQL Persistence"]
  node_db_setup["Database setup<br/>[database.py]"]
  node_schema_loader["Schema loader<br/>[database.py]"]
  node_schema["Artifact schema<br/>[schema.sql]"]
  node_insert["Duplicate-safe insert<br/>[database.py]"]
  node_artifact_db[("Artifact tables<br/>[schema.sql]")]
end

subgraph group_analytics["SQL Analytics"]
  node_query_catalog["SQL query catalog<br/>[queries.py]"]
  node_query_runner["Query execution<br/>[app.py]"]
end

node_user(("User"))
node_harvard{{"Harvard API"}}

node_user -->|"uses"| node_app
node_app -->|"reads credentials"| node_config
node_app -->|"initializes database"| node_db_setup
node_app -->|"loads schema"| node_schema_loader
node_schema_loader -->|"reads"| node_schema
node_schema_loader -->|"creates tables"| node_artifact_db
node_app -->|"requests collection"| node_collector
node_collector -->|"fetches records"| node_harvard
node_collector -->|"returns normalized data"| node_preview
node_app -->|"shows sample data"| node_preview
node_app -->|"invokes migration"| node_insert
node_insert -->|"inserts records"| node_artifact_db
node_app -->|"selects SQL"| node_query_catalog
node_app -->|"runs query"| node_query_runner
node_query_runner -->|"reads tables"| node_artifact_db
node_query_runner -->|"displays rows"| node_results
node_user -->|"chooses query"| node_query_ui

click node_app "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py"
click node_preview "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py"
click node_query_ui "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py"
click node_config "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/config.py"
click node_collector "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/api.py"
click node_db_setup "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py"
click node_schema_loader "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py"
click node_schema "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/schema.sql"
click node_insert "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py"
click node_artifact_db "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/schema.sql"
click node_query_catalog "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/queries.py"
click node_query_runner "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py"
click node_results "https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.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_preview,node_query_ui,node_results,node_user toneBlue
class node_config,node_collector toneAmber
class node_db_setup,node_schema_loader,node_schema,node_insert,node_artifact_db,node_harvard toneMint
class node_query_catalog,node_query_runner toneRose
```

## Components

### Streamlit Experience

- [Streamlit app](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py): `app.py`
- [Data preview](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py): `app.py`
- [Query interface](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py): `app.py`
- [Query results](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py): `app.py`

### Artifact Collection

- [Credentials config](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/config.py): `config.py`
- [Async API collector](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/api.py): `api.py`

### SQL Persistence

- [Database setup](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py): `database.py`
- [Schema loader](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py): `database.py`
- [Artifact schema](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/schema.sql): `schema.sql`
- [Duplicate-safe insert](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/database.py): `database.py`
- [Artifact tables](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/schema.sql): `schema.sql`

### SQL Analytics

- [SQL query catalog](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/queries.py): `queries.py`
- [Query execution](https://github.com/sathishcb/sk-harvard-artifacts-collection/blob/main/app.py): `app.py`

### Other components

- **User**
- **Harvard API**

## Connections

- User → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Credentials config: reads credentials (evidence: `app.py`)
- Streamlit app → Database setup: initializes database (evidence: `app.py`)
- Streamlit app → Schema loader: loads schema (evidence: `app.py`)
- Schema loader → Artifact schema: reads (evidence: `database.py`)
- Schema loader → Artifact tables: creates tables (evidence: `database.py`)
- Streamlit app → Async API collector: requests collection (evidence: `app.py`)
- Async API collector → Harvard API: fetches records (evidence: `api.py`)
- Async API collector → Data preview: returns normalized data (evidence: `app.py`)
- Streamlit app → Data preview: shows sample data (evidence: `app.py`)
- Streamlit app → Duplicate-safe insert: invokes migration (evidence: `app.py`)
- Duplicate-safe insert → Artifact tables: inserts records (evidence: `database.py`)
- Streamlit app → SQL query catalog: selects SQL (evidence: `app.py`)
- Streamlit app → Query execution: runs query (evidence: `app.py`)
- Query execution → Artifact tables: reads tables
- Query execution → Query results: displays rows (evidence: `app.py`)
- User → Query interface: chooses query (evidence: `README.md`)
