# hivdb/sierra architecture

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

- Interactive diagram: https://gitdiagram.com/hivdb/sierra
- Repository: https://github.com/hivdb/sierra

## Overview

##### Main Components Identification

a) Core Components:
- sierra-core: Main business logic
- sierra-graphql: GraphQL API layer
- sierra-tests: Testing framework
- hivfacts: HIV-specific data and rules
- asi_interpreter: Algorithm interpretation component

b) Web Layer:
- GraphQL Services (HIV1 and HIV2)
- REST endpoints
- CORS Filter
- Error handling

c) External Dependencies:
- PostAlign Alignment Program
- Docker container runtime
- Database (for development)

##### Architecture Layers

**Client Layer**

**API Layer (GraphQL/REST)**

**Service Layer**

**Core Business Logic**

**Data Access Layer**

##### Specific Components Detail

a) Web Components:
**┌─────────────────────┐**
- GraphQL API      │
- HIV1 Endpoint    │
- HIV2 Endpoint    │
- ┘

b) Core Processing:
**┌─────────────────────┐**
- Sierra Core       │
- Sequence Analysis │
- Drug Resistance   │
- Mutation Analysis │
- ┘

c) Supporting Services:
**┌─────────────────────┐**
- External Services  │
- PostAlign         │
- ASI Interpreter   │
- ┘

##### Infrastructure Components

Deployment-related components:
**┌─────────────────────┐**
- Docker Container   │
- Tomcat Server   │
- Java Runtime    │
- ┘

##### Key Interactions

Following flows:
- Sequence submission flow
- Alignment processing
- Resistance interpretation
- Result delivery

##### Additional Elements

Include:
- Version information
- System requirements
- External dependency versions
- API endpoints

##### Notes

Annotations for:
- Required environment variables
- Configuration requirements
- Security considerations
- Performance considerations

- Hierarchical layouts
- Export to common formats
- Version control friendly format

Remember to maintain a balance between detail and clarity, focusing on the key architectural decisions while avoiding overwhelming detail that might obscure the main system structure.

- System boundaries
- Component interactions
- Data flow
- Deployment architecture
- Integration points
- Security boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Applications]
    end

    subgraph "API Layer"
        GQL["GraphQL API Layer"]:::api
        HIV1["HIV1 GraphQL Service"]:::api
        HIV2["HIV2 GraphQL Service"]:::api
        REST["REST Endpoints"]:::api
        CORS["CORS Filter"]:::api
        ERR["Error Handler"]:::api
        WEB["Web Application Entry"]:::api
    end

    subgraph "Service Layer"
        CORE["Sierra Core"]:::core
        ASI["ASI Interpreter"]:::core
        HIVF["HIV Facts Database"]:::core
    end

    subgraph "External Services"
        POST["PostAlign Program"]:::external
        DOCKER["Docker Container"]:::infra
    end

    subgraph "Testing"
        TEST["Testing Framework"]:::test
    end

    %% Relationships
    CL --> GQL
    GQL --> HIV1
    GQL --> HIV2
    GQL --> REST
    REST --> CORE
    HIV1 --> CORE
    HIV2 --> CORE
    CORE --> ASI
    CORE --> HIVF
    CORE --> POST
    DOCKER --> POST

    %% Click events
    click GQL "https://github.com/hivdb/sierra/tree/main/sierra-graphql/"
    click CORE "https://github.com/hivdb/sierra/tree/main/sierra-core/"
    click TEST "https://github.com/hivdb/sierra/tree/main/sierra-tests/"
    click HIVF "https://github.com/hivdb/sierra/tree/main/hivfacts/"
    click ASI "https://github.com/hivdb/sierra/tree/main/asi_interpreter/"
    click HIV1 "https://github.com/hivdb/sierra/blob/main/src/main/java/edu/stanford/hivdb/web/GraphQLService.java"
    click HIV2 "https://github.com/hivdb/sierra/blob/main/src/main/java/edu/stanford/hivdb/web/HIV2GraphQLService.java"
    click CORS "https://github.com/hivdb/sierra/blob/main/src/main/java/edu/stanford/hivdb/web/CorsFilter.java"
    click ERR "https://github.com/hivdb/sierra/blob/main/src/main/java/edu/stanford/hivdb/web/ErrorPageService.java"
    click DOCKER "https://github.com/hivdb/sierra/tree/main/docker/tomcat-with-nucamino/"
    click POST "https://github.com/hivdb/sierra/blob/main/docker-payload/postalign_linux-amd64.tar.gz"
    click WEB "https://github.com/hivdb/sierra/blob/main/src/main/java/edu/stanford/hivdb/web/WebApplication.java"

    %% Styling
    classDef api fill:#2374ab
    classDef core fill:#57a773
    classDef external fill:#ffc857
    classDef infra fill:#a8a8a8
    classDef test fill:#ff7f51

    %% Legend
    subgraph Legend
        L1["API Components"]:::api
        L2["Core Components"]:::core
        L3["External Services"]:::external
        L4["Infrastructure"]:::infra
        L5["Testing"]:::test
    end
```
