Audit service and adjustment retrieval¶
This operation covers the parent-child pair of clsAuditServiceCollection/clsAuditService and clsServiceAdjustmentCollection/clsServiceAdjustment, both retrieved through the same PK82396_MEDICAL_BILLS package. Audit services are the individual billed service lines that were audited for a bill; each audited service line can carry zero or more adjustments explaining how its allowed amount was derived. Because a service's adjustments cannot be understood without the audited-service context that produced them, and because both are read-only stored-procedure retrievals scoped to the same bill, they are documented together.
| Field | Value |
|---|---|
| Operation ID | OP-MB-03 |
| Trigger | clsMedicalBill.AuditServices (lazy read, unless SuppressAuditDetail is set); clsAuditService.ServiceAdjustments (lazy read per service) |
| Inputs | BillID (audit services); AuditSeqNum and BillID (service adjustments) |
| Outputs | Populated clsAuditServiceCollection of clsAuditService items, each with charge/allowed/MCO-admin-fee amounts and an IsIMEService flag; populated clsServiceAdjustmentCollection of clsServiceAdjustment items per service, each resolving its adjustment code description |
| Primary components | clsAuditServiceCollection.GetAuditServices, clsAuditServiceCollection.BeforeRetrieve, clsAuditService.ServiceAdjustments, clsAuditService.IsIMEService, clsServiceAdjustmentCollection.GetServiceAdjustments, clsServiceAdjustmentCollection.BeforeRetrieve, clsServiceAdjustment.AdjustmentCodeObject |
| Entry point | Business\SAIF.Business.Claim.MedicalBill\clsAuditServiceCollection.vb, Business\SAIF.Business.Claim.MedicalBill\clsServiceAdjustmentCollection.vb |
Steps¶
- Lazy trigger from the parent bill. Reading
clsMedicalBill.AuditServicesretrieves the collection only on first access and only whenSuppressAuditDetailis false (BR-MB-020); the result is cached on the bill instance for subsequent reads. - Retrieve audited services.
clsAuditServiceCollection.GetAuditServices(dpi, billID)callsPK82396_MEDICAL_BILLS.GetAuditServices(SQL-006, CBP_AUDITED_SERVICE, CBP_SERVICE_DESCRIPTION, CBP_NATIONAL_DRUG) and loads oneclsAuditServiceper returned row viaFill/Load. - Service description resolution prefers the bill-specific service description text and falls back to the national-drug generic name for drug-coded services, both joined with effective-date filtering (BR-PROC-002).
- Derive the IME flag.
clsAuditService.IsIMEServicereturns true when the resolvedServiceDescriptionstarts with"IME"; this is a computed convenience property, not separately persisted. - Lazy trigger for adjustments. Reading
clsAuditService.ServiceAdjustmentsretrieves the child collection only on first access, using the service's ownAuditSeqNumandBillID. - Retrieve service adjustments.
clsServiceAdjustmentCollection.GetServiceAdjustments(dpi, auditSeqNum, billID)callsPK82396_MEDICAL_BILLS.GetServiceAdjustments(SQL-013, CBP_AUDITED_SERVICE_ADJUSTMENT) and loads oneclsServiceAdjustmentper returned row. - Adjustments are returned in a fixed sort order — code
FTfirst, codePAlast, all other codes in between — enforced by aCASEexpression in the procedure query (BR-PROC-001). - Resolve the adjustment's descriptive code (lazy). Reading
clsServiceAdjustment.AdjustmentCodeObjectlazily resolves the adjustment's code description by delegating to the Adjustment code lookup operation, using the rawAdjustmentCodevalue stored on the adjustment row;AdjustmentCodeitself is a pass-through ofAdjustmentCodeObject.Code. - Aggregate totals on the parent bill.
clsMedicalBill.TotalAdjustmentAmtsumsAdjustmentAmountacross every service and every adjustment (whenSuppressAuditDetailis false), andclsAuditService.PaidAmtcomputesAllowedAmt - McoAdminFeeper service line.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Bill.AuditServices read]) --> Suppress{SuppressAuditDetail?}
Suppress -->|Yes| Skip([Returns Nothing;<br>no retrieval issued])
Suppress -->|No| Retrieve[GetAuditServices via<br>PK82396_MEDICAL_BILLS]
Retrieve --> Services[Populate clsAuditService items<br>with resolved descriptions]
Services --> IME[Compute IsIMEService per item]
IME --> AdjTrigger{ServiceAdjustments read?}
AdjTrigger -->|Yes| AdjRetrieve[GetServiceAdjustments via<br>PK82396_MEDICAL_BILLS, sorted FT/others/PA]
AdjTrigger -->|No| Done
AdjRetrieve --> CodeLookup[Resolve AdjustmentCodeObject<br>per adjustment]
CodeLookup --> Done([Aggregate totals available<br>on parent bill])
Failure and edge-case behavior¶
- Both collections are read-only stored-procedure retrievals; there is no persist/save path on either object.
AuditServicesandServiceAdjustmentsare each cached after first load, so subsequent reads within the same object lifetime do not re-issue the retrieval even if underlying data changes.- Bulk-print suppression (
SuppressAuditDetail) silently skips this entire operation for affected bills rather than raising an error, which can make aggregate totals across a suppressed collection understate actual adjustments.
Related documentation¶
Sources¶
Business\SAIF.Business.Claim.MedicalBill\clsAuditServiceCollection.vbBusiness\SAIF.Business.Claim.MedicalBill\clsAuditService.vbBusiness\SAIF.Business.Claim.MedicalBill\clsServiceAdjustmentCollection.vbBusiness\SAIF.Business.Claim.MedicalBill\clsServiceAdjustment.vb