Giter Club home page Giter Club logo

atom_cql_support's Introduction

🚨Notice🚨

This plugin is deprecated

With the sunsetting of Atom the CQL plugin is no longer being supported. Please migrate to using the VS Code plugin instead.

Clinical Quality Language (CQL) Support in Atom

Adds syntax highlighting, semantic (error) highlighting, and local execution to CQL files in Atom, a free and open source editor.

CQL Syntax Highlighting Screenshot

How to Install

The cql-language package has been published to the Atom package repository, so installation is simple:

  1. If you don't have Atom, download and install it.
  2. Install the cql-language package by follow the instructions for installing packages a. The cql-language package requires both a Java v1.8 runtime and a correct Java Path. If the installation fails to detect either, you will be prompted to download and install Java and/or set a correct Java Path.

Using the CQL support in Atom

After you've installed the cql-language package, open any .cql file in Atom. As long as the file has the .cql extension, syntax and error highlighting will be automatically applied.

To execute CQL right-click in the CQL Editor Windows and select CQL -> Execute or press F5

The translation and execution capabilities in the plugin expect CQL files to be in the following directories, by convention:

input/cql
input/tests
input/tests/<cql-library-name>
input/tests/<cql-library-name>/<patient-id>
input/tests/<cql-library-name>/<patient-id>/<resource-type-name>/<resource files> // flexible structure
input/vocabulary/codesystem
input/vocabulary/valueset

Within the tests folder, there is a folder for each CQL library, by name (note that the name of the file must match the name of the library in order for the evaluator to properly execute the CQL). Note also that the evaluator is a separate subsystem from the translator, so it will read whatever is current of off disk, so be sure to save before executing.

Within the library folder, there is a folder for each "test case", in the form of a Patient (the execution only supports patient context execution at this point). The folder must have the same id as the patient (that's how the evaluator knows what the patient id is).

Within each test case folder are the resources for that specific test case. The resource files can be provided either directly in this folder, or they can be organized into folders by resource type name. Whether they are in the test folder or in subfolders, resources can be provided as bundles (included nested bundles), or as separate files, and in either XML or JSON format. If a Patient is provided, the id element of the Patient resource must match the name of the test case folder.

More About the Clinical Quality Language

The Clinical Quality Language (CQL) is a domain specific language for expressing electronic clinical quality measures (eCQM) and clinical decision support rules (CDS) in an author-friendly computable format. Find out more about CQL:

Local Plugin Development

  • uninstall the language-cql package from Atom if you have it installed
  • run npm install -g yarn
  • run yarn install in the root directory to install dependencies
  • run apm link to create a symbolic link from the git directories to the working directory
    • working directory can be found at <user dir>\.atom\packages\language-cql
  • reload workspace to get updates (ctr-shift-f5)

License

Copyright 2014 - 2015 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

atom_cql_support's People

Contributors

brynrhodes avatar cmoesel avatar dependabot[bot] avatar hossenlopp avatar jpercival avatar sliver007 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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

atom_cql_support's Issues

Only Warning messages are displayed in the output

define "Trace Message":
  Message(1, true, '123', 'Trace', 'This is a trace message')

define "Warning Message":
  Message(1, true, '123', 'Warning', 'This is a warning message')

define "Information Message":
  1 + Message(2, true, '123', 'Information', 'The value is 2')

These all work, but only the Warning message is displayed in the output.

Better Upgrade experience

The plugin needs a "beforeShutdown" or "beforeUpgrade" hook to shut down all the processes running in the background. Specifically, the language server and any executing tests.

Uncaught Error: Message header must separate key and value using :

I have removed the .Atom files in my home directory, loaded a new version of atom and have installed version 2.11.0 of language-cql. I get this error whenever I load a cql file. I've attached a zipped copy of a file that's throwing this error:

Atom: 1.58.0 x64
Electron: 9.4.4
OS: Microsoft Windows 10 Pro
Thrown From: language-cql package 2.11.0

Stack Trace

Uncaught Error: Message header must separate key and value using :

At C:\Users\fadrian\.atom\packages\language-cql\node_modules\vscode-jsonrpc\lib\messageReader.js:57

Error: Message header must separate key and value using :
    at /packages/language-cql/node_modules/vscode-jsonrpc/lib/messageReader.js:57:23
    at Array.forEach (<anonymous>)
    at MessageBuffer.tryReadHeaders (/packages/language-cql/node_modules/vscode-jsonrpc/lib/messageReader.js:54:17)
    at StreamMessageReader.onData (/packages/language-cql/node_modules/vscode-jsonrpc/lib/messageReader.js:157:43)
    at /packages/language-cql/node_modules/vscode-jsonrpc/lib/messageReader.js:148:18)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)

