diff --git a/build-in-docker.sh b/build-in-docker.sh
index 2880552a..e362a29d 100755
--- a/build-in-docker.sh
+++ b/build-in-docker.sh
@@ -2,7 +2,7 @@
docsroot=$(pwd)
echo "Building documentation in folder ${docsroot}"
-docker run --rm -v ${docsroot}:/docs firely.azurecr.io/firely/docs-sphinx:latest
+docker run --rm -v /${docsroot}:/docs firely.azurecr.io/firely/docs-sphinx:latest
index="${docsroot}/_build/html/index.html"
echo "Build ready, showing output from ${index}"
open ${index} &2> /dev/null || xdg-open ${index} &2> /dev/null
diff --git a/features_and_tools/cql.rst b/features_and_tools/cql.rst
new file mode 100644
index 00000000..4414019f
--- /dev/null
+++ b/features_and_tools/cql.rst
@@ -0,0 +1,402 @@
+.. _cql:
+
+CQL Plugin
+============
+
+Introduction
+------------
+
+Firely Server CQL Plugin is a means to use the Firely Server to run the `CQL engine `_.
+
+This document demonstrates :
+ * Creation of a simple CQL file
+ * Transformation of the CQL file to a `library resource `_ using the CQL Packager Tool
+ * Setting up Firely Server with CQL Plugin
+ * Getting the result of your CQL measure on the library resource in Firely Server using Postman tool
+
+
+Create a CQL File
+-----------------
+
+To start working with Firely Server CQL Plugin, you would need a CQL File. Some examples can be found `here `_.
+An example of a CQL file ``AgeFHIR4.cql`` is displayed below:
+
+ .. code-block:: jsonc
+
+ library AgeFHIR4 version '0.0.1'
+ using FHIR version '4.0.1'
+
+ context Patient
+
+ define "is18OrAbove":
+ AgeInYears() >= 18
+
+Generate a Library resource
+---------------------------
+
+CQL File created in the previous step is translated to a `library resource `_ using the `CQL Packager tool `_.
+Firely Server CQL plugin uses this library resource to evaluate the CMS measure on other resources.
+
+ 1. Follow the step by step `Installation of the CQL Packager tool and use the Demo solution `_ to generate a resource file.
+ 2. Place the CQL file ``Age.cql`` in the folder ``..\firely-cql-sdk\Demo\Cql\input``
+ 3. From the Demo Solution, Clean and Build CQL folder
+
+ .. note::
+ Running the build for this project turns these CQL files into ELM and puts the files into the source directory of the next step.
+ (Json folder under the Elm project contains the translated file AgeFHIR4.json)
+
+ .. container:: toggle
+
+ .. container:: header
+
+ Click to expand AgeFHIR4.json
+
+ .. code-block:: jsonc
+
+ {
+ "library" : {
+ "annotation" : [ {
+ "translatorVersion" : "2.11.0",
+ "translatorOptions" : "EnableLocators,EnableResultTypes",
+ "type" : "CqlToElmInfo"
+ } ],
+ "identifier" : {
+ "id" : "AgeFHIR4",
+ "version" : "0.0.1"
+ },
+ "schemaIdentifier" : {
+ "id" : "urn:hl7-org:elm",
+ "version" : "r1"
+ },
+ "usings" : {
+ "def" : [ {
+ "localIdentifier" : "System",
+ "uri" : "urn:hl7-org:elm-types:r1"
+ }, {
+ "locator" : "3:1-3:26",
+ "localIdentifier" : "FHIR",
+ "uri" : "http://hl7.org/fhir",
+ "version" : "4.0.1"
+ } ]
+ },
+ "contexts" : {
+ "def" : [ {
+ "locator" : "5:1-5:15",
+ "name" : "Patient"
+ } ]
+ },
+ "statements" : {
+ "def" : [ {
+ "locator" : "5:1-5:15",
+ "name" : "Patient",
+ "context" : "Patient",
+ "expression" : {
+ "type" : "SingletonFrom",
+ "operand" : {
+ "locator" : "5:1-5:15",
+ "dataType" : "{http://hl7.org/fhir}Patient",
+ "templateId" : "http://hl7.org/fhir/StructureDefinition/Patient",
+ "type" : "Retrieve"
+ }
+ }
+ }, {
+ "locator" : "7:1-8:20",
+ "resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
+ "name" : "is18OrAbove",
+ "context" : "Patient",
+ "accessLevel" : "Public",
+ "expression" : {
+ "locator" : "8:3-8:20",
+ "resultTypeName" : "{urn:hl7-org:elm-types:r1}Boolean",
+ "type" : "GreaterOrEqual",
+ "operand" : [ {
+ "locator" : "8:3-8:14",
+ "resultTypeName" : "{urn:hl7-org:elm-types:r1}Integer",
+ "precision" : "Year",
+ "type" : "CalculateAge",
+ "operand" : {
+ "path" : "birthDate.value",
+ "type" : "Property",
+ "source" : {
+ "name" : "Patient",
+ "type" : "ExpressionRef"
+ }
+ }
+ }, {
+ "locator" : "8:19-8:20",
+ "resultTypeName" : "{urn:hl7-org:elm-types:r1}Integer",
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
+ "value" : "18",
+ "type" : "Literal"
+ } ]
+ }
+ } ]
+ }
+ }
+ }
+
+ 4. From the Demo Solution, Clean and Build Elm folder
+
+ .. note::
+
+ PackagerCLI takes the original CQL (from the input folder in step 1) and the ELM (from Json folder from this project from step 2) as input.
+ The generated C# is exported to the root directory of the Measures project and built into a Measures.dll.
+ The generated Library resource ``AgeFHIR4-0.0.1.json`` is stored in the Resources folder in the Test project.
+ We use the content of this generated Library resource to create a Library resource in Firely Server.
+
+ .. container:: toggle
+
+ .. container:: header
+
+ Click to expand AgeFHIR4-0.0.1.json
+
+ .. code-block:: jsonc
+
+ {
+ "resourceType": "Library",
+ "id": "AgeFHIR4-0.0.1",
+ "url": "https://fire.ly/fhir/Library/AgeFHIR4-0.0.1",
+ "version": "0.0.1",
+ "name": "AgeFHIR4",
+ "status": "active",
+ "type": {
+ "coding": [
+ {
+ "system": "http://terminology.hl7.org/CodeSystem/library-type",
+ "code": "logic-library"
+ }
+ ]
+ },
+ "date": "2024-03-13T09:28:27.954Z",
+ "parameter": [
+ {
+ "name": "is18OrAbove",
+ "use": "out",
+ "min": 0,
+ "max": "1",
+ "type": "boolean"
+ }
+ ],
+ "content": [
+ {
+ "id": "AgeFHIR4-0.0.1+elm",
+ "contentType": "application/elm+json",
+ "data": "ew0KICAgImxpYnJhcnkiIDogew0KICAgICAgImFubm90YXRpb24iIDogWyB7DQogICAgICAgICAidHJhbnNsYXRvclZlcnNpb24iIDogIjIuMTEuMCIsDQogICAgICAgICAidHJhbnNsYXRvck9wdGlvbnMiIDogIkVuYWJsZUxvY2F0b3JzLEVuYWJsZVJlc3VsdFR5cGVzIiwNCiAgICAgICAgICJ0eXBlIiA6ICJDcWxUb0VsbUluZm8iDQogICAgICB9IF0sDQogICAgICAiaWRlbnRpZmllciIgOiB7DQogICAgICAgICAiaWQiIDogIkFnZUZISVI0IiwNCiAgICAgICAgICJ2ZXJzaW9uIiA6ICIwLjAuMSINCiAgICAgIH0sDQogICAgICAic2NoZW1hSWRlbnRpZmllciIgOiB7DQogICAgICAgICAiaWQiIDogInVybjpobDctb3JnOmVsbSIsDQogICAgICAgICAidmVyc2lvbiIgOiAicjEiDQogICAgICB9LA0KICAgICAgInVzaW5ncyIgOiB7DQogICAgICAgICAiZGVmIiA6IFsgew0KICAgICAgICAgICAgImxvY2FsSWRlbnRpZmllciIgOiAiU3lzdGVtIiwNCiAgICAgICAgICAgICJ1cmkiIDogInVybjpobDctb3JnOmVsbS10eXBlczpyMSINCiAgICAgICAgIH0sIHsNCiAgICAgICAgICAgICJsb2NhdG9yIiA6ICIzOjEtMzoyNiIsDQogICAgICAgICAgICAibG9jYWxJZGVudGlmaWVyIiA6ICJGSElSIiwNCiAgICAgICAgICAgICJ1cmkiIDogImh0dHA6Ly9obDcub3JnL2ZoaXIiLA0KICAgICAgICAgICAgInZlcnNpb24iIDogIjQuMC4xIg0KICAgICAgICAgfSBdDQogICAgICB9LA0KICAgICAgImNvbnRleHRzIiA6IHsNCiAgICAgICAgICJkZWYiIDogWyB7DQogICAgICAgICAgICAibG9jYXRvciIgOiAiNToxLTU6MTUiLA0KICAgICAgICAgICAgIm5hbWUiIDogIlBhdGllbnQiDQogICAgICAgICB9IF0NCiAgICAgIH0sDQogICAgICAic3RhdGVtZW50cyIgOiB7DQogICAgICAgICAiZGVmIiA6IFsgew0KICAgICAgICAgICAgImxvY2F0b3IiIDogIjU6MS01OjE1IiwNCiAgICAgICAgICAgICJuYW1lIiA6ICJQYXRpZW50IiwNCiAgICAgICAgICAgICJjb250ZXh0IiA6ICJQYXRpZW50IiwNCiAgICAgICAgICAgICJleHByZXNzaW9uIiA6IHsNCiAgICAgICAgICAgICAgICJ0eXBlIiA6ICJTaW5nbGV0b25Gcm9tIiwNCiAgICAgICAgICAgICAgICJvcGVyYW5kIiA6IHsNCiAgICAgICAgICAgICAgICAgICJsb2NhdG9yIiA6ICI1OjEtNToxNSIsDQogICAgICAgICAgICAgICAgICAiZGF0YVR5cGUiIDogIntodHRwOi8vaGw3Lm9yZy9maGlyfVBhdGllbnQiLA0KICAgICAgICAgICAgICAgICAgInRlbXBsYXRlSWQiIDogImh0dHA6Ly9obDcub3JnL2ZoaXIvU3RydWN0dXJlRGVmaW5pdGlvbi9QYXRpZW50IiwNCiAgICAgICAgICAgICAgICAgICJ0eXBlIiA6ICJSZXRyaWV2ZSINCiAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgIH0sIHsNCiAgICAgICAgICAgICJsb2NhdG9yIiA6ICI3OjEtODoyMCIsDQogICAgICAgICAgICAicmVzdWx0VHlwZU5hbWUiIDogInt1cm46aGw3LW9yZzplbG0tdHlwZXM6cjF9Qm9vbGVhbiIsDQogICAgICAgICAgICAibmFtZSIgOiAiaXMxOE9yQWJvdmUiLA0KICAgICAgICAgICAgImNvbnRleHQiIDogIlBhdGllbnQiLA0KICAgICAgICAgICAgImFjY2Vzc0xldmVsIiA6ICJQdWJsaWMiLA0KICAgICAgICAgICAgImV4cHJlc3Npb24iIDogew0KICAgICAgICAgICAgICAgImxvY2F0b3IiIDogIjg6My04OjIwIiwNCiAgICAgICAgICAgICAgICJyZXN1bHRUeXBlTmFtZSIgOiAie3VybjpobDctb3JnOmVsbS10eXBlczpyMX1Cb29sZWFuIiwNCiAgICAgICAgICAgICAgICJ0eXBlIiA6ICJHcmVhdGVyT3JFcXVhbCIsDQogICAgICAgICAgICAgICAib3BlcmFuZCIgOiBbIHsNCiAgICAgICAgICAgICAgICAgICJsb2NhdG9yIiA6ICI4OjMtODoxNCIsDQogICAgICAgICAgICAgICAgICAicmVzdWx0VHlwZU5hbWUiIDogInt1cm46aGw3LW9yZzplbG0tdHlwZXM6cjF9SW50ZWdlciIsDQogICAgICAgICAgICAgICAgICAicHJlY2lzaW9uIiA6ICJZZWFyIiwNCiAgICAgICAgICAgICAgICAgICJ0eXBlIiA6ICJDYWxjdWxhdGVBZ2UiLA0KICAgICAgICAgICAgICAgICAgIm9wZXJhbmQiIDogew0KICAgICAgICAgICAgICAgICAgICAgInBhdGgiIDogImJpcnRoRGF0ZS52YWx1ZSIsDQogICAgICAgICAgICAgICAgICAgICAidHlwZSIgOiAiUHJvcGVydHkiLA0KICAgICAgICAgICAgICAgICAgICAgInNvdXJjZSIgOiB7DQogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSIgOiAiUGF0aWVudCIsDQogICAgICAgICAgICAgICAgICAgICAgICAidHlwZSIgOiAiRXhwcmVzc2lvblJlZiINCiAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgIH0sIHsNCiAgICAgICAgICAgICAgICAgICJsb2NhdG9yIiA6ICI4OjE5LTg6MjAiLA0KICAgICAgICAgICAgICAgICAgInJlc3VsdFR5cGVOYW1lIiA6ICJ7dXJuOmhsNy1vcmc6ZWxtLXR5cGVzOnIxfUludGVnZXIiLA0KICAgICAgICAgICAgICAgICAgInZhbHVlVHlwZSIgOiAie3VybjpobDctb3JnOmVsbS10eXBlczpyMX1JbnRlZ2VyIiwNCiAgICAgICAgICAgICAgICAgICJ2YWx1ZSIgOiAiMTgiLA0KICAgICAgICAgICAgICAgICAgInR5cGUiIDogIkxpdGVyYWwiDQogICAgICAgICAgICAgICB9IF0NCiAgICAgICAgICAgIH0NCiAgICAgICAgIH0gXQ0KICAgICAgfQ0KICAgfQ0KfQ0KDQo="
+ },
+ {
+ "id": "AgeFHIR4-0.0.1+cql",
+ "contentType": "text/cql",
+ "data": "bGlicmFyeSBBZ2VGSElSNCB2ZXJzaW9uICcwLjAuMScNCg0KdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMScNCg0KY29udGV4dCBQYXRpZW50DQoNCmRlZmluZSAiaXMxOE9yQWJvdmUiOg0KICBBZ2VJblllYXJzKCkgPj0gMTg="
+ },
+ {
+ "id": "Ag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ZXh0Lk9wZXJhdG9ycy5HcmVhdGVyT3JFcXVhbChjXywgKGludD8pMTgpOw0KDQoJCXJldHVybiBkXzsNCgl9DQoNCiAgICBbQ3FsRGVjbGFyYXRpb24oImlzMThPckFib3ZlIildDQoJcHVibGljIGJvb2w/IGlzMThPckFib3ZlKCkgPT4gDQoJCV9faXMxOE9yQWJvdmUuVmFsdWU7DQoNCn0="
+ }
+ ]
+ }
+
+Firely Server CQL Plugin
+------------------------
+
+This chapter details setting up Firely Server CQL Plugin and provides you with an example to get some hands-on experience with CQL library with Postman tool.
+
+* Getting Started
+* CQL Plugin Configuration
+* Using Postman
+
+Getting Started
+^^^^^^^^^^^^^^^^
+
+* Install Firely Server using `Basic installation — Firely Server documentation `_
+
+ .. warning::
+ Make sure that the license contains CQL Plugin.
+
+CQL Plugin Configuration in Firely Server
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* Edit appsettings.instance.json:
+
+ 1. Set Repository to ``SQL`` and add the database configuration
+ 2. Add ``$evaluate-measure`` to the ``SupportedInteractions.TypeLevelInteractions``
+ 3. Ensure ``$everything`` is present in the ``SupportedInteractions.InstanceLevelInteractions``
+ 4. Insert ``Vonk.Plugin.Cql`` to PipelineOptions.Branches[Path="/"].Include before any other plugin
+ 5. Uncomment ``Vonk.Plugin.PatientEverything`` from the same list PipelineOptions.Branches[Path="/"].Include.
+
+* Build and run the Vonk.Server project from your IDE
+
+Using Postman
+^^^^^^^^^^^^^
+CQL Plugin in Firely Server uses the ``$evaluate-measure`` operation to execute a CQL measure on a resource.
+To verify the result of our CQL measure, we use Postman tool
+
+Create a postman collection
+ #. Set up Postman with variable : baseUrl and point to http://localhost:4080
+
+ .. note::
+ Make sure that the capability statement contains a Library operation ``https:/fire.ly/fhir/OperationDefinition/Library-evaluate-measure``.
+ This confirms that the CQL Plugin is enabled for the Firely Server.
+
+ Request :
+ .. code-block::
+
+ GET {{baseUrl}}/metadata
+
+ #. Create a Library resource with the Library resource json file ``AgeFHIR4-0.0.1.json``.
+
+ Request :
+ .. code-block::
+
+ POST {{baseUrl}}/administration/Library
+
+ Store the ``url``
+ #. Create a Support File with a binary file (todo : Explain this)
+ #. Create a Patient resource with age over 18 years
+
+ Request :
+ .. code-block::
+
+ POST {{baseUrl}}/Patient
+
+ Request Body :
+ .. code-block:: jsonc
+
+ {
+ "resourceType": "Patient",
+ "active": true,
+ "gender": "male",
+ "birthDate": "1967-11-06",
+ "name": [
+ {
+ "use": "official",
+ "family": "Smith",
+ "given": [
+ "John"
+ ]
+ }
+ ]
+ }
+
+ Store the ``id`` of the patient resource created.
+
+ #. Create a POST request for $evaluate-measure operation on the Library resource created
+
+ Request :
+ .. code-block::
+
+ POST {{baseUrl}}/Library/$evaluate-measure
+
+ Request Body :
+ .. code-block:: jsonc
+
+ {
+ "resourceType": "Parameters",
+ "parameter": [
+ {
+ "name": "url",
+ "valueCanonical": "https://fire.ly/fhir/Library/AgeFHIR4-0.0.1"
+ },
+ {
+ "name": "version",
+ "valueString": "0.0.1"
+ },
+ {
+ "name": "subject",
+ "valueString": "Patient/patient-id"
+ },
+ {
+ "name": "periodStart",
+ "valueDate": "2023-01-01"
+ },
+ {
+ "name": "periodEnd",
+ "valueDate": "2023-12-01"
+ }
+ ]
+ }
+
+ ``valueCanonical`` of the url comes from the ``url`` of the library resource in Step 1 and the ``patient-id`` comes from the ``id`` of the patient created in Step 3
+
+ Response :
+ .. code-block:: jsonc
+
+ {
+ "resourceType": "Binary",
+ "contentType": "application/json",
+ "id": "1aa7aa74-73cd-40a5-b1e9-30aaa370cb19",
+ "data": "eyJQYXRpZW50Ijp7InJlc291cmNlVHlwZSI6IlBhdGllbnQiLCJpZCI6IjFjMjI1NzVmLWE5Y2QtNGI4OS05YTI3LTk2M2VmNmU3Y2QwNyIsIm1ldGEiOnsidmVyc2lvbklkIjoiN2VjMzkzYjItOTE1ZS00MTYyLTk1YzEtYjc4Y2M4YjE5MjhlIiwibGFzdFVwZGF0ZWQiOiIyMDI0LTAzLTEzVDEyOjQyOjAyLjU4MiswMDowMCJ9LCJhY3RpdmUiOnRydWUsIm5hbWUiOlt7InVzZSI6Im9mZmljaWFsIiwiZmFtaWx5IjoiU21pdGgiLCJnaXZlbiI6WyJKb2huIl19XSwiZ2VuZGVyIjoibWFsZSIsImJpcnRoRGF0ZSI6IjIwMTgtMTEtMDYifSwiaXMxOE9yQWJvdmUiOmZhbHNlfQ=="
+ }
+
+ #. Get the result of the $evaluate-measure by passing the parameters.
+
+ Request :
+ .. code-block::
+
+ GET {{baseUrl}}/Library/$evaluate-measure
+
+ .. image:: ../images/postman_cql_evaluate_measure_parameters.png
+ :width: 1000px
+ :alt: Illustration of parameters
+
+ Response :
+ .. code-block::
+
+ {
+ "Patient": {
+ "resourceType": "Patient",
+ "id": "1c22575f-a9cd-4b89-9a27-963ef6e7cd07",
+ "meta": {
+ "versionId": "7ec393b2-915e-4162-95c1-b78cc8b1928e",
+ "lastUpdated": "2024-03-13T12:42:02.582+00:00"
+ },
+ "active": true,
+ "name": [
+ {
+ "use": "official",
+ "family": "Smith",
+ "given": [
+ "John"
+ ]
+ }
+ ],
+ "gender": "male",
+ "birthDate": "1967-11-06"
+ },
+ "is18OrAbove": true
+ }
+
+ The result displays if the Patient is evaluated as ``true`` or ``false`` for the CQL measure, in this case 18 years or above.
+
+Fork an existing collection:
+ #. Click the following "Fork postman collection into your workspace" link:
+
+ .. raw:: html
+
+
+
+
+ #. Click "Fork Collection"
+
+ .. image:: ../images/Compliance_ForkTestCollectionPostman.png
+ :align: center
+ :width: 500
+
+ #. Sign-In with your Postman account and click "Fork Collection". Change the label and workspace names as desired.
+ #. Run the requests in the collection
diff --git a/features_and_tools/features.rst b/features_and_tools/features.rst
index ed4772b2..41df109c 100644
--- a/features_and_tools/features.rst
+++ b/features_and_tools/features.rst
@@ -3,7 +3,7 @@
Features and Tools
==================
-Firely Server offers many features as defined in the FHIR Specification and beyond. Below pages provide you with an overview of these features and tools. Note that for some tools, such as Firely Server Ingest and Bulk Data Export, separate licensing applies. You can always reach out to us at server@fire.ly if you have questions.
+Firely Server offers many features as defined in the FHIR Specification and beyond. Below pages provide you with an overview of these features and tools. Note that for some tools, such as Firely Server Ingest, Bulk Data Export and CQL, separate licensing applies. You can always reach out to us at server@fire.ly if you have questions.
.. image:: ../images/FirelyPlugins.png
:align: right
@@ -27,6 +27,7 @@ Firely Server offers many features as defined in the FHIR Specification and beyo
pubsub
multi-tenancy
features-availability
+ cql
diff --git a/images/postman_cql_evaluate_measure_parameters.png b/images/postman_cql_evaluate_measure_parameters.png
new file mode 100644
index 00000000..ad40fdcb
Binary files /dev/null and b/images/postman_cql_evaluate_measure_parameters.png differ