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

changes for version 3.4.3 #139

Merged
merged 10 commits into from
Sep 20, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ public String initializeValidator(CliContext cliContext, String definitions, Tim
validator.setLanguage(cliContext.getLang());
validator.setLocale(cliContext.getLocale());
validator.setSnomedExtension(cliContext.getSnomedCTCode());
validator.setDisplayWarnings(cliContext.isDisplayWarnings());
validator.setAssumeValidRestReferences(cliContext.isAssumeValidRestReferences());
validator.setShowMessagesFromReferences(cliContext.isShowMessagesFromReferences());
validator.setDoImplicitFHIRPathStringConversion(cliContext.isDoImplicitFHIRPathStringConversion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public Base translate(TransformContext context, StructureMap map, Base source, S
ConceptMap cmap = null;
if (conceptMapUrl.startsWith("#")) {
for (Resource r : map.getContained()) {
// if (r instanceof ConceptMap && r.getId().equals(conceptMapUrl)) { FIXME: looks like a simpleworkercontext issue
if (r instanceof ConceptMap && r.getId().equals(conceptMapUrl.substring(1))) {
if (r instanceof ConceptMap && (r.getId().equals(conceptMapUrl.substring(1)) || r.getId().equals(conceptMapUrl))) {
cmap = (ConceptMap) r;
su = map.getUrl() + "#" + conceptMapUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public interface IPackageProvider {
private boolean suppressErrors;
private boolean minimalMemory;

private final static String VER_XVER_PROVIDED = "0.0.13";



public FilesystemPackageCacheManager(boolean userMode) throws IOException {
init(userMode ? FilesystemPackageCacheMode.USER : FilesystemPackageCacheMode.SYSTEM);
Expand Down Expand Up @@ -293,16 +296,27 @@ private void listSpecs(Map<String, String> specList, PackageServer server) throw

protected InputStreamWithSrc loadFromPackageServer(String id, String version) {

// matchbox-engine PATCH, we do not want to load from a package server for hl7.fhir.xver-extension :
if (CommonPackages.ID_XVER.equals(id)) {
version = "0.0.13";
// matchbox-engine PATCH, we do not want to load from a package server for hl7.fhir.xver-extension :
if (CommonPackages.ID_XVER.equals(id)) {
ourLog.info("loading " +id+ " form classpath");
version = VER_XVER_PROVIDED;
InputStream stream = getClass().getResourceAsStream("/"+id+"#"+version+".tgz");
if (stream==null) {
ourLog.error("Unable to find/resolve/read from classpath (we dont' want go to the package server) for :" + id+"#"+version+".tgz");
throw new FHIRException("Unable to find/resolve/read from classpath (we dont' want go to the package server) for :" + id+"#"+version+".tgz");
}
return new InputStreamWithSrc(stream, "http://fhir.org/packages/hl7.fhir.xver-extensions", version);
}
}

if ("hl7.fhir.r5.core".equals(id)) {
ourLog.info("loading hl7.fhir.r5.core form classpath");
InputStream stream = getClass().getResourceAsStream("/"+id+".tgz");
if (stream==null) {
ourLog.error("Unable to find/resolve/read from classpath (we dont' want go to the package server) for :" + id+"#"+version+".tgz");
throw new FHIRException("Unable to find/resolve/read from classpath (we dont' want go to the package server) for :" + id+"#"+version+".tgz");
}
return new InputStreamWithSrc(stream, "https://hl7.org/fhir/R5/hl7.fhir.r5.core.tgz", version);
}

InputStreamWithSrc retVal = super.loadFromPackageServer(id, version);
if (retVal != null) {
Expand Down Expand Up @@ -464,7 +478,7 @@ public NpmPackage loadPackageFromCacheOnly(String id, String version) throws IOE
public NpmPackage addPackageToCache(String id, String version, InputStream packageTgzInputStream, String sourceDesc) throws IOException {
// matchbox-engine PATCH, we do not want to load from a package server for hl7.fhir.xver-extension :
if (CommonPackages.ID_XVER.equals(id)) {
version = "0.0.13";
version = VER_XVER_PROVIDED;
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream, sourceDesc, true);
return npm;
}
Expand Down Expand Up @@ -586,6 +600,23 @@ public void listAllIds(Map<String, String> specList) throws IOException {
@Override
public NpmPackage loadPackage(String id, String version) throws FHIRException, IOException {
//ok, try to resolve locally

if (CommonPackages.ID_XVER.equals(id)) {
version = VER_XVER_PROVIDED;
InputStreamWithSrc packageTgzInputStream = this.loadFromPackageServer(id, version);
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream.stream);
// org.hl7.fhir.exceptions.FHIRException: Unknown FHIRVersion code '0.0.13'
// https://github.com/ahdis/matchbox/issues/135
npm.getNpm().set("version", "4.0");
return npm;
}

if ("hl7.fhir.r5.core".equals(id)) {
InputStreamWithSrc packageTgzInputStream = this.loadFromPackageServer(id, version);
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream.stream);
return npm;
}

if (!Utilities.noString(version) && version.startsWith("file:")) {
return loadPackageFromFile(id, version.substring(5));
}
Expand Down
Loading