---
title: WorkerNodeBuilder
summary: API reference for WorkerNodeBuilder.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# WorkerNodeBuilder

Builds a `WorkerNode` from a `Worker` domain object (and the owning `Claim`), populating personal data (age, birth/death dates, gender description derived from a raw M/F code, masked SSN), health insurance provider (from the claim), other-claims count, language/contact preferences, and a full contact record (email, address via `Worker.BuildWorkerAddress`, home and message phone numbers).

## Purpose
- Populates worker identity and demographic fields, deriving a `Gender` description ("Male"/"Female"/"Unknown") from the worker's raw gender code and masking the SSN to only the last four digits.
- Copies the claim's health insurance provider name onto the worker node.
- Reports the worker's total other-claims count.
- Resolves language preference and preferred contact method descriptions/codes, defaulting to empty strings when unset.
- Builds the worker's contact record (email, address, name, home and message phone numbers) for display.

## Context
- Namespace: `SAIF.Services.Claims.Information.Api`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Node | `public WorkerNode Node { get; }` | Exposes the node instance being populated by this builder. |
| WorkerNodeBuilder(worker, claim, node) | `public WorkerNodeBuilder(Worker worker, Claim claim, WorkerNode node)` | Stores the worker, claim, and target node for later population. |
| AddPersonalData() | `public WorkerNodeBuilder AddPersonalData()` | Sets `WorkerId`, `Age`, `BirthDate`, `DeathDate`, a derived `Gender` description from the raw gender code, and a masked `WorkerSsn` (format `***-**-####`) when worker data exists. |
| AddHealthInsurance() | `public WorkerNodeBuilder AddHealthInsurance()` | Sets `HealthInsuranceProvider` from the claim's health insurance provider name when the claim has data. |
| AddClaimSpecifics() | `public WorkerNodeBuilder AddClaimSpecifics()` | Sets `OtherClaims` to the worker's total claim count when worker data exists. |
| AddPreferences() | `public WorkerNodeBuilder AddPreferences()` | Sets `LanguagePreference`/`LanguagePreferenceCode` (empty strings if unset) and `PreferredContactMethod` (null if unset) from worker data. |
| AddContact() | `public WorkerNodeBuilder AddContact()` | Builds and sets `Contact` with email, address, name, formatted name, and home/message phone numbers, when worker data exists. |

## Behavioral notes
- `AddPersonalData()` includes a commented-out earlier gender-description approach, replaced by an inline `GenderCode` object construction that maps "M"/"F"/other to "Male"/"Female"/"Unknown".*
- SSN masking assumes the tax ID string is at least 11 characters (it slices `Substring(7, 4)`), so malformed/short tax IDs would throw at runtime.*

## Constraints and usage notes
- All `Add*` methods no-op (return `this` unchanged) when the relevant `Worker`/`Claim` object has no data, so callers relying on default node values must handle the all-empty case explicitly.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- Services/SAIF.Services/Claims/Information/Api/WorkerNodeBuilder.cs
