ResourceDataRulesExecutor

class ResourceDataRulesExecutor @Inject constructor(val rulesFactory: RulesFactory)

This class is used to fire rules used to extract and manipulate data from FHIR resources.

NOTE: that the Facts object is not thread safe, each thread should have its own set of data to work on. When used in multi-threaded environment may exhibit unexpected behavior and return wrong results when rules are fired. Use the ResourceDataRulesExecutor in the same coroutine context of the caller.

Constructors

Link copied to clipboard
@Inject
constructor(rulesFactory: RulesFactory)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun computeResourceDataRules(ruleConfigs: List<RuleConfig>, repositoryResourceData: RepositoryResourceData?, params: Map<String, String>): Map<String, Any>

This function computes rules based on the provided facts RepositoryResourceData.resource, RepositoryResourceData.relatedResourcesMap and RepositoryResourceData.relatedResourcesCountMap. The function returns the outcome of the computation in a map; the name of the rule is used as the key.

Link copied to clipboard
fun processListResourceData(listProperties: ListProperties, relatedResourcesMap: Map<String, List<Resource>>, computedValuesMap: Map<String, Any>, listResourceDataStateMap: SnapshotStateMap<String, SnapshotStateList<ResourceData>>)

This function pre-computes all the Rules for ViewType's of List including list nested in the views. The LIST view computed values includes the parent's. Every list identified by ListProperties.id is added to the listResourceDataStateMap, where the value is SnapshotStateList to ensure the items are rendered (incrementally) as they are added to the list

Link copied to clipboard
fun processResourceData(repositoryResourceData: RepositoryResourceData, ruleConfigs: List<RuleConfig>, params: Map<String, String>?): ResourceData