Skip to content

Commit 2685f46

Browse files
committed
Updated translator to 3.3.2
Added skip-packages option to refresh ig operation Removed operation processing for narrative refresh operations and drools operation NOTE: This is known not to compile at this point, I've removed all the code related to the narrative refresh and drools operations locally, and have published a release based on that local code. This is in anticipation of a reorganization of the tooling that moves different operations into different packages, so I'm committing the changes here that are released as 2.6.0 from my local compile.
1 parent 26701a1 commit 2685f46

File tree

16 files changed

+90
-62
lines changed

16 files changed

+90
-62
lines changed

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55

66
<groupId>org.opencds.cqf</groupId>
77
<artifactId>tooling-parent</artifactId>
8-
<version>2.5.0</version>
9-
8+
<version>2.6.0</version>
109

1110
<packaging>pom</packaging>
1211

1312
<properties>
1413
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1514
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
16-
<cql-engine.version>2.9.0</cql-engine.version>
15+
<cql-engine.version>3.3.2</cql-engine.version>
1716
<cql-evaluator.version>2.6.0</cql-evaluator.version>
18-
<cqframework.version>2.9.0</cqframework.version>
19-
<hapi.version>6.0.1</hapi.version>
20-
<core.version>5.6.36</core.version>
17+
<cqframework.version>3.3.2</cqframework.version>
18+
<hapi.version>6.8.0</hapi.version>
19+
<core.version>6.0.22</core.version>
2120
<spring-boot.version>2.1.5.RELEASE</spring-boot.version>
2221
<log4j2-version>2.17.1</log4j2-version>
2322
</properties>

tooling-cli/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>org.opencds.cqf</groupId>
88
<artifactId>tooling-parent</artifactId>
9-
<version>2.5.0</version>
9+
<version>2.6.0</version>
1010
</parent>
1111

1212
<groupId>org.opencds.cqf</groupId>
1313
<artifactId>tooling-cli</artifactId>
14-
<version>2.5.0</version>
14+
<version>2.6.0</version>
1515
<packaging>jar</packaging>
1616

1717
<description>CQF Tooling CLI</description>
@@ -20,7 +20,7 @@
2020
<dependency>
2121
<groupId>org.opencds.cqf</groupId>
2222
<artifactId>tooling</artifactId>
23-
<version>2.5.0</version>
23+
<version>2.6.0</version>
2424
<!-- <packaging>jar</packaging> -->
2525
</dependency>
2626

