---
title: "SOIL (State of Oregon Intercept) processing"
summary: Operation implemented by CollectionsRepository
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data.NHibernate
reference_type: package
operation_id: "OP-SDN-06"
trigger: "See steps below"
---


# SOIL (State of Oregon Intercept) processing

SOIL (State of Oregon Intercept) processing is implemented by `CollectionsRepository` and is documented as OP-SDN-06 in the Stage 1 analysis.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-SDN-06 |
| **Trigger** | See steps below |
| **Primary components** | `CollectionsRepository` |

## Steps

1. `GetWorkerIdForDebtors()`: [SQL-019](../sql/SQL-019-collections-repository-get-worker-id-for-debtors.md).
   - Selects distinct worker ids from `legal_collection_debtor` joined to `legal_collection`.
   - Filter: balance ≥ 0, `INCLUDE_ON_SOIL_FLAG='Y'`, no third party, and worker_id not null.
   - Rule: [SDN-BR-011](../business-rules.md#sdn-br-011-soil-debtor-eligibility%3A-balance-%E2%89%A5-0%2C-include-on-soil-flag-'y'%2C-no-third-party%2C-worker-id-present).
2. `CreateSoilDebtorReferenceRecords(runDate, uniqueRunId)`: `call WCIS_DBA.PK80011_LEGALCOL_SOIL.CREATE_REFERENCE_RECORDS`, write, [SQL-002](../sql/SQL-002-collections-repository-create-soil-debtor-reference-records.md).
3. `GetWorkerIdForSoilTrans(createDate)`: [SQL-020](../sql/SQL-020-collections-repository-get-worker-id-for-soil-trans.md).
   - Tables: `soil_debtor_reference`, `legal_collection` and `legal_collection_debtor`.
   - Filter: `TRUNC(create_date) = :input`.
   - Rule: [SDN-BR-012](../business-rules.md#sdn-br-012-soil-transactions-are-selected-by-the-truncated-create-date).
4. `CreateSoilAdjustmentRecords(runDate, uniqueRunId)`: `call WCIS_DBA.PK80011_LEGALCOL_SOIL.CREATE_SOIL_TRANSACTIONS`, write, [SQL-003](../sql/SQL-003-collections-repository-create-soil-adjustment-records.md).

"SOIL" is inferred from the package name `LEGALCOL_SOIL`. The expansion is not verified; see Open questions.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SOIL (State of Oregon Intercept) processing"]) --> S1["`CollectionsRepository`"]
	S1 --> S2{"Rules satisfied?"}
	S2 -->|Yes| EndOk([Result returned])
	S2 -->|No| EndErr([Exception / empty result])
```

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `Data/SAIF.Data.NHibernate/Repositories/CollectionsRepository.cs`
