# manoj8374/polygon-migration-assignment architecture

> Architecture diagram of the GitHub repository manoj8374/polygon-migration-assignment, 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/manoj8374/polygon-migration-assignment
- Repository: https://github.com/manoj8374/polygon-migration-assignment

## Overview

Polygon Migration is a staff-facing Django app that fetches competitive-programming problems from Polygon, persists problem and test descriptions in PostgreSQL, and uploads full test files to S3 or Azure. The principal workflow runs through the problems view: fetch and display, save problem metadata, save test descriptions, then upload files. The README also documents staff email login, cached Polygon tests, and optional custom-checker compilation. Some source excerpts are partial, so unsampled internals are represented only where the README documents their role.

Main entry points: [`PolygonMigration/problems/views.py`](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/views.py) (Migration workflow), [`PolygonMigration/problems/polygon_api.py`](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/polygon_api.py) (Polygon client), [`PolygonMigration/problems/storage/base.py`](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/base.py) (Storage interface), [`PolygonMigration/problems/storage/__init__.py`](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/__init__.py) (Storage selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Staff access"]
  node_browser["Migration page<br/>[index.html]"]
  node_login["Email login<br/>[views.py]"]
  node_user_model[("Staff accounts<br/>[models.py]")]
end

subgraph group_migration["Problem migration"]
  node_problem_view["Migration workflow<br/>[views.py]"]
  node_polygon_api["Polygon client<br/>[polygon_api.py]"]
  node_redis[("Test cache")]
  node_checker["Checker handling<br/>[polygon_api.py]"]
end

subgraph group_persistence["Database records"]
  node_problem_records[("Problem and tags<br/>[models.py]")]
  node_test_records[("Test descriptions<br/>[models.py]")]
  node_topics[("Topic model<br/>[models.py]")]
end

subgraph group_storage["Cloud file storage"]
  node_storage_factory["Storage selector<br/>[__init__.py]"]
  node_storage_contract["Storage interface<br/>[base.py]"]
  node_s3["S3 backend<br/>[s3.py]"]
  node_azure["Azure backend<br/>[azure.py]"]
  node_azure_auth["Azure client setup<br/>[AzureTestcase.py]"]
end

node_staff(("Staff user"))
node_polygon_service{{"Polygon API"}}
node_postgres[("PostgreSQL")]
node_cloud[("S3 or Azure")]

node_staff -->|"signs in"| node_login
node_login -->|"authenticates"| node_user_model
node_login -->|"redirects to"| node_browser
node_staff -->|"uses"| node_browser
node_browser -->|"posts actions"| node_problem_view
node_problem_view -->|"fetches problem"| node_polygon_api
node_polygon_api -->|"requests packages"| node_polygon_service
node_polygon_api -->|"caches tests"| node_redis
node_problem_view -->|"saves problem"| node_problem_records
node_problem_view -->|"saves tests"| node_test_records
node_problem_records -->|"persists records"| node_postgres
node_test_records -->|"persists records"| node_postgres
node_problem_view -->|"selects storage"| node_storage_factory
node_storage_factory -->|"returns backend"| node_storage_contract
node_storage_factory -->|"selects provider"| node_s3
node_storage_factory -->|"selects provider"| node_azure
node_s3 -->|"implements"| node_storage_contract
node_azure -->|"implements"| node_storage_contract
node_azure -->|"builds client"| node_azure_auth
node_problem_view -->|"uploads tests"| node_polygon_api
node_polygon_api -->|"uploads files"| node_storage_contract
node_s3 -->|"writes objects"| node_cloud
node_azure -->|"writes blobs"| node_cloud
node_polygon_api -->|"fetches checker"| node_checker
node_checker -->|"uploads checker"| node_storage_contract

click node_browser "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/templates/problems/index.html"
click node_login "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/users/views.py"
click node_user_model "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/users/models.py"
click node_problem_view "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/views.py"
click node_polygon_api "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/polygon_api.py"
click node_checker "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/polygon_api.py"
click node_problem_records "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/models.py"
click node_test_records "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/models.py"
click node_storage_factory "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/__init__.py"
click node_storage_contract "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/base.py"
click node_s3 "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/s3.py"
click node_azure "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/azure.py"
click node_azure_auth "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/AzureTestcase.py"
click node_topics "https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/contents/models.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_browser,node_login,node_user_model,node_staff toneBlue
class node_problem_view,node_polygon_api,node_redis,node_checker,node_postgres,node_cloud toneAmber
class node_problem_records,node_test_records,node_topics,node_polygon_service toneMint
class node_storage_factory,node_storage_contract,node_s3,node_azure,node_azure_auth toneRose
```

## Components

### Staff access

- [Migration page](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/templates/problems/index.html): `PolygonMigration/problems/templates/problems/index.html`
- [Email login](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/users/views.py): `PolygonMigration/users/views.py`
- [Staff accounts](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/users/models.py): `PolygonMigration/users/models.py`

### Problem migration

- [Migration workflow](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/views.py): `PolygonMigration/problems/views.py`
- [Polygon client](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/polygon_api.py): `PolygonMigration/problems/polygon_api.py`
- **Test cache**
- [Checker handling](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/polygon_api.py): `PolygonMigration/problems/polygon_api.py`

### Database records

- [Problem and tags](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/models.py): `PolygonMigration/problems/models.py`
- [Test descriptions](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/models.py): `PolygonMigration/problems/models.py`
- [Topic model](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/contents/models.py): `PolygonMigration/contents/models.py`

### Cloud file storage

- [Storage selector](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/__init__.py): `PolygonMigration/problems/storage/__init__.py`
- [Storage interface](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/base.py): `PolygonMigration/problems/storage/base.py`
- [S3 backend](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/s3.py): `PolygonMigration/problems/storage/s3.py`
- [Azure backend](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/storage/azure.py): `PolygonMigration/problems/storage/azure.py`
- [Azure client setup](https://github.com/manoj8374/polygon-migration-assignment/blob/main/PolygonMigration/problems/AzureTestcase.py): `PolygonMigration/problems/AzureTestcase.py`

### Other components

- **Staff user**
- **Polygon API**
- **PostgreSQL**
- **S3 or Azure**

## Connections

- Staff user → Email login: signs in (evidence: `README.md`)
- Email login → Staff accounts: authenticates (evidence: `PolygonMigration/users/views.py`)
- Email login → Migration page: redirects to (evidence: `PolygonMigration/users/views.py`)
- Staff user → Migration page: uses (evidence: `README.md`)
- Migration page → Migration workflow: posts actions (evidence: `README.md`)
- Migration workflow → Polygon client: fetches problem (evidence: `PolygonMigration/problems/views.py`)
- Polygon client → Polygon API: requests packages (evidence: `README.md`)
- Polygon client → Test cache: caches tests (evidence: `README.md`)
- Migration workflow → Problem and tags: saves problem (evidence: `PolygonMigration/problems/views.py`)
- Migration workflow → Test descriptions: saves tests (evidence: `PolygonMigration/problems/views.py`)
- Problem and tags → PostgreSQL: persists records (evidence: `README.md`)
- Test descriptions → PostgreSQL: persists records (evidence: `README.md`)
- Migration workflow → Storage selector: selects storage (evidence: `PolygonMigration/problems/views.py`)
- Storage selector → Storage interface: returns backend (evidence: `PolygonMigration/problems/storage/__init__.py`)
- Storage selector → S3 backend: selects provider (evidence: `PolygonMigration/problems/storage/__init__.py`)
- Storage selector → Azure backend: selects provider (evidence: `PolygonMigration/problems/storage/__init__.py`)
- S3 backend → Storage interface: implements (evidence: `PolygonMigration/problems/storage/s3.py`)
- Azure backend → Storage interface: implements (evidence: `PolygonMigration/problems/storage/azure.py`)
- Azure backend → Azure client setup: builds client (evidence: `PolygonMigration/problems/storage/azure.py`)
- Migration workflow → Polygon client: uploads tests (evidence: `PolygonMigration/problems/views.py`)
- Polygon client → Storage interface: uploads files (evidence: `PolygonMigration/problems/polygon_api.py`)
- S3 backend → S3 or Azure: writes objects (evidence: `PolygonMigration/problems/storage/s3.py`)
- Azure backend → S3 or Azure: writes blobs (evidence: `PolygonMigration/problems/storage/azure.py`)
- Polygon client → Checker handling: fetches checker (evidence: `PolygonMigration/problems/polygon_api.py`)
- Checker handling → Storage interface: uploads checker (evidence: `PolygonMigration/problems/tests.py`)
