Giter Club home page Giter Club logo

cql_execution_service's Introduction

CQL Execution Service

The CQL Execution Service is an implementation of the cql_engine as a web service.

Usage:

  • Clone repository
  • mvn install
  • mvn -Djetty.http.port=xxxx jetty:run
    • This command spins up the server and listens on the port of your choosing (usually 8080 for development).
  • Start the CQL Runner (follow instructions here) or navigate to the publicly available implementation here and edit the url to point to your execution service implementation in the "Engine URL" tab.

Execution Service

  • POST the following to [base]/cql/evaluate:

    {
        "code": "Your CQL code",
        "terminologyServiceUri": "Terminology Service Endpoint",
        "terminologyUser": "Username for authentication",
        "terminologyPass": "Password for authentication",
        "dataServiceUri": "Fhir Data Provider Endpoint",
        "dataUser": "Username for authentication",
        "dataPass": "Password for authentication",
        "patientId": "The patient you want to run the library against"
        "parameters": [
          {
            "name": "Name of the parameter as specified in the CQL",
            "type": "Name of the type (currently only singleton CQL types are supported)",
            "value": String (String, DateTime, and Time) | Integer | Decimal | Object (Code, Concept, Quantity, Interval)
          }
        ]
    }
    
  • Parameter Examples:

    {
      ...
      "parameters": [
        {
          "name": "MeasurementPeriod",
          "type": "Interval<DateTime>",
          "value": {
            "start": "@2019-01-01",
            "end": "@2019-12-31"
          }
        },
        {
          "name": "MyCode",
          "type": "Code",
          "value": {
            "system": "http://example.org",
            "code": "example-code",
            "display": "My exmaple code",
            "version": "1.0"
          }
        },
        {
          "name": "MyConcept",
          "type": "Concept",
          "value": {
            "codes": [
              {
                "system": "http://example.org",
                "code": "example-code"							
              },
              {
                "code": "another-example-code"							
              }
            ],
            "display": "My Concept"
          }
        },
        {
          "name": "MyQuantityInterval",
          "type": "Interval<Quantity>",
          "value": {
            "start": {
              "value": 12.5,
              "unit": "mg"
            },
            "end": {
              "value": 17.5,
              "unit": "mg"
            }
          }
        },
        {
          "name": "ClosingTime",
          "type": "Time",
          "value": "T17:00:00.000-07:00"
        }
      ]
    }
    
  • This Request will produce a JSON Response in the following format:

    [
        {
            "translator-error": "Translation error message (is the only element returned)",
            "name": "CQL Expression name",
            "location": "[row:col]",
            "resultType": "CQL Type being returned",
            "error": "Runtime error output (this may cause the omission of resultType)"
        }
    ]
    
  • This service is used by the cql-runner

CQL Formatter

  • POST the following to [base]/cql/format:

    {
        "code": "Unformatted CQL code"
    }
    
  • This Request will produce a JSON Response in the following format:

    [
        {
            "formatted-cql": "The formatted CQL code"
        }
    ]
    
  • This service is used by the cql-runner

cql_execution_service's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cql_execution_service's Issues

ExecutorLibrarySourceProvider using static source-based references to FHIRHelper

