Working with Sub-flows

Oracle Insurance Gateway makes it possible to start a a sequence of defined steps as 'Subflow' in sequence or in parallel from an "Integration".

In this chapter illustrates, the following two examples:

1) Sequential processing of Provider files

2) Parallel processing of financial activities for group in Approved status

Sequential Processing of Files

At times multiples files are required to be processed by integration in a specific order. In this example, the integration gets invoked with two provider files, one being the primary file, and the other one being the delta file. The primary file must be processed first, and then the delta file.

This requires the file processing logic - a series of integrations steps to be set up as a Subflow. The Subflow must then be called in a sequence, once for the primary file, and then for the delta file.

To process the provider files, configure a subflow with two integration steps as follows by sending in a POST request to Generic API /subflows:

{
  "code": "ProviderUploadSubflow",
  "integrationSteps": [
   {
      "code": "file_upload_step",
      "sequence": 1,
      "subtype": "DELIVERY",
      "destination": {
        "code": "claims_fileUPload"
      },
      "functionTransformation": {
        "code": "providerFile_transform"
      }
    },
    {
      "code": "invoke_provider_import",
      "sequence": 2,
      "subtype": "ACTIVITY",
      "indicatorExpectNotification": "true",
      "outputName": "invoke_provider_import",
      "typeConfig": {
        "code": "PROVIDER_IMPORT",
        "level": "GL",
        "description": "Provider Import",
        "parameters": [
          {
            "name": "dataFileSetCode",
            "value": "{dataFileSetCode}"
          },
          {
            "name": "responseDataFileSetCode",
            "value": "{responseDataFileSetCode}"
          }
        ]
      },
      "destination": {
        "code": "claims"
      }
    }
  ]
}
Refer to provider import example in the section File Upload to get a better understanding of data import using Oracle Insurance Gateway.

The next step is to configure Integration using the following payload and making a post request to Generic API /integrations

{
  "code": "ProviderUpload",
  "integrationSteps": [
    {
      "code": "ProviderSubflow",
      "sequence": "1",
      "subtype" : "SUBFLOW",
      "subflow": {
        "code" : "ProviderUploadSubflow"
      },
      "typeConfig" : {
          "subflowFunctionCode" : "subflow_step_sequential",
          "processSubflowInSequence" : true
      }
    }
  ]
}

Note, the attribute processSubflowInSequence is set to true to call the subflow in sequence.

The dynamic logic subflow_step_sequential processes the uploaded data file set using the bind variable 'trigger' to set the subflowStepParameters. For more details on reading files refer to section Transformation Dynamic Logic section in the chapter dynamic logic.

Sample subflow_step_sequential Logic

/* Process the file with a code ending in 'primary' */
// This logic assumes there is one primary and one delta file.

trigger.dataFiles.findAll{file ->
file.code.endsWith("master")}.each{master->
subflowStepParameters.addProperties([dataFileCode: master.code])}

/* Process the file with a code ending in 'delta' */

trigger.dataFiles.findAll{file ->
file.code.endsWith("delta")}.each{updfile ->
subflowStepParameters.addProperties([dataFileCode: delta.code])}

In the 'providerFile_transfor' transformation dynamic logic, the file with the name that matches the dataFileCode value gets processed. The code snippet below shows the dynamic logic to select the file based on the subflow properties for transformation and deliver.

/* Use the file name in the subflow properties
  Find the datafile in the trigger object (which is the trigger object of the whole integration) */

def df = trigger.dataFiles.find {file -> file.code ==
          properties["dataFileCode"]
         }

Parallel Processing of Financial Activities for Group in Approved Status

In this scenario, Calculate Premium and Financial Activities needs to be invoked in parallel for the groups in 'Approved' state.

This requires a subflow to be set up with the following five integration steps

  • Calculate Premium ACTIVITY step

  • Select Transaction Into Set ACTIVITY step

  • Supersede ACTIVITY step

  • Generate financial message ACTIVITY step

  • Send to financial subsystem DELIVERY step

Refer to Financial Integration with ORMB example in the section ORMB Integration via SFTP to get a better understanding of configuring financial activities using Oracle Insurance Gateway.

The next step is to configure Integration using the following payload and making a post request to Generic API /integrations

{
  "code": "CalculationFinancialFlow",
  "integrationSteps": [
    {
     /* Extract or Query step as sequence 1 (depending on the number of group accounts)
      to get the list of all the group account codes that are linked to Approved clients.*/
     "code": "approvedGroups",
     "outputName":"approvedGroups"


    },
    {
      "code": "CalculationFinancialSubflow",
      "sequence": "2",
      "subtype" : "SUBFLOW",
      "subflow": {
        "code" : "CalculationSubflow"
      },
      "typeConfig" : {
          "subflowFunctionCode" : "subflow_step_parallel",
          "processSubflowInSequence" : false
      }
    }
  ]
}

Note, the attribute processSubflowInSequence is set to 'false' for calling the subflow in parallel.

Configure Dynamic Logic 'subflow_step_parallel' as a Subflow Function to return parameters for subflow processing. Suppose the exchange parameters have a groupAccountCodes as a parameter and for each of those group account code, the logic process needs to be invoked.

The dynamic logic subflow_step_parallel processes the extracted/queried data to set the subflowStepParameters. For more details on reading extracted data files/ raw payload refer to section Transformation Dynamic Logic section in the chapter dynamic logic.

Sample subflow_step_sequential Logic

Assuming query step is used to fetch approved group accounts, then the query response is accessible through bind variable 'approvedGroups' in the subflow_step_sequential dynamic logic.

approvedGroups.items.each{group->
  subflowStepParameters.addProperties(["groupAccountCode": group.code])
}​​​​​​​​​​​​