---
title: Pharmacy report retrieval
summary: Extracts full, change-only, and first-fill pharmacy eligibility report sets for downstream transmission to the pharmacy benefit manager.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.Claim.Entry
reference_type: package
operation_id: OP-CE-10
trigger: Caller calls GetEligibilityReports, GetEligibilityFFReports, or GetFirstFillEligibilityReports
---

# Pharmacy report retrieval

Pharmacy eligibility data must periodically be extracted and sent to the pharmacy benefit manager (MedImpact) so pharmacies can verify a worker's eligibility at the point of sale. Three related extraction modes exist: a full snapshot, a change-only (delta) extract for routine transmission, and a first-fill (FF) extract that identifies claims ready for a first pharmacy pickup.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CE-10 |
| **Trigger** | Caller calls `GetEligibilityReports` (full/delta) or `GetEligibilityFFReports` / `GetFirstFillEligibilityReports` (first-fill) |
| **Inputs** | A full/delta extraction flag |
| **Outputs** | A sorted collection of pharmacy eligibility report entries for transmission |
| **Primary components** | `clsPharmacyEligibilityReportCollection.GetEligibilityReports`, `GetEligibilityFFReports`, `GetFirstFillEligibilityReports` |
| **Entry point** | `Business\SAIF.Business.Claim.Entry\clsPharmacyEligibility.vb` |

## Steps

1. **Full extract path** ([BR-CE-016](../business-rules.md#br-ce-016-full-pharmacy-eligibility-extract-excludes-inactive-records)). `GetEligibilityReports` called with the full-extract flag selects every eligibility report row except those whose status is inactive, via an inline query not catalogued in the SQL index.*
2. **Change-only (delta) extract path** ([BR-CE-017](../business-rules.md#br-ce-017-change-only-pharmacy-eligibility-extract-requires-an-untransmitted-or-changed-row)). `GetEligibilityReports` called with the delta flag instead selects only rows that have never been transmitted, or whose update date is later than their last transmit date, via a separate inline query not catalogued in the SQL index.*
3. **First-fill (FF) extract path** ([BR-CE-018](../business-rules.md#br-ce-018-first-fill-ff-eligibility-extract-remaps-inactive-status-to-outbound-code-1)). `GetEligibilityFFReports` selects rows for FF transmission and remaps an inactive eligibility status to the outbound code `'1'` before returning it, so the pharmacy-facing status code does not simply mirror the internal status column.
4. **First-fill pickup eligibility check** ([BR-CE-019](../business-rules.md#br-ce-019-first-fill-eligibility-pickup-requires-a-related-document-no-medimpact-transmit-and-a-two-minute-aging-delay)). `GetFirstFillEligibilityReports` further restricts the FF set to rows that: have a related Online 801 document on file, have not yet been transmitted to MedImpact for first fill, and have aged at least two minutes since their last update — the aging delay guards against transmitting a report before all of its related same-transaction updates have committed.*
5. **Sort and return the resulting collection** in each path for the caller to iterate over and transmit.

## Process flow

```mermaid
flowchart TD
	Start([Caller requests<br>pharmacy eligibility extract]) --> Mode{Which extract?}
	Mode -->|Full| Full[Select all rows<br>excluding inactive]
	Mode -->|Delta| Delta[Select untransmitted or<br>changed-since-transmit rows]
	Mode -->|First fill| FF[Select FF rows;<br>remap inactive status to '1']
	FF --> Pickup{Related document exists,<br>not yet MedImpact-transmitted,<br>aged 2+ minutes?}
	Pickup -->|Yes| Include[Include in first-fill<br>pickup set]
	Pickup -->|No| Exclude[Exclude from result]
	Full --> Sort[Sort collection]
	Delta --> Sort
	Include --> Sort
	Exclude --> Sort
	Sort --> Return([Return report collection])
```

## Failure and edge-case behavior

- None of the four extract queries (full, delta, FF, first-fill-pickup) are catalogued in the library's SQL index; they are inline queries embedded directly in `clsPharmacyEligibility.vb` and are described here from source rather than linked to a `SQL-NNN` catalog entry.*
- The two-minute aging delay in step 4 is a fixed value in code rather than configurable, so it applies uniformly regardless of transaction volume or system load.*
- Because the underlying `UpdateNum`/update-date tracking in [Pharmacy eligibility CRUD](pharmacy-eligibility-crud.md) has a confirmed double-increment defect, any downstream logic that relies on `UpdateNum` (rather than the update-date comparison used here) to detect changes could be affected by that defect; the delta extract documented here relies on the update-date column, not `UpdateNum`, so it is not directly affected.*

## Related documentation

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

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources

- `Business\SAIF.Business.Claim.Entry\clsPharmacyEligibility.vb`
