31.4.1MDM Operations

 

Smile CDR provides several custom operations for working with Master Data Management (MDM).

31.4.1.1$mdm-evaluate operation

$mdm-evaluate is a custom Smile CDR operation, which you can use to test out different MDM algorithms available and get match results based on the input values.

This operation is only available when a FHIR persistence module is configured to use MDM. This operation will be available on the base FHIR endpoint url.

This operation takes in Parameters FHIR resource for inputs and responds with a Parameters resource with the match results.

31.4.1.2Permissions

31.4.1.3Limitations

  • This custom operation is available for FHIR version DSTU3 and FHIR versions released after.
  • This custom operation does not support two matcher type algorithms:
    • IDENTIFIER
    • EXTENSION_ANY_ORDER

31.4.1.4Input Parameters

Parameter nameCardinalityTypeDescription
compareTo1..1StringThe input string to compare.
compareWith1..1StringThe input string to compare against.
algorithmType1..1StringThe algorithm type matcher or similarity.
algorithm1..1StringThe algorithm name to use for evaluation.
threshold0..1DecimalThe match threshold to check with.
Note: This is not required for matcher type but required for similarity type algorithm.

31.4.1.5Output Parameters

Parameter nameCardinalityTypeDescription
match1..1Booleantrue or false based on the evaluation.
score0..1StringThe match score based on the evaluation. Note: This is only returned for similarity type evaluation.

31.4.1.5.1Sample request for

Below is a sample request and response when using $mdm-evaluate for similarity type algorithm.

POST http://fhir.example.com/baseR4/$mdm-evaluate

Sample request body

{
	"resourceType":"Parameters",
	"parameter":[
		{
			"name":"compareTo",
			"valueString":"My tsring"
		},
		{
			"name":"compareWith",
			"valueString":"My string"
		},
		{
			"name":"algorithmType",
			"valueString":"similarity"
		},
		{
			"name":"algorithm",
			"valueString":"JARO_WINKLER"
		},
		{
			"name":"threshold",
			"valueDecimal":0.5
		}
	]
}

Sample response body

{
	"resourceType": "Parameters",
	"parameter": [
		{
			"name": "match",
			"valueBoolean": true
		},
		{
			"name": "score",
			"valueDecimal": 0.974
		}
	]
}

Below is a sample request and response when using $mdm-evaluate for matcher type algorithm.

POST http://fhir.example.com/baseR4/$mdm-evaluate

Sample request body

{
	"resourceType":"Parameters",
	"parameter":[
		{
			"name":"compareTo",
			"valueString":"Gail"
		},
		{
			"name":"compareWith",
			"valueString":"Gael"
		},
		{
			"name":"algorithmType",
			"valueString":"matcher"
		},
		{
			"name":"algorithm",
			"valueString":"CAVERPHONE1"
		}
	]
}

Sample response body

{
	"resourceType": "Parameters",
	"parameter": [
		{
			"name": "match",
			"valueBoolean": true
		}
	]
}

31.4.1.6$sdh.mdm-bundle-match operation

$sdh.mdm-bundle-match is a custom Smile CDR operation that processes a FHIR Bundle to match resources against existing resources in the repository using MDM rules. This operation helps prevent duplicate resources by identifying and removing resources in the input Bundle that match existing resources in the repository before persisting the bundle.

This Bundle operation is only available when a FHIR persistence module is configured to use MDM. Similar to Patient/$match, this operation does not require the heavier MATCH_AND_LINK MDM mode to use; It is also available in lightweight MATCH_ONLY MDM mode.

31.4.1.6.1How it works

For each resource in the input bundle:

  1. The operation uses MDM rules to find matching resources in the repository 2. If a resource matches exactly one resource in the repository:
    • It removes the resource from the bundle
    • It updates all references to that resource in the bundle to point to the matched resource 3. If a resource matches more than one resource in the repository:
    • It throws a ResourceVersionConflictException 4. If a resource doesn't match any resources in the repository:
    • It keeps the resource in the bundle, updating references to removed resources as necessary

In addition to the above rules, if the input Bundle is a Document bundle and the first entry in the Bundle is a Composition resource, the Composition resource is removed. The operation returns a new transaction Bundle with matched resources removed and references updated. This bundle can then be submitted to the repository to create only the non-duplicate resources as determined by the MDM Rules.

31.4.1.6.2Permissions

31.4.1.6.3Limitations

  • This custom operation is available for FHIR version DSTU3 and FHIR versions released after.

31.4.1.6.4Input Parameters

Parameter nameCardinalityTypeDescription
inputBundle1..1BundleThe input bundle to process for MDM matching.

31.4.1.6.5Output

The operation returns a FHIR transaction Bundle with matched resources removed and references updated.

31.4.1.6.6Sample request

Below is a sample request when using $sdh.mdm-bundle-match:

POST http://fhir.example.com/baseR4/Bundle/$sdh.mdm-bundle-match

Sample request body

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "inputBundle",
      "resource": {
        "resourceType": "Bundle",
        "type": "transaction",
        "entry": [
          {
            "fullUrl": "urn:uuid:1",
            "resource": {
              "resourceType": "Patient",
              "name": [
                {
                  "family": "Smith",
                  "given": ["John"]
                }
              ],
              "birthDate": "1970-01-01"
            },
            "request": {
              "method": "POST",
              "url": "Patient"
            }
          },
          {
            "fullUrl": "urn:uuid:2",
            "resource": {
              "resourceType": "Observation",
              "status": "final",
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "8480-6",
                    "display": "Systolic blood pressure"
                  }
                ]
              },
              "subject": {
                "reference": "urn:uuid:1"
              },
              "valueQuantity": {
                "value": 120,
                "unit": "mmHg",
                "system": "http://unitsofmeasure.org",
                "code": "mm[Hg]"
              }
            },
            "request": {
              "method": "POST",
              "url": "Observation"
            }
          }
        ]
      }
    }
  ]
}

31.4.1.7MDM Bundle Match Processor

The MDM Bundle Match Processor is a Camel processor that provides access to the $sdh.mdm-bundle-match operation functionality within a Camel route.

  • Example URI: <to uri="smile:mdm/mdmBundleMatchProcessor"/>
  • Description: Processes a FHIR Bundle to match resources against existing resources in the repository using MDM rules.

31.4.1.7.1Input

The processor takes an IBaseBundle (FHIR Bundle) as input.

31.4.1.7.2Output

The processor returns a reconciled IBaseBundle (FHIR Bundle) with matched resources removed and references updated.

31.4.1.7.3Example

The following example shows a route that reads a FHIR Bundle from a file, processes it with the MDM Bundle Match Processor, and then stores the reconciled bundle in a FHIR repository:

<route>
    <from uri="file:input/bundles?noop=true"/>
    <to uri="smile:mdm/mdmBundleMatchProcessor"/>
    <to uri="smile:persistence/bundleProcessor"/>
</route>