Commands

     -2:34.4.0 application:open-folder (div.tool-panel.tree-view)
     -1:24.4.0 core:backspace (input.hidden-input)
     -1:18.7.0 core:page-up (input.hidden-input)

Non-Core Packages

atom-ide-ui 0.13.0 
ide-json 0.2.1 
json-colorer 1.0.0 
language-cql 2.11.0 

snippets.zip

Performance crawls when dealing with large files

The current support re-translates on every keystroke, this is usually fine, but with large files it's quite impactful. Consider delaying start of translation so that multiple keystrokes do not result in multiple translations, only the last one does.

CQL code will not execute after Upgrade to 2.8.1

Hello all,
Upgraded language-CQL to 2.8.1 within ATOM. Could not execute the CQL code from ATOM. Tried to uninstall from within ATOM and could not. Removed contents from users/me/.atom/packages/ to remove the CQL plugin. Able to reinstall. Still cannot see CQL execute. However, I now see the following error:

"CQL language server stopped unexpectedly.

Error: Could not find or load main class org.opencds.cqf.cql.ls.Main Caused by: java.lang.ClassNotFoundException: org.opencds.cqf.cql.ls.Main"

I have uninstalled and reinstalled Java. Both times I had version 8 build 271. Removed and reinstalled Atom, both times build 1.52, I could really use help.

Thanks,

Doug

Consider addition of capability of running a highlighted segment of CQL within Atom

Wouldn't it be great if we could highlight a section of code in Atom to run that segment with right click or F5.
This would have to include measure.cql file start up from libraries to context Patient etc for context of libraries, valuesets, etc.
Even better would be to have that post 'context Patient' break point relocatable to further in the cql so as to include required populations of definitions and then skip to the highlighted segment then stop.
Recognized that any content of highlighted selection of code would require presence before context Patient statement or contained within highlighted segment.
Rationale: This would be helpful in cql measure development by permitting testing of an operation, definition or function.
Bryn is aware.
Thank you. PMuir

Ubuntu 20.04 OpenJDK11 language-cql parser error

Atom language-CQL Java Version parsing error
Ubuntu 20.04 includes OpenJDK11 but includes multiple versions:

$ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

$ which java
/usr/bin/java

$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64

I uninstalled packages and Atom and have successfully reinstalled both via Ubuntu software and via Atom.io
Latest versions of packages installed successfully for atom-ide-iu, ide-java and language-cql
Pop up error as follows:

language-cql requires Java 11 but could not determine your Java version.

Could not parse the Java '--showVersion' output
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

I suspect that the multiple line response is the issue for the language-cql parser.
(since Ubuntu 20.04 includes multiple versions of Java)
I suspect this may impact others running Linux/Ubuntu 20.04 (MacOs runs ok)

Appreciate your input, Thanks

Inconsistency between CQL Translation and Evaluation for FHIR Types

Hello,

I use cql-language 2.11.1

I found that during translation(and during the writing the code in IDE) it uses FHIR types for DSTU 2. These classes are included in Java library along with classes for r4 (org.hl7.fhir.r4.model)

