# thisisnabi/scoring architecture

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

- Interactive diagram: https://gitdiagram.com/thisisnabi/scoring
- Repository: https://github.com/thisisnabi/scoring

## Overview

##### Main Components
- Entry Point: The application starts in Program.cs, which boots the ASP.NET Core host.
- Configuration: appsettings.json (and its Development variant) provide configuration details used at runtime.
- Business Logic: The BusinessPlan.cs file likely encapsulates higher-level scoring rules or flows.
- Chain Builder: ScoringChainBuilder.cs (under the Builders folder) appears responsible for constructing the chain of scoring handlers.
- Scoring Handlers: Under the Levels directory, you have several handler classes (e.g., AlivePersonScoringHandler, EmployeeScoringHandler, FinanceScoringHandler, SabeghehScoringHandler, ShahkarScoringHandler). These represent individual scoring logic components.
- Context: UserScoringContext.cs is probably used to pass user data and state through the chain.

##### Relationships and Interactions
- The Program.cs component initializes the application and likely creates or configures the business logic.
- The BusinessPlan might determine the overall flow or priorities for scoring.
- The ScoringChainBuilder constructs a chain that links all the individual scoring handler components.
- Each scoring handler in the Levels folder is a node in this chain, processing the scoring request in sequence.
- UserScoringContext is passed through the chain as a data object holding user information and scoring results.
- External configurations (appsettings files) provide parameters that influence how the business logic and handlers operate.

##### Architectural Patterns and Design Principles
- Chain-of-Responsibility Pattern: Evident through the use of multiple “handler” components which can process or pass along the scoring operation.
- Builder Pattern: The chain builder indicates a structured way to assemble the components dynamically.
- Separation of Concerns: Each handler and the corresponding business plan ensure modularity by isolating different aspects of the scoring process.
- Configuration-Driven Behavior: The presence of configuration files (appsettings.json) implies that aspects of the scoring logic can likely be tuned without code changes.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Entry Layer
    subgraph "Entry Layer"
        A["Program Entry (Program.cs)"]:::entry
    end

    %% Configuration Layer
    subgraph "Configuration Module"
        B1["appsettings.json"]:::config
        B2["appsettings.Development.json"]:::config
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        C["Business Logic/Plan (BusinessPlan.cs)"]:::business
    end

    %% Scoring Chain Builder Layer
    subgraph "Chain Builder Layer"
        D["Scoring Chain Builder (ScoringChainBuilder.cs)"]:::builder
    end

    %% Scoring Handlers Chain (Chain-of-Responsibility)
    subgraph "Scoring Handlers"
        E["AlivePerson Scoring Handler"]:::handler
        F["Employee Scoring Handler"]:::handler
        G["Finance Scoring Handler"]:::handler
        H["Sabegheh Scoring Handler"]:::handler
        I["Shahkar Scoring Handler"]:::handler
    end

    %% Context Layer
    subgraph "Context"
        J["User Scoring Context"]:::context
    end

    %% Connections
    A -->|"initializes"| C
    B1 -->|"configures"| C
    B2 -->|"configures"| C
    C -->|"builds chain using"| D
    D -->|"assembles"| E
    E -->|"passes_context"| F
    F -->|"passes_context"| G
    G -->|"passes_context"| H
    H -->|"passes_context"| I
    E -->|"uses_context"| J
    F -->|"uses_context"| J
    G -->|"uses_context"| J
    H -->|"uses_context"| J
    I -->|"uses_context"| J

    %% Styles
    classDef entry fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef config fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef builder fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef handler fill:#AFEEEE,stroke:#333,stroke-width:2px;
    classDef context fill:#FFB6C1,stroke:#333,stroke-width:2px;

    %% Click Events
    click A "https://github.com/thisisnabi/scoring/blob/main/Scoring/Program.cs"
    click B1 "https://github.com/thisisnabi/scoring/blob/main/Scoring/appsettings.json"
    click B2 "https://github.com/thisisnabi/scoring/blob/main/Scoring/appsettings.Development.json"
    click C "https://github.com/thisisnabi/scoring/blob/main/Scoring/BusinessPlan.cs"
    click D "https://github.com/thisisnabi/scoring/blob/main/Scoring/Builders/ScoringChainBuilder.cs"
    click E "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/AlivePersonScoringHandler.cs"
    click F "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/EmployeeScoringHandler.cs"
    click G "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/FinanceScoringHandler.cs"
    click H "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/SabeghehScoringHandler.cs"
    click I "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/ShahkarScoringHandler.cs"
    click J "https://github.com/thisisnabi/scoring/blob/main/Scoring/Levels/UserScoringContext.cs"
```
