National drug validation¶
National drug validation retrieves the master reference record for a national drug code (NDC) — product, generic, manufacturer, and dosage attributes — together with its price history, and enforces that the code resolves to a real record before the object is considered valid. It is a read-only reference lookup used elsewhere in bill and service auditing to confirm drug-related charges against known NDC data.
| Field | Value |
|---|---|
| Operation ID | OP-CB-05 |
| Trigger | Caller calls clsNationalDrug.GetNationalDrug(inDataportal, inNationalDrugCode) to load a drug record |
| Inputs | NationalDrugCode |
| Outputs | Populated clsNationalDrug with product/generic/manufacturer/dosage fields and a PriceList of clsNationalDrugPrice entries; broken rule if the code does not resolve |
| Primary components | clsNationalDrug.GetNationalDrug, clsNationalDrug.BeforeRetrieve/AfterRetrieve, clsNationalDrug.Fill, clsNationalDrug.AddBusinessRules/ValidateCode |
| Entry point | Business\SAIF.Business.Claim.Bill\AuditSupport\Services\clsNationalDrug.vb |
Steps¶
- Dispatch the retrieve.
GetNationalDrug(inDataportal, inNationalDrugCode)builds aCriteria(...)and callsDataAccessLayer.RetrieveObject, which the BOF data portal routes toBeforeRetrieve/AfterRetrieve. - Build the primary select.
BeforeRetrievesets the request type toResultSet, assignsMyCriteria.RetrieveSQL, and binds theNationalDrugCodeparameter againstCBP_NATIONAL_DRUG. - Hydrate the object (
AfterRetrieve/Fill). If the result set has at least one row,Fill(Result(0))maps roughly twenty-five columns onto the object — product name, generic code/name, manufacturer name, therapy class, dose form, package size/unit/quantity, DESI code, and disallow-record code — thenMarkOld()runs. - Mark the record valid and load price history. Inside
Fill, ifNationalDrugCode.Trim.Length > 0after mapping,m_Valid = Trueis set and the price history is loaded by a separate query againstcbp_national_drug_pricefiltered bynational_drug_code(SQL-016, CBP_NATIONAL_DRUG_PRICE); aclsNationalDrugPrice(effectiveDate, expirationDate, amount)is created per row and added toPriceList. - If no row was returned by the primary select:
Fillis never called, som_ValidremainsFalseandPriceListstays empty. - Enforce the resolution rule.
AddBusinessRules()registersValidateCodeagainstNationalDrugCode. - On failure (the code did not resolve to a valid record): add the formatted message
"Error: Information not found for <{0}>", substitutingMyCriteria.NationalDrugCode(BR-003). - Resolve the current or as-of price.
PriceList.PriceandPriceList.Price(inDate)return the latestclsNationalDrugPricein effect — filtering to entries whereIsInEffectis true, ordering descending by effective date, and taking the first result. - Expose expiration and effect-date helpers. Each
clsNationalDrugPriceexposesHasExpirationDate,IsExpired,IsActive, andIsInEffect(inDate)so callers can reason about which price applies without re-querying the database. The parentclsNationalDrugobject exposes the equivalentHasExpirationDate/IsExpired/IsActive/IsInEffect(inDate)for the drug record itself.
Process flow¶
The following diagram visualizes retrieval, validation, and price-history loading for a national drug code.
flowchart TD
Start([Caller retrieves NDC<br>via GetNationalDrug]) --> Select[Select CBP_NATIONAL_DRUG<br>by NationalDrugCode]
Select --> Found{Row found?}
Found -->|No| Invalid([m_Valid stays False;<br>PriceList empty])
Found -->|Yes| Fill[Fill fields; set m_Valid = True]
Fill --> Prices[Load cbp_national_drug_price<br>rows into PriceList]
Prices --> Rule{ValidateCode passes?}
Invalid --> Rule
Rule -->|No| BrokenRule([Broken rule:<br>Information not found])
Rule -->|Yes| Ready([Drug record ready;<br>Price / Price(date) available])
Failure and edge-case behavior¶
- A national drug code with no matching
CBP_NATIONAL_DRUGrow produces a fully-default object withm_Valid = Falserather than a distinct "not found" retrieval error; the caller only learns of the failure whenIsValid()/ValidateCoderuns (BR-003). PriceList.PriceandPriceList.Price(inDate)returnNothing/default when no price entry is currently in effect, which callers must handle before using the amount.*- The price-history load is a second, separate query executed only when the primary drug row was found, so a drug record retrieved without a match never issues the price query at all.
Related documentation¶
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.Bill\AuditSupport\Services\clsNationalDrug.vbBusiness\SAIF.Business.Claim.Bill\AuditSupport\Services\clsNationalDrugPrice.vb