# ai4bharat/anudesh-backend architecture

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

- Interactive diagram: https://gitdiagram.com/ai4bharat/anudesh-backend
- Repository: https://github.com/ai4bharat/anudesh-backend

## Overview

Anudesh Backend is the Django/DRF backend for a collaborative data-annotation platform. The principal workflow is users working in organization workspaces and projects, with project tasks and annotations managed through API views and persisted as domain records. Celery supports background work, including project, dataset, organization, and workspace operations; reporting and annotation utilities add further capabilities. The README confirms background workers and project-creation tasks. Several view and task files were not sampled, so links involving their runtime behavior are omitted or marked unverified.

Main entry points: [`backend/projects/models.py`](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/models.py) (Projects), [`backend/dataset/models.py`](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/models.py) (Datasets), [`backend/tasks/models.py`](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/tasks/models.py) (Tasks and annotations), [`backend/organizations/models.py`](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/models.py) (Organizations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Accounts and access"]
  node_user[("Users<br/>[models.py]")]
  node_user_api["User API<br/>[views.py]"]
end

subgraph group_workspace["Organizations and workspaces"]
  node_organization[("Organizations<br/>[models.py]")]
  node_organization_api["Organization API<br/>[views.py]"]
  node_workspace_model[("Workspaces<br/>[models.py]")]
  node_workspace_api["Workspace API<br/>[views.py]"]
end

subgraph group_annotation["Annotation workflow"]
  node_dataset[("Datasets<br/>[models.py]")]
  node_dataset_api["Dataset API<br/>[views.py]"]
  node_project[("Projects<br/>[models.py]")]
  node_project_api["Project API<br/>[views.py]"]
  node_project_registry["Project registry<br/>[registry_helper.py]"]
  node_annotation_registry["Annotation registry"]
  node_task[("Tasks and annotations<br/>[models.py]")]
  node_task_api["Task API<br/>[views.py]"]
  node_conversion["Result conversion"]
end

subgraph group_async["Background work and reports"]
  node_celery["Celery app<br/>[celery.py]"]
  node_locks["Task locks<br/>[locks.py]"]
  node_project_jobs["Project jobs<br/>[tasks.py]"]
  node_dataset_jobs["Dataset jobs<br/>[tasks.py]"]
  node_organization_jobs["Organization jobs<br/>[tasks.py]"]
  node_workspace_jobs["Workspace reports<br/>[tasks.py]"]
  node_analytics_jobs["Analytics exports<br/>[tasks.py]"]
  node_email["Email templates<br/>[email_template.py]"]
  node_settings["Application settings<br/>[settings.py]"]
end

node_client(("Platform users"))

node_client -.->|"uses API"| node_project_api
node_client -.->|"submits annotations"| node_task_api
node_project -->|"references"| node_user
node_project -->|"references"| node_organization
node_project -->|"references"| node_workspace_model
node_project -->|"references"| node_dataset
node_project -->|"uses"| node_project_registry
node_task -->|"references"| node_user
node_task -->|"references"| node_dataset
node_task -->|"references"| node_project
node_organization -->|"references"| node_user
node_workspace_model -->|"references"| node_organization
node_dataset -->|"references"| node_user
node_dataset -->|"references"| node_organization
node_dataset -->|"references"| node_workspace_model
node_task_api -->|"uses"| node_task
node_task_api -->|"calls"| node_conversion
node_project_api -.->|"uses"| node_project
node_project_api -.->|"invokes"| node_task_api
node_annotation_registry -->|"uses"| node_project_registry
node_annotation_registry -->|"uses"| node_dataset
node_project_jobs -->|"uses"| node_project
node_project_jobs -->|"uses"| node_task
node_project_jobs -->|"uses"| node_project_registry
node_project_jobs -->|"uses"| node_annotation_registry
node_dataset_jobs -->|"uses"| node_dataset
node_dataset_jobs -->|"uses"| node_task
node_dataset_jobs -->|"registers task"| node_celery
node_organization_jobs -->|"uses"| node_organization
node_organization_jobs -->|"uses"| node_task
node_organization_jobs -->|"calls"| node_email
node_workspace_jobs -->|"uses"| node_workspace_model
node_workspace_jobs -->|"queries"| node_project
node_workspace_jobs -->|"queries"| node_task
node_analytics_jobs -->|"downloads projects"| node_project_api
node_analytics_jobs -->|"registers task"| node_celery
node_celery -->|"loads config"| node_settings
node_user_api -.->|"uses"| node_user
node_organization_api -.->|"uses"| node_organization
node_workspace_api -.->|"uses"| node_workspace_model
node_dataset_api -.->|"uses"| node_dataset

click node_user "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/users/models.py"
click node_user_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/users/views.py"
click node_organization "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/models.py"
click node_organization_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/views.py"
click node_workspace_model "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/models.py"
click node_workspace_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/views.py"
click node_dataset "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/models.py"
click node_dataset_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/views.py"
click node_project "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/models.py"
click node_project_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/views.py"
click node_project_registry "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/registry_helper.py"
click node_annotation_registry "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/annotation_registry.py"
click node_task "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/tasks/models.py"
click node_task_api "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/tasks/views.py"
click node_conversion "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/utils/convert_result_to_chitralekha_format.py"
click node_celery "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/celery.py"
click node_locks "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/locks.py"
click node_project_jobs "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/tasks.py"
click node_dataset_jobs "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/tasks.py"
click node_organization_jobs "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/tasks.py"
click node_workspace_jobs "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/tasks.py"
click node_analytics_jobs "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/functions/tasks.py"
click node_email "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/utils/email_template.py"
click node_settings "https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/settings.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_user,node_user_api,node_client toneBlue
class node_organization,node_organization_api,node_workspace_model,node_workspace_api toneAmber
class node_dataset,node_dataset_api,node_project,node_project_api,node_project_registry,node_annotation_registry,node_task,node_task_api,node_conversion toneMint
class node_celery,node_locks,node_project_jobs,node_dataset_jobs,node_organization_jobs,node_workspace_jobs,node_analytics_jobs,node_email,node_settings toneRose
```

## Components

### Accounts and access

- [Users](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/users/models.py): `backend/users/models.py`
- [User API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/users/views.py): `backend/users/views.py`

### Organizations and workspaces

- [Organizations](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/models.py): `backend/organizations/models.py`
- [Organization API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/views.py): `backend/organizations/views.py`
- [Workspaces](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/models.py): `backend/workspaces/models.py`
- [Workspace API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/views.py): `backend/workspaces/views.py`

### Annotation workflow

- [Datasets](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/models.py): `backend/dataset/models.py`
- [Dataset API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/views.py): `backend/dataset/views.py`
- [Projects](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/models.py): `backend/projects/models.py`
- [Project API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/views.py): `backend/projects/views.py`
- [Project registry](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/registry_helper.py): `backend/projects/registry_helper.py`
- [Annotation registry](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/annotation_registry.py): `backend/projects/annotation_registry.py`
- [Tasks and annotations](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/tasks/models.py): `backend/tasks/models.py`
- [Task API](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/tasks/views.py): `backend/tasks/views.py`
- [Result conversion](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/utils/convert_result_to_chitralekha_format.py): `backend/utils/convert_result_to_chitralekha_format.py`

### Background work and reports

- [Celery app](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/celery.py): `backend/anudesh_backend/celery.py`
- [Task locks](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/locks.py): `backend/anudesh_backend/locks.py`
- [Project jobs](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/projects/tasks.py): `backend/projects/tasks.py`
- [Dataset jobs](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/dataset/tasks.py): `backend/dataset/tasks.py`
- [Organization jobs](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/organizations/tasks.py): `backend/organizations/tasks.py`
- [Workspace reports](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/workspaces/tasks.py): `backend/workspaces/tasks.py`
- [Analytics exports](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/functions/tasks.py): `backend/functions/tasks.py`
- [Email templates](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/utils/email_template.py): `backend/utils/email_template.py`
- [Application settings](https://github.com/ai4bharat/anudesh-backend/blob/master/backend/anudesh_backend/settings.py): `backend/anudesh_backend/settings.py`

### Other components

- **Platform users**

## Connections

- Platform users → Project API: uses API
- Platform users → Task API: submits annotations
- Projects → Users: references (evidence: `backend/projects/models.py`)
- Projects → Organizations: references (evidence: `backend/projects/models.py`)
- Projects → Workspaces: references (evidence: `backend/projects/models.py`)
- Projects → Datasets: references (evidence: `backend/projects/models.py`)
- Projects → Project registry: uses (evidence: `backend/projects/models.py`)
- Tasks and annotations → Users: references (evidence: `backend/tasks/models.py`)
- Tasks and annotations → Datasets: references (evidence: `backend/tasks/models.py`)
- Tasks and annotations → Projects: references (evidence: `backend/tasks/models.py`)
- Organizations → Users: references (evidence: `backend/organizations/models.py`)
- Workspaces → Organizations: references (evidence: `backend/workspaces/models.py`)
- Datasets → Users: references (evidence: `backend/dataset/models.py`)
- Datasets → Organizations: references (evidence: `backend/dataset/models.py`)
- Datasets → Workspaces: references (evidence: `backend/dataset/models.py`)
- Task API → Tasks and annotations: uses (evidence: `backend/tasks/views.py`)
- Task API → Result conversion: calls (evidence: `backend/tasks/views.py`)
- Project API → Projects: uses
- Project API → Task API: invokes
- Annotation registry → Project registry: uses (evidence: `backend/projects/annotation_registry.py`)
- Annotation registry → Datasets: uses (evidence: `backend/projects/annotation_registry.py`)
- Project jobs → Projects: uses (evidence: `backend/projects/tasks.py`)
- Project jobs → Tasks and annotations: uses (evidence: `backend/projects/tasks.py`)
- Project jobs → Project registry: uses (evidence: `backend/projects/tasks.py`)
- Project jobs → Annotation registry: uses (evidence: `backend/projects/tasks.py`)
- Dataset jobs → Datasets: uses (evidence: `backend/dataset/tasks.py`)
- Dataset jobs → Tasks and annotations: uses (evidence: `backend/dataset/tasks.py`)
- Dataset jobs → Celery app: registers task (evidence: `backend/dataset/tasks.py`)
- Organization jobs → Organizations: uses (evidence: `backend/organizations/tasks.py`)
- Organization jobs → Tasks and annotations: uses (evidence: `backend/organizations/tasks.py`)
- Organization jobs → Email templates: calls (evidence: `backend/organizations/tasks.py`)
- Workspace reports → Workspaces: uses (evidence: `backend/workspaces/tasks.py`)
- Workspace reports → Projects: queries (evidence: `backend/workspaces/tasks.py`)
- Workspace reports → Tasks and annotations: queries (evidence: `backend/workspaces/tasks.py`)
- Analytics exports → Project API: downloads projects (evidence: `backend/functions/tasks.py`)
- Analytics exports → Celery app: registers task (evidence: `backend/functions/tasks.py`)
- Celery app → Application settings: loads config (evidence: `backend/anudesh_backend/celery.py`)
- User API → Users: uses
- Organization API → Organizations: uses
- Workspace API → Workspaces: uses
- Dataset API → Datasets: uses
