# westofengland-ca/weca_tdh_ckan architecture

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

- Interactive diagram: https://gitdiagram.com/westofengland-ca/weca_tdh_ckan
- Repository: https://github.com/westofengland-ca/weca_tdh_ckan

## Overview

##### Main Components

a. Core Components:
- CKAN Core Platform (central component)
- WECA TDH Extension (ckanext-weca-tdh)
- CLI Tools Layer (ckan-cli)
- Web Interface Layer
- Database Layer (PostgreSQL)
- NGINX Web Server

b. Extension Components:
- Authentication System
- Template Engine
- Asset Management
- Plugin System
- API Layer

##### Component Relationships

- NGINX as the front-facing component, handling HTTP requests
- CKAN Core as the central component
- WECA TDH Extension connecting to CKAN Core
- CLI Tools interfacing with the API Layer

##### Specific Implementation Details

- Blue containers for Docker components
- Green components for the custom WECA extension
- Yellow for external interfaces (API, CLI)
- Gray for infrastructure components (NGINX, PostgreSQL)

##### Key Architectural Elements

Distinct layers:
**[Web Layer (NGINX)]**
- ↓
**[Template Layer (Jinja2 Templates)]**
- ↓
**[CKAN Core + WECA Extension]**
- ↓
**[Database Layer (PostgreSQL)]**

##### Integration Points

Highlight:
- API endpoints for CLI tool integration
- Template override system
- Asset pipeline
- Authentication flow
- Plugin hook points

##### Development/Deployment Flow

A separate section showing:
- Docker container relationships
- CI/CD pipeline flow
- Development environment setup

##### Specific Details

- Custom templates location
- Asset management system
- Configuration management
- Authentication handlers
- Custom controllers and helpers

##### Technical Specifications

Aspects:
- Docker-based deployment
- CKAN extension architecture
- Template inheritance system
- Asset compilation pipeline
- Database schema extensions

**[Frontend Layer]**
- NGINX (reverse proxy)
- Template System
- Asset Pipeline

**[Application Layer]**
- CKAN Core
- WECA Extension
- Authentication
- Controllers

**[Data Layer]**
- PostgreSQL
- Data Storage
- Search Index

**[Integration Layer]**
- CLI Tools
- API Endpoints
- External Services

Remember to:
- Keep components modular and clearly separated
- Version information
- Configuration dependencies

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#e6f3ff,stroke:#333
    classDef core fill:#f9f9f9,stroke:#333
    classDef database fill:#f5f5f5,stroke:#333
    classDef extension fill:#e6ffe6,stroke:#333
    classDef integration fill:#fff2e6,stroke:#333
    classDef infrastructure fill:#f0f0f0,stroke:#333

    %% Frontend Layer
    subgraph Frontend
        NGINX["NGINX Web Server"]
        Templates["Template Engine"]
        Assets["Asset Management"]
    end

    %% Application Layer
    subgraph Application
        CKAN["CKAN Core Platform"]
        WECA["WECA TDH Extension"]
        Auth["Authentication System"]
        Plugin["Plugin System"]
        Controllers["Controllers"]
        Helpers["Helper Functions"]
        Config["Configuration Management"]
        Upload["File Upload System"]
        UserMgmt["User Management"]
    end

    %% Data Layer
    subgraph Data
        PostgreSQL[(PostgreSQL Database)]
    end

    %% Integration Layer
    subgraph Integration
        CLI["CLI Tools"]
        API["API Layer"]
    end

    %% Relationships
    NGINX --> Templates
    NGINX --> Assets
    Templates --> CKAN
    Assets --> CKAN
    
    CKAN --> Auth
    CKAN --> Plugin
    CKAN --> Controllers
    CKAN --> PostgreSQL
    
    WECA --> Plugin
    WECA --> Controllers
    WECA --> Helpers
    WECA --> Config
    WECA --> Upload
    WECA --> UserMgmt
    
    CLI --> API
    API --> CKAN

    %% Click Events
    click NGINX "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/docker/nginx/"
    click Templates "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/ckanext-weca-tdh/ckanext/weca_tdh/templates/"
    click Assets "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/ckanext-weca-tdh/ckanext/weca_tdh/assets/"
    click WECA "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/ckanext-weca-tdh/ckanext/weca_tdh/"
    click Auth "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/auth.py"
    click Plugin "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/plugin.py"
    click Controllers "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/controller.py"
    click Helpers "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/lib/helpers.py"
    click Config "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/ckanext-weca-tdh/ckanext/weca_tdh/config/"
    click Upload "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/upload.py"
    click UserMgmt "https://github.com/westofengland-ca/weca_tdh_ckan/blob/main/ckanext-weca-tdh/ckanext/weca_tdh/user.py"
    click PostgreSQL "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/docker/postgresql/"
    click CLI "https://github.com/westofengland-ca/weca_tdh_ckan/tree/main/ckan-cli/"

    %% Style Applications
    class NGINX,Templates,Assets frontend
    class CKAN core
    class PostgreSQL database
    class WECA,Auth,Plugin,Controllers,Helpers,Config,Upload,UserMgmt extension
    class CLI,API integration
    class NGINX infrastructure
```
