Defining the existence of R6
This commit is contained in:
parent
9a8392275f
commit
e59c83855d
|
@ -178,7 +178,7 @@ public class PackageVisitor {
|
||||||
processor.processResource(pid+"#current", npm, fv, type, s, TextFile.streamToBytes(npm.load("package", s)));
|
processor.processResource(pid+"#current", npm, fv, type, s, TextFile.streamToBytes(npm.load("package", s)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("####### Error loading "+pid+"#current["+fv+"]/"+type+" ####### "+e.getMessage());
|
System.out.println("####### Error loading "+pid+"#current["+fv+"]/"+type+" ####### "+e.getMessage());
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class SearchParameterAnalysis implements IPackageVisitorProcessor {
|
||||||
versions.get(version).version = version;
|
versions.get(version).version = version;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (VersionUtilities.isR5Ver(version)) {
|
if (VersionUtilities.isR5Plus(version)) {
|
||||||
processR5SP(core, versions.get(version), content);
|
processR5SP(core, versions.get(version), content);
|
||||||
} else if (VersionUtilities.isR4BVer(version)) {
|
} else if (VersionUtilities.isR4BVer(version)) {
|
||||||
processR4SP(core, versions.get(version), content);
|
processR4SP(core, versions.get(version), content);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public abstract class BaseLoaderR5 implements IContextResourceLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseLoaderR5 loaderFactory(NpmPackage npm) throws JsonSyntaxException, IOException {
|
protected BaseLoaderR5 loaderFactory(NpmPackage npm) throws JsonSyntaxException, IOException {
|
||||||
if (VersionUtilities.isR5Ver(npm.fhirVersion())) {
|
if (VersionUtilities.isR5Plus(npm.fhirVersion())) {
|
||||||
return new R5ToR5Loader(types, lkp.forNewPackage(npm));
|
return new R5ToR5Loader(types, lkp.forNewPackage(npm));
|
||||||
} else if (VersionUtilities.isR4Ver(npm.fhirVersion())) {
|
} else if (VersionUtilities.isR4Ver(npm.fhirVersion())) {
|
||||||
return new R4ToR5Loader(types, lkp.forNewPackage(npm), npm.version());
|
return new R4ToR5Loader(types, lkp.forNewPackage(npm), npm.version());
|
||||||
|
|
|
@ -54,9 +54,6 @@ import org.hl7.fhir.r5.model.UriType;
|
||||||
|
|
||||||
public class R5ToR5Loader extends BaseLoaderR5 {
|
public class R5ToR5Loader extends BaseLoaderR5 {
|
||||||
|
|
||||||
// TODO Grahame, will this ever be populated? No conversion is being done?
|
|
||||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
|
||||||
|
|
||||||
public R5ToR5Loader(List<String> types, ILoaderKnowledgeProviderR5 lkp) {
|
public R5ToR5Loader(List<String> types, ILoaderKnowledgeProviderR5 lkp) {
|
||||||
super(types, lkp);
|
super(types, lkp);
|
||||||
}
|
}
|
||||||
|
@ -78,11 +75,6 @@ public class R5ToR5Loader extends BaseLoaderR5 {
|
||||||
b.setType(BundleType.COLLECTION);
|
b.setType(BundleType.COLLECTION);
|
||||||
b.addEntry().setResource(r5).setFullUrl(r5 instanceof CanonicalResource ? ((CanonicalResource) r5).getUrl() : null);
|
b.addEntry().setResource(r5).setFullUrl(r5 instanceof CanonicalResource ? ((CanonicalResource) r5).getUrl() : null);
|
||||||
}
|
}
|
||||||
for (CodeSystem cs : cslist) {
|
|
||||||
BundleEntryComponent be = b.addEntry();
|
|
||||||
be.setFullUrl(cs.getUrl());
|
|
||||||
be.setResource(cs);
|
|
||||||
}
|
|
||||||
if (killPrimitives) {
|
if (killPrimitives) {
|
||||||
List<BundleEntryComponent> remove = new ArrayList<BundleEntryComponent>();
|
List<BundleEntryComponent> remove = new ArrayList<BundleEntryComponent>();
|
||||||
for (BundleEntryComponent be : b.getEntry()) {
|
for (BundleEntryComponent be : b.getEntry()) {
|
||||||
|
@ -113,9 +105,6 @@ public class R5ToR5Loader extends BaseLoaderR5 {
|
||||||
r5 = new XmlParser().parse(stream);
|
r5 = new XmlParser().parse(stream);
|
||||||
setPath(r5);
|
setPath(r5);
|
||||||
|
|
||||||
if (!cslist.isEmpty()) {
|
|
||||||
throw new FHIRException("Error: Cannot have included code systems");
|
|
||||||
}
|
|
||||||
if (killPrimitives) {
|
if (killPrimitives) {
|
||||||
throw new FHIRException("Cannot kill primitives when using deferred loading");
|
throw new FHIRException("Cannot kill primitives when using deferred loading");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,128 @@
|
||||||
|
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r5.formats.JsonParser;
|
||||||
|
import org.hl7.fhir.r5.formats.XmlParser;
|
||||||
|
import org.hl7.fhir.r5.model.Bundle;
|
||||||
|
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||||
|
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.CodeSystem;
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
|
import org.hl7.fhir.r5.model.UriType;
|
||||||
|
|
||||||
|
public class R6ToR5Loader extends BaseLoaderR5 {
|
||||||
|
|
||||||
|
public R6ToR5Loader(List<String> types, ILoaderKnowledgeProviderR5 lkp) {
|
||||||
|
super(types, lkp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||||
|
Resource r5 = null;
|
||||||
|
if (isJson)
|
||||||
|
r5 = new JsonParser().parse(stream);
|
||||||
|
else
|
||||||
|
r5 = new XmlParser().parse(stream);
|
||||||
|
|
||||||
|
Bundle b;
|
||||||
|
if (r5 instanceof Bundle)
|
||||||
|
b = (Bundle) r5;
|
||||||
|
else {
|
||||||
|
b = new Bundle();
|
||||||
|
b.setId(UUID.randomUUID().toString().toLowerCase());
|
||||||
|
b.setType(BundleType.COLLECTION);
|
||||||
|
b.addEntry().setResource(r5).setFullUrl(r5 instanceof CanonicalResource ? ((CanonicalResource) r5).getUrl() : null);
|
||||||
|
}
|
||||||
|
if (killPrimitives) {
|
||||||
|
List<BundleEntryComponent> remove = new ArrayList<BundleEntryComponent>();
|
||||||
|
for (BundleEntryComponent be : b.getEntry()) {
|
||||||
|
if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
|
||||||
|
StructureDefinition sd = (StructureDefinition) be.getResource();
|
||||||
|
if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE)
|
||||||
|
remove.add(be);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b.getEntry().removeAll(remove);
|
||||||
|
}
|
||||||
|
if (patchUrls) {
|
||||||
|
for (BundleEntryComponent be : b.getEntry()) {
|
||||||
|
if (be.hasResource()) {
|
||||||
|
doPatchUrls(be.getResource());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException {
|
||||||
|
Resource r5 = null;
|
||||||
|
if (isJson)
|
||||||
|
r5 = new JsonParser().parse(stream);
|
||||||
|
else
|
||||||
|
r5 = new XmlParser().parse(stream);
|
||||||
|
setPath(r5);
|
||||||
|
|
||||||
|
if (killPrimitives) {
|
||||||
|
throw new FHIRException("Cannot kill primitives when using deferred loading");
|
||||||
|
}
|
||||||
|
if (patchUrls) {
|
||||||
|
doPatchUrls(r5);
|
||||||
|
}
|
||||||
|
return r5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CodeSystem> getCodeSystems() {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String versionString() {
|
||||||
|
return "5.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -228,7 +228,7 @@ public class NpmPackageVersionConverter {
|
||||||
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_10_30.convertResource(res));
|
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_10_30.convertResource(res));
|
||||||
} else if (VersionUtilities.isR4Ver(version)) {
|
} else if (VersionUtilities.isR4Ver(version)) {
|
||||||
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_10_40.convertResource(res));
|
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_10_40.convertResource(res));
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_10_50.convertResource(res));
|
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_10_50.convertResource(res));
|
||||||
}
|
}
|
||||||
} else if (VersionUtilities.isR2BVer(currentVersion)) {
|
} else if (VersionUtilities.isR2BVer(currentVersion)) {
|
||||||
|
@ -242,7 +242,7 @@ public class NpmPackageVersionConverter {
|
||||||
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_14_30.convertResource(res));
|
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_14_30.convertResource(res));
|
||||||
} else if (VersionUtilities.isR4Ver(version)) {
|
} else if (VersionUtilities.isR4Ver(version)) {
|
||||||
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_14_40.convertResource(res));
|
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_14_40.convertResource(res));
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_14_50.convertResource(res));
|
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_14_50.convertResource(res));
|
||||||
}
|
}
|
||||||
} else if (VersionUtilities.isR3Ver(currentVersion)) {
|
} else if (VersionUtilities.isR3Ver(currentVersion)) {
|
||||||
|
@ -256,7 +256,7 @@ public class NpmPackageVersionConverter {
|
||||||
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(res);
|
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(res);
|
||||||
} else if (VersionUtilities.isR4Ver(version)) {
|
} else if (VersionUtilities.isR4Ver(version)) {
|
||||||
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_30_40.convertResource(res));
|
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_30_40.convertResource(res));
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_30_50.convertResource(res));
|
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_30_50.convertResource(res));
|
||||||
}
|
}
|
||||||
} else if (VersionUtilities.isR4Ver(currentVersion)) {
|
} else if (VersionUtilities.isR4Ver(currentVersion)) {
|
||||||
|
@ -270,10 +270,10 @@ public class NpmPackageVersionConverter {
|
||||||
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_30_40.convertResource(res, new BaseAdvisor_30_40(false)));
|
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_30_40.convertResource(res, new BaseAdvisor_30_40(false)));
|
||||||
} else if (VersionUtilities.isR4Ver(version)) {
|
} else if (VersionUtilities.isR4Ver(version)) {
|
||||||
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(res);
|
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(res);
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_40_50.convertResource(res));
|
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertorFactory_40_50.convertResource(res));
|
||||||
}
|
}
|
||||||
} else if (VersionUtilities.isR5Ver(currentVersion)) {
|
} else if (VersionUtilities.isR5Plus(currentVersion)) {
|
||||||
org.hl7.fhir.r5.model.Resource res = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
|
org.hl7.fhir.r5.model.Resource res = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
|
||||||
convertResourceR5(res);
|
convertResourceR5(res);
|
||||||
if (VersionUtilities.isR2Ver(version)) {
|
if (VersionUtilities.isR2Ver(version)) {
|
||||||
|
@ -284,7 +284,7 @@ public class NpmPackageVersionConverter {
|
||||||
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_30_50.convertResource(res, new BaseAdvisor_30_50(false)));
|
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertorFactory_30_50.convertResource(res, new BaseAdvisor_30_50(false)));
|
||||||
} else if (VersionUtilities.isR4Ver(version)) {
|
} else if (VersionUtilities.isR4Ver(version)) {
|
||||||
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_40_50.convertResource(res));
|
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertorFactory_40_50.convertResource(res));
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(res);
|
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,7 +517,7 @@ public class CorePackageVersionConvertor {
|
||||||
if (VersionUtilities.isR3Ver(fhirVersion)) {
|
if (VersionUtilities.isR3Ver(fhirVersion)) {
|
||||||
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
||||||
return new ContentConverter3to4(fhirVersion);
|
return new ContentConverter3to4(fhirVersion);
|
||||||
} else if (VersionUtilities.isR5Ver(versionTarget)) {
|
} else if (VersionUtilities.isR5Plus(versionTarget)) {
|
||||||
return new ContentConverter3to5(fhirVersion);
|
return new ContentConverter3to5(fhirVersion);
|
||||||
} else if (VersionUtilities.isR2Ver(versionTarget)) {
|
} else if (VersionUtilities.isR2Ver(versionTarget)) {
|
||||||
return new ContentConverter3to2(fhirVersion);
|
return new ContentConverter3to2(fhirVersion);
|
||||||
|
@ -527,7 +527,7 @@ public class CorePackageVersionConvertor {
|
||||||
} else if (VersionUtilities.isR2Ver(fhirVersion)) {
|
} else if (VersionUtilities.isR2Ver(fhirVersion)) {
|
||||||
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
||||||
return new ContentConverter2to4(fhirVersion);
|
return new ContentConverter2to4(fhirVersion);
|
||||||
} else if (VersionUtilities.isR5Ver(versionTarget)) {
|
} else if (VersionUtilities.isR5Plus(versionTarget)) {
|
||||||
return new ContentConverter2to5(fhirVersion);
|
return new ContentConverter2to5(fhirVersion);
|
||||||
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
||||||
return new ContentConverter2to3(fhirVersion);
|
return new ContentConverter2to3(fhirVersion);
|
||||||
|
@ -535,7 +535,7 @@ public class CorePackageVersionConvertor {
|
||||||
} else if (VersionUtilities.isR2BVer(fhirVersion)) {
|
} else if (VersionUtilities.isR2BVer(fhirVersion)) {
|
||||||
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
||||||
return new ContentConverter2Bto4(fhirVersion);
|
return new ContentConverter2Bto4(fhirVersion);
|
||||||
} else if (VersionUtilities.isR5Ver(versionTarget)) {
|
} else if (VersionUtilities.isR5Plus(versionTarget)) {
|
||||||
return new ContentConverter2Bto5(fhirVersion);
|
return new ContentConverter2Bto5(fhirVersion);
|
||||||
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
||||||
return new ContentConverter2Bto3(fhirVersion);
|
return new ContentConverter2Bto3(fhirVersion);
|
||||||
|
@ -543,7 +543,7 @@ public class CorePackageVersionConvertor {
|
||||||
} else if (VersionUtilities.isR4Ver(fhirVersion)) {
|
} else if (VersionUtilities.isR4Ver(fhirVersion)) {
|
||||||
if (VersionUtilities.isR3Ver(versionTarget)) {
|
if (VersionUtilities.isR3Ver(versionTarget)) {
|
||||||
return new ContentConverter4to3(fhirVersion);
|
return new ContentConverter4to3(fhirVersion);
|
||||||
} else if (VersionUtilities.isR5Ver(versionTarget)) {
|
} else if (VersionUtilities.isR5Plus(versionTarget)) {
|
||||||
return new ContentConverter4to5(fhirVersion);
|
return new ContentConverter4to5(fhirVersion);
|
||||||
} else if (VersionUtilities.isR2Ver(versionTarget)) {
|
} else if (VersionUtilities.isR2Ver(versionTarget)) {
|
||||||
return new ContentConverter4to2(fhirVersion);
|
return new ContentConverter4to2(fhirVersion);
|
||||||
|
@ -555,7 +555,7 @@ public class CorePackageVersionConvertor {
|
||||||
} else if (VersionUtilities.isR4BVer(fhirVersion)) {
|
} else if (VersionUtilities.isR4BVer(fhirVersion)) {
|
||||||
if (VersionUtilities.isR3Ver(versionTarget)) {
|
if (VersionUtilities.isR3Ver(versionTarget)) {
|
||||||
return new ContentConverter4to3(fhirVersion);
|
return new ContentConverter4to3(fhirVersion);
|
||||||
} else if (VersionUtilities.isR5Ver(versionTarget)) {
|
} else if (VersionUtilities.isR5Plus(versionTarget)) {
|
||||||
return new ContentConverter4to5(fhirVersion);
|
return new ContentConverter4to5(fhirVersion);
|
||||||
} else if (VersionUtilities.isR4Ver(versionTarget)) {
|
} else if (VersionUtilities.isR4Ver(versionTarget)) {
|
||||||
return new ContentConverter4to4(fhirVersion);
|
return new ContentConverter4to4(fhirVersion);
|
||||||
|
@ -564,7 +564,7 @@ public class CorePackageVersionConvertor {
|
||||||
} else if (VersionUtilities.isR2BVer(versionTarget)) {
|
} else if (VersionUtilities.isR2BVer(versionTarget)) {
|
||||||
return new ContentConverter4to2B(fhirVersion);
|
return new ContentConverter4to2B(fhirVersion);
|
||||||
}
|
}
|
||||||
} else if (VersionUtilities.isR5Ver(fhirVersion)) {
|
} else if (VersionUtilities.isR5Plus(fhirVersion)) {
|
||||||
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
|
||||||
return new ContentConverter5to4(fhirVersion);
|
return new ContentConverter5to4(fhirVersion);
|
||||||
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
} else if (VersionUtilities.isR3Ver(versionTarget)) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TerminologyClientFactory {
|
||||||
if (VersionUtilities.isR4BVer(v)) {
|
if (VersionUtilities.isR4BVer(v)) {
|
||||||
return new TerminologyClientR4(checkEndsWith("/r4", url), userAgent);
|
return new TerminologyClientR4(checkEndsWith("/r4", url), userAgent);
|
||||||
}
|
}
|
||||||
if (VersionUtilities.isR5Ver(v)) {
|
if (VersionUtilities.isR5Plus(v)) {
|
||||||
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent); // r4 for now, since the terminology is currently the same
|
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent); // r4 for now, since the terminology is currently the same
|
||||||
}
|
}
|
||||||
throw new Error("The version " + v + " is not currently supported");
|
throw new Error("The version " + v + " is not currently supported");
|
||||||
|
|
|
@ -2573,6 +2573,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String baseSpecUrl() {
|
||||||
|
return VersionUtilities.getSpecUrl(context.getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames, Set<String> baseFilenames, Set<String> localFilenames, boolean processRelatives) {
|
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames, Set<String> baseFilenames, Set<String> localFilenames, boolean processRelatives) {
|
||||||
if (markdown == null) {
|
if (markdown == null) {
|
||||||
return "";
|
return "";
|
||||||
|
@ -2686,28 +2690,6 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
url.startsWith("resource-definitions.html");
|
url.startsWith("resource-definitions.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String baseSpecUrl() {
|
|
||||||
if (VersionUtilities.isR5Ver(context.getVersion())) {
|
|
||||||
return "http://build.fhir.org/";
|
|
||||||
}
|
|
||||||
if (VersionUtilities.isR4Ver(context.getVersion())) {
|
|
||||||
return "http://hl7.org/fhir/R4/";
|
|
||||||
}
|
|
||||||
if (VersionUtilities.isR3Ver(context.getVersion())) {
|
|
||||||
return "http://hl7.org/fhir/STU3/";
|
|
||||||
}
|
|
||||||
if (VersionUtilities.isR2BVer(context.getVersion())) {
|
|
||||||
return "http://hl7.org/fhir/2016May/";
|
|
||||||
}
|
|
||||||
if (VersionUtilities.isR2Ver(context.getVersion())) {
|
|
||||||
return "http://hl7.org/fhir/DSTU2/";
|
|
||||||
}
|
|
||||||
if (VersionUtilities.isR4BVer(context.getVersion())) {
|
|
||||||
return "http://hl7.org/fhir/2021Mar/";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ElementDefinition> getSiblings(List<ElementDefinition> list, ElementDefinition current) {
|
private List<ElementDefinition> getSiblings(List<ElementDefinition> list, ElementDefinition current) {
|
||||||
List<ElementDefinition> result = new ArrayList<ElementDefinition>();
|
List<ElementDefinition> result = new ArrayList<ElementDefinition>();
|
||||||
String path = current.getPath();
|
String path = current.getPath();
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
package org.hl7.fhir.r4b.model;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright (c) 2011+, HL7, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
|
||||||
endorse or promote products derived from this software without specific
|
|
||||||
prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
||||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
|
||||||
import org.hl7.fhir.utilities.VersionUtilities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This enumreation is special, and hand crafted. It only supports a subset of the actual published FHIR versions, those that are still supported.
|
|
||||||
* @author graha
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum FhirPublication {
|
|
||||||
NULL,
|
|
||||||
DSTU1,
|
|
||||||
DSTU2,
|
|
||||||
DSTU2016May,
|
|
||||||
STU3,
|
|
||||||
R4,
|
|
||||||
R4B,
|
|
||||||
R5;
|
|
||||||
|
|
||||||
public static FhirPublication fromCode(String v) {
|
|
||||||
if (VersionUtilities.isR2Ver(v))
|
|
||||||
return FhirPublication.DSTU2;
|
|
||||||
if (VersionUtilities.isR2BVer(v))
|
|
||||||
return FhirPublication.DSTU2016May;
|
|
||||||
if (VersionUtilities.isR3Ver(v))
|
|
||||||
return FhirPublication.STU3;
|
|
||||||
if (VersionUtilities.isR4Ver(v))
|
|
||||||
return FhirPublication.R4;
|
|
||||||
if (VersionUtilities.isR4BVer(v))
|
|
||||||
return FhirPublication.R4B;
|
|
||||||
if (VersionUtilities.isR5Ver(v))
|
|
||||||
return FhirPublication.R5;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toCode() {
|
|
||||||
switch (this) {
|
|
||||||
case DSTU1: return "0.01";
|
|
||||||
case DSTU2: return "1.0.2";
|
|
||||||
case DSTU2016May: return "1.4.0";
|
|
||||||
case STU3: return "3.0.1";
|
|
||||||
case R4: return "4.0.1";
|
|
||||||
case R4B: return "4.3.0";
|
|
||||||
case R5: return "5.0.0";
|
|
||||||
default:
|
|
||||||
return "??";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FhirPublication fromVersion(FHIRVersion v) {
|
|
||||||
return fromCode(v.toCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,10 +18,10 @@ import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.DomainResource;
|
import org.hl7.fhir.r4b.model.DomainResource;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r4b.model.FhirPublication;
|
|
||||||
import org.hl7.fhir.r4b.renderers.utils.Resolver.IReferenceResolver;
|
import org.hl7.fhir.r4b.renderers.utils.Resolver.IReferenceResolver;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
|
import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -12021,6 +12021,10 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
* R5 Final QA.
|
* R5 Final QA.
|
||||||
*/
|
*/
|
||||||
_5_0_0DRAFTFINAL,
|
_5_0_0DRAFTFINAL,
|
||||||
|
/**
|
||||||
|
* R6 Rolling ci-build.
|
||||||
|
*/
|
||||||
|
_6_0_0CIBUILD,
|
||||||
/**
|
/**
|
||||||
* added to help the parsers
|
* added to help the parsers
|
||||||
*/
|
*/
|
||||||
|
@ -12142,6 +12146,8 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
return _5_0_0SNAPSHOT3;
|
return _5_0_0SNAPSHOT3;
|
||||||
if ("5.0.0-draft-final".equals(codeString))
|
if ("5.0.0-draft-final".equals(codeString))
|
||||||
return _5_0_0DRAFTFINAL;
|
return _5_0_0DRAFTFINAL;
|
||||||
|
if ("6.0.0-cibuild".equals(codeString))
|
||||||
|
return _6_0_0CIBUILD;
|
||||||
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
}
|
}
|
||||||
public static boolean isValidCode(String codeString) {
|
public static boolean isValidCode(String codeString) {
|
||||||
|
@ -12208,6 +12214,7 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
case _5_0_0BALLOT: return "5.0.0-ballot";
|
case _5_0_0BALLOT: return "5.0.0-ballot";
|
||||||
case _5_0_0SNAPSHOT3: return "5.0.0-snapshot3";
|
case _5_0_0SNAPSHOT3: return "5.0.0-snapshot3";
|
||||||
case _5_0_0DRAFTFINAL: return "5.0.0-draft-final";
|
case _5_0_0DRAFTFINAL: return "5.0.0-draft-final";
|
||||||
|
case _6_0_0CIBUILD: return "6.0.0-cibuild";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
}
|
}
|
||||||
|
@ -12271,6 +12278,7 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
case _5_0_0BALLOT: return "http://hl7.org/fhir/FHIR-version";
|
case _5_0_0BALLOT: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case _5_0_0SNAPSHOT3: return "http://hl7.org/fhir/FHIR-version";
|
case _5_0_0SNAPSHOT3: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case _5_0_0DRAFTFINAL: return "http://hl7.org/fhir/FHIR-version";
|
case _5_0_0DRAFTFINAL: return "http://hl7.org/fhir/FHIR-version";
|
||||||
|
case _6_0_0CIBUILD: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
}
|
}
|
||||||
|
@ -12334,6 +12342,7 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
case _5_0_0BALLOT: return "R5 Ballot.";
|
case _5_0_0BALLOT: return "R5 Ballot.";
|
||||||
case _5_0_0SNAPSHOT3: return "R5 January 2023 Staging Release + Connectathon 32.";
|
case _5_0_0SNAPSHOT3: return "R5 January 2023 Staging Release + Connectathon 32.";
|
||||||
case _5_0_0DRAFTFINAL: return "R5 Final QA.";
|
case _5_0_0DRAFTFINAL: return "R5 Final QA.";
|
||||||
|
case _6_0_0CIBUILD: return "R6 Rolling ci-build.";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
}
|
}
|
||||||
|
@ -12397,6 +12406,7 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
case _5_0_0BALLOT: return "5.0.0-ballot";
|
case _5_0_0BALLOT: return "5.0.0-ballot";
|
||||||
case _5_0_0SNAPSHOT3: return "5.0.0-snapshot3";
|
case _5_0_0SNAPSHOT3: return "5.0.0-snapshot3";
|
||||||
case _5_0_0DRAFTFINAL: return "5.0.0-draft-final";
|
case _5_0_0DRAFTFINAL: return "5.0.0-draft-final";
|
||||||
|
case _6_0_0CIBUILD: return "6.0.0-cibuild";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
}
|
}
|
||||||
|
@ -12539,6 +12549,8 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
return FHIRVersion._5_0_0SNAPSHOT3;
|
return FHIRVersion._5_0_0SNAPSHOT3;
|
||||||
if ("5.0.0-draft-final".equals(codeString))
|
if ("5.0.0-draft-final".equals(codeString))
|
||||||
return FHIRVersion._5_0_0DRAFTFINAL;
|
return FHIRVersion._5_0_0DRAFTFINAL;
|
||||||
|
if ("6.0.0-cibuild".equals(codeString))
|
||||||
|
return FHIRVersion._6_0_0CIBUILD;
|
||||||
throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12664,6 +12676,8 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
return new Enumeration<FHIRVersion>(this, FHIRVersion._5_0_0SNAPSHOT3, code);
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._5_0_0SNAPSHOT3, code);
|
||||||
if ("5.0.0-draft-final".equals(codeString))
|
if ("5.0.0-draft-final".equals(codeString))
|
||||||
return new Enumeration<FHIRVersion>(this, FHIRVersion._5_0_0DRAFTFINAL, code);
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._5_0_0DRAFTFINAL, code);
|
||||||
|
if ("6.0.0-cibuild".equals(codeString))
|
||||||
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._6_0_0CIBUILD, code);
|
||||||
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
}
|
}
|
||||||
public String toCode(FHIRVersion code) {
|
public String toCode(FHIRVersion code) {
|
||||||
|
@ -12781,6 +12795,8 @@ The primary difference between a medicationstatement and a medicationadministrat
|
||||||
return "5.0.0-snapshot3";
|
return "5.0.0-snapshot3";
|
||||||
if (code == FHIRVersion._5_0_0DRAFTFINAL)
|
if (code == FHIRVersion._5_0_0DRAFTFINAL)
|
||||||
return "5.0.0-draft-final";
|
return "5.0.0-draft-final";
|
||||||
|
if (code == FHIRVersion._6_0_0CIBUILD)
|
||||||
|
return "6.0.0-cibuild";
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
public String toSystem(FHIRVersion code) {
|
public String toSystem(FHIRVersion code) {
|
||||||
|
|
|
@ -1874,7 +1874,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
erow.getSubRows().add(row);
|
erow.getSubRows().add(row);
|
||||||
Cell c = gen.new Cell();
|
Cell c = gen.new Cell();
|
||||||
row.getCells().add(c);
|
row.getCells().add(c);
|
||||||
c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(VersionUtilities.isR5Ver(context.getWorker().getVersion()) ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null));
|
c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(VersionUtilities.isR5Plus(context.getWorker().getVersion()) ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null));
|
||||||
c = gen.new Cell();
|
c = gen.new Cell();
|
||||||
row.getCells().add(c);
|
row.getCells().add(c);
|
||||||
c.addPiece(gen.new Piece(null, null, null));
|
c.addPiece(gen.new Piece(null, null, null));
|
||||||
|
|
|
@ -13,7 +13,8 @@ public enum FhirPublication {
|
||||||
STU3,
|
STU3,
|
||||||
R4,
|
R4,
|
||||||
R4B,
|
R4B,
|
||||||
R5;
|
R5,
|
||||||
|
R6;
|
||||||
|
|
||||||
public static FhirPublication fromCode(String v) {
|
public static FhirPublication fromCode(String v) {
|
||||||
if (VersionUtilities.isR2Ver(v))
|
if (VersionUtilities.isR2Ver(v))
|
||||||
|
@ -28,6 +29,8 @@ public enum FhirPublication {
|
||||||
return FhirPublication.R4B;
|
return FhirPublication.R4B;
|
||||||
if (VersionUtilities.isR5Ver(v))
|
if (VersionUtilities.isR5Ver(v))
|
||||||
return FhirPublication.R5;
|
return FhirPublication.R5;
|
||||||
|
if (VersionUtilities.isR6Ver(v))
|
||||||
|
return FhirPublication.R6;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +43,7 @@ public enum FhirPublication {
|
||||||
case R4: return "4.0.1";
|
case R4: return "4.0.1";
|
||||||
case R4B: return "4.3.0";
|
case R4B: return "4.3.0";
|
||||||
case R5: return "5.0.0";
|
case R5: return "5.0.0";
|
||||||
|
case R6: return "6.0.0";
|
||||||
default:
|
default:
|
||||||
return "??";
|
return "??";
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,6 @@ public class VersionUtilities {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String CURRENT_VERSION = "5.0";
|
|
||||||
public static final String CURRENT_FULL_VERSION = "5.0.0";
|
|
||||||
|
|
||||||
public static final String CURRENT_DEFAULT_VERSION = "4.0";
|
|
||||||
public static final String CURRENT_DEFAULT_FULL_VERSION = "4.0.1";
|
|
||||||
|
|
||||||
public static String packageForVersion(String v) {
|
public static String packageForVersion(String v) {
|
||||||
if (isR2Ver(v)) {
|
if (isR2Ver(v)) {
|
||||||
|
@ -83,15 +77,14 @@ public class VersionUtilities {
|
||||||
return "hl7.fhir.r5.core";
|
return "hl7.fhir.r5.core";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isR6Ver(v)) {
|
||||||
|
return "hl7.fhir.r6.core";
|
||||||
|
}
|
||||||
|
|
||||||
if ("current".equals(v)) {
|
if ("current".equals(v)) {
|
||||||
return "hl7.fhir.r5.core";
|
return "hl7.fhir.r5.core";
|
||||||
}
|
}
|
||||||
if (v != null && v.startsWith(CURRENT_VERSION)) {
|
|
||||||
return "hl7.fhir.r5.core";
|
|
||||||
}
|
|
||||||
if (Utilities.existsInList(v, "4.4.0", "4.5.0")) {
|
|
||||||
return "hl7.fhir.r5.core";
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +104,8 @@ public class VersionUtilities {
|
||||||
if (isR5Ver(v)) {
|
if (isR5Ver(v)) {
|
||||||
return "5.0.0";
|
return "5.0.0";
|
||||||
}
|
}
|
||||||
if (v != null && v.startsWith(CURRENT_VERSION)) {
|
if (isR6Ver(v)) {
|
||||||
return "current";
|
return "6.0.0";
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -130,8 +123,11 @@ public class VersionUtilities {
|
||||||
if (isR4Ver(v)) {
|
if (isR4Ver(v)) {
|
||||||
return "4.0";
|
return "4.0";
|
||||||
}
|
}
|
||||||
if (v != null && v.startsWith(CURRENT_VERSION)) {
|
if (isR5Ver(v)) {
|
||||||
return "current";
|
return "5.0";
|
||||||
|
}
|
||||||
|
if (isR6Ver(v)) {
|
||||||
|
return "6.0";
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -140,15 +136,19 @@ public class VersionUtilities {
|
||||||
if (version.contains("-")) {
|
if (version.contains("-")) {
|
||||||
version = version.substring(0, version.indexOf("-"));
|
version = version.substring(0, version.indexOf("-"));
|
||||||
}
|
}
|
||||||
return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", CURRENT_FULL_VERSION);
|
return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", "6.0.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String listSupportedVersions() {
|
public static String listSupportedVersions() {
|
||||||
return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, " + CURRENT_FULL_VERSION;
|
return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, 6.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isR6Ver(String ver) {
|
||||||
|
return ver != null && (ver.startsWith("6.0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isR5Ver(String ver) {
|
public static boolean isR5Ver(String ver) {
|
||||||
return ver != null && (ver.startsWith("5.0") || ver.startsWith(CURRENT_VERSION) || ver.equals("current"));
|
return ver != null && (ver.startsWith("5.0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isR4BVer(String ver) {
|
public static boolean isR4BVer(String ver) {
|
||||||
|
@ -197,24 +197,20 @@ public class VersionUtilities {
|
||||||
if (s.contains("#")) {
|
if (s.contains("#")) {
|
||||||
s = s.substring(0, s.indexOf("#"));
|
s = s.substring(0, s.indexOf("#"));
|
||||||
}
|
}
|
||||||
return Utilities.existsInList(s, "hl7.fhir.core","hl7.fhir.r2.core", "hl7.fhir.r2b.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r4b.core", "hl7.fhir.r5.core");
|
return Utilities.existsInList(s, "hl7.fhir.core","hl7.fhir.r2.core", "hl7.fhir.r2b.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r4b.core", "hl7.fhir.r5.core", "hl7.fhir.r6.core");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMajMin(String version) {
|
public static String getMajMin(String version) {
|
||||||
if (version == null)
|
if (version == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ("current".equals(version)) {
|
|
||||||
return CURRENT_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Utilities.charCount(version, '.') == 1) {
|
if (Utilities.charCount(version, '.') == 1) {
|
||||||
String[] p = version.split("\\.");
|
String[] p = version.split("\\.");
|
||||||
return p[0]+"."+p[1];
|
return p[0]+"."+p[1];
|
||||||
} else if (Utilities.charCount(version, '.') == 2) {
|
} else if (Utilities.charCount(version, '.') == 2) {
|
||||||
String[] p = version.split("\\.");
|
String[] p = version.split("\\.");
|
||||||
return p[0]+"."+p[1];
|
return p[0]+"."+p[1];
|
||||||
} else if (Utilities.existsInList(version, "R2", "R2B", "R3", "R4", "R4B", "R5")) {
|
} else if (Utilities.existsInList(version, "R2", "R2B", "R3", "R4", "R4B", "R5", "R6")) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case "R2": return "1.0";
|
case "R2": return "1.0";
|
||||||
case "R2B": return "1.4";
|
case "R2B": return "1.4";
|
||||||
|
@ -222,6 +218,7 @@ public class VersionUtilities {
|
||||||
case "R4": return "4.0";
|
case "R4": return "4.0";
|
||||||
case "R4B": return "4.3";
|
case "R4B": return "4.3";
|
||||||
case "R5": return "5.0";
|
case "R5": return "5.0";
|
||||||
|
case "R6": return "6.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -376,6 +373,9 @@ public class VersionUtilities {
|
||||||
if ("r5".equals(version)) {
|
if ("r5".equals(version)) {
|
||||||
return "5.0.0";
|
return "5.0.0";
|
||||||
}
|
}
|
||||||
|
if ("r6".equals(version)) {
|
||||||
|
return "6.0.0-cibuild";
|
||||||
|
}
|
||||||
throw new FHIRException("Unknown version "+version);
|
throw new FHIRException("Unknown version "+version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ public class VersionUtilities {
|
||||||
String v = url.substring(20, 24);
|
String v = url.substring(20, 24);
|
||||||
if (v.endsWith("/")) {
|
if (v.endsWith("/")) {
|
||||||
v = v.substring(0, v.length()-1);
|
v = v.substring(0, v.length()-1);
|
||||||
if (Utilities.existsInList(v, "1.0", "1.4", "3.0", "4.0", "5.0", CURRENT_VERSION)) {
|
if (Utilities.existsInList(v, "1.0", "1.4", "3.0", "4.0", "5.0", "6.0")) {
|
||||||
return new VersionURLInfo(v, "http://hl7.org/fhir/"+url.substring(24));
|
return new VersionURLInfo(v, "http://hl7.org/fhir/"+url.substring(24));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ public class VersionUtilities {
|
||||||
res.add("ValueSet");
|
res.add("ValueSet");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isR5Ver(version) || "current".equals(version)) {
|
if (isR5Ver(version) || isR6Ver(version)) {
|
||||||
res.add("ActorDefinition");
|
res.add("ActorDefinition");
|
||||||
res.add("ActivityDefinition");
|
res.add("ActivityDefinition");
|
||||||
res.add("CapabilityStatement");
|
res.add("CapabilityStatement");
|
||||||
|
@ -555,9 +555,6 @@ public class VersionUtilities {
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (version.startsWith(CURRENT_VERSION) || version.equals("current")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String v = getMajMin(version);
|
String v = getMajMin(version);
|
||||||
return v.compareTo("4.5") >= 0;
|
return v.compareTo("4.5") >= 0;
|
||||||
}
|
}
|
||||||
|
@ -599,6 +596,7 @@ public class VersionUtilities {
|
||||||
case "4.0" : return "http://hl7.org/fhir/R4";
|
case "4.0" : return "http://hl7.org/fhir/R4";
|
||||||
case "4.3" : return "http://hl7.org/fhir/R4B";
|
case "4.3" : return "http://hl7.org/fhir/R4B";
|
||||||
case "5.0" : return "http://hl7.org/fhir/R5";
|
case "5.0" : return "http://hl7.org/fhir/R5";
|
||||||
|
case "6.0" : return "http://hl7.org/fhir/R6";
|
||||||
default:
|
default:
|
||||||
return "http://hl7.org/fhir";
|
return "http://hl7.org/fhir";
|
||||||
}
|
}
|
||||||
|
@ -612,6 +610,7 @@ public class VersionUtilities {
|
||||||
case "4.0" : return "R4";
|
case "4.0" : return "R4";
|
||||||
case "4.3" : return "R4B";
|
case "4.3" : return "R4B";
|
||||||
case "5.0" : return "R5";
|
case "5.0" : return "R5";
|
||||||
|
case "6.0" : return "R6";
|
||||||
default:
|
default:
|
||||||
return "R?";
|
return "R?";
|
||||||
}
|
}
|
||||||
|
@ -621,5 +620,9 @@ public class VersionUtilities {
|
||||||
return version != null && (version.startsWith("5.") || version.startsWith("6.") || "current".equals(version));
|
return version != null && (version.startsWith("5.") || version.startsWith("6.") || "current".equals(version));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isR6Plus(String version) {
|
||||||
|
return version != null && version.startsWith("6.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -358,7 +358,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
||||||
engine.initContext(timeTracker);
|
engine.initContext(timeTracker);
|
||||||
engine.setIgLoader(new IgLoader(engine.getPcm(), engine.getContext(), engine.getVersion(), engine.isDebug()));
|
engine.setIgLoader(new IgLoader(engine.getPcm(), engine.getContext(), engine.getVersion(), engine.isDebug()));
|
||||||
loadTx(engine);
|
loadTx(engine);
|
||||||
if (VersionUtilities.isR5Ver(version)) {
|
if (VersionUtilities.isR5Plus(version)) {
|
||||||
engine.loadPackage("hl7.fhir.uv.extensions", null);
|
engine.loadPackage("hl7.fhir.uv.extensions", null);
|
||||||
}
|
}
|
||||||
return engine;
|
return engine;
|
||||||
|
@ -377,7 +377,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
||||||
if (THO) {
|
if (THO) {
|
||||||
loadTx(engine);
|
loadTx(engine);
|
||||||
}
|
}
|
||||||
if (VersionUtilities.isR5Ver(version)) {
|
if (VersionUtilities.isR5Plus(version)) {
|
||||||
engine.loadPackage("hl7.fhir.uv.extensions", null);
|
engine.loadPackage("hl7.fhir.uv.extensions", null);
|
||||||
}
|
}
|
||||||
return engine;
|
return engine;
|
||||||
|
@ -394,7 +394,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
||||||
if (VersionUtilities.isR4BVer(version)) {
|
if (VersionUtilities.isR4BVer(version)) {
|
||||||
pid = "hl7.terminology.r4";
|
pid = "hl7.terminology.r4";
|
||||||
}
|
}
|
||||||
if (VersionUtilities.isR5Ver(version)) {
|
if (VersionUtilities.isR5Plus(version)) {
|
||||||
pid = "hl7.terminology.r5";
|
pid = "hl7.terminology.r5";
|
||||||
}
|
}
|
||||||
if (pid != null) {
|
if (pid != null) {
|
||||||
|
@ -881,7 +881,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
||||||
new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res);
|
new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res);
|
||||||
else
|
else
|
||||||
throw new FHIRException("Unsupported format for " + fn);
|
throw new FHIRException("Unsupported format for " + fn);
|
||||||
} else if (VersionUtilities.isR5Ver(version)) {
|
} else if (VersionUtilities.isR5Plus(version)) {
|
||||||
if (fn.endsWith(".xml") && !fn.endsWith("template.xml"))
|
if (fn.endsWith(".xml") && !fn.endsWith("template.xml"))
|
||||||
new XmlParser().setOutputStyle(org.hl7.fhir.r5.formats.IParser.OutputStyle.PRETTY).compose(s, r);
|
new XmlParser().setOutputStyle(org.hl7.fhir.r5.formats.IParser.OutputStyle.PRETTY).compose(s, r);
|
||||||
else if (fn.endsWith(".json") && !fn.endsWith("template.json"))
|
else if (fn.endsWith(".json") && !fn.endsWith("template.json"))
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.hl7.fhir.convertors.loaders.loaderR5.R3ToR5Loader;
|
||||||
import org.hl7.fhir.convertors.loaders.loaderR5.R4BToR5Loader;
|
import org.hl7.fhir.convertors.loaders.loaderR5.R4BToR5Loader;
|
||||||
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
||||||
import org.hl7.fhir.convertors.loaders.loaderR5.R5ToR5Loader;
|
import org.hl7.fhir.convertors.loaders.loaderR5.R5ToR5Loader;
|
||||||
|
import org.hl7.fhir.convertors.loaders.loaderR5.R6ToR5Loader;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
|
@ -75,6 +76,9 @@ public class ValidatorUtils {
|
||||||
if (VersionUtilities.isR5Ver(version)) {
|
if (VersionUtilities.isR5Ver(version)) {
|
||||||
return new R5ToR5Loader(Utilities.strings("CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"), loader);
|
return new R5ToR5Loader(Utilities.strings("CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"), loader);
|
||||||
}
|
}
|
||||||
|
if (VersionUtilities.isR6Ver(version)) {
|
||||||
|
return new R6ToR5Loader(Utilities.strings("CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"), loader);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,11 +392,7 @@ public class ValidationService {
|
||||||
IgLoader igLoader = new IgLoader(validator.getPcm(), validator.getContext(), validator.getVersion(), validator.isDebug());
|
IgLoader igLoader = new IgLoader(validator.getPcm(), validator.getContext(), validator.getVersion(), validator.isDebug());
|
||||||
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), "hl7.terminology", false);
|
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), "hl7.terminology", false);
|
||||||
if (!VersionUtilities.isR5Ver(validator.getContext().getVersion())) {
|
if (!VersionUtilities.isR5Ver(validator.getContext().getVersion())) {
|
||||||
System.out.print(" Load R5 Extensions");
|
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), "hl7.fhir.uv.extensions", false);
|
||||||
R5ExtensionsLoader r5e = new R5ExtensionsLoader(validator.getPcm(), validator.getContext());
|
|
||||||
r5e.load();
|
|
||||||
r5e.loadR5Extensions();
|
|
||||||
System.out.println(" - " + r5e.getCount() + " resources (" + tt.milestone() + ")");
|
|
||||||
}
|
}
|
||||||
System.out.print(" Terminology server " + cliContext.getTxServer());
|
System.out.print(" Terminology server " + cliContext.getTxServer());
|
||||||
String txver = validator.setTerminologyServer(cliContext.getTxServer(), cliContext.getTxLog(), ver);
|
String txver = validator.setTerminologyServer(cliContext.getTxServer(), cliContext.getTxLog(), ver);
|
||||||
|
@ -468,8 +464,8 @@ public class ValidationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (versions.isEmpty()) {
|
if (versions.isEmpty()) {
|
||||||
System.out.println(" No Version Info found: Using Default version '" + VersionUtilities.CURRENT_DEFAULT_VERSION + "'");
|
System.out.println(" No Version Info found: Using Default version R5");
|
||||||
return VersionUtilities.CURRENT_DEFAULT_FULL_VERSION;
|
return "5.0.0";
|
||||||
}
|
}
|
||||||
if (versions.size() == 1) {
|
if (versions.size() == 1) {
|
||||||
System.out.println("-> use version " + versions.version());
|
System.out.println("-> use version " + versions.version());
|
||||||
|
|
|
@ -40,9 +40,6 @@ public class Display {
|
||||||
final static String[][] PLACEHOLDERS = {
|
final static String[][] PLACEHOLDERS = {
|
||||||
{ getMoustacheString("XML_AND_JSON_FHIR_VERSIONS"), "1.0, 1.4, 3.0, 4.0," + Constants.VERSION_MM },
|
{ getMoustacheString("XML_AND_JSON_FHIR_VERSIONS"), "1.0, 1.4, 3.0, 4.0," + Constants.VERSION_MM },
|
||||||
{ getMoustacheString("TURTLE_FHIR_VERSIONS"), "3.0, 4.0, " + Constants.VERSION_MM },
|
{ getMoustacheString("TURTLE_FHIR_VERSIONS"), "3.0, 4.0, " + Constants.VERSION_MM },
|
||||||
{ getMoustacheString("FHIR_MAJOR_VERSIONS"), "1.0|1.4|3.0|" + VersionUtilities.CURRENT_VERSION},
|
|
||||||
{ getMoustacheString("FHIR_MINOR_VERSIONS"), "1.0.2|1.4.0|3.0.2|4.0.1|" + VersionUtilities.CURRENT_FULL_VERSION },
|
|
||||||
{ getMoustacheString("FHIR_CURRENT_VERSION"), VersionUtilities.CURRENT_VERSION},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final static String replacePlaceholders(final String input, final String[][] placeholders) {
|
final static String replacePlaceholders(final String input, final String[][] placeholders) {
|
||||||
|
|
|
@ -570,7 +570,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
StructureDefinition t = determineBaseType(sd);
|
StructureDefinition t = determineBaseType(sd);
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p) && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p) && ok;
|
||||||
} else if (!VersionUtilities.isR5Ver(context.getVersion())) {
|
} else if (!VersionUtilities.isR5Plus(context.getVersion())) {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()) || "Resource".equals(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()) || "Resource".equals(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
||||||
} else {
|
} else {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), Utilities.existsInList(t.getType(), "Resource", "CanonicalResource") || VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), Utilities.existsInList(t.getType(), "Resource", "CanonicalResource") || VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
||||||
|
|
Loading…
Reference in New Issue