# Business Flow

### Overview

This document illustrates the business flow for the Digital Employee Flight Risk Analyst system. The workflow covers how a user requests flight risk analysis for employees or organizational segments, and how the DE clarifies scope parameters, validates permissions, retrieves multi-domain HRIS data from CATAPA, computes risk signals across five dimensions, scores and assigns risk tiers, and returns ranked risk outputs with explainable drivers and confidence indicators.

The process begins when the user asks a question such as "Which organization has the highest attrition risk?" or "Which employees are categorized as high risk?" The DE then confirms the analysis scope (company, organization, country/location, employment type, analysis type), validates admin-level data access privileges, and retrieves snapshot and historical data from CATAPA HRIS. The DE computes five risk signals (recent manager change, mobility stagnation, compensation positioning, leave/absence, disciplinary documents), runs scoring to produce risk tiers with confidence indicators, identifies top drivers using HR-safe language, and delivers a ranked segment or employee risk table with coverage notes and suggested next actions. The user can iterate by adjusting scope, filters, or analysis type.

***

### Flow Description (End-to-End)

```mermaid
flowchart TD
    %% Swimlanes
    subgraph HRUser["HR User"]
        A["Request Flight Risk Analysis"]
        B["Provide / Confirm Scope Parameters"]
        C["Receive Flight Risk Report"]
        D["Adjust Scope / Filters (Iteration)"]
    end

    subgraph DigitalEmployee["Digital Employee"]
        E["Identify Intent & Analysis Type"]
        F["Clarify Company / Legal Entity
        & Organization"]
        G["Clarify Country, Location
        & Employment Type"]
        H["Clarify Analysis Type:
        Segment vs. Employee Lookup"]
        I["Echo Final Confirmed Scope"]
        J{{"Admin-Level Privileges Valid?"}}
        K["Error: Access Denied"]
        L["Request Data from CATAPA HRIS"]
        M["Compute Risk Signals:
        - Recent Manager Change
        - Mobility Stagnation
        - Compensation Positioning
        - Leave / Absence
        - Disciplinary Documents"]
        N["Compute Data Coverage Indicators"]
        O["Score & Assign Risk Tier
        (Low / Medium / High)
        with Confidence Indicator"]
        P["Identify Top Drivers
        per Segment / Employee
        (HR-safe language)"]
        Q["Segment, Rank & Package Results"]
        R{{"Rows > 12?"}}
        S["Generate Downloadable File with Link"]
        T["Display Inline Table"]
        U["Deliver Analysis to User"]
    end

    subgraph CATAPA["CATAPA HRIS Data Provider"]
        V["Provide Snapshot & Historical Data"]
    end

    %% Main Flow
    A --> E
    E --> F
    F --> G
    G --> H
    H --> B
    B --> I
    I --> J
    J -->|"No"| K
    J -->|"Yes"| L
    L --> V
    V --> M
    M --> N
    N --> O
    O --> P
    P --> Q
    Q --> R
    R -->|"Yes"| S
    R -->|"No"| T
    S --> U
    T --> U
    U --> C
    C --> D
    D -->|"Updated Scope / Filters"| F

    %% Styling
    style HRUser fill:#e1f5ff,stroke:#000,color:#000
    style DigitalEmployee fill:#f3e5f5,stroke:#000,color:#000
    style CATAPA fill:#e8f5e9,stroke:#000,color:#000
    linkStyle default stroke:#1f77b4,stroke-width:1.5px
```

***

### Step-by-Step Description

#### 1. User Request

User requests flight risk analysis (e.g., "Which organization has the highest attrition risk?", "Show me high-risk employees in the Engineering division", or "What are the main flight risk drivers in Jakarta office?").

#### 2. Intent & Analysis Type Identification

DE identifies whether the user wants:

* **Segment analysis** (risk aggregated by organization/location/job level/job title), or
* **Specific employee lookup** (individual employee risk scores), or
* **Both** (default: both — employee list + segment analysis by organization).

#### 3. Company / Legal Entity & Organization Clarification

DE checks whether the company/legal entity and organization are provided.

