Skip to content

Maintain provider MCO membership

clsProviderMCOMembership maintains a provider location's enrollment in an MCO plan for a given effective/expiration window, including per-membership admin-fee and specialty rate fields. The membership period must fit inside the parent plan's active dates and cannot expire before an effective service contract for the same plan/location, and every successful save or delete is synchronized to Contact Manager through clsMembershipApi.

Field Value
Operation ID OP-PRV-09
Trigger Caller calls NewProviderMCOMembership/GetProviderMCOMembership, edits properties, and calls Save() or Delete()
Inputs ProviderLocationSeqNum, MCOPlanID, EffDate/ExpDate, NewPatientsFlag, DirectoryFlag, AdminFeeFlag/AdminFeeRate, RatePtOtSt, RateRad, RateWcCtc, RateAsc
Outputs Persisted MCO_PROVIDER row; ContactManager MembershipDto sync
Primary components clsProviderMCOMembership.Create, BeforeInsert/BeforeUpdate/BeforeDelete, ActiveEffDate, BeforeContractExpDate, FillMembershipDto, clsMembershipApi.AddMembership/UpdateMembership/DeleteMembership
Entry point Business\SAIF.Business.Provider\clsProviderMCOMembership.vb

Steps

  1. Create with defaults. Create() defaults NewPatientsFlag, DirectoryFlag, and AdminFeeFlag to "Y", and AdminFeeRate, RatePtOtSt, RateRad, RateWcCtc, RateAsc to 1; assigns a new seq num via GetNextSeqNum("Mco_Provider_SEQ").
  2. Retrieve. Reads MCO_PROVIDER by PROVIDER_LOCATION_SEQ_NUM + MCO_PLAN_ID + EFF_DATE (SQL-054); Fill(...) also captures m_OriginalMCOPlanID/m_OriginalEffDate for use as the update/delete key, since the plan ID and effective date are themselves editable.
  3. Validate before save.
  4. MissingMCOPlanID, MissingEffDate: hard errors requiring the plan and effective date.
  5. BR-016: ActiveEffDate requires the membership's effective/expiration window to fall entirely within clsMCOPlan.GetMCOPlan(...).EffDate/ExpDate (open-ended plan or membership expirations default to Date.MaxValue).
  6. LateExpDate: hard error if ExpDate exceeds Today + 10 years.
  7. BR-017: BeforeContractExpDate — only when the object IsDirty and an ExpDate is set — runs IsServiceContractEffective, a scalar count query against PROVIDER_SERVICE_CONTRACT for the same location/plan whose expiration (NVL(EXP_DATE, '31-Dec-2999')) exceeds the proposed membership expiration; a nonzero count fails the rule.
  8. ValidEffExpDate: hard error if ExpDate precedes EffDate.
  9. BR-018: ValidAdminFeeRate — if AdminFeeFlag is set, requires a nonblank rate no greater than 1.000; if not set, requires the rate to be blank.
  10. ValidRatePtOtSt, ValidRateRad, ValidRateWcCtc, ValidRateAsc: hard errors requiring each specialty rate to be present.
  11. Warning-only checks: EarlyEffDate/EarlyExpDate (dates more than a year in the past), LowAdminFeeRate/LowRatePtOtSt/LowRateRad/LowRateWcCtc/LowRateAsc (rate below .75) — none of these block the save.
  12. Overlapping-membership-period rules exist in source as commented-out code and are not currently enforced.*
  13. Insert. Writes MCO_PLAN_ID, PROVIDER_LOCATION_SEQ_NUM, EFF_DATE/EXP_DATE, NEW_PATIENTS_FLAG, DIRECTORY_FLAG, ADMIN_FEE_RATE/ADMIN_FEE_FLAG, the four specialty rates, MCO_PROVIDER_SEQ_NUM, and audit fields to MCO_PROVIDER (SQL-029).
  14. FillMembershipDto(MCOPlanID) resolves planName via clsProviderUtility.GetPlanNameByid, providerNumber via clsProviderUtility.GetProviderByProviderLocSeqNum, and normalizes mcoMembershipExpDate to Nothing when ExpDate = Date.MinValue.
  15. On success: MarkOld(), then call clsMembershipApi.AddMembership(...) against route provider/{providerLocationSeqNumber}/membership; API exceptions are JSON-logged and surfaced as ApiInsertError.
  16. Update. Writes the same fields to MCO_PROVIDER (SQL-077) with concurrency check WHERE PROVIDER_LOCATION_SEQ_NUM = :ProviderLocationSeqNum AND MCO_PLAN_ID = :OriginalMCOPlanID AND EFF_DATE = :OriginalEffDate AND UPDATE_NUM = :UpdateNum — the row is located by the original plan ID and effective date even though those fields may have just changed.
  17. FillMembershipDto(m_OriginalMCOPlanID) is used for the API call, so the synced planName reflects the original plan while dates reflect the current fields.*
  18. On success: call clsMembershipApi.UpdateMembership(...); API failure is logged and surfaced as ApiUpdateError.
  19. Delete. Deletes from MCO_PROVIDER by ProviderLocationSeqNum + OriginalMCOPlanID + OriginalEffDate (SQL-099) — no UPDATE_NUM check on delete.
  20. The DTO for the API call is built using the original plan ID.
  21. On success: call clsMembershipApi.DeleteMembership(...) against route provider/{providerLocationSeqNumber}/membership/remove; API failure is logged and surfaced as ApiDeleteError.

Process flow

flowchart TD
    Start([Caller edits MCO membership]) --> PlanRange{Period within<br>MCO plan active dates?}
    PlanRange -->|No| Fail([Outside plan's active<br>date range blocks save])
    PlanRange -->|Yes| ContractCheck{Dirty, ExpDate set,<br>effective service contract outlives it?}
    ContractCheck -->|Yes| Fail2([Membership would expire<br>before contract blocks save])
    ContractCheck -->|No| AdminFee{Admin fee flag/rate consistent?}
    AdminFee -->|No| Fail3([Inconsistent admin<br>fee flag/rate blocks save])
    AdminFee -->|Yes| Rates{All specialty rates present?}
    Rates -->|No| Fail4([Broken rules returned])
    Rates -->|Yes| Persist[Insert/update/delete MCO_PROVIDER]
    Persist --> Rows{RowsAffected = 1?}
    Rows -->|No| Contention([Insert Failed / DB contention error])
    Rows -->|Yes| Api[Call clsMembershipApi Add/Update/Delete]
    Api --> Done([Save complete;<br>API failures logged, not blocking])

Failure and edge-case behavior

  • Update and delete locate the row by the original plan ID and effective date, so changing either field mid-edit relies on those original values being preserved correctly in memory; a stale original value would misdirect the SQL.*
  • Delete has no UPDATE_NUM concurrency check, unlike insert/update, so a concurrent modification is not detected on delete.
  • Overlapping-membership-period validation exists in source but is commented out, so a provider location can currently hold overlapping memberships in the same MCO plan.*
  • Warning-only low-rate checks (below .75) never block a save, regardless of how far below the threshold the rate is.

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\clsProviderMCOMembership.vb
  • Business\SAIF.Business.Provider\Api\clsMembershipApi.vb
  • Business\SAIF.Business.Provider\clsMCOPlan.vb
  • Business\SAIF.Business.Provider\clsProviderUtility.vb