question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Retrieve library ELM XML from CQLTranslator

See original GitHub issue

We have a use-case where we translate CQL queries to ELM XML programmatically. This is being done via the CqlTranslator class, which has factory methods that take input streams, strings, and files. We can then invoke the toXml method to obtain the ELM AST that we then use to run the CQL query. This works for queries that are entirely self-contained, but the XML returned does not contain the ELM for libraries referenced by the query. This ELM is necessary for us to compile the query in its entirety.

The necessary information seems to be present in the LibraryManager class, specifically the private libraries field. Libraries can be located via the resolveLibrary method on LibraryManager but this method requires that the caller be searching for a particular library. Additionally, the fact that it takes a list of CqlTranslatorException suggests to me that this may not be intended to be called by external users, but rather used in internal translation.

Would you consider adding/merging a PR to add a method on CqlTranslator like

public getLibrariesXmlById <String, String>(){

}

where the keys would be the library ID and the values would be the ELM XML for the corresponding libraries?

I think something like this could be accomplished at a user level by walking the AST and finding all libraries that need to be looked up, but this seems like unnecessary complication and still seems potentially problematic if resolveLibrary isn’t intended to be called by users. For an implementor, the cleanest architecture seems to me to be to segregate the translation into an AST into its own component and have the rest of the implementation work purely in terms of this AST, regardless of how that AST was generated.

Alternatively, is there something I’m missing about the API and the reasoning behind it? Perhaps there is a way to accomplish these goals already that I’m missing.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brynrhodescommented, Apr 19, 2019

Adressed in 1.3.14

0reactions
WilliamParkercommented, Dec 6, 2017

That should work for us @brynrhodes, thanks. We may not have time to create a PR in December but hopefully we can get to it in the near future if it isn’t otherwise addressed first.

cc @bdrillard

Read more comments on GitHub >

github_iconTop Results From Across the Web

org.cqframework.cql.cql2elm.CqlTranslator Java Examples
Evaluate the given expression, within the context of the given Person and timestamp. * The given expression will be wrapped in CQL and...
Read more >
org.hl7.elm.r1.VersionedIdentifier.getId java code examples
How to use. getId. method. in. org.hl7.elm.r1.VersionedIdentifier. Best Java code snippets using org.hl7.
Read more >
Parsing XML in Elm - Stack Overflow
In Elm, how do I parse an XML file? I see lots of example for JSON decoders, but I cannot find an XML...
Read more >
elm-xml-parser 2.0.0 - Elm Packages
parse : String -> Result Parser.Error Xml format : Xml -> String. Typically, you'll use parse function, get the root node and traverse...
Read more >
7. Physical Representation - Clinical Quality Language (CQL)
The physical representation is simply a set of XML schemata which define XML types for each class defined in the ELM UML model....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found