SAIF.Domain architecture¶
SAIF.Domain is a domain-logic layer that sits between the contracts library SAIF.Core and the data-access libraries SAIF.Data / SAIF.Data.Guidewire below it, and the application-services library SAIF.Services above it, which is its only production consumer; it wraps NHibernate-mapped entities in domain objects (DomainBase<TItem>, DomainQueryBase<TItem,TQueryProvider>, DomainRepositoryBase<TItem>) and layers electronic-billing (ebilling), claims, audit, certificate-holder, packet-generation and EDI-processing behaviour on top of them, reading and writing exclusively through the framework IRepositoryFactory / IUnitOfWork abstractions and SAIF.Data query-provider interfaces, with no configuration reads, no authorization checks, and no direct transaction control of its own.
Responsibilities¶
- Wrap SAIF.Data entities in domain objects that expose behaviour methods such as
Bill.ModifyStatus,Bill.SendToAudit,Audit.AllowAllServicesandCertificateHolder.Expire. - Assign, index and generate CBP (converted-bill-processing) bills from inbound electronic bills (ebills), including patient, provider and bill-service indexing.
- Parse and build EDI files: inbound 837 claims (
File837Extractor), outbound 835 remittances, 277 claim-acknowledgement responses and 837 acknowledgements. - Generate explanation-of-benefits (EOB) records and their adjustments/remittance advices from Guidewire payment extracts.
- Manage bill audits, audit notes and bill regeneration.
- Manage policy certificate-holder lifecycle (create, update, expire, reinstate, supersede).
- Present a Guidewire-backed
Claimread model that merges legacy WCIS entities with Guidewire ClaimCenter API data viaGuidewireToLegacyMapper. - Generate document packets (
PacketManager,PacketGenerator,PacketDefinition) for policy correspondence.
Component boundaries¶
SAIF.Domain(root namespace):DomainBase<TItem>,DomainQueryBase<TItem,TQueryProvider>,DomainRepositoryBase<TItem>— shared base classes that inject a query provider orIRepositoryFactoryinto concrete domain types.SAIF.Domain.Claims.Ebillingand.Indexing: ebilling lifecycle — bill assignment (BillAssignment), patient/provider/service indexing (PatientIndexer,ProviderIndexer,ProviderIndexerV2,BillServiceIndexer,ProviderMatcher, match rules), CBP bill generation (GenerateCbpBills), EDI file processing (File837Extractor,File835Builder,File277CaBuilder,File837AckBuilder,EdiBuildSegments), EOB generation (EobBuilder), and service-code resolution (ServiceCodeManager).SAIF.Domain.Model.Claims.Billsand.Audits/.Notes: bill behaviours (Bill), audits (Audit,AuditedService), audit notes (AuditNote), and bill regeneration (BillRegenerator, inClaims/Bills/).SAIF.Domain.Model.Claims: the Guidewire-backedClaimread model,ClaimAdjuster,ClaimReserveGenerator,SecureClaimAttributesandWorker.SAIF.Domain.Model.Policies(.Certificates):PolicyandCertificateHolderlifecycle management.SAIF.Domain.Tasks.Documents.Packets:PacketManager,PacketGenerator,PacketDefinition,PacketRequestfor document-packet assembly.SAIF.Domain.Mappers(internal):GuidewireToLegacyMapper, used by theClaimstatic constructor to configure AutoMapper maps.SAIF.Domain.Model.Employees/.Imaging:Employee(delegates to SAIF.Framework.CoreIUserProfileService) andImage.
Interaction model¶
- SAIF.Services is the sole production consumer and owns transaction boundaries: it calls into SAIF.Domain types and is responsible for
IUnitOfWork.Begin/Commitaround them. - Domain wrapper types (
DomainBase<T>subclasses) receive query providers orIRepositoryFactorythrough constructor injection and read/write SAIF.Data entities viaGetRepository<T>().Add/Delete/Query(). - Claim-centric operations delegate to SAIF.Data.Guidewire's
ICCClaimApiService,IClaimDataApiClientandIMedicalBillingApiServicefor ClaimCenter data (contacts, MCO, conditions, financials, payment extracts) rather than reading claim data from the local database. - Provider-location matching uses a strategy/rule-set pattern:
ProviderIndexerV2builds candidate address lists, selects an ordered set ofIProviderMatchRuleimplementations, andProviderMatcherreturns the first unique match. - Inbound 837 files are parsed by a segment state machine in
File837Extractor, which has static mutable state and is therefore not safe for concurrent use*.
Architecture diagram¶
The following diagram shows high-level component interactions.
flowchart TD
Services["SAIF.Services<br>application services (only production consumer)"] --> Domain["SAIF.Domain<br>domain-logic layer"]
Domain --> Core["SAIF.Core<br>contracts (SAIF.SAIFCode.Core)"]
Domain --> Data["SAIF.Data<br>entities and query providers"]
Domain --> Guidewire["SAIF.Data.Guidewire<br>ClaimCenter API clients"]
Domain --> Framework["SAIF.Framework.Core / .Common<br>IRepositoryFactory, IUnitOfWork"]
Data --> NHibernate["SAIF.Data.NHibernate<br>ClassMaps (Oracle*)"]
Sequence diagram¶
The following diagram shows the primary request/response sequence for bill assignment (OP-DOM-01).
sequenceDiagram
participant Client as SAIF.Services
participant Service as BillAssignment (SAIF.Domain)
participant Dependency as ICCClaimApiService (SAIF.Data.Guidewire)
Client->>Service: AssignBillsResponsibily(ebill)
Service->>Dependency: GetClaim(claimNumber)
Dependency-->>Service: Claim data (contacts, MCO, conditions)
Service-->>Client: Ebill status set to Assigned
Design constraints¶
- No configuration reads: a scan found no
ConfigurationManager,IEnvironmentService,DbConnectionManager,AppSettingsorGetConfigSettingusage; hard-coded values that behave like configuration (thresholds 20000 and 900, responsible party "SYSTEM", packet definitions PKT001–PKT038, Vignette IFN constants) are treated as business rules instead. - No authorization checks: there are no
IsAuthorizedcalls or authorization attributes in this library;Claim.BuildSecurityAttributesonly computesSecureClaimAttributes(IsConflictClaim,IsSecureClaim) for consumers such as SAIF.ServicesClaimSecurityServiceto evaluate. - No transaction control: callers in SAIF.Services own
IUnitOfWork.Begin/Commit; SAIF.Domain never begins or commits a unit of work itself. File837Extractoruses static mutable state, so batch jobs that process files concurrently could corrupt each other*.- No raw SQL, stored procedures or ADO.NET; all persistence goes through NHibernate ORM operations mediated by
IRepositoryFactory/IUnitOfWork, with SQL generated at runtime from ClassMaps inSAIF.Data.NHibernate. See Database tables and the SQL catalog for the full 33-operation catalog. - The database is inferred to be Oracle* (from the 900-row IN-list chunking comment in
EobBuilderand from SAIF.Data entity mappings); no connection strings are held in this library.
Related documentation¶
- Index
- Overview
- Dependencies
- Operations and processes
- Business rules
- Database tables
- SQL catalog
- API reference
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/SAIF.Domain.csprojDomain/SAIF.Domain/DomainBase.cs,DomainQueryBase.cs,DomainRepositoryBase.csDomain/SAIF.Domain/Claims/Ebilling/BillAssignment.cs,GenerateCBPBills.cs,File837Extractor.cs,File835Builder.cs,File277CaBuilder.cs,File837AckBuilder.cs,EdiBuildSegments.cs,EobBuilder.cs,ServiceCodeManager.csDomain/SAIF.Domain/Claims/Ebilling/Indexing/*.csDomain/SAIF.Domain/Claims/Bills/BillRegenerator.csDomain/SAIF.Domain/Model/Claims/Bills/Bill.cs,Model/Claims/Bills/Audits/Audit.cs,Model/Claims/Bills/Notes/AuditNote.csDomain/SAIF.Domain/Model/Claims/Claim.cs,ClaimReserveGenerator.cs,SecureClaimAttributes.cs,Worker.csDomain/SAIF.Domain/Model/Policies/Certificates/CertificateHolder.cs,Model/Policies/Policy.csDomain/SAIF.Domain/Mappers/GuidewireToLegacyMapper.csDomain/SAIF.Domain/Tasks/Documents/Packets/PacketManager.cs,PacketGenerator.cs,PacketDefinition.csCore/SAIF.Core/SAIF.SAIFCode.Core.nuspecData/SAIF.Data.NHibernate/Mappings/Claims/Bills/CbpBillMap.cs