FHIR Chat · CQL for Christmas? · social

Stream: social

Topic: CQL for Christmas?


view this post on Zulip Erich Schulz (Jun 12 2016 at 23:34):

I think what I'd like for Christmas is a CQL->javascript transpiler

view this post on Zulip Grahame Grieve (Jun 13 2016 at 00:35):

well, you have 6 months to write it ;-)

view this post on Zulip Erich Schulz (Jun 13 2016 at 00:47):

not sure I'm smart enough

view this post on Zulip Erich Schulz (Jun 13 2016 at 00:54):

although I'm tempted

view this post on Zulip Erich Schulz (Jun 13 2016 at 00:54):

to attempt it

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 04:04):

There is a JavaScript engine, though it's definitely an interpreter, a transpiler would be nice.

view this post on Zulip Erich Schulz (Jun 13 2016 at 04:21):

hey @Bryn Rhodes - yes I finally made it to page 201 of the spec

view this post on Zulip Erich Schulz (Jun 13 2016 at 04:22):

are there any test case suites?

view this post on Zulip Erich Schulz (Jun 13 2016 at 04:25):

after dragging my feet for a long time I'm bit of a TDD convert now

view this post on Zulip Erich Schulz (Jun 13 2016 at 08:23):

although to be honest don't even need a suite - just a couple of patients in FHIR json and some basic scripts might be engough to get started

view this post on Zulip Erich Schulz (Jun 13 2016 at 11:28):

i suppose I've have to install antlr

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 13:59):

Yes, there are tests for the engine, in the test folder. I'm not sure how extensive they are, but should be enough to get started.

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:07):

I got as far as installing antlr and running it over the g4 file last night

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:08):

Good times :) Have you tried the CQL-to-ELM translator?

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:09):

no I haven't @Bryn Rhodes

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:10):

is that in java or javascript?

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:11):

my plan today is to download the antlr book

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:11):

all this "visiting" and "listening" is completely foreign!

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:11):

It's in Java, but it spits out ELM (basically the type-verified parse tree) and is a better starting point than the grammar directly for dealing with CQL. It handles things like implicit conversions, and timing phrase interpretation.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:12):

The Antlr4 book is definitely worth a read, Antlr4 is fantastic.

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:13):

mmm - so you think I should start with an ELM->js compiler then?

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:13):

which means I wont really need antlr at all since all the parsing is done?

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:14):

That's where I'd start, yes. It's a simplified format that's intended to support implementation of language processing applications like transpilers.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:14):

It's also invokable as a microservice so you could write your transpiler in JS or Java or whatever language suits your fancy.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:15):

But yes, it means you wouldn't have to deal with the Antlr4 (I'd still recommend familiarizing yourself with Antlr4, it's a great tool).

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:15):

mmm

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:16):

antlr does look cool - but it sounds like it just fell off my "things I should read about before I die" list

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:16):

does the cql->elm tool make json?

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:16):

xml makes my eyes bleed

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:16):

Yes, you can have it output either format.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:17):

For the JSON, it will add a "type" attribute to the output.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:17):

If you look at the existing JavaScript engine, it's running of the JSON representation of ELM.

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:18):

is the cql forum anywhere?

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:23):

There isn't a social forum like Zulip, but you can submit issues to the ONC Jira here:

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:23):

https://jira.oncprojectracking.org/browse/CQLIT

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:23):

There's also a wiki we use to coordinate discussions about Formatting and Usage:

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:24):

https://github.com/esacinc/CQL-Formatting-and-Usage-Wiki/wiki

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:24):

The discussions there have a QDM focus though.

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:25):

awesome

view this post on Zulip Erich Schulz (Jun 13 2016 at 23:25):

qdm? this is population based logic?

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:26):

CQL can do both patient and population logic, yes.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:26):

There's a context declaration.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:28):

There's also a CQL page on the eCQI Resource Center:

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:28):

https://ecqi.healthit.gov/cql

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:28):

That has links to past webinars we've done on CQL, as well as the schedule for future ones.

view this post on Zulip Bryn Rhodes (Jun 13 2016 at 23:28):

In particular, we're doing an implementer one that you would probably be interested in.

view this post on Zulip Erich Schulz (Jun 14 2016 at 00:45):

that's great @Bryn Rhodes - thanks for the pointers

view this post on Zulip Erich Schulz (Jun 14 2016 at 01:06):

so sounds like I need fire up the CQL to ELM translator

view this post on Zulip Erich Schulz (Jun 14 2016 at 06:55):

i suppose you're in bed @Bryn Rhodes ?

view this post on Zulip Erich Schulz (Jun 14 2016 at 06:55):

i'm getting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cql:compileJava'.
> Could not find tools.jar

view this post on Zulip Erich Schulz (Jun 14 2016 at 06:56):

on ./gradlew build

view this post on Zulip Erich Schulz (Jun 14 2016 at 06:57):

following https://github.com/cqframework/clinical_quality_language/blob/master/Src/java/README.md

view this post on Zulip Erich Schulz (Jun 14 2016 at 07:01):

actually never mind - i should have googled

view this post on Zulip Erich Schulz (Jun 14 2016 at 08:18):

urg

view this post on Zulip Erich Schulz (Jun 14 2016 at 08:19):

i've now progressed to invalid source release: 1.8

view this post on Zulip Erich Schulz (Jun 14 2016 at 08:34):

urg

view this post on Zulip Erich Schulz (Jun 14 2016 at 08:34):

