# ucf/search-service-django architecture

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

- Interactive diagram: https://gitdiagram.com/ucf/search-service-django
- Repository: https://github.com/ucf/search-service-django

## Overview

##### Main Components
- Core API and business logic (located in “core” and other Django apps such as “images”, “programs”, “research”, “teledata”, and “units”).
- Django Management Commands & Utilities (management commands in programs, research, teledata, etc., plus custom scripts like deployment and data import).
- Template Layer: Django templates (found in the “templates” directory) that serve the HTML views (including admin dashboards).
- Settings and Configurations (settings.py, settings_local.tmpl.py, etc.)

- Frontend Application (Angular – Archimedes):
- Angular App: Found in the “archimedes” directory, it includes the Angular project’s configuration (angular.json, package.json) and its components (under src/app/component/*). This layer is responsible for the UI and interacts with the backend REST API.
- Build and Deployment Tools: Includes npm, gulp (gulpfile.js, gulp-config.json), and build pipelines for converting Angular code into static assets. Also note the “static” folder that holds compiled assets.

- Database:
- While the file tree does not explicitly list a database configuration file, you have multiple migration folders (for each Django app such as “core/migrations”, “programs/migrations”, etc.) indicating that a relational database (e.g., PostgreSQL/MySQL) is used to persist data.

- External Tools and Dependencies:
- Third-party frontend libraries such as Fontawesome Pro (as mentioned in the README), and Node dependencies.
- Python dependencies (managed via requirements.txt, dev-requirements.txt and pyproject.toml) including packages like lxml, spacy (used by management commands), etc.
- External build and dependency management systems like pip-tools (for managing pip packages).

##### Relationships and Interactions
- The Angular Frontend (Archimedes) will communicate with the Django backend using HTTP/REST calls.
- The Django backend orchestrates data processing through its multiple apps, uses models and migrations to interact with the database, and also serves rendered templates for parts of the application (e.g., admin dashboard, login).
- Management commands and background tasks (found in each of the apps’ management/commands directories) perform data imports and other scheduled tasks, which may update the database, indirectly affecting the API responses.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The architecture clearly separates the frontend (Angular) from the backend (Django REST API) and further subdivides backend logic across several Django apps.
- Modular Design: The Django backend is divided into modules (core, images, programs, research, teledata, units) each handling separate aspects of the overall functionality.
- Use of RESTful APIs: The Angular application acts as a client consuming the data served by the Django REST API endpoints.
- Build Pipeline: Use of Angular CLI, Gulp, and npm for building and deploying the frontend assets.

##### Additional Details to Capture
- Configuration and Dependency Management: Represent the node modules, gulp configuration, and Python package management (requirements.txt, pyproject.toml) as foundational blocks that support the build and deployment processes.
- Versioning/Build Processes: Indicate that there are scripts like “gulp default” for builds, Angular CLI commands (ng build), and Django commands (manage.py migrate, deploy) in the process workflow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Django Backend"
        subgraph "API & Business Logic"
            core["Core App"]:::backend
            images["Images App"]:::backend
            programs["Programs App"]:::backend
            research["Research App"]:::backend
            teledata["Teledata App"]:::backend
            units["Units App"]:::backend
        end
        subgraph "Management & Utilities"
            mgmtComm["Management Commands"]:::backend_secondary
            util1["Jobs Utils"]:::backend_secondary
            util2["Programs Utilities"]:::backend_secondary
            util3["Units Utils"]:::backend_secondary
        end
        subgraph "Templates & Settings"
            templates["Template Layer"]:::template
            sett1["settings.py"]:::template
            sett2["settings_local.tmpl.py"]:::template
        end
    end

    subgraph "Angular Frontend (Archimedes)"
        angular["Angular App"]:::frontend
        subgraph "Build Tools"
            gulp["Gulpfile"]:::frontend_secondary
            gulpConfig["Gulp Config"]:::frontend_secondary
        end
        compiled["Compiled Assets"]:::frontend_secondary
    end

    subgraph "Database"
        db["RDBMS Database"]:::database
    end

    subgraph "External Dependencies"
        pythonDeps["Python Dependencies"]:::external
        nodeRoot["Node Package.json (Root)"]:::external
        angularPkg["Angular Package.json"]:::external
    end

    %% Interactions between components
    angular -->|"HTTPREST"| core
    core -->|"DBOps"| db
    images -->|"DBOps"| db
    programs -->|"DBOps"| db
    research -->|"DBOps"| db
    teledata -->|"DBOps"| db
    units -->|"DBOps"| db
    mgmtComm -->|"MgmtTasks"| db
    util1 -->|"UtilityOps"| db
    util2 -->|"UtilityOps"| db
    util3 -->|"UtilityOps"| db
    gulp -->|"BuildPipeline"| compiled
    gulpConfig -->|"BuildPipeline"| compiled
    pythonDeps -->|"SupportsDjango"| core
    nodeRoot -->|"SupportsAngular"| angular
    angularPkg -->|"SupportsAngular"| angular

    %% Styles
    classDef backend fill:#C2F0C2,stroke:#333,stroke-width:2px;
    classDef backend_secondary fill:#A9DFBF,stroke:#333,stroke-width:2px;
    classDef template fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef frontend_secondary fill:#85C1E9,stroke:#333,stroke-width:2px;
    classDef database fill:#F5B7B1,stroke:#333,stroke-width:2px;
    classDef external fill:#D2B4DE,stroke:#333,stroke-width:2px;

    %% Click Events
    click core "https://github.com/ucf/search-service-django/tree/master/core/"
    click images "https://github.com/ucf/search-service-django/tree/master/images/"
    click programs "https://github.com/ucf/search-service-django/tree/master/programs/"
    click research "https://github.com/ucf/search-service-django/tree/master/research/"
    click teledata "https://github.com/ucf/search-service-django/tree/master/teledata/"
    click units "https://github.com/ucf/search-service-django/tree/master/units/"
    click mgmtComm "https://github.com/ucf/search-service-django/tree/master/programs/management/commands/"
    click util1 "https://github.com/ucf/search-service-django/blob/master/core/utils/jobs_utils.py"
    click util2 "https://github.com/ucf/search-service-django/tree/master/programs/utilities/"
    click util3 "https://github.com/ucf/search-service-django/blob/master/units/utils.py"
    click templates "https://github.com/ucf/search-service-django/tree/master/templates/"
    click sett1 "https://github.com/ucf/search-service-django/blob/master/settings.py"
    click sett2 "https://github.com/ucf/search-service-django/blob/master/settings_local.tmpl.py"
    click angular "https://github.com/ucf/search-service-django/tree/master/archimedes/"
    click gulp "https://github.com/ucf/search-service-django/blob/master/gulpfile.js"
    click gulpConfig "https://github.com/ucf/search-service-django/blob/master/gulp-config.tmpl.json"
    click compiled "https://github.com/ucf/search-service-django/tree/master/static/archimedes/"
    click pythonDeps "https://github.com/ucf/search-service-django/blob/master/requirements.txt"
    click nodeRoot "https://github.com/ucf/search-service-django/blob/master/package.json"
    click angularPkg "https://github.com/ucf/search-service-django/blob/master/archimedes/package.json"
```
