Stream: social
Topic: CQL for Christmas?
Erich Schulz (Jun 12 2016 at 23:34):
I think what I'd like for Christmas is a CQL->javascript transpiler
Grahame Grieve (Jun 13 2016 at 00:35):
well, you have 6 months to write it ;-)
Erich Schulz (Jun 13 2016 at 00:47):
not sure I'm smart enough
Erich Schulz (Jun 13 2016 at 00:54):
although I'm tempted
Erich Schulz (Jun 13 2016 at 00:54):
to attempt it
Bryn Rhodes (Jun 13 2016 at 04:04):
There is a JavaScript engine, though it's definitely an interpreter, a transpiler would be nice.
Erich Schulz (Jun 13 2016 at 04:21):
hey @Bryn Rhodes - yes I finally made it to page 201 of the spec
Erich Schulz (Jun 13 2016 at 04:22):
are there any test case suites?
Erich Schulz (Jun 13 2016 at 04:25):
after dragging my feet for a long time I'm bit of a TDD convert now
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
Erich Schulz (Jun 13 2016 at 11:28):
i suppose I've have to install antlr
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.
Erich Schulz (Jun 13 2016 at 23:07):
I got as far as installing antlr and running it over the g4 file last night
Bryn Rhodes (Jun 13 2016 at 23:08):
Good times :) Have you tried the CQL-to-ELM translator?
Erich Schulz (Jun 13 2016 at 23:09):
no I haven't @Bryn Rhodes
Erich Schulz (Jun 13 2016 at 23:10):
is that in java or javascript?
Erich Schulz (Jun 13 2016 at 23:11):
my plan today is to download the antlr book
Erich Schulz (Jun 13 2016 at 23:11):
all this "visiting" and "listening" is completely foreign!
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.
Bryn Rhodes (Jun 13 2016 at 23:12):
The Antlr4 book is definitely worth a read, Antlr4 is fantastic.
Erich Schulz (Jun 13 2016 at 23:13):
mmm - so you think I should start with an ELM->js compiler then?
Erich Schulz (Jun 13 2016 at 23:13):
which means I wont really need antlr at all since all the parsing is done?
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.
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.
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).
Erich Schulz (Jun 13 2016 at 23:15):
mmm
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
Erich Schulz (Jun 13 2016 at 23:16):
does the cql->elm tool make json?
Erich Schulz (Jun 13 2016 at 23:16):
xml makes my eyes bleed
Bryn Rhodes (Jun 13 2016 at 23:16):
Yes, you can have it output either format.
Bryn Rhodes (Jun 13 2016 at 23:17):
For the JSON, it will add a "type" attribute to the output.
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.
Erich Schulz (Jun 13 2016 at 23:18):
is the cql forum anywhere?
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:
Bryn Rhodes (Jun 13 2016 at 23:23):
https://jira.oncprojectracking.org/browse/CQLIT
Bryn Rhodes (Jun 13 2016 at 23:23):
There's also a wiki we use to coordinate discussions about Formatting and Usage:
Bryn Rhodes (Jun 13 2016 at 23:24):
https://github.com/esacinc/CQL-Formatting-and-Usage-Wiki/wiki
Bryn Rhodes (Jun 13 2016 at 23:24):
The discussions there have a QDM focus though.
Erich Schulz (Jun 13 2016 at 23:25):
awesome
Erich Schulz (Jun 13 2016 at 23:25):
qdm? this is population based logic?
Bryn Rhodes (Jun 13 2016 at 23:26):
CQL can do both patient and population logic, yes.
Bryn Rhodes (Jun 13 2016 at 23:26):
There's a context declaration.
Bryn Rhodes (Jun 13 2016 at 23:28):
There's also a CQL page on the eCQI Resource Center:
Bryn Rhodes (Jun 13 2016 at 23:28):
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.
Bryn Rhodes (Jun 13 2016 at 23:28):
In particular, we're doing an implementer one that you would probably be interested in.
Erich Schulz (Jun 14 2016 at 00:45):
that's great @Bryn Rhodes - thanks for the pointers
Erich Schulz (Jun 14 2016 at 01:06):
so sounds like I need fire up the CQL to ELM translator
Erich Schulz (Jun 14 2016 at 06:55):
i suppose you're in bed @Bryn Rhodes ?
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
Erich Schulz (Jun 14 2016 at 06:56):
on ./gradlew build
Erich Schulz (Jun 14 2016 at 06:57):
following https://github.com/cqframework/clinical_quality_language/blob/master/Src/java/README.md
Erich Schulz (Jun 14 2016 at 07:01):
actually never mind - i should have googled
Erich Schulz (Jun 14 2016 at 08:18):
urg
Erich Schulz (Jun 14 2016 at 08:19):
i've now progressed to invalid source release: 1.8
Erich Schulz (Jun 14 2016 at 08:34):
urg
Erich Schulz (Jun 14 2016 at 08:34):
I'm going to try in a docker
Erich Schulz (Jun 14 2016 at 09:11):
I'm getting this now with java 9:
Erich Schulz (Jun 14 2016 at 09:11):
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'.
Erich Schulz (Jun 14 2016 at 09:13):
this is no the vanilla java 9 image specified here
Erich Schulz (Jun 14 2016 at 09:14):
at least with the docker I can now just try again on 8...
Erich Schulz (Jun 14 2016 at 09:21):
ok java 8 seemed to burn for longer
Erich Schulz (Jun 14 2016 at 09:21):
then died with:
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
Erich Schulz (Jun 14 2016 at 09:22):
will now try 7
Erich Schulz (Jun 14 2016 at 09:26):
am putting work into bitbucket...
Erich Schulz (Jun 14 2016 at 09:26):
https://bitbucket.org/erichbschulz/cql_java
Erich Schulz (Jun 14 2016 at 09:26):
i'm sure something will work soon
Erich Schulz (Jun 14 2016 at 09:27):
sigh
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
Erich Schulz (Jun 14 2016 at 09:33):
trying with 6 now...
Erich Schulz (Jun 14 2016 at 09:38):
ok 6 fails with same error as 7
Bryn Rhodes (Jun 14 2016 at 22:57):
I saw you post to the CQL issues tracker, did that resolve this?
Erich Schulz (Jun 14 2016 at 22:58):
heya @Bryn Rhodes sadly no
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
Erich Schulz (Jun 14 2016 at 23:03):
this is the docker image I'm using
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
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?
Bryn Rhodes (Jun 14 2016 at 23:09):
I posted a comment on the issue, BTW.
Erich Schulz (Jun 14 2016 at 23:10):
FHIR based examples would be good
Erich Schulz (Jun 14 2016 at 23:10):
i'm just setting up that docker on my lap-top
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
Erich Schulz (Jun 14 2016 at 23:14):
docker can be a pita - but once its set up its pretty nice
Bryn Rhodes (Jun 14 2016 at 23:44):
Here is the JSON for the measure we ran at the connect-a-thon:
Bryn Rhodes (Jun 14 2016 at 23:44):
Erich Schulz (Jun 14 2016 at 23:55):
great - thanks Bryn - I'll have a poke at that
Erich Schulz (Jun 14 2016 at 23:56):
is there any test data that a final script could be pointed at?
Erich Schulz (Jun 14 2016 at 23:56):
also do you have the .cql that matches that json?
Bryn Rhodes (Jun 14 2016 at 23:57):
The CQL is here:
Bryn Rhodes (Jun 14 2016 at 23:57):
Bryn Rhodes (Jun 15 2016 at 00:01):
I do have a zip with data, how best to get that to you?
Bryn Rhodes (Jun 15 2016 at 00:02):
It's not huge, I just don't have it committed anywhere.
Erich Schulz (Jun 15 2016 at 00:22):
I just pm'd you my email address
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
Erich Schulz (Jun 16 2016 at 02:34):
so I now have the CLQ->ELM translater running :-)
Erich Schulz (Jun 16 2016 at 02:34):
i just need it to get json output happening...
Erich Schulz (Jun 16 2016 at 03:03):
woot!
Erich Schulz (Jun 16 2016 at 03:03):
so that is CQL
-> ELM (json)
in the house
Erich Schulz (Jun 16 2016 at 03:04):
now I just need a JS generator
Erich Schulz (Jun 16 2016 at 03:04):
and a runtime
Erich Schulz (Jun 16 2016 at 03:04):
and FHIR request interface
Erich Schulz (Jun 16 2016 at 03:05):
and a test suite...
Erich Schulz (Jun 16 2016 at 03:05):
and ?? 200 hours??
Bryn Rhodes (Jun 16 2016 at 05:12):
Nice, glad it's working. And yes, 200 hours would be nice :)
Erich Schulz (Jun 17 2016 at 07:36):
well that is "hello world" done in ~24 hours
Erich Schulz (Jun 17 2016 at 07:37):
Its, erm, not a small job tho...
Erich Schulz (Jun 17 2016 at 07:38):
needs some friendly computer science honours students to help out...
Erich Schulz (Jun 17 2016 at 07:38):
there has to be a few PhD theses in there
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
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
Erich Schulz (Jun 20 2016 at 11:11):
@Bryn Rhodes at current pace maybe before Christmas
Erich Schulz (Jun 20 2016 at 11:14):
I still have a big 'runtime' to write
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