tooling-cli/src/main/java/org/opencds/cqf/tooling/cli/OperationFactory.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.opencds.cqf.tooling.Operation;
1010
import org.opencds.cqf.tooling.acceleratorkit.DTProcessor;
1111
import org.opencds.cqf.tooling.acceleratorkit.Processor;
12-
import org.opencds.cqf.tooling.library.r4.LibraryGenerator;
1312
import org.opencds.cqf.tooling.measure.r4.RefreshR4MeasureOperation;
1413
import org.opencds.cqf.tooling.measure.stu3.RefreshStu3MeasureOperation;
1514
import org.opencds.cqf.tooling.modelinfo.StructureDefinitionToModelInfo;
@@ -54,22 +53,12 @@ static Operation createOperation(String operationName) {
5453
return new EnsureExecutableValueSetOperation();
5554
case "ToJsonValueSetDb":
5655
return new ToJsonValueSetDbOperation();
57-
case "CqlToSTU3Library":
58-
return new org.opencds.cqf.tooling.library.stu3.LibraryGenerator();
59-
case "CqlToR4Library":
60-
return new LibraryGenerator();
61-
case "UpdateSTU3Cql":
62-
return new org.opencds.cqf.tooling.library.stu3.LibraryGenerator();
63-
case "UpdateR4Cql":
64-
return new LibraryGenerator();
6556
case "JsonSchemaGenerator":
6657
// return new SchemaGenerator();
6758
case "BundleIg":
6859
return new IgBundler();
6960
// case "PackageIG":
7061
// return new PackageOperation();
71-
case "GenerateCQLFromDrool":
72-
return new GenerateCQLFromDroolOperation();
7362
case "VmrToFhir":
7463
return new VmrToFhirOperation();
7564
case "RefreshIG":

tooling/pom.xml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<parent>
77
<groupId>org.opencds.cqf</groupId>
88
<artifactId>tooling-parent</artifactId>
9-
<version>2.5.0</version>
9+
<version>2.6.0</version>
1010

1111
</parent>
1212

1313
<groupId>org.opencds.cqf</groupId>
1414
<artifactId>tooling</artifactId>
15-
<version>2.5.0</version>
15+
<version>2.6.0</version>
1616
<packaging>jar</packaging>
1717

1818
<dependencies>
@@ -179,6 +179,7 @@
179179
</dependency>
180180

181181
<!-- Narrative Generation -->
182+
<!--
182183
<dependency>
183184
<groupId>org.thymeleaf</groupId>
184185
<artifactId>thymeleaf</artifactId>
@@ -187,15 +188,16 @@
187188
<dependency>
188189
<groupId>com.fasterxml.jackson.core</groupId>
189190
<artifactId>jackson-databind</artifactId>
190-
<version>2.13.4.1</version>
191+
<version>2.15.2</version>
191192
</dependency>
192193
<dependency>
193194
<groupId>com.github.ben-manes.caffeine</groupId>
194195
<artifactId>caffeine</artifactId>
195196
<version>2.9.1</version>
196197
</dependency>
197-
198+
-->
198199
<!-- https://mvnrepository.com/artifact/javax.activation/activation -->
200+
<!--
199201
<dependency>
200202
<groupId>javax.activation</groupId>
201203
<artifactId>activation</artifactId>
@@ -205,7 +207,7 @@
205207
<dependency>
206208
<groupId>com.fasterxml.jackson.module</groupId>
207209
<artifactId>jackson-module-jaxb-annotations</artifactId>
208-
<version>2.13.2</version>
210+
<version>2.14.2</version>
209211
<scope>compile</scope>
210212
</dependency>
211213
<dependency>
@@ -225,7 +227,7 @@
225227
<artifactId>validation-api</artifactId>
226228
<version>2.0.1.Final</version>
227229
</dependency>
228-
230+
-->
229231
<!--redirects apache commons-logging to slf4j -->
230232
<dependency>
231233
<groupId>org.slf4j</groupId>
@@ -278,6 +280,18 @@
278280
<version>${cql-evaluator.version}</version>
279281
<scope>test</scope>
280282
</dependency>
283+
<dependency>
284+
<groupId>info.cqframework</groupId>
285+
<artifactId>model-jaxb</artifactId>
286+
<version>${cql-engine.version}</version>
287+
<scope>test</scope>
288+
</dependency>
289+
<dependency>
290+
<groupId>info.cqframework</groupId>
291+
<artifactId>elm-jaxb</artifactId>
292+
<version>${cql-engine.version}</version>
293+
<scope>test</scope>
294+
</dependency>
281295
<dependency>
282296
<groupId>info.cqframework</groupId>
283297
<artifactId>engine</artifactId>

tooling/src/main/java/org/opencds/cqf/tooling/measure/MeasureProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private Measure refreshGeneratedContent(Measure measure) {
278278
String libraryUrl = ResourceUtils.getPrimaryLibraryUrl(measure, fhirContext);
279279
VersionedIdentifier primaryLibraryIdentifier = CanonicalUtils.toVersionedIdentifier(libraryUrl);
280280
List<CqlCompilerException> errors = new ArrayList<CqlCompilerException>();
281-
CompiledLibrary CompiledLibrary = libraryManager.resolveLibrary(primaryLibraryIdentifier, cqlTranslatorOptions, errors);
281+
CompiledLibrary CompiledLibrary = libraryManager.resolveLibrary(primaryLibraryIdentifier, errors);
282282
boolean hasErrors = false;
283283
if (errors.size() > 0) {
284284
for (CqlCompilerException e : errors) {

tooling/src/main/java/org/opencds/cqf/tooling/measure/MeasureRefreshProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public Measure refreshMeasure(Measure measureToUse, LibraryManager libraryManage
4747
private Library getModuleDefinitionLibrary(Measure measureToUse, LibraryManager libraryManager, CompiledLibrary CompiledLibrary, CqlTranslatorOptions options){
4848
Set<String> expressionList = getExpressions(measureToUse);
4949
DataRequirementsProcessor dqReqTrans = new DataRequirementsProcessor();
50-
return dqReqTrans.gatherDataRequirements(libraryManager, CompiledLibrary, options, expressionList, true);
50+
return dqReqTrans.gatherDataRequirements(libraryManager, CompiledLibrary, options.getCqlCompilerOptions(), expressionList, true);
5151
}
5252

5353
private Set<String> getExpressions(Measure measureToUse) {

tooling/src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public NpmPackageManager(ImplementationGuide sourceIg, String version) {
8585
try {
8686
// userMode indicates whether the packageCache is within the working directory
8787
// or in the user home
88-
pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
88+
pcm = new FilesystemPackageCacheManager(true);
8989
} catch (IOException e) {
9090
throw new NpmPackageManagerException("error creating the FilesystemPackageCacheManager", e);
9191
}

tooling/src/main/java/org/opencds/cqf/tooling/parameter/RefreshIGParameters.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class RefreshIGParameters {
99
public String rootDir;
1010
public String igPath;
1111
public IOUtils.Encoding outputEncoding;
12+
public Boolean skipPackages;
1213
public Boolean includeELM;
1314
public Boolean includeDependencies;
1415
public Boolean includeTerminology;

tooling/src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,9 @@ public void logMessage(String msg) {
236236
public void logDebugMessage(IWorkerContext.ILoggingService.LogCategory category, String msg) {
237237
logger.debug("Category: {} Message: {}", category.name(), msg);
238238
}
239+
240+
@Override
241+
public boolean isDebugLogging() {
242+
return false;
243+
}
239244
}

tooling/src/main/java/org/opencds/cqf/tooling/processor/CqlProcessor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ private void translateFolder(String folder) {
259259
// Construct FhirLibrarySourceProvider
260260
ModelManager modelManager = new ModelManager();
261261
LibraryManager libraryManager = new LibraryManager(modelManager);
262+
if (options.getCqlCompilerOptions().getValidateUnits()) {
263+
libraryManager.setUcumService(ucumService);
264+
}
262265
if (packages != null) {
263266
modelManager.getModelInfoLoader().registerModelInfoProvider(new NpmModelInfoProvider(packages, reader, logger), true);
264267
libraryManager.getLibrarySourceLoader().registerProvider(new NpmLibrarySourceProvider(packages, reader, logger));
@@ -273,7 +276,7 @@ private void translateFolder(String folder) {
273276
boolean hadCqlFiles = false;
274277
for (File file : new File(folder).listFiles(getCqlFilenameFilter())) {
275278
hadCqlFiles = true;
276-
translateFile(modelManager, libraryManager, file, options);
279+
translateFile(libraryManager, file, options);
277280
}
278281

279282
if (hadCqlFiles) {
@@ -339,16 +342,15 @@ public static ValidationMessage exceptionToValidationMessage(File file, CqlCompi
339342
}
340343
}
341344

342-
private void translateFile(ModelManager modelManager, LibraryManager libraryManager, File file, CqlTranslatorOptions options) {
345+
private void translateFile(LibraryManager libraryManager, File file, CqlTranslatorOptions options) {
343346
logger.logMessage(String.format("Translating CQL source in file %s", file.toString()));
344347
CqlSourceFileInformation result = new CqlSourceFileInformation();
345348
fileMap.put(file.getAbsoluteFile().toString(), result);
346349

347350
try {
348351

349352
// translate toXML
350-
CqlTranslator translator = CqlTranslator.fromFile(namespaceInfo, file, modelManager, libraryManager,
351-
options.getValidateUnits() ? ucumService : null, options);
353+
CqlTranslator translator = CqlTranslator.fromFile(namespaceInfo, file, libraryManager);
352354

353355
// record errors and warnings
354356
for (CqlCompilerException exception : translator.getExceptions()) {
@@ -376,13 +378,12 @@ private void translateFile(ModelManager modelManager, LibraryManager libraryMana
376378

377379
// Add the translated library to the library manager (NOTE: This should be a "cacheLibrary" call on the LibraryManager, available in 1.5.3+)
378380
// Without this, the data requirements processor will try to load the current library, resulting in a re-translation
379-
CompiledLibrary CompiledLibrary = translator.getTranslatedLibrary();
380-
String libraryPath = NamespaceManager.getPath(CompiledLibrary.getIdentifier().getSystem(), CompiledLibrary.getIdentifier().getId());
381-
libraryManager.getCompiledLibraries().put(libraryPath, CompiledLibrary);
381+
CompiledLibrary compiledLibrary = translator.getTranslatedLibrary();
382+
libraryManager.getCompiledLibraries().put(compiledLibrary.getIdentifier(), compiledLibrary);
382383

383384
DataRequirementsProcessor drp = new DataRequirementsProcessor();
384385
org.hl7.fhir.r5.model.Library requirementsLibrary =
385-
drp.gatherDataRequirements(libraryManager, translator.getTranslatedLibrary(), options, null, false);
386+
drp.gatherDataRequirements(libraryManager, translator.getTranslatedLibrary(), options.getCqlCompilerOptions(), null, false);
386387

387388
// TODO: Report context, requires 1.5 translator (ContextDef)
388389
// NOTE: In STU3, only Patient context is supported

0 commit comments

Comments
 (0)