return OperationOutcome { id:id{value:'xxx'}, issue: List<FHIR.OperationOutcome.OperationOutcomeIssueComponent >{ FHIR.OperationOutcome.OperationOutcomeIssueComponent { severity: FHIR.IssueSeverity {value:'error'}, code: FHIR.IssueType {value: 'sdfs'} } } }

such a code (that contain r4 model) highlights errors in IDE and produces

org.opencds.cqf.cql.engine.exception.CqlException: Translation of library CHF failed with the following message: A named type is required in this context. at org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader.translate(TranslatingLibraryLoader.java:134) at org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader.load(TranslatingLibraryLoader.java:78) at org.opencds.cqf.cql.evaluator.engine.execution.CacheAwareLibraryLoaderDecorator.load(CacheAwareLibraryLoaderDecorator.java:49) at org.opencds.cqf.cql.engine.execution.CqlEngine.loadAndValidate(CqlEngine.java:254) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluate(CqlEngine.java:154) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:89) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:76) at org.opencds.cqf.cql.evaluator.cli.command.CqlCommand.call(CqlCommand.java:163)

But if I use DSTU2 model

return OperationOutcome { id:id{value:'xxx'}, issue: List<FHIR.OperationOutcome.Issue >{ FHIR.OperationOutcome.Issue { severity: FHIR.IssueSeverity {value:'error'}, code: FHIR.IssueType {value: 'sdfs'} } } }

It does not highlights it in IDE (seems like it believes that this type is correct one), but during the running following exception occurs

org.opencds.cqf.cql.engine.fhir.exception.UnknownType: Could not resolve type OperationOutcome.Issue. Primary package(s) for this resolver are org.hl7.fhir.r4.model at org.opencds.cqf.cql.engine.fhir.model.FhirModelResolver.resolveType(FhirModelResolver.java:269) at org.opencds.cqf.cql.engine.fhir.model.R4FhirModelResolver.resolveType(R4FhirModelResolver.java:190) at org.opencds.cqf.cql.engine.fhir.model.FhirModelResolver.createInstance(FhirModelResolver.java:182) at org.opencds.cqf.cql.evaluator.engine.model.CachingModelResolverDecorator.createInstance(CachingModelResolverDecorator.java:88) at org.opencds.cqf.cql.engine.data.CompositeDataProvider.createInstance(CompositeDataProvider.java:74) at org.opencds.cqf.cql.engine.execution.Context.createInstance(Context.java:434) at org.opencds.cqf.cql.engine.elm.execution.InstanceEvaluator.internalEvaluate(InstanceEvaluator.java:9) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:18) at org.opencds.cqf.cql.engine.elm.execution.ListEvaluator.internalEvaluate(ListEvaluator.java:13) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:18) at org.opencds.cqf.cql.engine.elm.execution.InstanceEvaluator.internalEvaluate(InstanceEvaluator.java:11) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:18) at org.opencds.cqf.cql.engine.elm.execution.QueryEvaluator.evaluateReturn(QueryEvaluator.java:85) at org.opencds.cqf.cql.engine.elm.execution.QueryEvaluator.internalEvaluate(QueryEvaluator.java:202) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:18) at org.opencds.cqf.cql.engine.elm.execution.ExpressionDefEvaluator.internalEvaluate(ExpressionDefEvaluator.java:19) at org.opencds.cqf.cql.engine.elm.execution.Executable.evaluate(Executable.java:18) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluateExpressions(CqlEngine.java:186) at org.opencds.cqf.cql.engine.execution.CqlEngine.evaluate(CqlEngine.java:164) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:89) at org.opencds.cqf.cql.evaluator.CqlEvaluator.evaluate(CqlEvaluator.java:76) at org.opencds.cqf.cql.evaluator.cli.command.CqlCommand.call(CqlCommand.java:163) at org.opencds.cqf.cql.evaluator.cli.command.CqlCommand.call(CqlCommand.java:34)

Plugin "Could not load source for library"

The plugin was highlighting a "could not load source for library" error for all my include statements. I ensured that versions were correct. Any statements that referenced the library would then also give an error. However, the code still ran normally.
image

