# doe-cio/justice40-cejst architecture

> Architecture diagram of the GitHub repository doe-cio/justice40-cejst, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doe-cio/justice40-cejst
- Repository: https://github.com/doe-cio/justice40-cejst

## Overview

Key Components to Include in the System Design:

##### Frontend Layer (Client)
- Framework: Gatsby.js (React-based)
- Components structure following the /client/src/components hierarchy
- Visualization system using MapLibre
- Internationalization system (en/es)
- Testing infrastructure (Cypress, Jest)

##### Data Pipeline Layer
- ETL processes for multiple data sources
- Score calculation system
- Data validation and testing framework
- Geographic data processing
- Multiple source integrations (CDC, Census, EPA, etc.)

##### Data Serving Layer
- Static file serving
- Tile generation system
- API endpoints for data access

##### Infrastructure Components
- Docker containerization
- GitHub Actions CI/CD pipeline
- CDN integration
- Staging and production environments

- Frontend    | --> |  Data Pipeline | --> | Data Serving  |
- (Client)    |     |    (Python)    |     |    Layer      |

##### For Each Section, Detail the Internal Components

Frontend:

- Frontend         |

- Map Component |    |

- UI/UX      |    |

- Data Display |    |

Data Pipeline:

- Data Pipeline      |

- ETL Processes  |    |

- Score Engine   |    |

- Geo Processing|    |

- Data flow between components
- User interaction paths
- ETL process flow
- Deployment paths

**→ Data Flow**
**⇢ User Interaction**
**⇉ Deployment Flow**
**🔷 Frontend Component**
**🔶 Data Component**
**⭐ Critical Path**

- Infrastructure                    |

- Docker   |  | GitHub   |  | CDN         |   |
- Containers| | Actions  |  | Distribution |   |

Key Recommendations:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Client[Client Application]:::frontend
        MapVis[Map Visualization]:::frontend
        UIComp[UI Components]:::frontend
        I18n[Internationalization]:::frontend
        Testing[Testing Framework]:::frontend

        Client --> MapVis
        Client --> UIComp
        Client --> I18n
        Testing -.-> Client
    end

    subgraph DataPipeline
        ETL[ETL Framework]:::pipeline
        Score[Score Calculation]:::pipeline
        DataSrc[Data Sources]:::pipeline
        GeoProc[Geographic Processing]:::pipeline
        DataVal[Data Validation]:::pipeline

        DataSrc --> ETL
        ETL --> Score
        GeoProc --> Score
        DataVal -.-> ETL
    end

    subgraph DataServing
        TileGen[Tile Generation]:::serving
        DataServe[Data Serving Setup]:::serving
        StaticFiles[Static Files]:::serving

        TileGen --> DataServe
        StaticFiles --> DataServe
    end

    subgraph Infrastructure
        Docker[Docker Config]:::infra
        CICD[CI/CD Pipelines]:::infra
        Docs[Architecture Docs]:::infra

        Docker --> CICD
        Docs -.-> Docker
    end

    DataPipeline --> DataServing
    DataServing --> Frontend
    Infrastructure -.-> DataPipeline
    Infrastructure -.-> Frontend

    %% Click Events
    click Client "https://github.com/doe-cio/justice40-cejst/tree/main/client/src/"
    click MapVis "https://github.com/doe-cio/justice40-cejst/blob/main/client/src/components/J40Map.tsx"
    click UIComp "https://github.com/doe-cio/justice40-cejst/tree/main/client/src/components/"
    click I18n "https://github.com/doe-cio/justice40-cejst/tree/main/client/src/intl/"
    click Testing "https://github.com/doe-cio/justice40-cejst/tree/main/client/cypress/"
    click ETL "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/etl/"
    click Score "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/score/"
    click DataSrc "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/etl/sources/"
    click GeoProc "https://github.com/doe-cio/justice40-cejst/blob/main/data/data-pipeline/data_pipeline/etl/sources/geo_utils.py"
    click DataVal "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/tests/"
    click TileGen "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/tile/"
    click DataServe "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-serve/"
    click StaticFiles "https://github.com/doe-cio/justice40-cejst/tree/main/data/data-pipeline/data_pipeline/files/"
    click Docker "https://github.com/doe-cio/justice40-cejst/blob/main/docker-compose.yml"
    click CICD "https://github.com/doe-cio/justice40-cejst/tree/main/.github/workflows/"
    click Docs "https://github.com/doe-cio/justice40-cejst/tree/main/docs/architecture/"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef pipeline fill:#2ecc71,stroke:#27ae60,color:white
    classDef serving fill:#e74c3c,stroke:#c0392b,color:white
    classDef infra fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend_L[Frontend]:::frontend
        Pipeline_L[Data Pipeline]:::pipeline
        Serving_L[Data Serving]:::serving
        Infra_L[Infrastructure]:::infra
        Flow["--> Data Flow"]
        TestFlow["-.-> Test/Doc Flow"]
    end
```
