Files & Location
-
ri-extended-daily-report.js— Core data processing script that parses raw Resource Inn data, calculates expected hours, floor time, shift completion percentages, and sets attendance flags (absent/on-time/late). -
ri-attendance-report.js— Email report generator that applies performance filters, excludes management roles using keyword matching, and produces the final HTML report sent to stakeholders. -
management-keywords.json— Configuration file containing list of keywords used to identify management roles that should be excluded from performance calculations. -
code-to-department.json— Mapping configuration that converts department codes to human-readable department names used in filtering and reporting. -
fetch-ri-extended-daily-report.js— Data fetcher that retrieves Resource Inn Excel/CSV reports and prepares them for processing (if present in your deployment).
Data sources
Raw attendance data comes from Resource Inn daily reports exported as Excel/CSV files. Thefetch-ri-extended-daily-report.js script retrieves these files and passes them to ri-extended-daily-report.js for preprocessing. Pre-processing includes:
- Time format normalization (converting various time formats to minutes)
- Department code resolution using
code-to-department.json - Expected hours calculation based on shift schedules
- Break time extraction and validation
Field definitions
| Field | Type | Description |
|---|---|---|
id / employeeId | string | Unique employee identifier from Resource Inn |
name | string | Employee full name |
designation | string | Job title/role used for management filtering |
department | string | Department name (resolved from code) |
expectedHours | number | Hours expected for the shift based on schedule |
totalTimeOnFloorHours | number | Actual hours spent on floor during shift |
breakMinutes | number | Total break time taken in minutes |
shiftCompletionPercentage | number | Percentage of expected hours completed (0-100) |
checkInStatus | string | Attendance status: ‘Present’, ‘Day Off’, ‘Absent’ |
isAbsent | boolean | True if employee was marked absent |
isOnTime | boolean | True if employee checked in on time |
isLate | boolean | True if employee checked in late |
Calculations & formulas
Core performance metrics
Department-level calculations
Management filtering
Management roles are excluded from performance calculations using keyword matching:-
Keyword loading:
ri-attendance-report.jsloads keywords using: -
Matching behavior: Case-insensitive substring match against
record.designation: -
Configuration: Add or modify keywords in
management-keywords.json. Common entries include “Manager”, “Lead”, “Supervisor”, “Director”.
Edge cases & notes
-
Zero expected hours: Records with
expectedHoursof 0 or null are excluded from calculations to avoid division by zero and skewed averages. -
Missing/malformed times: Invalid time formats are marked as absent and excluded from performance metrics. The
parseTimeToMinutesfunction handles various formats but logs errors for unparseable values. -
Designation ambiguity: Roles like “Lead” or “Team Lead” may be unintentionally excluded. Modify
management-keywords.jsonto include or remove specific keywords based on your organizational structure. -
Part-time shifts: Fractional
expectedHoursvalues are supported. The 75% threshold applies proportionally (e.g., 4-hour shift requires 3+ hours to pass). -
Department name variations: Multiple department codes can map to the same name in
code-to-department.json. Ensure all relevant codes are included for accurate filtering. - Time format variations: The parser handles formats like “06:00 pm”, “18:00”, “6:00 PM”. Unrecognized formats default to 0 and trigger absent flags.
Worked example
Input records
| Employee | Expected Hours | Floor Hours | Break Minutes | Designation |
|---|---|---|---|---|
| Alice | 8.0 | 6.0 | 45 | Agent |
| Bob | 8.0 | 5.5 | 30 | Agent |
| Carol | 8.0 | 7.0 | 70 | Team Lead |
Calculations
Output summary
- Department utilization: (75.0% + 68.75%) / 2 = 71.88%
- Present count: 3 (all marked present)
- Low performance: 1 agent (Bob)
- Excessive breaks: 1 agent (Carol)
- Management excluded: 1 record (Carol)
How to change thresholds & configuration
Low performance threshold
Editri-attendance-report.js and search for the 0.75 value or comment referencing “25% less”:
Break time limit
In the same file, find the break minutes comparison:Include management in reports
To include management roles in calculations:- Delete or rename
management-keywords.json - Or modify
ri-attendance-report.jsto skip the filtering step:
Testing suggestions
Unit tests to implement
Integration testing
Run the full processing pipeline in your project root:References
- Core processing:
ri-extended-daily-report.js-parseTimeToMinutes(),calculateShiftCompletion(),getDepartmentNames() - Report generation:
ri-attendance-report.js-isManagement(),generateHTMLReport() - Configuration files:
management-keywords.json,code-to-department.json - Data fetching:
fetch-ri-extended-daily-report.js(if deployed)