Worker health issue tracking¶
Worker health issue tracking retrieves all health-issue rows for one worker, lets the caller create additional child rows inside a managed collection, validates the exposure code on each row, and persists inserts or deletes against the worker health issue table. The implementation does not define an update SQL statement, so persistence is limited to create and delete behavior.
| Field | Value |
|---|---|
| Operation ID | OP-PER-08 |
| Trigger | Caller loads the worker's health-issue collection, creates or removes a child row, and calls Save() |
| Inputs | WorkerID; child ExposureCode; acting user from DataPortalInfo.UserID |
| Outputs | In-memory clsWorkerHealthIssueCollection; persisted inserts or deletes in CL_WORKER_HEALTH_ISSUE; broken rules and DB-contention messages |
| Primary components | clsWorkerHealthIssueCollection.GetWorkerHealthIssueCollection, clsWorkerHealthIssueCollection.NewWorkerHealthIssue, clsWorkerHealthIssue.BeforeInsert, clsWorkerHealthIssue.BeforeDelete |
| Entry point | Business\SAIF.Business.Claim.Person\clsWorkerHealthIssueCollection.vb |
Steps¶
- Retrieve the worker's current health-issue rows.
GetWorkerHealthIssueCollectionissues the worker-scoped read query, creates aclsWorkerHealthIssuefor each returned row, and adds the child to the managed collection (SQL-014, CL_WORKER_HEALTH_ISSUE). - Create a new managed child row when requested.
NewWorkerHealthIssuecreates a child throughclsWorkerHealthIssue.NewWorkerHealthIssue, adds it to the collection, and returns the child for editing. - Initialize default values for a new child.
clsWorkerHealthIssue.CreatesetsExposureCodeto empty, stamps the current time and acting user, zerosUpdateNum, and initializesWorkerIDto0before the caller supplies row data. - Validate the exposure code before save. The row rule rejects blank exposure codes and rejects values less than
1(BR-PER-027). - Persist inserts and deletes through BOF child processing. The managed collection calls
ApplyEdit()and delegates persistence to each child, which inserts new rows with the worker-health-issue create SQL and deletes removed rows with the delete SQL (BR-PER-001, SQL-004, SQL-023, CL_WORKER_HEALTH_ISSUE). - Translate row-count mismatches into contention errors. After insert or delete, the child checks the returned row count and adds the standard DB-contention message when exactly one row was not affected (BR-PER-001).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Load worker health issues]) --> Read[Retrieve existing rows]
Read --> Change{Add or remove a row?}
Change -->|Add| NewRow[Create child and set defaults]
Change -->|Remove| DeleteRow[Queue child delete]
NewRow --> Validate[Validate exposure code]
Validate --> Valid{Validation passes?}
Valid -->|No| Fail([Broken rules returned])
Valid -->|Yes| Save[Run managed child save]
DeleteRow --> Save
Save --> Rows{Rows affected = 1?}
Rows -->|No| Contention([Add DB-contention message])
Rows -->|Yes| Done([Save completes])
Failure and edge-case behavior¶
- The collection is the supported retrieval path; the single-object
GetWorkerHealthIssuepath cannot execute becauseclsWorkerHealthIssue.Criteria.RetrieveSQLthrowsInvalidSQLProperty. - Row persistence is create-or-delete only;
clsWorkerHealthIssue.Criteria.UpdateSQLalso throwsInvalidSQLProperty. - New child initialization sets
WorkerIDto0, so callers must populate the row before save if the worker ID is required downstream. clsWorkerHealthIssue.Criteriaaccepts an exposure code in one constructor but does not assign it to a field, which further limits the single-row retrieval path.
Related documentation¶
Sources¶
Business\SAIF.Business.Claim.Person\clsWorkerHealthIssue.vbBusiness\SAIF.Business.Claim.Person\clsWorkerHealthIssueCollection.vb