cqframework / clinical_quality_language

Clinical Quality Language (CQL) is an HL7 specification for the expression of clinical knowledge that can be used within both the Clinical Decision Support (CDS) and Clinical Quality Measurement (CQM) domains. This repository contains complementary tooling in support of that specification.
https://confluence.hl7.org/display/CDS/Clinical+Quality+Language
Apache License 2.0
257 stars 120 forks source link

Compilation Error when imported the java-quickstart project into Eclipse #112

Closed ishwaryaakkiah closed 7 years ago

ishwaryaakkiah commented 7 years ago

errors

brynrhodes commented 7 years ago

Hi @ishwaryaakkiah, I haven't tried to run the java quickstart from Eclipse, so I'm not sure what the error you are seeing is. Are you able to run the quickstart using just Gradle and following the readme here?

ishwaryaakkiah commented 7 years ago

Hi Bryn, I have tried today to run cqltoelm program in eclipse by using gradle build system. Was able to convert the cql to json and XML.. Can I please know few details regarding CQL. 1). What is the flow for a complete project using CQL? 2). What is the input data provided for CQL? What format is the input? 3).How is the output (JSON/XML) from CQL is processed further??

Can you please help me out with this? I surfed through all sites,but couldn't get exactly what I am searching for..

Looking forward from you.. On 10-May-2017 11:38 am, "Bryn Rhodes" notifications@github.com wrote:

Hi @ishwaryaakkiah https://github.com/ishwaryaakkiah, I haven't tried to run the java quickstart from Eclipse, so I'm not sure what the error you are seeing is. Are you able to run the quickstart using just Gradle and following the readme here https://github.com/cqframework/clinical_quality_language/blob/master/Src/java-quickstart/README.md ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cqframework/clinical_quality_language/issues/112#issuecomment-300384136, or mute the thread https://github.com/notifications/unsubscribe-auth/AbNIBlDj3OZumiJIdjQ0k910Djyk__ZXks5r4VRigaJpZM4NTl8s .

cmoesel commented 7 years ago

Hi Ishwarya,

If you haven't seen it already, the CQL specification may be able to clear up some of your questions: http://www.hl7.org/implement/standards/product_brief.cfm?product_id=400

Regarding your specific questions:

What is the flow for a complete project using CQL?

I'm not entirely sure what you mean, but I guess an end-to-end flow might look like:

  1. Usually eCQM/CDS is backed by evidence. So the first step is to gather the evidence, determine feasibility, etc., and perhaps write pseudo code to prepare for more formal CQL authoring.
  2. Write the CQL. This is also when you need to choose a data model (FHIR 1.0.2, FHIR 3.0.0, QDM, etc). The CQL author will likely want to use the CQL-to-ELM tool during authoring to ensure syntactic validity of the CQL.
  3. Convert CQL to ELM. As you already know we have a tool for this. You can also use Gradle's installDist task to create a local script (bash or bat) to easily launch CQL-to-ELM at the commandline. We convert to ELM for two reasons: (a) it verifies there are no syntactic errors in the CQL, and (b) CQL execution platforms usually execute against ELM, not CQL, because ELM is easier for machines to parse (it's essentially an Abstract Syntax Tree).
  4. Testing. Ideally, there would be tests to ensure the CQL works as expected -- perhaps passing in synthetic health records and verifying the CQL calculates the correct answers. Of course, this requires a way to execute the CQL. There are a couple of open source CQL interpreters/executors out there (here and here).
  5. Integration. Finally, integrating it in a real environment. How exactly this works will depend on the environment and may use some of the open source components available or may use a proprietary implementation of CQL.

What is the input data provided for CQL? What format is the input?

CQL doesn't really say what format the input data must be in, but a CQL implementation will interact with the data using the form of the data model identified in the CQL. For example, if the CQL uses the FHIR 3.0.0 data model, then the CQL will query and process data using FHIR 3.0.0 data types and attributes. It's likely easiest if the data itself is in the FHIR 3.0.0 format, but it's possible to operate against data in a different format if there is an adaptor to do the translation.

