Parameters

Most of the signatures have an input parameter that represents the rule, check or regime that invoked the dynamic logic. These are passed along as input parameters so that the (dynamic) fields on these checks, rules and regimes can be used as parameters for the dynamic logic. To clarify the purpose and use, consider the following example on a parametrized authorization regime.

Suppose that the Authorization regime dynamic logic function allows some slack in the period. Depending on the regime, that slack might be 3, 4 or 10 days. Without parametrization, one would have to make 3 different functions, i.e., one for each variant. By parametrizing the authorization regime, a single dynamic logic function suffices.

The authorization regime signature:

In or Out Name Type Description

In

claimLine

ClaimLine

The claim line being processed

In

authorizationList

List of authorizations

All authorizations for the claim line person or object

In

authorizationRegime

AuthorizationRegime

The authorization regime being evaluated. Can be used to parametrize the dynamic logic.

Out

n/a

List of Authorizations

The list of authorizations that meets the conditions of the function.

The authorization regime is extend with three dynamic fields:

Fields Description

dateMatching

Possible values: "Exact", "Overlap" or "Within X days"

withinDays

The number of slack days applied for "Within X days" matching.

diagnosisDigits

The number of digits for which the primary diagnosis of the claim line has to match with the diagnosis of the authorization.

Using these parameters the dynamic logic to match the claim lines to the authorizations could be done as specified below

def matchedAuthorizations = []
def primaryDiagnosis = claimLine.getPrimaryDiagnosis()
if (primaryDiagnosis == null) {
  //no primary diagnosis found, cannot find matching authorizations
  return null;
}

for (authorization in authorizationsList) {
  if (authorizationCodeMatch(authorization.authorizationDiagnosisList, primaryDiagnosis, authorizationRegime.diagnosisDigits))
  and (specialtyMatch(authorization, claimLine))
  and (providerMatch(authorization, claimLine))
  and (procedureMatch(authorization.authorizationProcedureList, claimLine.procedure))
  and (dateMatch(authorizationRegime.dateMatching, claimLine.startDate, claimLine.endDate, authorization, authorizationRegime.withinDays))
  and (authorization.locationProvider == claimLine.locationProvider) {
    matchedAuthorizations << authorization
  }
}
return matchedAuthorizations

// Do the first three characters of the primary diagnosis code of the claim line match with the first three
// characters of one of the authorization diagnoses?

def authCodeMatch(authorizationDiagnosisList, primaryDiagnosis, noOfDigits) {
  for (authDiagnosis in authorizationDiagnosisList) {
    if (authDiagnosis.code[0..noOfDigits] == primaryDiagnosisCodeSubstring[0..noOfDigits] ) return true
  }
  return false
}

def specialtyMatch(authorization, claimLine) {
  return claimLine.servicingProvider.hasSpecialty(authorization.serviceSpecialty)}

def providerMatch(auth, claimLine) {
  if (auth.servicingProvider && claimLine.servicingProvider) {
    return auth.servicingProvider.affiliatedToSameOrganisationProvider(claimLine.servicingProvider)
  } else {
    return true
  }
  return false
}

def procedureMatch(authorizationProceduresList, procedure) {
  for (authProcedure in authorizationProceduresList) {
    if (authProcedure.procedure == procedure) return true
  }
  return false
}

def dateMatch (dateMatching, startDate, endDate, authorization, noOfDays) {
 if (dateMatching == "Exact")
  { return ((startDate >= authorization.startDate && startDate <= authorization.endDate)
           && (endDate >= authorization.startDate && endDate <= authorization.endDate));
   }

 if (dateMatching == "Overlap")
  { return ((startDate >= authorization.startDate && startDate <= authorization.endDate)
           ||(endDate >= authorization.startDate && endDate <= authorization.endDate)) ;
   }

 if (dateMatching == "Within X Days")
  { return startDate >= authorization.startDate - noOfDays && startDate <= authorization.endDate + noOfDays;
   }
}