CQDefine is a lightweight and flexible module for creating re-usable knowledge executables. It can be used to define the logic and data required to build computable CDS workflows.
At it's essence, CQDefine is a series of TypeScript implementations with syntactic sugar that allow for precise declaration of expected inputs and outputs, while providing a mechanism for documenting, validating, and testing all executable code.
CQDefine is not required to use other aspects of CQLab, and alternative modules can be plugged in to provide similar functionality. However, we have had great success using CQDefine to create and manage our own knowledge due to it's flexibility and inherent power (anything that can be executed in asynchronous TypeScript can be packaged and surfaced as a CQDefine Library).
A CQDefine module encapsulates all data access and retrieval logic. It can wrap logic that searches a FHIR Bundle, a FHIR server, proprietary data models, custom SQL queries, complex distributed databases, or other knowledge repositories such as medical ontologies or clinical vocabularies. It can even wrap AI/ML models or other probabilistic algorithms.
Once logic is defined and tested in CQDefine, it is generally packaged and exposed to many different frontend applications within an organization's technology stack. There are many architectural possibilities that could make sense depending on an organizations scale and needs.
Next, let's check out the examples to see how it works in practice.