* If the organization name is ambiguous (e.g., "Marketing" exists in multiple entities), DE asks for clarification.
* DE confirms the exact entity and org unit to scope the analysis.

#### 4. Country, Location & Employment Type Clarification

DE confirms:

* **Country & location** of employees to include.
* **Employment type**: permanent, contractor, intern, probation.
* If not specified, default = **all employment types**, and DE states it.

#### 5. Analysis Type Clarification

DE confirms the desired output type:

* Segment analysis (by organization), or
* Specific employee lookup, or
* Both (default).

#### 6. User Confirms Scope Parameters

User provides or confirms missing scope details. DE echoes the final confirmed scope back to the user before proceeding.

#### 7. Permission Validation

DE validates that it has **admin-level privileges** to access the required data domains:

* Compensation data (pay, pay grade, pay change history).
* Leave/absence data.
* Disciplinary document flags (SP1/SP2/SP3).

If privileges are **insufficient**, DE returns an **Access Denied** error and the flow terminates. If validated, the flow continues.

#### 8. Data Retrieval (CATAPA HRIS)

DE retrieves the following datasets from CATAPA:

* **Snapshot data (as of today):**
  * Employee & employment data (ID, status, join date, employment type, legal entity, country, location, org unit, job title, job level/grade).
  * Org & job assignment.
* **Historical data (within configured lookback windows):**
  * Transfer/promotion history (default: 5-year lookback).
  * Manager assignment changes (default: 12-month lookback).
  * Compensation change history (default: 12-month lookback; permissioned).
  * Leave/absence events (default: 6-month lookback; permissioned).
  * Disciplinary document flags — SP1/SP2/SP3 presence + dates only (default: 24-month lookback; permissioned).

#### 9. Risk Signal Computation

DE computes the following five risk signals for each employee:

| Signal                       | Low                            | Mid                               | High                             |
| ---------------------------- | ------------------------------ | --------------------------------- | -------------------------------- |
| **Recent Manager Change**    | Long (>18 months)              | Mid (6–18 months)                 | Short (<6 months)                |
| **Mobility Stagnation**      | Low (<18 months)               | Mid (18–36 months)                | High (>36 months)                |
| **Compensation Positioning** | Recent increase with healthy % | Moderate time since last increase | Long time since increase / low % |
| **Leave/Absence**            | 0–2 days                       | 3–7 days                          | >7 days                          |
| **Disciplinary Documents**   | None                           | SP1                               | SP2 or SP3                       |

#### 10. Data Coverage Indicators

DE computes data coverage indicators per signal and detects missing or low-quality data. Examples:

* "Compensation data available for 84% of employees in this cohort."
* "Manager history available for 92% of employees in this cohort."

#### 11. Scoring & Confidence

DE runs scoring using the configured rules engine/model, producing:

* **Risk Tier**: Low / Medium / High — based on aggregation of all five signals.
* **Numeric score**.
* **Confidence indicator** — reflects data completeness, model calibration, and sample size. If a key signal has low coverage, confidence is downgraded.

#### 12. Explainable Drivers (Top Drivers)

DE identifies the **top drivers** per high-risk segment (and per employee if permitted), phrased in HR-safe language:

* "Signals associated with higher attrition risk" — not subjective labels like "underpaid" or "disengaged."

#### 13. Segmentation, Ranking & Packaging

DE groups and ranks results by the requested segmentation:

* Organization / unit.
* Location / country.
* Job level / grade.
* Job title.
* Employee list (if permitted).

DE packages the output including:

* Segment/employee risk table with risk tier, numeric score, signal breakdown, and confidence indicator.
* Top drivers per segment/employee.
* Note/remark (narrative risk summary).
* Coverage notes.
* Suggested next actions (non-executing recommendations).
* Thought process & source references.

#### 14. Output Delivery

* If segment/rows **exceed 12 rows**: DE generates a **downloadable temporary file with a link**.
* If segment/rows are **12 or fewer**: DE displays an **inline table**.

#### 15. Delivery & Iteration

DE sends the final flight risk analysis report to the user. The user may iterate (change company/org, location, employment type, analysis type, or filters), and DE reruns the flow with updated parameters.