The CQL spec doesn't really say much about how this should be implemented in a runtime. For some implementations, input data might be retrieved in real time, as the CQL is being processed. This required the implementation to know how to physically retrieve the data from the system. Other implementations expect all of the required data to be passed into the CQL implementation with the CQL execution request -- so the CQL implementation doesn't need to know the details of the system that houses the data.

In the two open source CQL engines I linked above, I believe that one (the Java one) queries data from a FHIR database, and the other (the CoffeeScript one) expects all data to be provided as a JSON array of FHIR resources.

How is the output (JSON/XML) from CQL is processed further?

That's up to the implementation -- but Section 5 in the CQL specification includes some guidance about implementation.

Can I please know how to build custom data model for CQL?

In our reference implementations, we use what we call a model-info file to describe the data model. This model-info can be passed into the CQL-to-ELM translator to be used during the translation. It may also be used by the CQL execution implementation to assist in building and processing queries (although our CoffeeScript implementation does not do this).

Here's the schema for the model-info file:

And here are a few examples:

If you use gradle installDist (from the cql-to-elm project root), then this is how you would pass your model into the cql-to-elm via the commandline:

./build/install/cql-to-elm/bin/cql-to-elm --input path/to/your/cql --model path/to/your/modelinfo.xml --format JSON

(The above works on Mac. You might have to adjust a bit for Windows.)

Hopefully this information helps as you begin to work with CQL.

ishwaryaakkiah commented 7 years ago

Thankssss a lottttt buddy :-)

ishwaryaakkiah commented 7 years ago

Hi Chris, Thanks for your valuable time. I really love working with CQL ,I am learning new things everyday .Its really amazing. I have few more doubts in building up the model: 1).Can I please know do we have any database connectivity made ,to pull the data for executing the CQL? 2).How data is being passed in CQL??

cmoesel commented 7 years ago

I'm glad you're enjoying working with CQL!

The CoffeeScript/JavaScript execution engine does not pull from any databases. It expects patient data to be provided to it as an array of FHIR resources in JSON format. Constructing that array of data (via a DB query or FHIR query) is outside of the scope of the CoffeeScript/JavaScript execution engine.

That said, the Java-based execution engine can be used as a plugin to a HAPI server, in which case it pulls data from the HAPI database. As an added bonus, at this point, my understanding is that the Java-based engine is more mature and feature-complete anyway. If you need/want more information on the Java engine, I'd check with @brynrhodes.

ishwaryaakkiah commented 7 years ago

Thank You Chris..

ishwaryaakkiah commented 7 years ago

Hi Bryn, Thanks for your valuable time.I have done few testings before building an engine to execute CQL. It's really amazing to work in new technology like CQL. Can I please,know few details to proceed further : 1).While analyzing,java based engine for CQL execution, found that your evaluating each expressions(defined in CQL - if I'm not wrong.) of the cql..Can I please know the reason behind it? What will be the output for this? 2).Can we please, get a sample output produced finally by the engine. 3).When we tried to execute the test file(TestFhirLibrary.java),we tried to fetch the result,but it was empty and throws following exception: FhirClientConnectionException: Failed to retrieve the server metadata statement during client initialization. URL used was http://fhirtest.uhn.ca/baseDstu3/metadata Do we need to provide any input ? I tried changing the URL to http://fhirtest.uhn.ca/baseDstu2/ http://fhirtest.uhn.ca/baseDstu2/ , even throws exception.Can I ,please know what output is returned? 4).While analyzing, found that Data model's datatypes and attributes are used to build a CQL - Please correct me if I am wrong. There are various data models available like QDM,QUICK,FHIR - why do we use these data models? Without using these data models can't we execute a CQL? Is CQL dependent on data model? 5).Can I please know do we have any database connectivity made ,to pull the data for executing the CQL using data models? 6).How data from the DB is passed in CQL?

Can you please help us, by sparing your valuable time.

Thanks & Regards

Ishwarya Akkiah

On Wed, May 10, 2017 at 11:38 AM, Bryn Rhodes notifications@github.com wrote:

