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

Cqf740 data reqs #214

Merged
merged 25 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eeacfc7
baseline
Mar 19, 2021
0790d04
prior to adding newer elm.jar
Mar 19, 2021
ea8a846
holding spot before getValueSetRefsFromContext refactor
Mar 24, 2021
89a3dd6
valueset first cut
Mar 24, 2021
6a72817
gather library, include, and retrieve
Mar 24, 2021
0ad8231
added expressionRefs
Mar 26, 2021
8d1b00b
fix for check on duplicate expressionref
Mar 26, 2021
bd9a194
consolidated duplicate check and added don't include null version on…
Mar 26, 2021
d5c0c65
added codeDefs
Mar 26, 2021
ae56fb0
Refactored CqlProcessor to use the visitor; added reference visiting …
brynrhodes Mar 27, 2021
e73952a
beginnings of eCQM created
Mar 29, 2021
9667947
main functionality of ECQM creation added
Mar 31, 2021
24a89f3
adjustment to setType to account for already present
Mar 31, 2021
71b9f51
adjustment to scoring/scoringUnit
Mar 31, 2021
9b2b4d3
test files. Yes they are in the wrong place, ultimately
Mar 31, 2021
d2e0891
removed unneeded methods
Mar 31, 2021
81f93a3
debugged measure template and fixed dupes in parameters
Apr 1, 2021
f83db59
added test and updated liquid file
Apr 1, 2021
674dbc9
Added logicDefinition extraction
brynrhodes Apr 2, 2021
3fbd314
added logic definition to the template
Apr 2, 2021
dfe4f34
Merge branch 'master' into cqf740-dataReqs
brynrhodes Apr 2, 2021
28ca096
fix logic definition statement
Apr 3, 2021
2398abd
Merge branch 'cqf740-dataReqs' of https://github.com/cqframework/cqf-…
Apr 3, 2021
65e8296
Refactored MeasureProcessor to use new MeasureRefresh functionality
brynrhodes Apr 3, 2021
c9bd0e0
Merge branch 'cqf740-dataReqs' of https://github.com/cqframework/cqf-…
brynrhodes Apr 3, 2021
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
@@ -1,4 +1,4 @@
package org.opencds.cqf.tooling.processor;
package org.opencds.cqf.tooling.library;

import java.io.File;
import java.io.IOException;
Expand All @@ -7,18 +7,16 @@
import java.util.Map;

import org.apache.commons.io.FilenameUtils;
import org.fhir.ucum.UcumEssenceService;
import org.fhir.ucum.UcumException;
import org.fhir.ucum.UcumService;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r5.model.Attachment;
import org.hl7.fhir.r5.model.Library;
import org.hl7.fhir.r5.model.RelatedArtifact;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.opencds.cqf.tooling.npm.LibraryLoader;
import org.opencds.cqf.tooling.library.r4.R4LibraryProcessor;
import org.opencds.cqf.tooling.library.stu3.STU3LibraryProcessor;
import org.opencds.cqf.tooling.parameter.RefreshLibraryParameters;
import org.opencds.cqf.tooling.utilities.IGUtils;
import org.opencds.cqf.tooling.processor.*;
import org.opencds.cqf.tooling.utilities.IOUtils;
import org.opencds.cqf.tooling.utilities.IOUtils.Encoding;
import org.opencds.cqf.tooling.utilities.LogUtils;
Expand Down Expand Up @@ -49,7 +47,7 @@ public static List<String> refreshIgLibraryContent(BaseProcessor parentContext,
"Unknown fhir version: " + fhirContext.getVersion().getVersion().getFhirVersionString());
}

String libraryPath = FilenameUtils.concat(parentContext.rootDir, IGProcessor.libraryPathElement);
String libraryPath = FilenameUtils.concat(parentContext.getRootDir(), IGProcessor.libraryPathElement);
RefreshLibraryParameters params = new RefreshLibraryParameters();
params.libraryPath = libraryPath;
params.parentContext = parentContext;
Expand Down Expand Up @@ -79,9 +77,6 @@ public static Boolean bundleLibraryDependencies(String path, FhirContext fhirCon
return shouldPersist;
}

private UcumService ucumService;
private List<String> binaryPaths;
private CqlProcessor cqlProcessor;
protected boolean versioned;

