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

Migrating NPM package management #447

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@
<version>${cqframework.version}</version>
</dependency>

<dependency>
<groupId>info.cqframework</groupId>
<artifactId>cqf-fhir-npm</artifactId>
<version>${cqframework.version}</version>
</dependency>

<dependency>
<groupId>info.cqframework</groupId>
<artifactId>elm-fhir</artifactId>
Expand Down
1 change: 0 additions & 1 deletion tooling-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<version>2.5.0-SNAPSHOT</version>
</parent>

<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-cli</artifactId>
<version>2.5.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
21 changes: 15 additions & 6 deletions tooling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-parent</artifactId>
<version>2.5.0-SNAPSHOT</version>

</parent>

<groupId>org.opencds.cqf</groupId>
<artifactId>tooling</artifactId>
<version>2.5.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down Expand Up @@ -192,7 +190,7 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.9.1</version>
<version>3.1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.activation/activation -->
Expand Down Expand Up @@ -230,14 +228,20 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.30</version>
<version>1.7.33</version>
</dependency>

<!--redirects log4j (used by rckms artifacts) to slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.30</version>
<version>1.7.33</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.33</version>
</dependency>

<!-- FHIR DAL -->
Expand All @@ -251,6 +255,11 @@
<artifactId>elm-fhir</artifactId>
</dependency>

<dependency>
<groupId>info.cqframework</groupId>
<artifactId>cqf-fhir-npm</artifactId>
</dependency>

<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
Expand Down Expand Up @@ -325,7 +334,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<version>2.0.5</version>
<optional>true</optional>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,40 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

public class ResourceDataDateRoller {
private static Logger logger = LoggerFactory.getLogger(ResourceDataDateRoller.class);

private ResourceDataDateRoller() {

}

public static void rollBundleDates(FhirContext fhirContext, IBaseResource iBaseResource) {
switch (fhirContext.getVersion().getVersion().name()) {
case "R4":
ArrayList<Resource> r4ResourceArrayList = BundleUtils.getR4ResourcesFromBundle((org.hl7.fhir.r4.model.Bundle) iBaseResource);
r4ResourceArrayList.forEach(resource -> {
RollDatesR4.rollDatesInResource(resource);
});
switch (fhirContext.getVersion().getVersion()) {
case R4:
List<Resource> r4ResourceArrayList = BundleUtils.getR4ResourcesFromBundle((org.hl7.fhir.r4.model.Bundle) iBaseResource);
r4ResourceArrayList.forEach(RollDatesR4::rollDatesInResource);
break;
case "Stu3":
ArrayList<org.hl7.fhir.dstu3.model.Resource> stu3resourceArrayList = BundleUtils.getStu3ResourcesFromBundle((org.hl7.fhir.dstu3.model.Bundle) iBaseResource);
stu3resourceArrayList.forEach(resource -> {
RollDatesDstu3.rollDatesInResource(resource);
});
case DSTU3:
List<org.hl7.fhir.dstu3.model.Resource> stu3resourceArrayList = BundleUtils.getStu3ResourcesFromBundle((org.hl7.fhir.dstu3.model.Bundle) iBaseResource);
stu3resourceArrayList.forEach(RollDatesDstu3::rollDatesInResource);
break;
default: throw new UnsupportedOperationException("Date Roller not supported for version "
+ fhirContext.getVersion().getVersion().getFhirVersionString());
}
}

public static void rollResourceDates(FhirContext fhirContext, IBaseResource resource) {
switch (fhirContext.getVersion().getVersion().name()) {
case "R4":
switch (fhirContext.getVersion().getVersion()) {
case R4:
RollDatesR4.rollDatesInResource(resource);
break;
case "DSTU3":
case DSTU3:
RollDatesDstu3.rollDatesInResource(resource);
break;
default: throw new UnsupportedOperationException("Date Roller not supported for version "
+ fhirContext.getVersion().getVersion().getFhirVersionString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static String getId(String baseId) {

private static Pattern getPattern() {
if(pattern == null) {
String regex = "^[a-zA-Z]+[a-zA-Z0-9_\\-\\.]*";
String regex = "^[a-zA-Z]+[a-zA-Z\\d_\\-.]*";
pattern = Pattern.compile(regex);
}
return pattern;
Expand Down Expand Up @@ -92,8 +92,8 @@ public List<String> refreshIgLibraryContent(BaseProcessor parentContext, Encodin
public Boolean bundleLibraryDependencies(String path, FhirContext fhirContext, Map<String, IBaseResource> resources,
Encoding encoding, boolean versioned) {
String fileName = FilenameUtils.getName(path);
boolean prefixed = fileName.toLowerCase().startsWith("library-");
Boolean shouldPersist = true;
boolean prefixed = fileName.toLowerCase().startsWith(ResourcePrefix);
boolean shouldPersist = true;
try {
Map<String, IBaseResource> dependencies = ResourceUtils.getDepLibraryResources(path, fhirContext, encoding, versioned, logger);
// String currentResourceID = IOUtils.getTypeQualifiedResourceId(path, fhirContext);
Expand Down Expand Up @@ -163,7 +163,7 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
sourceLibrary.getParameter().clear();
sourceLibrary.getParameter().addAll(info.getParameters());
} else {
logMessage(String.format("No cql info found for ", fileName));
logMessage("No cql info found for " + fileName);
//f.getErrors().add(new ValidationMessage(ValidationMessage.Source.Publisher, ValidationMessage.IssueType.NOTFOUND, "Library", "No cql info found for "+f.getName(), ValidationMessage.IssueSeverity.ERROR));
}
}
Expand All @@ -176,14 +176,14 @@ protected List<Library> refreshGeneratedContent(List<Library> sourceLibraries) {
}

public List<Library> refreshGeneratedContent(String cqlDirectoryPath, String fhirVersion) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
File input = new File(cqlDirectoryPath);
if (input.exists() && input.isDirectory()) {
result.add(input.getAbsolutePath());
}
setBinaryPaths(result);

List<Library> libraries = new ArrayList<Library>();
List<Library> libraries = new ArrayList<>();
return internalRefreshGeneratedContent(libraries);
}

Expand Down Expand Up @@ -217,7 +217,7 @@ private List<Library> internalRefreshGeneratedContent(List<Library> sourceLibrar
newLibrary.setId(newLibrary.getName() + (versioned ? "-" + newLibrary.getVersion() : ""));
setLibraryType(newLibrary);
validateIdAlphaNumeric(newLibrary.getId());
List<Attachment> attachments = new ArrayList<Attachment>();
List<Attachment> attachments = new ArrayList<>();
Attachment attachment = new Attachment();
attachment.setContentType("application/elm+xml");
attachment.setData(fileInfo.getElm());
Expand All @@ -228,7 +228,7 @@ private List<Library> internalRefreshGeneratedContent(List<Library> sourceLibrar
}
}

List<Library> resources = new ArrayList<Library>();
List<Library> resources = new ArrayList<>();
for (Library library : sourceLibraries) {
resources.add(refreshGeneratedContent(library));
}
Expand All @@ -250,6 +250,6 @@ private Attachment loadFile(String fn) throws IOException {
}

public List<String> refreshLibraryContent(RefreshLibraryParameters params) {
return new ArrayList<String>();
return new ArrayList<>();
}
}
Loading