# tapilab/ant architecture

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

- Interactive diagram: https://gitdiagram.com/tapilab/ant
- Repository: https://github.com/tapilab/ant

## Overview

ANT is a Django web application for creating and exploring humanities network visualizations from spreadsheet data. A site owner submits a Google Sheet URL; the configuration view enqueues an import, which reads the sheet, builds entity and relationship records, and stores a serialized network for the interactive network page. Visitors can also browse entities and details, while site owners can configure branding and manage a single account. The README documents keyword, time, and entity-type exploration; the supplied excerpts do not expose the visualization’s client-side filtering implementation, so that capability is represented at the page level.

Main entry points: [`core/views.py`](https://github.com/tapilab/ant/blob/main/core/views.py) (Page views), [`core/util.py`](https://github.com/tapilab/ant/blob/main/core/util.py) (Sheet importer), [`core/models.py`](https://github.com/tapilab/ant/blob/main/core/models.py) (Entity records), [`ant/urls.py`](https://github.com/tapilab/ant/blob/main/ant/urls.py) (HTTP routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes["HTTP routes<br/>[urls.py]"]
  node_views["Page views<br/>[views.py]"]
  node_templates["Rendered pages"]
  node_context["Entity options"]
  node_networkpage["Network explorer<br/>[network.html]"]
  node_entitypages["Entity pages<br/>[entity.html]"]
end

subgraph group_import["Data import"]
  node_configform["Sheet configuration<br/>[forms.py]"]
  node_importer["Sheet importer<br/>[util.py]"]
  node_googlesheet["Google Sheets"]
  node_queue["RQ queue"]
  node_taskstub["Background task stub<br/>[tasks.py]"]
end

subgraph group_domain["Network domain"]
  node_entities["Entity records<br/>[models.py]"]
  node_relationships["Relationship records<br/>[models.py]"]
  node_networkdata["Serialized network<br/>[models.py]"]
  node_database[("Application database")]
end

subgraph group_accounts["Site management"]
  node_forms["Input forms<br/>[forms.py]"]
  node_accountsdata["Accounts and branding<br/>[models.py]"]
end

node_visitor(("Visitor"))
node_owner(("Site owner"))

node_visitor -->|"requests pages"| node_routes
node_owner -->|"opens configuration"| node_routes
node_routes -->|"routes requests"| node_views
node_views -->|"renders pages"| node_templates
node_views -->|"validates submissions"| node_forms
node_views -->|"reads branding"| node_accountsdata
node_context -->|"queries entity types"| node_entities
node_views -->|"queries entities"| node_entities
node_views -->|"queries relationships"| node_relationships
node_views -->|"enqueues import"| node_queue
node_queue -->|"runs import"| node_importer
node_importer -->|"reads workbook"| node_googlesheet
node_importer -->|"creates records"| node_entities
node_importer -->|"creates links"| node_relationships
node_importer -->|"stores JSON"| node_networkdata
node_views -->|"loads network"| node_networkdata
node_networkdata -.->|"persists records"| node_database
node_entities -.->|"persists records"| node_database
node_relationships -.->|"persists records"| node_database
node_accountsdata -.->|"persists records"| node_database
node_views -->|"renders explorer"| node_networkpage
node_views -->|"renders details"| node_entitypages
node_forms -->|"saves profile"| node_accountsdata

click node_routes "https://github.com/tapilab/ant/blob/main/ant/urls.py"
click node_views "https://github.com/tapilab/ant/blob/main/core/views.py"
click node_templates "https://github.com/tapilab/ant/tree/main/core/templates"
click node_context "https://github.com/tapilab/ant/blob/main/core/context_processors.py"
click node_forms "https://github.com/tapilab/ant/blob/main/core/forms.py"
click node_accountsdata "https://github.com/tapilab/ant/blob/main/core/models.py"
click node_configform "https://github.com/tapilab/ant/blob/main/core/forms.py"
click node_importer "https://github.com/tapilab/ant/blob/main/core/util.py"
click node_taskstub "https://github.com/tapilab/ant/blob/main/core/tasks.py"
click node_entities "https://github.com/tapilab/ant/blob/main/core/models.py"
click node_relationships "https://github.com/tapilab/ant/blob/main/core/models.py"
click node_networkdata "https://github.com/tapilab/ant/blob/main/core/models.py"
click node_networkpage "https://github.com/tapilab/ant/blob/main/core/templates/network.html"
click node_entitypages "https://github.com/tapilab/ant/blob/main/core/templates/entity.html"

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_routes,node_views,node_templates,node_context,node_networkpage,node_entitypages toneBlue
class node_configform,node_importer,node_googlesheet,node_queue,node_taskstub toneAmber
class node_entities,node_relationships,node_networkdata,node_database toneMint
class node_forms,node_accountsdata toneRose
class node_visitor,node_owner toneIndigo
```

## Components

### Web experience

- [HTTP routes](https://github.com/tapilab/ant/blob/main/ant/urls.py): `ant/urls.py`
- [Page views](https://github.com/tapilab/ant/blob/main/core/views.py): `core/views.py`
- [Rendered pages](https://github.com/tapilab/ant/tree/main/core/templates): `core/templates`
- [Entity options](https://github.com/tapilab/ant/blob/main/core/context_processors.py): `core/context_processors.py`
- [Network explorer](https://github.com/tapilab/ant/blob/main/core/templates/network.html): `core/templates/network.html`
- [Entity pages](https://github.com/tapilab/ant/blob/main/core/templates/entity.html): `core/templates/entity.html`

### Data import

- [Sheet configuration](https://github.com/tapilab/ant/blob/main/core/forms.py): `core/forms.py`
- [Sheet importer](https://github.com/tapilab/ant/blob/main/core/util.py): `core/util.py`
- **Google Sheets**
- **RQ queue**
- [Background task stub](https://github.com/tapilab/ant/blob/main/core/tasks.py): `core/tasks.py`

### Network domain

- [Entity records](https://github.com/tapilab/ant/blob/main/core/models.py): `core/models.py`
- [Relationship records](https://github.com/tapilab/ant/blob/main/core/models.py): `core/models.py`
- [Serialized network](https://github.com/tapilab/ant/blob/main/core/models.py): `core/models.py`
- **Application database**

### Site management

- [Input forms](https://github.com/tapilab/ant/blob/main/core/forms.py): `core/forms.py`
- [Accounts and branding](https://github.com/tapilab/ant/blob/main/core/models.py): `core/models.py`

### Other components

- **Visitor**
- **Site owner**

## Connections

- Visitor → HTTP routes: requests pages (evidence: `ant/urls.py`)
- Site owner → HTTP routes: opens configuration (evidence: `ant/urls.py`)
- HTTP routes → Page views: routes requests (evidence: `ant/urls.py`)
- Page views → Rendered pages: renders pages (evidence: `core/views.py`)
- Page views → Input forms: validates submissions (evidence: `core/views.py`)
- Page views → Accounts and branding: reads branding (evidence: `core/views.py`)
- Entity options → Entity records: queries entity types (evidence: `core/context_processors.py`)
- Page views → Entity records: queries entities (evidence: `core/views.py`)
- Page views → Relationship records: queries relationships (evidence: `core/views.py`)
- Page views → RQ queue: enqueues import (evidence: `core/views.py`)
- RQ queue → Sheet importer: runs import
- Sheet importer → Google Sheets: reads workbook (evidence: `core/util.py`)
- Sheet importer → Entity records: creates records (evidence: `core/util.py`)
- Sheet importer → Relationship records: creates links (evidence: `core/util.py`)
- Sheet importer → Serialized network: stores JSON (evidence: `core/util.py`)
- Page views → Serialized network: loads network (evidence: `core/views.py`)
- Serialized network → Application database: persists records
- Entity records → Application database: persists records
- Relationship records → Application database: persists records
- Accounts and branding → Application database: persists records
- Page views → Network explorer: renders explorer (evidence: `core/views.py`)
- Page views → Entity pages: renders details (evidence: `core/views.py`)
- Input forms → Accounts and branding: saves profile (evidence: `core/forms.py`)