I'm going to try in a docker

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:11):

I'm getting this now with java 9:

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:11):

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:12):

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9-internal'.

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:13):

this is no the vanilla java 9 image specified here

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:14):

at least with the docker I can now just try again on 8...

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:21):

ok java 8 seemed to burn for longer

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:21):

then died with:

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:21):

FAILURE: Build failed with an exception.

* Where:
Build file '/usr/src/myapp/elm/build.gradle' line: 12

* What went wrong:
Execution failed for task ':elm:generateSources'.
> unable to parse the schema. Error messages should have been provided

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:22):

will now try 7

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:26):

am putting work into bitbucket...

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:26):

https://bitbucket.org/erichbschulz/cql_java

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:26):

i'm sure something will work soon

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:27):

sigh

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:27):

:cql:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cql:test'.
> There were failing tests. See the report at: file:///usr/src/myapp/cql/build/repor
ts/tests/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug opti
on to get more log output.

BUILD FAILED

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:33):

trying with 6 now...

view this post on Zulip Erich Schulz (Jun 14 2016 at 09:38):

ok 6 fails with same error as 7

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 22:57):

I saw you post to the CQL issues tracker, did that resolve this?

view this post on Zulip Erich Schulz (Jun 14 2016 at 22:58):

heya @Bryn Rhodes sadly no

view this post on Zulip Erich Schulz (Jun 14 2016 at 22:59):

I got a docker up with the oracle jdk and got the error at Build file '/usr/src/myapp/elm/build.gradle' line: 12 still

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:03):

this is the docker image I'm using

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:04):

I'm thinking if I could get access to the json versions of the eml for example cql files then I could start poking at a transpiler

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:08):

I've got it running locally, happy to provide JSON examples. Would you want QDM or FHIR based examples?

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:09):

I posted a comment on the issue, BTW.

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:10):

FHIR based examples would be good

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:10):

i'm just setting up that docker on my lap-top

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:13):

only now I'm on my laptop using the hospital lan :-) so bare with me and I'll get those debug traces

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:14):

docker can be a pita - but once its set up its pretty nice

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:44):

Here is the JSON for the measure we ran at the connect-a-thon:

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:44):

https://github.com/cqframework/clinical_quality_language/blob/dstu-updates/Examples/EH_CMS9v4_NQF0480_BF_ExclusiveBreastFeed/CMS9v4_CQM.json

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:55):

great - thanks Bryn - I'll have a poke at that

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:56):

is there any test data that a final script could be pointed at?

view this post on Zulip Erich Schulz (Jun 14 2016 at 23:56):

also do you have the .cql that matches that json?

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:57):

The CQL is here:

view this post on Zulip Bryn Rhodes (Jun 14 2016 at 23:57):

https://github.com/cqframework/clinical_quality_language/blob/dstu-updates/Examples/EH_CMS9v4_NQF0480_BF_ExclusiveBreastFeed/CMS9v4_CQM.cql

view this post on Zulip Bryn Rhodes (Jun 15 2016 at 00:01):

I do have a zip with data, how best to get that to you?

view this post on Zulip Bryn Rhodes (Jun 15 2016 at 00:02):

It's not huge, I just don't have it committed anywhere.

view this post on Zulip Erich Schulz (Jun 15 2016 at 00:22):

I just pm'd you my email address

view this post on Zulip Erich Schulz (Jun 15 2016 at 11:08):

i tell you what... writing (or I should say attempting to write) a transpiler is a mighty fine way to get to grips with the nuances of a language

view this post on Zulip Erich Schulz (Jun 16 2016 at 02:34):

so I now have the CLQ->ELM translater running :-)

view this post on Zulip Erich Schulz (Jun 16 2016 at 02:34):

i just need it to get json output happening...

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:03):

woot!

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:03):

so that is CQL -> ELM (json) in the house

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:04):

now I just need a JS generator

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:04):

and a runtime

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:04):

and FHIR request interface

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:05):

and a test suite...

view this post on Zulip Erich Schulz (Jun 16 2016 at 03:05):

and ?? 200 hours??

view this post on Zulip Bryn Rhodes (Jun 16 2016 at 05:12):

Nice, glad it's working. And yes, 200 hours would be nice :)

view this post on Zulip Erich Schulz (Jun 17 2016 at 07:36):

well that is "hello world" done in ~24 hours

view this post on Zulip Erich Schulz (Jun 17 2016 at 07:37):

Its, erm, not a small job tho...

view this post on Zulip Erich Schulz (Jun 17 2016 at 07:38):

needs some friendly computer science honours students to help out...

view this post on Zulip Erich Schulz (Jun 17 2016 at 07:38):

there has to be a few PhD theses in there

view this post on Zulip Erich Schulz (Jun 19 2016 at 03:57):

note to self... never return a string from a complicated function... I keep doing it then regretting it

view this post on Zulip Erich Schulz (Jun 19 2016 at 04:32):

there's always meta data... in this case I need to track {js, deps, type} not just js

view this post on Zulip Erich Schulz (Jun 20 2016 at 11:11):

@Bryn Rhodes at current pace maybe before Christmas

view this post on Zulip Erich Schulz (Jun 20 2016 at 11:14):

I still have a big 'runtime' to write

view this post on Zulip Erich Schulz (Jun 20 2016 at 11:15):

but hopefully I can plagerise the interpreter for a lot of that


Last updated: Apr 12 2022 at 19:14 UTC