Rule definition and triggering

Define your rule

The rule that you will be defining is an instance of the SAP custom ResourceType RuleSet.

  • See here the sample ruleSet instance.
  • The result of the rule execution will be a List instance (see example here)

Note: The List instance will not be persisted, but be availabe in the working memory of the rule service and available to the UI to display these patients.

Create RuleSet

You can create your rule by creating an instance of the RuleSet Resource via

  • POST [base]/RuleSet where [base] is the rules service endpoint.

CodeSystems for selection criteria

As you can see below, the rule uses two CodeSystems where the codes for inclusion and exclusion are specified:

  • here is the inclusion CodeSystem with ICD codes that patients should have at least one of
    • contains the ICD codes E66.0, E66.1, E66.2, E66.8
  • here is the exclusion CodeSystem with ICD codes that patients should not have
    • contains the ICD codes C38.0, C79.83, C79.84

Create CodeSystems

You can create these code systems via Post with the CodeSystem as body via

  • POST [base]/CodeSystem where [base] is the core service endpoint.

Trigger your rule

Via the FHIR operation $apply-rules (this is an SAP custom operation) you can trigger the execution of the ruleSet you created. This can be done via

POST [base]/$apply-rules where [base] is the rules service endpoint.

  • Here is the definition of the apply-rules Operation.
  • Its input parameter of the operation is a RuleSetRequest instance.
  • Its output parameter is a RuleSetResponse instance.

Samples:

  • You can use this sample instance of RuleSetRequest to pass it to the operation.
  • Here is a sample of a RuleSetResponse that you will get containing a List instance like this.