Hi @ishwaryaakkiah https://github.com/ishwaryaakkiah, I haven't tried to run the java quickstart from Eclipse, so I'm not sure what the error you are seeing is. Are you able to run the quickstart using just Gradle and following the readme here https://github.com/cqframework/clinical_quality_language/blob/master/Src/java-quickstart/README.md ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cqframework/clinical_quality_language/issues/112#issuecomment-300384136, or mute the thread https://github.com/notifications/unsubscribe-auth/AbNIBlDj3OZumiJIdjQ0k910Djyk__ZXks5r4VRigaJpZM4NTl8s .

brynrhodes commented 7 years ago

Hi Ishwarya,

1).While analyzing,java based engine for CQL execution, found that your evaluating each expressions(defined in CQL - if I'm not wrong.) of the cql..Can I please know the reason behind it? What will be the output for this?

The CQL specification is designed to enable sharing of clinical knowledge like measures and decision support artifacts. The actual "sharing" portion of the specification is Expression Logical Model (ELM). The ELM can be used to evaluate the expression directly (which is what the Java-based and JavaScript-based engines are doing), or it can be the input to a translation step that converts the ELM into a format suitable for execution in a target environment (such as Drools or a SQL-based DBMS).

In the Java-based engine, each node in the ELM is represented by a class that knows how to implement the evaluation for that operator. Each node implements an "Evaluate" interface, and the ELM expression is then evaluated by calling Evaluate() on the root node.

2).Can we please, get a sample output produced finally by the engine.

The unit tests in the engine provide example inputs and outputs. Are you able to use those?

3).When we tried to execute the test file(TestFhirLibrary.java),we tried to fetch the result,but it was empty and throws following exception...

I'm not sure what's going on there, can you submit an issue to the cql-engine repository? The metadata retrieval link is working for me, so this may need more investigation.

4).While analyzing, found that Data model's datatypes and attributes are used to build a CQL - Please correct me if I am wrong. There are various data models available like QDM,QUICK,FHIR - why do we use these data models? Without using these data models can't we execute a CQL? Is CQL dependent on data model?

No, you don't need to specify a data model to use CQL, but if you don't specify one, then you are limited to working with literals and selectors. Whenever you need to retrieve data from a source (such as patient information), you need to specify a data model so that the translator understands what the structures in that model look like (i.e. the result type of the retrieve). CQL supports working with any data model, you just have to provide a model info file to describe it so the translator can validate the expressions you have written.

5).Can I please know do we have any database connectivity made ,to pull the data for executing the CQL using data models?

We recently built a connector that uses JDBC to access a SqlLite database in the CDC Opioid Logic repository.

6).How data from the DB is passed in CQL?

It's up to the implementation environment to define the physical representation of the data involved. In the Java-based implementation, for the FHIR model, for example, we use the HAPI FHIR classes directly. The DataProvider interface provides wrapper methods that the engine interacts with to access the data and attributes of the instances.

I hope this helps.

ishwaryaakkiah commented 7 years ago

Hi Bryn, Thanks for your reply. Sorry to bother you. Still few more doubts arise when I tried to understand your points. As you said in below points:

4).While analyzing, found that Data model's datatypes and attributes are used to build a CQL - Please correct me if I am wrong. There are various data models available like QDM,QUICK,FHIR - why do we use these data models? Without using these data models can't we execute a CQL? Is CQL dependent on data model?

             No, you don't need to specify a data model to use CQL, but

if you don't specify one, then you are limited to working with literals and selectors. Whenever you need to retrieve data from a source (such as patient information), you need to specify a data model so that the translator understands what the structures in that model look like (i.e. the result type of the retrieve). CQL supports working with any data model, you just have to provide a model info file to describe it so the translator can validate the expressions you have written.

                 --- Here can I please know how customized data model

is integrated with the CQL? As per my analysis, existing model is integrated to cql through xml schema and using JAXB it's converted into java objects(please correct me if I'm wrong).

5).Can I please know do we have any database connectivity made ,to pull the data for executing the CQL using data models?

              We recently built a connector that uses JDBC to access a

SqlLite database in the CDC Opioid Logic https://github.com/cqframework/opioid-cds-logic/tree/master/java/omtk-provider repository.

          Where is the input being passed for CQL? As per my analysis,

