# unbarqdsw2021-2/2021.2_g4_cadernetadecampodigital_backend architecture

> Architecture diagram of the GitHub repository unbarqdsw2021-2/2021.2_g4_cadernetadecampodigital_backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unbarqdsw2021-2/2021.2_g4_cadernetadecampodigital_backend
- Repository: https://github.com/unbarqdsw2021-2/2021.2_g4_cadernetadecampodigital_backend

## Overview

##### Main System Components

The system should be represented as a Django-based REST API with the following main components:

a. Core Application Modules:
- User Management (usuario)
- Producer Management (produtor)
- Technical Management (tecnico)
- Property Management (propriedade)
- Plot Management (talhao)
- Cultivation Management (cultura)
- Pesticide Management (agrotoxico)
- Planting Management (plantio)
- Field Notebook Management (caderneta)

b. Infrastructure Components:
- Docker Container Environment
- Database (PostgreSQL, based on Django usage)
- Authentication System (Token-based, evident from usuario/serializers/token.py)

**┌─────────────────────────────────────────────┐**
- Client Applications             │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- API Gateway Layer              │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Django REST Framework             │
- ┬─────────────┬─────────────────┤
- Views     │ Serializers │     URLs        │
- ┴─────────────┴─────────────────┘
- ↕
**┌─────────────────────────────────────────────┐**
- Business Logic                 │
- ┬─────────────┬─────────────────┤
- Models    │  Services   │    Admin        │
- ┴─────────────┴─────────────────┘
- ↕
**┌─────────────────────────────────────────────┐**
- Database                     │
- ┘

##### Specific Module Details

For each core module, show:
- API endpoints (grouped by functionality)
- Authentication requirements
- Data flow direction

##### Additional Elements

Supporting components:
- Docker container boundaries
- CI/CD pipeline integration points (shown by GitHub Actions)
- Test coverage monitoring (CodeCov integration)
- Code quality checks (CodeClimate integration)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CA[Client Applications]:::client
    end

    subgraph API
        AG["API Gateway"]:::gateway
    end

    subgraph DRF["Django REST Framework"]
        Views["Views Layer"]:::views
        Serializers["Serializers Layer"]:::serializers
        URLs["URLs Layer"]:::urls
    end

    subgraph Business["Business Logic Layer"]
        direction TB
        UM["User Management"]:::module
        PM["Producer Management"]:::module
        TM["Technical Management"]:::module
        PRM["Property Management"]:::module
        PLM["Plot Management"]:::module
        CM["Cultivation Management"]:::module
        PSM["Pesticide Management"]:::module
        PTM["Planting Management"]:::module
        FNM["Field Notebook Management"]:::module
    end

    subgraph Infrastructure
        Docker["Docker Container"]:::infra
        DB[(PostgreSQL)]:::db
        Auth["Authentication System"]:::auth
        Observer["Observer Pattern"]:::pattern
    end

    CA --> AG
    AG --> Views
    Views --> Serializers
    Serializers --> URLs

    Views --> Business
    Business --> DB
    Auth --> Business
    Observer --> Business

    %% Component Mappings
    click UM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/usuario"
    click PM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/produtor"
    click TM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/tecnico"
    click PRM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/propriedade"
    click PLM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/talhao"
    click CM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/cultura"
    click PSM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/agrotoxico"
    click PTM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/plantio"
    click FNM "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/caderneta"
    click Docker "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/tree/develop/Dockerfile"
    click Observer "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/blob/develop/core/observer.py"
    click Auth "https://github.com/UnBArqDsw2021-2/2021.2_G4_CadernetaDeCampoDigital_Backend/blob/develop/usuario/serializers/token.py"

    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef gateway fill:#aaf,stroke:#333,stroke-width:2px
    classDef views fill:#ddf,stroke:#333,stroke-width:2px
    classDef serializers fill:#ddf,stroke:#333,stroke-width:2px
    classDef urls fill:#ddf,stroke:#333,stroke-width:2px
    classDef module fill:#bbf,stroke:#333,stroke-width:2px
    classDef infra fill:#bfb,stroke:#333,stroke-width:2px
    classDef db fill:#fbb,stroke:#333,stroke-width:2px
    classDef auth fill:#ff9,stroke:#333,stroke-width:2px
    classDef pattern fill:#f9f,stroke:#333,stroke-width:2px

    subgraph Legend
        L1[Client]:::client
        L2[Gateway]:::gateway
        L3[DRF Components]:::views
        L4[Business Modules]:::module
        L5[Infrastructure]:::infra
        L6[Database]:::db
        L7[Authentication]:::auth
        L8[Patterns]:::pattern
    end
```
