# royashcenazi/fhir-indexer architecture

> Architecture diagram of the GitHub repository royashcenazi/fhir-indexer, 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/royashcenazi/fhir-indexer
- Repository: https://github.com/royashcenazi/fhir-indexer

## Overview

##### Connection and Data Flow

**External FHIR APIs → Authentication Layer → FHIR Clients → Indexing Engine → Storage**

##### Component Details

For each major component, include:
- Input/Output specifications
- Key responsibilities
- Dependencies on other components
- Concurrent operation indicators

##### Technical Stack Indicators

Technology badges for:
- Scala
- ZIO
- HAPI FHIR
- Any other major dependencies

##### The clear separation of concerns between components

Remember to indicate the scalability aspects of the system and how ZIO's concurrency model is utilized for efficient resource indexing. This will help developers understand both the current architecture and potential areas for extension or modification.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#90EE90
    classDef core fill:#ADD8E6
    classDef config fill:#FFE4B5
    classDef external fill:#D3D3D3
    
    %% External Systems
    subgraph External["External Systems"]
        FAPI["FHIR APIs"]:::external
        AUTH["Authentication Services"]:::external
        STORE["Storage/Index Destination"]:::external
    end

    %% Client Layer
    subgraph Clients["Client Layer"]
        HAPI["FHIRHapiClient"]:::client
        AUTHC["FhirAuthClient"]:::client
    end

    %% Core Processing
    subgraph Core["Core Processing Layer"]
        IE["Indexing Engine"]:::core
        AI["ApiIndexer"]:::core
        ZIO["ZIO Runtime Environment"]:::core
    end

    %% Configuration
    subgraph Config["Configuration Layer"]
        FIC["FhirIndexingConfig"]:::config
    end

    %% Connections
    FAPI --> AUTH
    AUTH --> AUTHC
    AUTHC --> HAPI
    HAPI --> IE
    IE --> AI
    AI --> STORE
    ZIO --> IE
    FIC --> IE
    FIC --> HAPI
    FIC --> AUTHC

    %% Legend
    subgraph Legend
        L1["Client Components"]:::client
        L2["Core Components"]:::core
        L3["Configuration"]:::config
        L4["External Systems"]:::external
    end

    %% Click Events
    click HAPI "https://github.com/royashcenazi/fhir-indexer/blob/master/src/main/scala/io/github/royashcenazi/fhir/indexer/client/FHIRHapiClient.scala"
    click AUTHC "https://github.com/royashcenazi/fhir-indexer/blob/master/src/main/scala/io/github/royashcenazi/fhir/indexer/client/FhirAuthClient.scala"
    click AI "https://github.com/royashcenazi/fhir-indexer/blob/master/src/main/scala/io/github/royashcenazi/fhir/indexer/indexer/ApiIndexer.scala"
    click ZIO "https://github.com/royashcenazi/fhir-indexer/blob/master/src/main/scala/io/github/royashcenazi/fhir/indexer/ZioApp.scala"
    click FIC "https://github.com/royashcenazi/fhir-indexer/blob/master/src/main/scala/io/github/royashcenazi/fhir/indexer/config/FhirIndexingConfig.scala"
```