in TestFhirPath.java , loadTests() loads the tests-fhir-r3.xml , which contains patient-example.xml,observation-example.xml as input file and this input is passed to the cql mentioned in runTest() method. Can I please know , whether I'm correct? Thanks & Regards Ishwarya Akkiah

On Wed, May 31, 2017 at 9:00 AM, Bryn Rhodes notifications@github.com wrote: Hi Ishwarya, 1).While analyzing,java based engine for CQL execution, found that your evaluating each expressions(defined in CQL - if I'm not wrong.) of the cql..Can I please know the reason behind it? What will be the output for this? The CQL specification is designed to enable sharing of clinical knowledge like measures and decision support artifacts. The actual "sharing" portion of the specification is Expression Logical Model (ELM). The ELM can be used to evaluate the expression directly (which is what the Java-based and JavaScript-based engines are doing), or it can be the input to a translation step that converts the ELM into a format suitable for execution in a target environment (such as Drools or a SQL-based DBMS). In the Java-based engine, each node in the ELM is represented by a class that knows how to implement the evaluation for that operator. Each node implements an "Evaluate" interface, and the ELM expression is then evaluated by calling Evaluate() on the root node. 2).Can we please, get a sample output produced finally by the engine. The unit tests in the engine provide example inputs and outputs. Are you able to use those? 3).When we tried to execute the test file(TestFhirLibrary.java),we tried to fetch the result,but it was empty and throws following exception... I'm not sure what's going on there, can you submit an issue to the cql-engine repository? The metadata retrieval link is working for me, so this may need more investigation. 4).While analyzing, found that Data model's datatypes and attributes are used to build a CQL - Please correct me if I am wrong. There are various data models available like QDM,QUICK,FHIR - why do we use these data models? Without using these data models can't we execute a CQL? Is CQL dependent on data model? No, you don't need to specify a data model to use CQL, but if you don't specify one, then you are limited to working with literals and selectors. Whenever you need to retrieve data from a source (such as patient information), you need to specify a data model so that the translator understands what the structures in that model look like (i.e. the result type of the retrieve). CQL supports working with any data model, you just have to provide a model info file to describe it so the translator can validate the expressions you have written. 5).Can I please know do we have any database connectivity made ,to pull the data for executing the CQL using data models? We recently built a connector that uses JDBC to access a SqlLite database in the CDC Opioid Logic https://github.com/cqframework/opioid-cds-logic/tree/master/java/omtk-provider repository. 6).How data from the DB is passed in CQL? It's up to the implementation environment to define the physical representation of the data involved. In the Java-based implementation, for the FHIR model, for example, we use the HAPI FHIR classes directly. The DataProvider interface provides wrapper methods that the engine interacts with to access the data and attributes of the instances. I hope this helps. — You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/cqframework/clinical_quality_language/issues/112#issuecomment-305072332, or mute the thread https://github.com/notifications/unsubscribe-auth/AbNIBqI8kv5u1JJCQHhoD2wLmHniyQzoks5r_N7SgaJpZM4NTl8s .

brynrhodes commented 7 years ago

Hi Ishwarya,

No, the OutputType.java is part of the FHIRPath test harness.

Regards, Bryn

ishwaryaakkiah commented 7 years ago

Thanks a lot Bryn for sparing your valuable time.

Thanks & Regards

Ishwarya Akkiah

Software Engineer, BORN

[image: Group GMG Logo]

2nd Floor, Hardy Tower, Ramanujan IT SEZ,

TRIL Infopark Limited, Taramani, Chennai - 600113

www.borngroup.com

On Wed, Jun 7, 2017 at 1:44 AM, Bryn Rhodes notifications@github.com wrote:

Hi Ishwarya,

No, the OutputType.java is part of the FHIRPath test harness.

Regards, Bryn

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cqframework/clinical_quality_language/issues/112#issuecomment-306603644, or mute the thread https://github.com/notifications/unsubscribe-auth/AbNIBrcOPq8fr2xDQzFBac-heQDM0PO3ks5sBbM9gaJpZM4NTl8s .