# ga4gh/ga4gh-schemas architecture

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

- Interactive diagram: https://gitdiagram.com/ga4gh/ga4gh-schemas
- Repository: https://github.com/ga4gh/ga4gh-schemas

## Overview

##### Main Components

a. Schema Definition Layer
- Protocol Buffers (.proto files) in src/main/proto/ga4gh/
- Core data models for genomics data
- Service definitions for each data type

b. Generated Code Layer
- Python implementations (python/ga4gh/schemas/ga4gh/)
- Protocol buffer generated classes
- Service interfaces

c. Documentation System
- Sphinx documentation engine
- API documentation
- RST source files

d. Build & Testing Infrastructure
- Maven build system (pom.xml)
- Python testing framework
- Travis CI integration

**┌─────────────────────────────────────────────┐**
- Client Applications            │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Service Definitions              │
- Read Service         - Variant Service   │
- Reference Service    - Metadata Service  │
- Annotation Service   - Bio Metadata      │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Data Models                    │
- Reads          - Variants               │
- References     - Annotations            │
- Common         - Metadata               │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Protocol Buffer Definitions         │
- ┘

##### Implementation Details to Highlight

- Protocol Buffer message definitions
- Service interface definitions
- Generated language bindings
- Documentation generation flow
- Test infrastructure

##### Additional Elements

- Documentation generation process
- Test coverage and validation flow
- Extension points for implementers

##### The documentation system integration

Keep the focus on the schema definition and code generation aspects, as this is primarily a protocol definition project rather than an implementation project.

## Diagram (Mermaid)

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

    subgraph "Service Definitions Layer"
        ReadSvc["Read Service"]:::service
        RefSvc["Reference Service"]:::service
        VarSvc["Variant Service"]:::service
        MetaSvc["Metadata Service"]:::service
        AnnSvc["Sequence Annotation Service"]:::service
    end

    subgraph "Data Models Layer"
        Reads["Reads Model"]:::model
        References["References Model"]:::model
        Variants["Variants Model"]:::model
        Annotations["Annotations Model"]:::model
        Common["Common Model"]:::model
        Metadata["Metadata Model"]:::model
    end

    subgraph "Protocol Buffer Definitions"
        ProtoCore["Core Proto Definitions"]:::proto
        GoogleAPI["Google API Definitions"]:::proto
    end

    subgraph "Generated Code"
        PyRead["Python Read Service"]:::generated
        PyRef["Python Reference Service"]:::generated
        PyVar["Python Variant Service"]:::generated
        PyMeta["Python Metadata Service"]:::generated
    end

    subgraph "Documentation System"
        SphinxDocs["Sphinx Documentation"]:::docs
        APIDocs["API Documentation"]:::docs
        APIDesign["API Design Docs"]:::docs
    end

    subgraph "Build & Testing"
        Maven["Maven Build System"]:::build
        PyTests["Python Tests"]:::build
        Travis["Travis CI"]:::build
        BuildScripts["Build Scripts"]:::build
    end

    %% Relationships
    Client --> ReadSvc & RefSvc & VarSvc & MetaSvc & AnnSvc

    ReadSvc --> Reads
    RefSvc --> References
    VarSvc --> Variants
    MetaSvc --> Metadata
    AnnSvc --> Annotations

    Reads & References & Variants & Annotations & Metadata --> Common
    Common --> ProtoCore
    ProtoCore --> GoogleAPI

    ReadSvc --> PyRead
    RefSvc --> PyRef
    VarSvc --> PyVar
    MetaSvc --> PyMeta

    ProtoCore --> SphinxDocs
    SphinxDocs --> APIDocs
    SphinxDocs --> APIDesign

    BuildScripts --> Maven
    BuildScripts --> PyTests
    PyTests --> Travis

    %% Click Events
    click ReadSvc "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/read_service.proto"
    click RefSvc "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/reference_service.proto"
    click VarSvc "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/variant_service.proto"
    click MetaSvc "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/metadata_service.proto"
    click AnnSvc "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/sequence_annotation_service.proto"
    click Reads "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/reads.proto"
    click References "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/references.proto"
    click Variants "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/variants.proto"
    click Annotations "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/sequence_annotations.proto"
    click Common "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/common.proto"
    click Metadata "https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/metadata.proto"
    click ProtoCore "https://github.com/ga4gh/ga4gh-schemas/tree/master/src/main/proto/ga4gh/"
    click GoogleAPI "https://github.com/ga4gh/ga4gh-schemas/tree/master/src/main/proto/google/api/"
    click PyRead "https://github.com/ga4gh/ga4gh-schemas/blob/master/python/ga4gh/schemas/ga4gh/read_service_pb2.py"
    click PyRef "https://github.com/ga4gh/ga4gh-schemas/blob/master/python/ga4gh/schemas/ga4gh/reference_service_pb2.py"
    click PyVar "https://github.com/ga4gh/ga4gh-schemas/blob/master/python/ga4gh/schemas/ga4gh/variant_service_pb2.py"
    click PyMeta "https://github.com/ga4gh/ga4gh-schemas/blob/master/python/ga4gh/schemas/ga4gh/metadata_service_pb2.py"
    click SphinxDocs "https://github.com/ga4gh/ga4gh-schemas/tree/master/doc/source/"
    click APIDocs "https://github.com/ga4gh/ga4gh-schemas/tree/master/doc/source/api/"
    click APIDesign "https://github.com/ga4gh/ga4gh-schemas/blob/master/doc/source/api/apidesign_intro.rst"
    click Maven "https://github.com/ga4gh/ga4gh-schemas/blob/master/pom.xml"
    click PyTests "https://github.com/ga4gh/ga4gh-schemas/tree/master/tests/"
    click Travis "https://github.com/ga4gh/ga4gh-schemas/blob/master/.travis.yml"
    click BuildScripts "https://github.com/ga4gh/ga4gh-schemas/blob/master/scripts/process_schemas.py"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef service fill:#aaf,stroke:#333,stroke-width:2px
    classDef model fill:#afa,stroke:#333,stroke-width:2px
    classDef proto fill:#ffa,stroke:#333,stroke-width:2px
    classDef generated fill:#fda,stroke:#333,stroke-width:2px
    classDef docs fill:#ddd,stroke:#333,stroke-width:2px
    classDef build fill:#daf,stroke:#333,stroke-width:2px
```