Reinstalled several times and problem still persisted. However, I was eventually able to get a "fix" that I could replicate by performing the installation in the following order.
1 Uninstall atom-ide-ui then language-cql.
2 Restart Atom.
3 Install language-cql.
4 Open a folder, you'll be prompted to install the atom-ide-ui dependency. Click Yes.
5 After that has been installed, open a .cql file.
6 The cql language server will automatically install.

Address already in use when attempting to execute

When attempting to Execute CQL in the Atom plugin, we're getting the following error:

ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [:735]

Breaking change for FHIR.id Types between CQL 1.4 and 1.5

In CQL 1.4 (using extension v2.5.1), Patient.id (and FHIR id's in general) are interpreted as System.Strings. When correctly typing, an error occurs:

CQL 1.4 extension v2.5.1
image

CQL 1.4 exception on FHIR.id
image

Then when switching to CQL 1.5 extension v2.9.1
image

The typing is corrected to FHIR.id, but that is a breaking change from the CQL 1.4 behavior
image

Path resolution not working

I'm curious how to use the tool with any publicly available CQL repositories.

In a fresh repository with the recommended structure, the tool appends an additional input folder name and cannot resolve.

Screen Shot 2021-01-29 at 19 22 46

In using with the connectathon repo, the tool doesn't resolve paths.

Screen Shot 2021-01-29 at 19 19 40

Add support for cql-options.json

FHIR IGs like the Connectathon repository include a cql-options.json file which describes which options the cql should be run with. Currently the cql is executed / translated with default options.

Problems installing 2.4.0

I installed the 2.4.0 upgrade and the CQL language server will not start. Left Atom open over night, closed and reopened several times. Now unable to uninstall language-cql plugin.

Uncaught ReferenceError: minJavaRuntime is not defined

This message appeared when I opened Atom.

  1. ...
  2. ...

Atom: 1.55.0 x64
Electron: 6.1.12
OS: Microsoft Windows 10 Enterprise
Thrown From: language-cql package 2.9.0

Stack Trace

Uncaught ReferenceError: minJavaRuntime is not defined

At C:\Users\linda.duffy\.atom\packages\language-cql\language-cql\pkg\language-cql-common\lib\java-helpers.js:65

ReferenceError: minJavaRuntime is not defined
    at showJavaRequirements (/packages/language-cql/language-cql/pkg/language-cql-common/lib/java-helpers.js:65:136)
    at /packages/language-cql/language-cql/pkg/language-cql-common/lib/java-helpers.js:11:13)
    at ChildProcess.emit (events.js:200:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)

Commands

Non-Core Packages

atom-ide-ui 0.13.0 
language-cql 2.9.0 

Add support for setting options using the cql-options.json file

The latest translator (1.4.9-SNAPSHOT) includes support for reading and writing a translator options file for use in setting translator options. Include support for this capability in the Atom plugin. The CqlTranslatorOptions class in the Cql2Elm translator provides the capability, and the sample-content-ig includes an example options file:

https://github.com/cqframework/sample-content-ig/blob/master/input/cql/cql-options.json

The relevant code in the IG Publisher is here:
https://github.com/HL7/fhir-ig-publisher/blob/master/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/CqlSubSystem.java#L240

Getting Started

I have downloaded atom and installed the language-cql extension. I also installed Java Runtime 1.8 and added the directory (C:\Program Files\Java\jre1.8.0_301\bin) to the path system environment variable.

I am trying to run some of the example exercises available (https://github.com/cqframework/cqf-exercises). I copied these files onto my computer.

When I try to run the exercises, I get a warning that it is unable to determine the version of FHIR used and defaulting to R4 and another tab opens with the following:

Running tests.
No tests found at input\tests. Evaluation may fail if data is required.
No terminology found at input\vocabulary\valueset. Evaluation may fail if terminology is required.

image

Nothing else happens. Even if I purposefully add some syntax errors or try to run a function that has been defined, I don't get any output. What am I missing?

Thanks in advance for your help.

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.