ExecutorLibrarySourceProvider uses this code to search for libraries to load at runtime.
@Override public InputStream getLibrarySource(VersionedIdentifier versionedIdentifier) { Path path = Paths.get("src/main/resources").toAbsolutePath(); File source = new File(path.resolve(versionedIdentifier.getId() + "-" + versionedIdentifier.getVersion() + ".cql").toString());

try { return new FileInputStream(source); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Cannot find library source " + versionedIdentifier.getId()); } }

The Paths base directory is FileSystem-dependent however, and doesn't translate over well. Deploying the war to tomcat, for example, breaks the library loading.

The Paths documentation itself provides a proposed solution

The Path is obtained by invoking the getPath method of the default FileSystem. Note that while this method is very convenient, using it will imply an assumed reference to the default FileSystem and limit the utility of the calling code. Hence it should not be used in library code intended for flexible reuse. A more flexible alternative is to use an existing Path instance as an anchor, such as:

Path dir = ... Path path = dir.resolve("file");

Paths Documentation Here

Refresh Examples

I am trying to find specific individuals based on codesets, but I can't figure out how the terminology services are set up or where to find other services.

The current example
valueset "Ambulatory Abuse Potential Opioids": 'http://hl7.org/fhir/ig/opioid-cds/ValueSet/opioids-abused-in-ambulatory-care'

does not return any codes. Or at least not when pointed to the default Terminology URL: http://measure.eval.kanvix.com/cqf-ruler/baseDstu3

Your help would be most appreciated, specifically in the form of an example wherein I define a set of ICD or SNOMED codes and search for patients with these codes. I am not able to run the Cooking with CQL Examples out of the box with this service.

Thanks!

Code Mapping Logic Assessment

The recently implemented Code Mapping service needs to be assessed to determine whether or not the expression iteration accounts for all occurrences of the ConceptEvaluator in the library.

Great code, missing documentation

The code is clear and understandable, however, use of it would be greatly assisted by JavaDoc and some user oriented documentation. I've never really worked on an open source project other than posting bugs, but I might be interested in helping out with the documentation challenges on this code base.

CQF Ruler Output Question

Is there any documentation for outputs that CQF Ruler will generate in the event of a failure/error occurring during the $evaluate-measure operation? If not, what do those responses look like?

This information will help when Link needs to create Notification and Audit events when CQFRuler encounters a failure while creating a MeasureReport.

The evaluation of 'include' library expression is not implemented

If you have include expression like the following, the included library is not being loaded in ExecutorLibraryLoader class. This is a know issue since there is a todo comment in load(VersionedIdentifier versionedIdentifier) method when the library is null
include FHIRHelpers version '3.0.0' called FHIRHelpers

compatibility with cql_engine

This seems to be dependent on cql_engine version 1.3.10-SNAPSHOT, and not compatible with cql_engine's released version (1.3.12?).
Is there any plan in the near future to update this to the latest cql_engine version?

Passing in Parameters

Sorry if this is a simple question, but how do I pass in parameters (eg Measurement Period) to the CQL engine (/cql/evaluate)?

eg, I have a parameter in my CQL like:

parameter "MyString" String

and I want to pass in this string when I execute the CQL.

Thanks!

Defect: CQF Ruler does not appear to apply the CQL logic for encounter.class and encounter.type (union logic).

The CQL specifies the value sets and codes to be returned:

define "Initial Population":

("Inpatient Encounter"

union "Patient Hospital Locations") InpatientEncounters

where exists(

"Antidiabetic Drugs Administered or Ordered" ADD

where Coalesce(start of Global."Normalize Interval"(ADD.effective), ADD.authoredOn)

during "HospitalizationWithObservationOrEmergency"(InpatientEncounters)

and Coalesce(start of Global."Normalize Interval"(ADD.effective), ADD.authoredOn) during "Measurement Period")

define "Inpatient Encounter":

[Encounter: class in {"inpatient encounter", "inpatient acute", "inpatient non-acute", "short stay", "emergency", "observation encounter"}]

union [Encounter: "Encounter Inpatient"] Encounters

where Encounters.status in {'in-progress', 'finished', 'triaged'}

and Encounters.period overlaps "Measurement Period

What this means is that in the beta data, we would expect to see either Encounter.class with codes returning from this HL7 V3 value set (HL7.TERMINOLOGY\ActEncounterCode - FHIR v4.0.1 ) and not numeric local codes OR encounter.type with a SNOMED CT code returning from one of these 3 value set Emergency Department Visit OID:2.16.840.1.113883.3.117.1.7.1.29, Encounter Inpatient 2.6.840.1.113883.3.666.5.307', "Observation Services": OID: 2.16.840.1.113762.1.4.1111.143'.

What is returning is local codes for both encounter.class and encounter.type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.