Maintain provider identity¶
clsProviderIdentity maintains alternate provider identifiers (for example, National Provider IDs) keyed by ProviderIdentitySeqNum. Every successful insert, update, or delete attempts a follow-up call to clsIdentifierApi to keep Contact Manager's identifier list in sync.
| Field | Value |
|---|---|
| Operation ID | OP-PRV-06 |
| Trigger | Caller calls NewProviderIdentity/GetProviderIdentity, edits properties, and calls Save() or Delete() |
| Inputs | ProviderLocationSeqNum, ProviderIdentityCode, IdentityValue, IdentityName |
| Outputs | Persisted PROVIDER_IDENTITY row; Contact Manager IdentifierDto sync |
| Primary components | clsProviderIdentity.Create, BeforeInsert/BeforeUpdate/BeforeDelete, FillIdentifier, clsIdentifierApi.AddIdentifier/UpdateIdentifier/RemoveIdentifier |
| Entry point | Business\SAIF.Business.Provider\clsProviderIdentity.vb |
Steps¶
- Create.
Create()assigns a new seq num viaGetNextSeqNum("PROVIDER_IDENTITY_SEQ")and stamps the acting user. - Retrieve.
BeforeRetrieve/AfterRetrieveread PROVIDER_IDENTITY byPROVIDER_IDENTITY_SEQ_NUM(SQL-048). - Validate before save.
ValidType: hard error requiring a nonblankProviderIdentityCode("Error: Identifier type is missing.").MissingValue: hard error requiring a nonblankIdentityValue("Error: Identifier value is missing.").- BR-010:
ValidValue— only whenProviderIdentityCodeisNPIorONPI— requires the trimmedIdentityValueto be exactly 10 characters ("Error: National Provider ID must be 10 digits in length."). - Insert.
BeforeInsertwritesPROVIDER_IDENTITY_SEQ_NUM,PROVIDER_LOCATION_SEQ_NUM,PROVIDER_IDENTITY_CODE,IDENTITY_VALUE(uppercased before persistence),IDENTITY_NAME, and audit fields to PROVIDER_IDENTITY (SQL-024). FillIdentifier()buildsIdentifierDto:officialIDType = ProviderIdentityCode,officialIDValue = IdentityValue.ToUpper,offcialIDSeqNumber = ProviderIdentitySeqNum.ToString,providerNumber = clsProviderUtility.GetProviderByProviderLocSeqNum(...).- On a rows-affected value other than
1: add"Insert Failed". - On success:
MarkOld(), then callclsIdentifierApi.AddIdentifier(...)against routeprovider/{providerlocationseqnumber}/identifier.- On API exception: serialize
IdentifierDtoto JSON, log viaLogging.clsLogError.CreateError(...), and addApiInsertError— the database insert is not rolled back.*
- On API exception: serialize
- Update.
BeforeUpdatewrites the same fields (uppercasingIdentityValueagain) to PROVIDER_IDENTITY (SQL-072) with concurrency checkWHERE PROVIDER_IDENTITY_SEQ_NUM = :ProviderIdentitySeqNum AND UPDATE_NUM = :UpdateNum. - On success:
MarkOld(), then callclsIdentifierApi.UpdateIdentifier(...)against routeprovider/{providerlocationseqnumber}/identifier; API failure is logged and surfaced asApiUpdateError. - Delete.
BeforeDeletedeletes the PROVIDER_IDENTITY row byPROVIDER_IDENTITY_SEQ_NUM(SQL-094);FillIdentifier()is rebuilt before the delete call so the DTO reflects the record being removed. - On success:
MarkNew(), then callclsIdentifierApi.RemoveIdentifier(...)against routeprovider/{providerlocationseqnumber}/identifier/remove; API failure is logged and surfaced asApiDeleteError.
Process flow¶
flowchart TD
Start([Caller edits identity]) --> TypeVal{Type and value present?}
TypeVal -->|No| Fail([Broken rules returned])
TypeVal -->|Yes| NpiCheck{Code is NPI or ONPI?}
NpiCheck -->|Yes, not 10 chars| Fail
NpiCheck -->|Valid or not applicable| Persist[Insert/update/delete PROVIDER_IDENTITY]
Persist --> Rows{RowsAffected = 1?}
Rows -->|No| Contention([Insert Failed / DB contention error])
Rows -->|Yes| Api[Call clsIdentifierApi Add/Update/Remove]
Api --> ApiOk{API call succeeds?}
ApiOk -->|Yes| Done([Save complete; Contact Manager synced])
ApiOk -->|No| Logged([Error logged and surfaced;<br>DB change already committed])
Failure and edge-case behavior¶
- API synchronization failures are logged and surfaced as an error message, but the database change is never rolled back, so the identity record can become out of sync with Contact Manager.*
- The NPI/ONPI length rule only fires for those two specific code values; other identity types accept any nonblank value.
- Identity values are always uppercased before both database and API persistence, so lookups by value should assume uppercase.
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.Provider\clsProviderIdentity.vbBusiness\SAIF.Business.Provider\Api\clsIdentifierApi.vbBusiness\SAIF.Business.Provider\clsProviderUtility.vb