# jaswanthg-10/django-backend-application- architecture

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

- Interactive diagram: https://gitdiagram.com/jaswanthg-10/django-backend-application-
- Repository: https://github.com/jaswanthg-10/django-backend-application-

## Overview

GreenTree is a Django REST service that accepts authenticated extraction requests, creates deduplicated jobs, runs extraction asynchronously, and exposes job status, results, controls, analytics, and health checks. The main workflow runs from HTTP caller through API validation and job orchestration, to a worker that fetches and normalizes provider data and persists results. The README documents additional operational capabilities; some are represented at the subsystem level because their implementation was not sampled.

Main entry points: [`apps/extraction/views.py`](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/views.py) (API routes and views), [`apps/extraction/models.py`](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/models.py) (Jobs and extracted records), [`apps/extraction/services.py`](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/services.py) (Job lifecycle service), [`apps/extraction/selectors.py`](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/selectors.py) (Job and record queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API access"]
  node_api["API routes and views<br/>[views.py]"]
  node_auth["API key authentication<br/>[authentication.py]"]
  node_permission["API key permission<br/>[permissions.py]"]
  node_dto["Request and response serializers<br/>[serializers.py]"]
  node_pagination["API pagination<br/>[pagination.py]"]
  node_errors["Error handling<br/>[exceptions.py]"]
end

subgraph group_workflow["Extraction workflow"]
  node_service["Job lifecycle service<br/>[services.py]"]
  node_worker["Extraction worker"]
  node_client["Provider client<br/>[clients.py]"]
end

subgraph group_operations["Operations and security"]
  node_encryption["Credential encryption<br/>[encryption.py]"]
  node_health["Health probes<br/>[views.py]"]
  node_reporting["Analytics and reporting<br/>[selectors.py]"]
end

subgraph group_state["Persistent state"]
  node_selectors["Job and record queries<br/>[selectors.py]"]
  node_models["Jobs and extracted records<br/>[models.py]"]
  node_database[("Relational database")]
end

node_caller(("HTTP caller"))
node_provider["External data provider"]

node_caller -->|"sends requests"| node_api
node_api -->|"authenticates with"| node_auth
node_api -->|"checks permission"| node_permission
node_api -->|"validates and serializes"| node_dto
node_api -->|"starts and controls jobs"| node_service
node_api -->|"queries jobs and results"| node_selectors
node_api -->|"paginates responses"| node_pagination
node_api -->|"raises domain errors"| node_errors
node_service -->|"checks active jobs"| node_selectors
node_service -->|"creates and claims jobs"| node_models
node_service -->|"requests extraction"| node_client
node_worker -->|"claims and processes jobs"| node_service
node_worker -->|"decrypts job token"| node_models
node_client -->|"fetches provider pages"| node_provider
node_selectors -->|"queries records"| node_models
node_reporting -->|"aggregates job metrics"| node_models
node_models -->|"persists job and record state"| node_database
node_models -->|"encrypts stored credentials"| node_encryption
node_api -->|"serves health probes"| node_health

click node_api "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/views.py"
click node_auth "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/authentication.py"
click node_permission "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/permissions.py"
click node_dto "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/serializers.py"
click node_pagination "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/pagination.py"
click node_errors "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/exceptions.py"
click node_service "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/services.py"
click node_worker "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/management/commands/run_extraction_worker.py"
click node_client "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/clients.py"
click node_selectors "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/selectors.py"
click node_models "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/models.py"
click node_encryption "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/encryption.py"
click node_health "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/views.py"
click node_reporting "https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/selectors.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_api,node_auth,node_permission,node_dto,node_pagination,node_errors toneBlue
class node_service,node_worker,node_client toneAmber
class node_encryption,node_health,node_reporting toneMint
class node_selectors,node_models,node_database toneRose
class node_caller,node_provider toneIndigo
```

## Components

### API access

- [API routes and views](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/views.py): `apps/extraction/views.py`
- [API key authentication](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/authentication.py): `apps/common/authentication.py`
- [API key permission](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/permissions.py): `apps/common/permissions.py`
- [Request and response serializers](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/serializers.py): `apps/extraction/serializers.py`
- [API pagination](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/pagination.py): `apps/common/pagination.py`
- [Error handling](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/exceptions.py): `apps/common/exceptions.py`

### Extraction workflow

- [Job lifecycle service](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/services.py): `apps/extraction/services.py`
- [Extraction worker](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/management/commands/run_extraction_worker.py): `apps/extraction/management/commands/run_extraction_worker.py`
- [Provider client](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/clients.py): `apps/extraction/clients.py`

### Operations and security

- [Credential encryption](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/common/encryption.py): `apps/common/encryption.py`
- [Health probes](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/views.py): `apps/extraction/views.py`
- [Analytics and reporting](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/selectors.py): `apps/extraction/selectors.py`

### Persistent state

- [Job and record queries](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/selectors.py): `apps/extraction/selectors.py`
- [Jobs and extracted records](https://github.com/jaswanthg-10/django-backend-application-/blob/main/apps/extraction/models.py): `apps/extraction/models.py`
- **Relational database**

### Other components

- **HTTP caller**
- **External data provider**

## Connections

- HTTP caller → API routes and views: sends requests (evidence: `README.md`)
- API routes and views → API key authentication: authenticates with (evidence: `apps/extraction/views.py`)
- API routes and views → API key permission: checks permission (evidence: `apps/extraction/views.py`)
- API routes and views → Request and response serializers: validates and serializes (evidence: `apps/extraction/views.py`)
- API routes and views → Job lifecycle service: starts and controls jobs (evidence: `apps/extraction/views.py`)
- API routes and views → Job and record queries: queries jobs and results (evidence: `apps/extraction/views.py`)
- API routes and views → API pagination: paginates responses (evidence: `apps/extraction/views.py`)
- API routes and views → Error handling: raises domain errors (evidence: `apps/extraction/views.py`)
- Job lifecycle service → Job and record queries: checks active jobs (evidence: `apps/extraction/services.py`)
- Job lifecycle service → Jobs and extracted records: creates and claims jobs (evidence: `apps/extraction/services.py`)
- Job lifecycle service → Provider client: requests extraction (evidence: `apps/extraction/services.py`)
- Extraction worker → Job lifecycle service: claims and processes jobs (evidence: `apps/extraction/management/commands/run_extraction_worker.py`)
- Extraction worker → Jobs and extracted records: decrypts job token (evidence: `apps/extraction/management/commands/run_extraction_worker.py`)
- Provider client → External data provider: fetches provider pages (evidence: `apps/extraction/clients.py`)
- Job and record queries → Jobs and extracted records: queries records (evidence: `apps/extraction/selectors.py`)
- Analytics and reporting → Jobs and extracted records: aggregates job metrics (evidence: `apps/extraction/selectors.py`)
- Jobs and extracted records → Relational database: persists job and record state (evidence: `README.md`)
- Jobs and extracted records → Credential encryption: encrypts stored credentials (evidence: `apps/extraction/models.py`)
- API routes and views → Health probes: serves health probes (evidence: `README.md`)
