Skip to content

dermatologist/cql-express-r4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

CQL is a domain-specific language that enables clinicians and researchers to express queries and retrieve data from electronic health records (EHRs) in a standardized, interoperable manner. CQL supports the use of terminology services, which are external services that provide mappings and translations between different code systems and value sets.

One limitation of FHIRPath-based CQL execution is that it cannot handle assertions in the FHIR DocumentReference resource. I have forked the nodejs CQL execution engine to add a hook that can call an LLM when it encounters a DocumentReference with unstructured text. The LLM can then execute the CQL with assertions and return the result to the CQL execution engine.

This is a prototype of the end-to-end LitL pipeline and dataflow to execute CQL that references unstructured text. The default implementation is in the medpromptjs package, which is imported and used in this application. You may override LLM and prompts in the src/bootstrap.ts file.

Read instructions

Related projects

Prerequisites

Before you begin, ensure you have the following installed on your machine:

  • Node.js: Ensure that Node.js, preferably version 16 or higher, is installed on your system, as this project utilizes the latest versions of TypeScript and Nodemon.
  • npm: npm is the package manager for Node.js and comes with the Node.js installation.

Installation

Clone the repository to your local machine:

git clone https://github.com/dermatologist/cql-express-r4.git

Navigate to the project directory:

cd cql-express-r4/

Install the project dependencies, including TypeScript and Nodemon:

npm i

LLM APIs and hyperparameters are defined in the src/bootstrap.ts file. You can modify the code to suit your requirements. For development purposes, you can run the application using Nodemon to automatically restart the server when changes are detected. Execute the following command:

npm run dev

This will start the server at http://localhost:3000 by default. You can change the port in the src/index.ts file or create an .env file to manage the environt-specific variables separately.

To build the TypeScript files and then start the server. Run the following commands:

npm run build
npm start

Usage

Access a form at http://localhost:3000 to post fhirBundles, cqlJson and fhirBaseUrl (for terminology). You can also post a json payload directly. 🚀 See example

Output

Configuration

You can configure the server settings, LLM API keys, and other parameters in the src/bootstrap.ts file. 👉 Modify the file to set your desired configurations.

Give us a star ⭐️

If you find this project useful, give us a star. It helps others discover the project.

Contributors

About

How to setup an Express server to execute CQL (Clinical Quality Language) with LLM support

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published