/*
Expand Down Expand Up @@ -116,7 +111,7 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
if (attachment != null) {
sourceLibrary.getContent().clear();
sourceLibrary.getContent().add(attachment);
CqlProcessor.CqlSourceFileInformation info = cqlProcessor.getFileInformation(attachment.getUrl());
CqlProcessor.CqlSourceFileInformation info = getCqlProcessor().getFileInformation(attachment.getUrl());
attachment.setUrlElement(null);
if (info != null) {
//f.getErrors().addAll(info.getErrors());
Expand All @@ -142,24 +137,6 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
}

protected List<Library> refreshGeneratedContent(List<Library> sourceLibraries) {
try {
binaryPaths = IGUtils.extractBinaryPaths(rootDir, sourceIg);
}
catch (IOException e) {
logMessage(String.format("Errors occurred extracting binary path from IG: ", e.getMessage()));
throw new IllegalArgumentException("Could not obtain binary path from IG");
}

LibraryLoader reader = new LibraryLoader(fhirVersion);
try {
ucumService = new UcumEssenceService(UcumEssenceService.class.getResourceAsStream("/ucum-essence.xml"));
} catch (UcumException e) {
System.err.println("Could not create UCUM validation service:");
e.printStackTrace();
}
cqlProcessor = new CqlProcessor(packageManager.getNpmList(), binaryPaths, reader, this, ucumService,
packageId, canonicalBase);

return internalRefreshGeneratedContent(sourceLibraries);
}

Expand All @@ -169,26 +146,17 @@ public List<Library> refreshGeneratedContent(String cqlDirectoryPath, String fhi
if (input.exists() && input.isDirectory()) {
result.add(input.getAbsolutePath());
}
binaryPaths = result;
setBinaryPaths(result);

LibraryLoader reader = new LibraryLoader(fhirVersion);
try {
ucumService = new UcumEssenceService(UcumEssenceService.class.getResourceAsStream("/ucum-essence.xml"));
} catch (UcumException e) {
System.err.println("Could not create UCUM validation service:");
e.printStackTrace();
}
cqlProcessor = new CqlProcessor(null, binaryPaths, reader, this, ucumService,
null, null);
List<Library> libraries = new ArrayList<Library>();
return internalRefreshGeneratedContent(libraries);
}

private List<Library> internalRefreshGeneratedContent(List<Library> sourceLibraries) {
cqlProcessor.execute();
getCqlProcessor().execute();

// For each CQL file, ensure that there is a Library resource with a matching name and version
for (CqlProcessor.CqlSourceFileInformation fileInfo : cqlProcessor.getAllFileInformation()) {
for (CqlProcessor.CqlSourceFileInformation fileInfo : getCqlProcessor().getAllFileInformation()) {
if (fileInfo.getIdentifier() != null && fileInfo.getIdentifier().getId() != null && !fileInfo.getIdentifier().getId().equals("")) {
Library existingLibrary = null;
for (Library sourceLibrary : sourceLibraries) {
Expand Down Expand Up @@ -219,7 +187,7 @@ private List<Library> internalRefreshGeneratedContent(List<Library> sourceLibrar
}

private Attachment loadFile(String fn) throws IOException {
for (String dir : binaryPaths) {
for (String dir : getBinaryPaths()) {
File f = new File(Utilities.path(dir, fn));
if (f.exists()) {
Attachment att = new Attachment();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.opencds.cqf.tooling.processor;
package org.opencds.cqf.tooling.library.r4;

import java.io.File;
import java.io.IOException;
Expand All @@ -12,6 +12,7 @@
import org.hl7.fhir.r4.model.Library;
import org.hl7.fhir.r4.model.Resource;
import org.opencds.cqf.tooling.common.r4.CqfmSoftwareSystemHelper;
import org.opencds.cqf.tooling.library.LibraryProcessor;
import org.opencds.cqf.tooling.parameter.RefreshLibraryParameters;
import org.opencds.cqf.tooling.utilities.IOUtils;
import org.opencds.cqf.tooling.utilities.IOUtils.Encoding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.tooling.library.BaseLibraryGenerator;
import org.opencds.cqf.tooling.processor.LibraryProcessor;
import org.opencds.cqf.tooling.library.LibraryProcessor;
import org.opencds.cqf.tooling.utilities.IOUtils;

import ca.uhn.fhir.context.FhirContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.opencds.cqf.tooling.processor;
package org.opencds.cqf.tooling.library.stu3;

import java.io.File;
import java.util.ArrayList;
Expand All @@ -12,6 +12,7 @@
import org.hl7.fhir.dstu3.model.RelatedArtifact;
import org.hl7.fhir.dstu3.model.Resource;
import org.opencds.cqf.tooling.common.stu3.CqfmSoftwareSystemHelper;
import org.opencds.cqf.tooling.library.LibraryProcessor;
import org.opencds.cqf.tooling.parameter.RefreshLibraryParameters;
import org.opencds.cqf.tooling.utilities.IOUtils;

Expand Down
Loading