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

# ClaimTaskGenerationService

Implements `IClaimTaskGenerationService`, a scheduled/batch process that scans open injury claims missing a tax ID and creates "request tax ID" claim activities (tasks) at 30-day and 60-day age thresholds. It depends on `IUnitOfWork` for the transaction boundary, `IClaimInformationService` to find claims missing a tax ID, `IClaimContactService` to resolve the responsible adjuster, `ITaskService` to check for existing tasks and create new ones, `IEnvironmentService` to read configured lookback days and task text, and `IWorkCalendarService` to compute the next valid work day for the new task's due date.

## Purpose
- Identifies injury claims that are missing a tax ID within a configurable lookback window and are not void, fatal, inmate, or in-progress.
- Creates a 30-day "request tax ID" activity for a claim once it reaches 30 days old and does not already have one.
- Creates a follow-up 60-day "request tax ID" activity once a claim reaches 60 days old and already has the 30-day task but not a 60-day one.
- Enforces a hard cutoff so claims received on or before 2021-01-03 are never processed, regardless of configured lookback.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ClaimTaskGenerationService(...) | `public ClaimTaskGenerationService(IUnitOfWork oracleUOW, IClaimContactService claimContactService, ITaskService taskService, IClaimInformationService claimInformationService, IEnvironmentService environmentService, IWorkCalendarService workCalendarService)` | Validates that none of the six collaborators are null (via `Enforce.ArgumentNotNull`) and stores them for use by `CreateClaimActivities`. |
| CreateClaimActivities | `public void CreateClaimActivities(DateTime processDate)` | Opens a unit-of-work transaction, runs the missing-tax-ID activity generation logic for `processDate`, and commits the transaction. |

## Behavioral notes
- `CreateClaimActivities` wraps the entire run in a single `_oracleUnitOfWork.Begin()`/`Commit()` pair with no explicit rollback on exception, so a failure partway through leaves the transaction uncommitted rather than explicitly rolled back*.
- The lookback window is clamped so it never processes claims received on or before 2021-01-03, via a fixed `lookbackLimit` date comparison.
- Skips claims that are void, fatal (by death date or fatal claim type), inmate-jurisdiction, or still in-progress before generating any activity.
- Uses `_taskService.GetTasks` with `IncludeDeleted = true` to detect whether the 30-day or 60-day task already exists (including completed/deleted ones), preventing duplicate activity creation.
- Reads task text and the lookback-day count from environment configuration keys (`manage_claim_activity.missing_tax_id_lookback_days`, `manage_claim_activity.request_tax_id_30`, `manage_claim_activity.request_tax_id_60`) and skips activity creation entirely if the corresponding text is empty.
- New activities are created via `ITaskService.CreateTaskStateless` in batch-commit mode, due on the next work day per `IWorkCalendarService.NextWorkDay`; failures (`id <= 0`) are only written to `Debug` output — there is no active logging call (a `TODO` and commented-out logging block remain in the source).

> **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/Tasks/ClaimTaskGenerationService.cs
