Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated translatedLibraryMap to store versionedIdentifier.getId() as … #106

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.LibraryBuilder;
import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.hl7.elm.r1.VersionedIdentifier;
import org.springframework.stereotype.Service;

import java.io.IOException;
Expand All @@ -42,12 +43,18 @@ private CQLTools parseCql(String cql, String accessToken) {
cqlConversionService.setUpLibrarySourceProvider(cql, accessToken);
CqlTranslator cqlTranslator = runTranslator(cql);

Map<String, CompiledLibrary> translatedLibraries = new HashMap<>();
cqlTranslator
.getTranslatedLibraries()
.forEach((key, value) -> translatedLibraries.put(key.getId(), value));

CQLTools cqlTools =
new CQLTools(
cql,
getIncludedLibrariesCql(librarySourceProvider, cqlTranslator),
getParentExpressions(cql),
cqlTranslator);
cqlTranslator,
translatedLibraries);

try {
cqlTools.generate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class CQLTools {

private Map<String, String> qdmTypeInfoMap = new HashMap<>();

private Map<VersionedIdentifier, CompiledLibrary> CompiledLibraryMap;
private Map<String, CompiledLibrary> CompiledLibraryMap;

/** Map in the form of <LibraryName-x.x.xxx, <ExpressionName, ReturnType>>. */
private Map<String, Map<String, String>> allNamesToReturnTypeMap = new HashMap<>();
Expand All @@ -79,26 +79,12 @@ public class CQLTools {
Set<String> usedCodeSystems = new HashSet<>();
DataCriteria dataCriteria = new DataCriteria();

public CQLTools(
String parentLibraryString,
Map<String, String> childrenLibraries,
List<String> parentExpressions,
CqlTranslator translator) {

this(
parentLibraryString,
childrenLibraries,
parentExpressions,
translator,
translator.getTranslatedLibraries());
}

public CQLTools(
String parentLibraryString,
Map<String, String> childrenLibraries,
List<String> parentExpressions,
CqlTranslator translator,
Map<VersionedIdentifier, CompiledLibrary> translatedLibraries) {
Map<String, CompiledLibrary> translatedLibraries) {

this.parentLibraryString = parentLibraryString;
this.translator = translator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class Cql2ElmListener extends cqlBaseListener {
private final CompiledLibrary library;

/** The map of the other libraries in the current library */
Map<VersionedIdentifier, CompiledLibrary> translatedLibraryMap;
Map<String, CompiledLibrary> translatedLibraryMap;

/** The current context, aka which expression are we currently in. */
private String currentContext;
Expand All @@ -84,7 +84,7 @@ public class Cql2ElmListener extends cqlBaseListener {
public Cql2ElmListener(
CQLGraph graph,
CompiledLibrary library,
Map<VersionedIdentifier, CompiledLibrary> translatedLibraryMap,
Map<String, CompiledLibrary> translatedLibraryMap,
Map<String, String> childrenLibraries) {
this.graph = graph;
this.library = library;
Expand All @@ -97,7 +97,7 @@ public Cql2ElmListener(
String libraryIdentifier,
CQLGraph graph,
CompiledLibrary library,
Map<VersionedIdentifier, CompiledLibrary> translatedLibraryMap,
Map<String, CompiledLibrary> translatedLibraryMap,
Map<String, String> childrenLibraries) {
this.graph = graph;
this.library = library;
Expand Down
Loading