Skip to content

ServiceCode

ServiceCode resolves a bill or audited-service's code (procedure/revenue/service code) to its effective description for a specific date of service, implementing the date-scoped lookup behaviour of OP-DOM-08: it prefers a non-expired code over an expired one and then, once a code is found, picks the single CbpServiceDescription whose effective/expiration window covers the service date (DOM-BR-080). BillProcedure, AuditedService, and GenerateCbpBills all construct ServiceCode instances to resolve display descriptions for CBP bill and service records.

Purpose

  • Looks up a service code by code value, type, and service date, preferring a non-expired code over an expired one (DOM-BR-080).
  • Resolves the single description record whose effective/expiration date range covers the service date, so Description always reflects wording that was current when the service occurred.
  • Exposes whether the resolved code is a CPT code, which downstream billing logic uses to decide code-specific formatting/validation.

Context

  • Namespace: SAIF.Domain.Model.Claims.Bills
  • Assembly/package: SAIF.Domain (packaged in SAIF.SAIFCode.Core)

Public members

Member Signature Purpose
ServiceCode (constructor, lookup by code/type/date) public ServiceCode(IServiceCodeQueryProvider provider, string code, string type, DateTime serviceDate) Looks up the CbpServiceCode matching code/type as of serviceDate (DOM-BR-080), then resolves the date-scoped description when a code is found.
ServiceCode (constructor from entity) public ServiceCode(IServiceCodeQueryProvider provider, CbpServiceCode data, DateTime serviceDate) Wraps an already-loaded CbpServiceCode entity and resolves its date-scoped description for serviceDate.
Data public CbpServiceCode Data { get; } Exposes the underlying CbpServiceCode entity.
Code public string Code { get; } The resolved service/procedure code value.
CodeEffectiveDate public DateTime CodeEffectiveDate { get; } The date the resolved code became effective.
Description public string Description { get; } The description text whose effective/expiration window covers the constructor's service date; empty when no matching description was found.
DescriptionEffectiveDate public DateTime? DescriptionEffectiveDate { get; } The effective date of the resolved description record, or null when no description was found.
IsCptCode public bool IsCptCode { get; } true when the code appears in its service type's CPT code list.

Inherited public members

Members in this section are inherited from DomainBase<TItem> in SAIF.Domain. They are available on this type through inheritance (via the intermediate DomainQueryBase<TItem,TQueryProvider> base).

Member Signature Purpose Origin
HasData public virtual bool HasData { get; } Reports whether the wrapped CbpServiceCode entity is present, evaluated as !DataItem.IsNull(). SAIF.Domain — DomainBase<TItem>

Behavioral notes

  • The date-lookup constructor resolves the description only when HasData is true after the code lookup, so a code that could not be found leaves Description and DescriptionEffectiveDate at their empty/null defaults.
  • GetDescription uses SingleOrDefault, so more than one description row with an overlapping effective window for the same service date would throw rather than silently pick one**.

Constraints and usage notes

  • Constructing a ServiceCode by code/type/date issues a query-provider call in the constructor; callers should avoid constructing it repeatedly in a tight loop for the same code*.

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

  • Domain/SAIF.Domain/Model/Claims/Bills/ServiceCode.cs
  • Domain/SAIF.Domain/DomainBase.cs
  • Domain/SAIF.Domain/DomainQueryBase.cs