cqframework / cql-execution

A JavaScript framework for executing CQL
Apache License 2.0
65 stars 30 forks source link

Support External Functions #286

Open cmoesel opened 2 years ago

cmoesel commented 2 years ago

External functions allow CQL to call custom functions that are defined natively rather than in CQL. See: https://cql.hl7.org/03-developersguide.html#external-functions

In the CQL Execution framework, this could potentially be supported by allowing integrators to pass in a map (or hash) of supported functions, for which the name of the function is the key. For example:

const externalFunctions = {
  "reverse": (list: any[]) => list.reverse(),
  "consoleLog": (message: string) => console.log(string)
}

External functions are generally discouraged since they impede interoperability. As such, implementation of this feature is low priority.