# Business Flow

This document illustrates the business flows for the Digital Employee Payroll Officer system, covering three main workflows: Follow-up Missing Attendance, Monthly Attendance Recap and Override with Unpaid Leave, and Reminder for HR about Unapproved Salary Decree.

### Follow-up Missing Attendance

This flow illustrates the end-to-end interaction between the **User**, **Claudia (Digital Employee)**, and **Employees** during the pre-payroll validation process for missing attendance.

The process begins when the user requests Claudia to list employees with incomplete attendance records. Claudia identifies the relevant payroll period, retrieves attendance data from CATAPA via API, detects missing entries, and returns a formatted summary to the user.

Upon receiving the summary, the user instructs Claudia to send reminders. Claudia then determines the recipients, prepares the appropriate WhatsApp templates, and sends the reminders directly to each employee, prompting them to correct their attendance records.

Once all messages are sent, Claudia confirms back to the user that the reminders have been successfully delivered, closing the automation loop.

{% @mermaid/diagram content="flowchart TD
subgraph U\["👤 User"]
U1@{ label: "Request: 'Claudia, list employees still missing attendance this month'" }
U2\["Receive missing attendance summary"]
U3{"Want to send reminder?"}
U4@{ label: "Command: 'Send reminder to all of them'" }
U5\["Receive confirmation that reminders were sent"]
end
subgraph C\["🤖 Claudia (System)"]
C1\["Identify payroll period and reference date"]
C2\["Retrieve attendance records via CATAPA API"]
C3{"Missing attendance detected?"}
C4\["Compile list and format WhatsApp summary"]
C5\["Send summary to User"]
C6\["Retrieve reminder instructions and recipient list"]
C7\["Prepare message templates and delivery channels"]
C8\["Send WhatsApp reminders to Employees"]
C9\["Notify User that reminders have been sent"]
end
subgraph E\["👩‍💼 Employees"]
E1@{ label: "Receive WhatsApp reminder: 'Please resolve your missing attendance immediately'" }
end
START(\["Start"]) --> U1
U1 --> C1
C1 --> C2
C2 --> C3
C3 -- Yes --> C4
C4 --> C5
C5 --> U2
U2 --> U3
C3 -- No --> END(\["End"])
U3 -- Yes --> U4
U4 --> C6
C6 --> C7
C7 --> C8
C8 --> E1
E1 --> C9
C9 --> U5
U5 --> END
U3 -- No --> END
U1@{ shape: rect}
U4@{ shape: rect}
E1@{ shape: rect}" %}

#### **Flow Description**

| Phase                        | Description                                                                               |
| ---------------------------- | ----------------------------------------------------------------------------------------- |
| **1. User Request**          | User requests Claudia to list employees with missing attendance for the current month     |
| **2. Period Identification** | Claudia identifies the relevant payroll period and reference date                         |
| **3. Data Retrieval**        | Claudia retrieves attendance records from CATAPA via API                                  |
| **4. Missing Detection**     | Claudia checks if there are any missing attendance records                                |
| **5. Summary Compilation**   | If missing attendance is detected, Claudia compiles a list and formats a WhatsApp summary |
| **6. Summary Delivery**      | Claudia sends the summary to the user                                                     |
| **7. User Decision**         | User decides whether to send reminders to employees                                       |
| **8. Reminder Preparation**  | If user confirms, Claudia retrieves reminder instructions and recipient list              |
| **9. Template Preparation**  | Claudia prepares message templates and determines delivery channels                       |
| **10. Reminder Delivery**    | Claudia sends WhatsApp reminders to each employee                                         |
| **11. Confirmation**         | Claudia notifies the user that reminders have been successfully sent                      |

### Monthly Attendance Recap and Override with Unpaid Leave

This flow describes how Claudia supports HR in resolving **attendance and approval issues automatically** during the pre-payroll validation phase.

In the **first user action**, the user asks Claudia to provide a monthly attendance recap. Claudia fetches presence, absence, and attendance data via CATAPA API, identifies unapproved or missing entries, and sends the summarized results through Claudia Chat.

In the **second user action**, the user instructs Claudia to process and clean up these issues — rejecting pending approvals and converting missing attendance into unpaid leave. Claudia confirms the intended actions (via Human-in-the-Loop confirmation), executes updates in CATAPA, and delivers a final **Monthly Pre-Payroll Compliance Report**, ensuring payroll can proceed smoothly.

{% @mermaid/diagram content="flowchart TD
subgraph U\["👤 User"]
U1@{ label: "Request: 'Give me the list of employees with missing attendance and pending approvals that require my attention'" }
U2\["Receive Monthly Attendance Recap highlighting missing/unapproved data"]
U3{"Command: 'Process all pending approvals and missing attendances this week'?"}
U4\["Receive Monthly Pre-Payroll Compliance Report with automation results"]
end

subgraph C\["🤖 Claudia (System)"]
C1\["Identify payroll period and reference date"]
C2\["Retrieve pre-payroll validation data (Presence Correction, Absence, Attendance Detail)"]
C3{"Missing or unapproved data detected?"}
C4\["Compile Monthly Attendance Recap highlighting issues"]
C5\["Send summary report to User via Claudia Chat"]
C6\["Re-identify period range (Today − 7 days to Today)"]
C7\["Retrieve and analyze unapproved data records"]
C8\["Determine update actions: Reject pending approvals / Convert missing attendance to Unpaid Leave"]
C9\["Request User confirmation (Human-in-the-Loop)"]
C10\["Execute data updates after User confirmation"]
C11\["Generate and send Monthly Pre-Payroll Compliance Report"]
end

subgraph E\["👩‍💼 Employees"]
E1@{ label: "Attendance and absence records automatically updated (Unpaid Leave / Rejected Requests)" }
end

```
START(["Start"]) --> U1
U1 --> C1
C1 --> C2
C2 --> C3
C3 -- Yes --> C4
C4 --> C5
C5 --> U2
U2 --> U3
C3 -- No --> END(["End"])
U3 -- Yes --> C6
C6 --> C7
C7 --> C8
C8 --> C9
C9 --> C10
C10 --> E1
E1 --> C11
C11 --> U4
U4 --> END
U3 -- No --> END


%% Shapes for clarity
U1@{ shape: rect }
U4@{ shape: rect }
E1@{ shape: rect }" %}
```

**Flow Description**

| Phase                           | Description                                                                                                     |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **1. User Request**             | User requests a list of employees with missing attendance and pending approvals                                 |
| **2. Period Identification**    | Claudia identifies the payroll period and reference date                                                        |
| **3. Data Retrieval**           | Claudia retrieves pre-payroll validation data (Presence Correction, Absence, Attendance Detail) from CATAPA API |
| **4. Issue Detection**          | Claudia checks if there are missing or unapproved data records                                                  |
| **5. Recap Compilation**        | If issues are detected, Claudia compiles a Monthly Attendance Recap highlighting the issues                     |
| **6. Recap Delivery**           | Claudia sends the summary report to the user via Claudia Chat                                                   |
| **7. User Decision**            | User decides whether to process all pending approvals and missing attendances                                   |
| **8. Period Re-identification** | If user confirms, Claudia re-identifies the period range (Today − 7 days to Today)                              |
| **9. Data Analysis**            | Claudia retrieves and analyzes unapproved data records                                                          |
| **10. Action Determination**    | Claudia determines update actions: reject pending approvals and convert missing attendance to Unpaid Leave      |
| **11. Human-in-the-Loop**       | Claudia requests user confirmation before executing updates                                                     |
| **12. Execution**               | After confirmation, Claudia executes data updates in CATAPA                                                     |
| **13. Report Generation**       | Claudia generates and sends the Monthly Pre-Payroll Compliance Report to the user                               |

### Reminder for HR about Unapproved Salary Decree

This flow shows how Claudia automates the **follow-up process for unapproved salary decree changes** to ensure payroll readiness.

When the user sends a message requesting reminders for pending approvals, Claudia determines the relevant payroll period, fetches unapproved salary change data from **CATAPA** via API, and identifies the responsible approvers. Using a predefined **Pending Approval Reminder Template**, Claudia generates personalized emails and sends them to the HR approvers' addresses.

Finally, Claudia confirms back to the user that the reminders have been successfully sent, ensuring full transparency and traceability in the pre-payroll validation workflow.

{% @mermaid/diagram content="flowchart TD
subgraph U\["👤 User"]
U1@{ label: "Request: 'Claudia, send a reminder to approvers for unapproved salary decree changes'" }
U2\["Receive confirmation that reminders have been sent to HR approvers"]
end

subgraph C\["🤖 Claudia (System)"]
C1\["Identify payroll period and reference date"]
C2\["Retrieve pre-payroll validation scope (Salary Changes)"]
C3\["Fetch unapproved salary decree changes from CATAPA API"]
C4\["Identify approvers responsible for pending approvals"]
C5\["Prepare reminder message template (Pending Approval Reminder Template)"]
C6\["Determine delivery channel and recipient email addresses"]
C7\["Send reminder emails to HR approvers"]
C8\["Confirm reminder dispatch completion to User"]
end

subgraph H\["👩‍💼 HR Approver"]
H1@{ label: "Receive email reminder: 'Please approve pending salary decree changes before payroll cutoff'" }
end

```
START(["Start"]) --> U1
U1 --> C1
C1 --> C2
C2 --> C3
C3 --> C4
C4 --> C5
C5 --> C6
C6 --> C7
C7 --> H1
H1 --> C8
C8 --> U2
U2 --> END(["End"])


%% Shapes for clarity
U1@{ shape: rect }
H1@{ shape: rect }" %}
```

**Flow Description**

| Phase                                    | Description                                                                               |
| ---------------------------------------- | ----------------------------------------------------------------------------------------- |
| **1. User Request**                      | User requests Claudia to send reminders to approvers for unapproved salary decree changes |
| **2. Period Identification**             | Claudia identifies the payroll period and reference date                                  |
| **3. Scope Identification**              | Claudia retrieves the pre-payroll validation scope (Salary Changes)                       |
| **4. Data Retrieval**                    | Claudia fetches unapproved salary decree changes from CATAPA API                          |
| **5. Approver Identification**           | Claudia identifies the approvers responsible for pending approvals                        |
| **6. Template Preparation**              | Claudia prepares the reminder message template (Pending Approval Reminder Template)       |
| **7. Channel & Recipient Determination** | Claudia determines the delivery channel and recipient email addresses                     |
| **8. Reminder Delivery**                 | Claudia sends reminder emails to HR approvers                                             |
| **9. Confirmation**                      | Claudia confirms to the user that reminders have been successfully sent                   |
