Merge pull request #1099 from hapifhir/gg-202302-extension-validation
Gg 202302 extension validation
This commit is contained in:
commit
92d2bd0eb2
|
@ -17,7 +17,6 @@ import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
|
|||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.json.model.JsonArray;
|
||||
import org.hl7.fhir.utilities.json.model.JsonElement;
|
||||
import org.hl7.fhir.utilities.json.model.JsonObject;
|
||||
import org.hl7.fhir.utilities.json.parser.JsonParser;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Bool
|
|||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Date30_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.Immunization;
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hl7.fhir.convertors.conv30_50.resources30_50;
|
|||
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Code30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
|
||||
|
|
|
@ -5,9 +5,7 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
|
|||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Code30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Integer30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class DateTime40_50 {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Reference;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.CodeableReference;
|
||||
|
||||
public class Reference40_50 {
|
||||
|
|
|
@ -5,10 +5,7 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableCon
|
|||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Code40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Integer40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
|
|
|
@ -5,10 +5,7 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableCon
|
|||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Integer43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
|
|
|
@ -47,12 +47,10 @@ 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.Enumerations.BindingStrength;
|
||||
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;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
|
||||
public class R5ToR5Loader extends BaseLoaderR5 {
|
||||
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.CanonicalResourceManager;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingAdditionalComponent;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
|
||||
public class ExtensionExtractor {
|
||||
|
||||
public static void main(String[] args) throws FHIRFormatError, FileNotFoundException, IOException {
|
||||
new ExtensionExtractor().process(args[0]);
|
||||
|
||||
}
|
||||
|
||||
private void process(String dst) throws IOException {
|
||||
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true);
|
||||
NpmPackage r5 = pcm.loadPackage("hl7.fhir.r5.core", "current");
|
||||
CanonicalResourceManager<CodeSystem> cslist = new CanonicalResourceManager<CodeSystem>(true);
|
||||
for (String r : r5.listResources("CodeSystem")) {
|
||||
CodeSystem cs = (CodeSystem) new JsonParser().parse(r5.load(r));
|
||||
cslist.see(cs, null);
|
||||
}
|
||||
CanonicalResourceManager<ValueSet> vslist = new CanonicalResourceManager<ValueSet>(true);
|
||||
for (String r : r5.listResources("ValueSet")) {
|
||||
ValueSet vs = (ValueSet) new JsonParser().parse(r5.load(r));
|
||||
vslist.see(vs, null);
|
||||
}
|
||||
for (ValueSet vs : vslist.getList()) {
|
||||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||
CodeSystem cs = cslist.get(inc.getSystem());
|
||||
if (cs != null) {
|
||||
if (!cs.hasUserData("vsl")) {
|
||||
cs.setUserData("vsl", new ArrayList<ValueSet>());
|
||||
}
|
||||
((ArrayList<ValueSet>) cs.getUserData("vsl")).add(vs);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String r : r5.listResources("StructureDefinition")) {
|
||||
StructureDefinition sd = (StructureDefinition) new JsonParser().parse(r5.load(r));
|
||||
if (sd.getType().equals("Extension") && sd.getDerivation() == TypeDerivationRule.CONSTRAINT) {
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||
seeBinding(ed.getBinding().getValueSet(), vslist, "ext", sd);
|
||||
for (ElementDefinitionBindingAdditionalComponent ab : ed.getBinding().getAdditional()) {
|
||||
seeBinding(ab.getValueSet(), vslist, "ext", sd);
|
||||
}
|
||||
}
|
||||
sd.setSnapshot(null);
|
||||
String fn;
|
||||
if (sd.getContext().size() == 0) {
|
||||
save(sd, dst,"none");
|
||||
} else if (sd.getContext().size() > 1) {
|
||||
boolean dt = true;
|
||||
for (StructureDefinitionContextComponent x : sd.getContext()) {
|
||||
String s = extractType(x.getExpression());
|
||||
dt = dt && isDataType(s);
|
||||
}
|
||||
if (dt) {
|
||||
save(sd, dst,"datatypes");
|
||||
} else {
|
||||
save(sd, dst,"multiple");
|
||||
}
|
||||
} else {
|
||||
String s = extractType(sd.getContextFirstRep().getExpression());
|
||||
if (isDataType(s)) {
|
||||
save(sd, dst,"datatypes");
|
||||
} else {
|
||||
save(sd, dst,s);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||
seeBinding(ed.getBinding().getValueSet(), vslist, "core", sd);
|
||||
for (ElementDefinitionBindingAdditionalComponent ab : ed.getBinding().getAdditional()) {
|
||||
seeBinding(ab.getValueSet(), vslist, "core", sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ValueSet vs : vslist.getList()) {
|
||||
if (vs.hasUserData("core") || !vs.hasUserData("ext") || vs.getUrl().startsWith("http://terminology.")) {
|
||||
vslist.drop(vs.getId());
|
||||
}
|
||||
}
|
||||
for (CodeSystem cs : cslist.getList()) {
|
||||
boolean keep = false;
|
||||
if (cs.hasUserData("vsl") && !cs.getUrl().startsWith("http://terminology.")) {
|
||||
keep = true;
|
||||
for (ValueSet vs : (ArrayList<ValueSet>) cs.getUserData("vsl")) {
|
||||
if (!vslist.has(vs.getUrl())) {
|
||||
keep = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!keep) {
|
||||
cslist.drop(cs.getId());
|
||||
}
|
||||
}
|
||||
for (ValueSet vs : vslist.getList()) {
|
||||
StructureDefinition sd = (StructureDefinition) vs.getUserData("ext");
|
||||
String s = sd.getUserString("folder");
|
||||
save(vs, dst, s);
|
||||
}
|
||||
for (CodeSystem cs : cslist.getList()) {
|
||||
ValueSet vs = ((ArrayList<ValueSet>) cs.getUserData("vsl")).get(0);
|
||||
String s = vs.getUserString("folder");
|
||||
save(cs, dst,s);
|
||||
}
|
||||
}
|
||||
|
||||
private void save(CanonicalResource cr, String dst, String folder) throws IOException {
|
||||
// TODO Auto-generated method stub
|
||||
cr.setText(null);
|
||||
if (!cr.hasTitle()) {
|
||||
cr.setTitle(Utilities.unCamelCase(cr.getName()));
|
||||
}
|
||||
String fn = Utilities.path(dst, folder, cr.fhirType()+"-"+cr.getId()+".xml");
|
||||
cr.setUserData("folder", folder);
|
||||
if (!new File(fn).exists()) {
|
||||
Utilities.createDirectory(Utilities.getDirectoryForFile(fn));
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), cr);
|
||||
}
|
||||
}
|
||||
|
||||
private void seeBinding(String url, CanonicalResourceManager<ValueSet> vslist, String name, StructureDefinition sd) {
|
||||
ValueSet vs = vslist.get(url);
|
||||
if (vs != null) {
|
||||
vs.setUserData(name, sd);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDataType(String s) {
|
||||
return Utilities.existsInList(s,
|
||||
"PrimitiveType", "instant", "time", "date", "dateTime", "decimal", "boolean", "integer", "string",
|
||||
"uri", "base64Binary", "code", "id", "oid", "unsignedInt", "positiveInt", "markdown", "url", "canonical",
|
||||
"uuid", "integer64", "DataType", "BackboneType", "Identifier", "HumanName", "Address", "ContactPoint",
|
||||
"Timing", "Quantity", "SimpleQuantity", "Attachment", "Range", "Period", "Ratio", "RatioRange", "CodeableConcept",
|
||||
"Coding", "SampledData", "Age", "Distance", "Duration", "Count", "Money", "MoneyQuantity", "Annotation", "Signature", "DataType",
|
||||
"ContactDetail", "Contributor", "DataRequirement", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext",
|
||||
"Expression", "ExtendedContactDetail", "VirtualServiceDetail", "Availability", "MonetaryComponent", "DataType",
|
||||
"BackboneType", "Reference", "Narrative", "Extension", "Meta", "ElementDefinition", "Dosage", "xhtml", "CodeableReference");
|
||||
}
|
||||
|
||||
private String extractType(String x) {
|
||||
String s = x;
|
||||
if (s.contains(".")) {
|
||||
s = s.substring(0, s.indexOf("."));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -8,6 +12,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
|
@ -35,9 +41,6 @@ import org.hl7.fhir.utilities.json.model.JsonObject;
|
|||
import org.hl7.fhir.utilities.json.parser.JsonParser;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class NpmPackageVersionConverter {
|
||||
|
||||
private static final int BUFFER_SIZE = 1024;
|
||||
|
@ -81,7 +84,7 @@ public class NpmPackageVersionConverter {
|
|||
output.put("package/other/spec.internals", convertSpec(content.get("package/other/spec.internals")));
|
||||
|
||||
for (Entry<String, byte[]> e : content.entrySet()) {
|
||||
if (!e.getKey().equals("package/package.json") && !e.getKey().equals("package/other/spec.internals")) {
|
||||
if (!e.getKey().equals("package/package.json") && !e.getKey().equals("package/other/spec.internals") && !e.getKey().endsWith("ig-r4.json")) {
|
||||
byte[] cnv = e.getValue();
|
||||
try {
|
||||
JsonObject json = JsonParser.parseObject(e.getValue());
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hl7.fhir.convertors.misc;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.hl7.fhir.utilities.json.model.JsonObject;
|
||||
import org.hl7.fhir.utilities.json.model.JsonProperty;
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hl7.fhir.convertors.misc.xver;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
|
||||
|
@ -14,7 +13,6 @@ import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50;
|
|||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.convertors.misc.xver.CorePackageVersionConvertor.BaseConvertor;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.json.model.JsonArray;
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package org.hl7.fhir.convertors.conv30_40;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class Immunization30_40Test {
|
||||
|
||||
private org.hl7.fhir.r4.formats.JsonParser r4Parser = new org.hl7.fhir.r4.formats.JsonParser();
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package org.hl7.fhir.convertors.conv40_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import javax.annotation.Nullable;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.tests.ResourceLoaderTests;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import org.hl7.fhir.utilities.tests.ResourceLoaderTests;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class NpmPackageVersionConverterTests implements ResourceLoaderTests {
|
||||
@org.junit.jupiter.api.Test
|
||||
|
|
|
@ -129,7 +129,7 @@ public class Identifier extends Type implements ICompositeType {
|
|||
public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> {
|
||||
public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
|
||||
if (codeString == null || "".equals(codeString))
|
||||
if (codeString == null || "".equals(codeString))
|
||||
if (codeString == null || "".equals(codeString) || "?".equals(codeString))
|
||||
return null;
|
||||
if ("usual".equals(codeString))
|
||||
return IdentifierUse.USUAL;
|
||||
|
|
|
@ -326,6 +326,8 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
|
|||
|
||||
public void drop(CachedCanonicalResource<T> cr) {
|
||||
while (map.values().remove(cr));
|
||||
while (listForId.values().remove(cr));
|
||||
while (listForUrl.values().remove(cr));
|
||||
list.remove(cr);
|
||||
List<CachedCanonicalResource<T>> set = listForUrl.get(cr.getUrl());
|
||||
if (set != null) { // it really should be
|
||||
|
|
|
@ -561,7 +561,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
} else if (!VersionUtilities.isR5Ver(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;
|
||||
} else {
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), 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(), "CanonicalResource".equals(t.getType()) || VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -47,9 +47,9 @@ public class FHIRPathExpressionFixer {
|
|||
if (expr.equals("url.matches('([^|#])*')")) {
|
||||
return ("$this.matches('([^|#])*')");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (expr.equals("((kind in 'resource' | 'complex-type') and (specialization = 'derivation')) implies differential.element.where((min != 0 and min != 1) or (max != '1' and max != '*')).empty()")) {
|
||||
return "((kind in 'resource' | 'complex-type') and (derivation = 'specialization')) implies differential.element.where((min.exists() and min != 0 and min != 1) or (max.exists() and max != '1' and max != '*')).empty()";
|
||||
}
|
||||
|
||||
// clarification in FHIRPath spec
|
||||
if ("eld-19".equals(key)) {
|
||||
|
|
Loading…
Reference in New Issue