Inception here means onboarding employees and dependents from an Excel upload
(files.action = inception or related actions like missed_inception,
addition, dependent_addition). The same three-step pipeline runs for those
actions; this page focuses on the inception path.
Manual policy inception (form UI under policy_tranction/inception) is a separate flow
in PolicyTransactionController — not covered by these three functions.
In short:
JobWorker.| Area | Location |
|---|---|
| UI | app/Views/employee_upload.php — client, branch, policy, action Inception, file upload |
| Upload handler | EmployeeController::employeesUplodWithEvents |
| Pipeline logic | EmployeeServiceController — the three functions on this page |
| Job dispatch | app/Controllers/JobWorker.php — maps job names to EmployeeServiceController |
| Column / Excel helpers | app/Helpers/excel_util_helper.php — check_columns_name, custom validators |
| Upload record | files table via FileModel — status, action, reason |
| Premium | EB rack rate calculation — calculate_premium_new, employeesOnboardProcess |
Routes (group /employee, filter authMVC):
GET /employee/upload — upload screenPOST /employee/upload — upload + start validation (upload-action-type=inception)GET /employee/excel_error/{file_id} — returns files.reason JSON for the error modal
REST upload (mobile/HR): POST employeeRest/employeeUpload — same pipeline via
EmployeeRestController.
files.policy_id stores client policy id (client_policies.id),
not the insurer policy master id. Slab/rack lookups use this id with client_id.
| File size | Step 1 | Steps 2–3 |
|---|---|---|
| < 1 MB | excelFileFormatValidation runs inline in the upload request |
Always queued: excelFileDataValidation → employeesOnboardPreprocess |
| ≥ 1 MB | Job excelFileFormatValidation |
Same job chain after format passes |
After upload the UI usually shows files.status = inprogress until jobs finish.
Poll notifications or refresh the upload list; use /employee/excel_error/{id} when status is failed.
Job chain for inception (and missed_inception / addition / dependent_addition):
excelFileFormatValidation → excelFileDataValidation → employeesOnboardPreprocess
Runs on the uploaded sheet before any DB business rules.
writable/uploads/excel/{file_name}.$inception_excel_columns when action is inception (same column set for addition / dependent_addition / missed_inception).I), date/mobile formats, allowed lists, custom helpers (DOB, relationship, SI, mobile duplicate, etc.).| Code | Meaning |
|---|---|
| 1 | Mandatory value missing |
| 2 | Wrong format (e.g. date, mobile) |
| 3 | Value not in allowed list |
| 4 | Custom validation failed (DOB, relationship, SI, etc.) |
| 5 | File / policy / slab configuration problem |
| 6 | Column headers wrong or out of order |
On failure: files.status = failed, reason JSON with row/column errors; user notification via pull notification.
Lead-policy branch: If inception file is for a policy created from leads (policy_entry_from == 3 and is_from_lead set), format validation queues compareMemberDataAndInceptionData instead of going straight to data validation.
Stored as JSON string on files.reason. Typical failure payload:
{
"error_type": 1,
"error_summary": { "4": 2, "1": 1 },
"error_data": {
"3": {
"dob": { "error": ["Invalid date format"], "value": "01/01/1990" }
}
}
}
error_type — 1 = format step, 2 = data steperror_summary — counts per error code (after aggregation)error_data — keyed by Excel row number (1-based, header is row 1)Runs after format passes. Groups rows by EMP ID (family) and applies business rules.
Typical inception checks:
policy_terms (family composition, LGBTQ flag, etc.).name_and_empid_check_in_db).On success for inception: queues job employeesOnboardPreprocess. Other actions queue different jobs (deletion, correction, etc.).
| Code | Meaning |
|---|---|
| 7 | Duplicate name within same family in the Excel file |
| 9 | Record already exists in DB (inception / addition) |
| 10 | Record not found (used on deletion flows) |
| 14 | Self row missing in family |
| 26 | Duplicate employee code in file or DB |
Calculates premium and writes members to the database.
emp_id.calculate_premium_new() using policy terms + slab rates + rack config.employeesOnboardProcess() — insert/update employees, employee_polices, create policy_transaction (inception).files.status = success; else failed with rack-rate message.
Optional second path: client_policy_id without file_id — converts enrolled DB members
to inception (enrollment → inception), not from Excel.
TPA batch: When batch_file_id is present on the job payload, success also queues
updateEmployeeDataFromTpa, reconTpaApiDataWithEmployeepolicies, and
initializeDeletionProcessForTpaApiData (multi-file TPA reconcile flow).
Defined in EmployeeServiceController::$inception_excel_columns.
Header row must match exactly — 19 columns (A–S), row 1 only.
Dates use format d-M-Y (e.g. 4-Apr-1990).
One Self row per EMP ID; other rows are dependents.
| Col | Header | Required (inception) | Notes |
|---|---|---|---|
| A | S.No | Yes | |
| B | EMP ID | Yes | Family key |
| C | NAME OF EMP/DEP | Yes | |
| D | DOB | Yes | d-M-Y; age vs relationship checked |
| E | Gender | Yes | M / F (several casings allowed) |
| F | RELATIONSHIP | Yes | Self, Spouse, Son, Daughter, … |
| G | BASIC COVER SI | Conditional | Validated against slab when applicable |
| H | Date of Coverage | No | Mandatory for addition / DA only |
| I | DOJ | No | |
| J | Basic Pay | No | Used when policy terms need it |
| K | Band/Grade | No | |
| L | Designation | No | |
| M | Phone | No | Mobile format; duplicate check |
| N | No | Duplicate check in file | |
| O | PRE EXISTING AILMENTS | Yes | 0 or 1 |
| P | Change event | No | Not used for pure inception |
| Q | Date of exit | No | Deletion only |
| R | Reason for exit | No | Deletion only |
| S | Unit | No | Must match branch units when filled |
Sample file: use the download link on the employee upload screen (environment-specific).
All rows with the same EMP ID (column B) are treated as one family. Step 2 requires exactly one Self row in that group; dependents share the same EMP ID. Step 3 runs premium and DB insert once per family.
Example: one employee (EMP001) with spouse and son — three data rows plus header.
| Row | S.No | EMP ID | NAME | DOB | Gender | RELATIONSHIP | BASIC COVER SI | PED |
|---|---|---|---|---|---|---|---|---|
| 1 | Header row (all 19 columns A–S required in file) | |||||||
| 2 | 1 | EMP001 | Raj Kumar | 15-Jan-1985 | M | Self | 500000 | 0 |
| 3 | 2 | EMP001 | Priya Kumar | 20-Mar-1988 | F | Spouse | 500000 | 0 |
| 4 | 3 | EMP001 | Arjun Kumar | 10-Jun-2015 | M | Son | 500000 | 0 |
Rules illustrated:
d-M-Y; ages are checked against relationship (e.g. Son vs Self).0 or 1 on every member for inception.
A second employee in the same file uses a different EMP ID (e.g. EMP002) with its own Self row — each EMP ID is a separate family loop in preprocess.
policy_terms JSON and slab/rack rates for the client policy./employee/upload with action inception; note file_id in response or files table.status = failed, call GET /employee/excel_error/{file_id} or read files.reason.error_data row keys back to Excel (row 1 = header).calculate_premium_new (see rack-rate doc) and SI/slab config.inprogress, check job queue / JobWorker logs for the three job names.policy_terms or slab rates fails step 1 with code 5.calculate_premium_new returns data for every family.files.reason JSON for row-level errors after failure.