Merge pull request #1447 from hapifhir/2023-09-gg-cda-fixes
2023 09 gg cda fixes
This commit is contained in:
commit
0d4e1af1a6
|
@ -92,6 +92,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingCompo
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.UriType;
|
import org.hl7.fhir.r5.model.UriType;
|
||||||
|
import org.hl7.fhir.r5.model.UsageContext;
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
|
@ -2691,6 +2692,14 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
if (d.hasValueSet()) {
|
if (d.hasValueSet()) {
|
||||||
nb.setValueSet(d.getValueSet());
|
nb.setValueSet(d.getValueSet());
|
||||||
}
|
}
|
||||||
|
for (ElementDefinitionBindingAdditionalComponent ab : d.getAdditional()) {
|
||||||
|
ElementDefinitionBindingAdditionalComponent eab = getMatchingAdditionalBinding(nb, ab);
|
||||||
|
if (eab != null) {
|
||||||
|
mergeAdditionalBinding(eab, ab);
|
||||||
|
} else {
|
||||||
|
nb.getAdditional().add(ab);
|
||||||
|
}
|
||||||
|
}
|
||||||
base.setBinding(nb);
|
base.setBinding(nb);
|
||||||
} else if (trimDifferential)
|
} else if (trimDifferential)
|
||||||
derived.setBinding(null);
|
derived.setBinding(null);
|
||||||
|
@ -2790,6 +2799,42 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
//updateURLs(url, webUrl, dest);
|
//updateURLs(url, webUrl, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mergeAdditionalBinding(ElementDefinitionBindingAdditionalComponent dest, ElementDefinitionBindingAdditionalComponent source) {
|
||||||
|
for (UsageContext t : source.getUsage()) {
|
||||||
|
if (!hasUsage(dest, t)) {
|
||||||
|
dest.addUsage(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (source.getAny()) {
|
||||||
|
source.setAny(true);
|
||||||
|
}
|
||||||
|
if (source.hasShortDoco()) {
|
||||||
|
dest.setShortDoco(source.getShortDoco());
|
||||||
|
}
|
||||||
|
if (source.hasDocumentation()) {
|
||||||
|
dest.setDocumentation(source.getDocumentation());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasUsage(ElementDefinitionBindingAdditionalComponent dest, UsageContext tgt) {
|
||||||
|
for (UsageContext t : dest.getUsage()) {
|
||||||
|
if (t.getCode() != null && t.getCode().matches(tgt.getCode()) && t.getValue() != null && t.getValue().equals(tgt.getValue())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ElementDefinitionBindingAdditionalComponent getMatchingAdditionalBinding(ElementDefinitionBindingComponent nb,ElementDefinitionBindingAdditionalComponent ab) {
|
||||||
|
for (ElementDefinitionBindingAdditionalComponent t : nb.getAdditional()) {
|
||||||
|
if (t.getValueSet() != null && t.getValueSet().equals(ab.getValueSet()) && t.getPurpose() == ab.getPurpose()) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void mergeExtensions(Element tgt, Element src) {
|
private void mergeExtensions(Element tgt, Element src) {
|
||||||
tgt.getExtension().addAll(src.getExtension());
|
tgt.getExtension().addAll(src.getExtension());
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,7 @@ public class FmlParser extends ParserBase {
|
||||||
lexer.token("(");
|
lexer.token("(");
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
parseParameter(ref, lexer);
|
parseParameter(ref, lexer, false);
|
||||||
done = !lexer.hasToken(",");
|
done = !lexer.hasToken(",");
|
||||||
if (!done)
|
if (!done)
|
||||||
lexer.next();
|
lexer.next();
|
||||||
|
@ -527,7 +527,7 @@ public class FmlParser extends ParserBase {
|
||||||
target.makeElement("transform").markLocation(loc).setValue(name);
|
target.makeElement("transform").markLocation(loc).setValue(name);
|
||||||
lexer.token("(");
|
lexer.token("(");
|
||||||
if (target.getChildValue("transform").equals(StructureMapTransform.EVALUATE.toCode())) {
|
if (target.getChildValue("transform").equals(StructureMapTransform.EVALUATE.toCode())) {
|
||||||
parseParameter(target, lexer);
|
parseParameter(target, lexer, true);
|
||||||
lexer.token(",");
|
lexer.token(",");
|
||||||
loc = lexer.getCurrentLocation();
|
loc = lexer.getCurrentLocation();
|
||||||
ExpressionNode node = fpe.parse(lexer);
|
ExpressionNode node = fpe.parse(lexer);
|
||||||
|
@ -535,7 +535,7 @@ public class FmlParser extends ParserBase {
|
||||||
target.addElement("parameter").markLocation(loc).makeElement("valueString").setValue(node.toString());
|
target.addElement("parameter").markLocation(loc).makeElement("valueString").setValue(node.toString());
|
||||||
} else {
|
} else {
|
||||||
while (!lexer.hasToken(")")) {
|
while (!lexer.hasToken(")")) {
|
||||||
parseParameter(target, lexer);
|
parseParameter(target, lexer, true);
|
||||||
if (!lexer.hasToken(")"))
|
if (!lexer.hasToken(")"))
|
||||||
lexer.token(",");
|
lexer.token(",");
|
||||||
}
|
}
|
||||||
|
@ -568,9 +568,9 @@ public class FmlParser extends ParserBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseParameter(Element ref, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError {
|
private void parseParameter(Element ref, FHIRLexer lexer, boolean isTarget) throws FHIRLexerException, FHIRFormatError {
|
||||||
boolean r5 = VersionUtilities.isR5Plus(context.getVersion());
|
boolean r5 = VersionUtilities.isR5Plus(context.getVersion());
|
||||||
String name = r5 ? "parameter" : "variable";
|
String name = r5 || isTarget ? "parameter" : "variable";
|
||||||
if (ref.hasChildren(name) && !ref.getChildByName(name).isList()) {
|
if (ref.hasChildren(name) && !ref.getChildByName(name).isList()) {
|
||||||
throw lexer.error("variable on target is not a list, so can't add an element");
|
throw lexer.error("variable on target is not a list, so can't add an element");
|
||||||
} else if (!lexer.isConstant()) {
|
} else if (!lexer.isConstant()) {
|
||||||
|
|
|
@ -143,9 +143,12 @@ public abstract class ParserBase {
|
||||||
|
|
||||||
protected StructureDefinition getDefinition(List<ValidationMessage> errors, int line, int col, String ns, String name) throws FHIRFormatError {
|
protected StructureDefinition getDefinition(List<ValidationMessage> errors, int line, int col, String ns, String name) throws FHIRFormatError {
|
||||||
if (logical != null) {
|
if (logical != null) {
|
||||||
String expectedName = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-name");
|
String expectedName = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name");
|
||||||
if (expectedName == null) {
|
if (expectedName == null) {
|
||||||
expectedName = logical.getType();
|
expectedName = logical.getType();
|
||||||
|
if (Utilities.isAbsoluteUrl(expectedName)) {
|
||||||
|
expectedName = expectedName.substring(expectedName.lastIndexOf("/")+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String expectedNamespace = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
|
String expectedNamespace = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
|
||||||
if (matchesNamespace(expectedNamespace, ns) && matchesName(expectedName, name)) {
|
if (matchesNamespace(expectedNamespace, ns) && matchesName(expectedName, name)) {
|
||||||
|
|
|
@ -38,7 +38,9 @@ import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -361,10 +363,16 @@ public class XmlParser extends ParserBase {
|
||||||
if (property.getName().equals("value") && element.isPrimitive())
|
if (property.getName().equals("value") && element.isPrimitive())
|
||||||
element.setValue(av);
|
element.setValue(av);
|
||||||
else {
|
else {
|
||||||
Element n = new Element(property.getName(), property, property.getType(), av).markLocation(line, col);
|
String[] vl = {av};
|
||||||
|
if (property.isList() && av.contains(" ")) {
|
||||||
|
vl = av.split(" ");
|
||||||
|
}
|
||||||
|
for (String v : vl) {
|
||||||
|
Element n = new Element(property.getName(), property, property.getType(), v).markLocation(line, col);
|
||||||
n.setPath(element.getPath()+"."+property.getName());
|
n.setPath(element.getPath()+"."+property.getName());
|
||||||
element.getChildren().add(n);
|
element.getChildren().add(n);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
if (FormatUtilities.FHIR_NS.equals(node.getNamespaceURI())) {
|
if (FormatUtilities.FHIR_NS.equals(node.getNamespaceURI())) {
|
||||||
|
@ -739,11 +747,20 @@ public class XmlParser extends ParserBase {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setXsiTypeIfIsTypeAttr(xml, element);
|
setXsiTypeIfIsTypeAttr(xml, element);
|
||||||
|
Set<String> handled = new HashSet<>();
|
||||||
for (Element child : element.getChildren()) {
|
for (Element child : element.getChildren()) {
|
||||||
if (isAttr(child.getProperty()) && wantCompose(element.getPath(), child)) {
|
if (!handled.contains(child.getName()) && isAttr(child.getProperty()) && wantCompose(element.getPath(), child)) {
|
||||||
|
handled.add(child.getName());
|
||||||
|
String av = child.getValue();
|
||||||
|
if (child.getProperty().isList()) {
|
||||||
|
for (Element c2 : element.getChildren()) {
|
||||||
|
if (c2 != child && c2.getName().equals(child.getName())) {
|
||||||
|
av = av + " "+c2.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (linkResolver != null)
|
if (linkResolver != null)
|
||||||
xml.link(linkResolver.resolveType(child.getType()));
|
xml.link(linkResolver.resolveType(child.getType()));
|
||||||
String av = child.getValue();
|
|
||||||
if (ToolingExtensions.hasExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT))
|
if (ToolingExtensions.hasExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT))
|
||||||
av = convertForDateFormatToExternal(ToolingExtensions.readStringExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT), av);
|
av = convertForDateFormatToExternal(ToolingExtensions.readStringExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT), av);
|
||||||
xml.attribute(child.getProperty().getXmlNamespace(),child.getProperty().getXmlName(), av);
|
xml.attribute(child.getProperty().getXmlNamespace(),child.getProperty().getXmlName(), av);
|
||||||
|
|
|
@ -186,6 +186,18 @@ public class AdditionalBindingsRenderer {
|
||||||
return abr;
|
return abr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AdditionalBindingDetail additionalBinding(ElementDefinitionBindingAdditionalComponent ab) {
|
||||||
|
AdditionalBindingDetail abr = new AdditionalBindingDetail();
|
||||||
|
abr.purpose = ab.getPurpose().toCode();
|
||||||
|
abr.valueSet = ab.getValueSet();
|
||||||
|
abr.doco = ab.getDocumentation();
|
||||||
|
abr.docoShort = ab.getShortDoco();
|
||||||
|
abr.usage = ab.hasUsage() ? ab.getUsageFirstRep() : null;
|
||||||
|
abr.any = ab.getAny();
|
||||||
|
abr.isUnchanged = ab.hasUserData(ProfileUtilities.UD_DERIVATION_EQUALS);
|
||||||
|
return abr;
|
||||||
|
}
|
||||||
|
|
||||||
public String render() throws IOException {
|
public String render() throws IOException {
|
||||||
if (bindings.isEmpty()) {
|
if (bindings.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
|
@ -455,4 +467,40 @@ public class AdditionalBindingsRenderer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void seeAdditionalBindings(ElementDefinition definition, ElementDefinition compDef, boolean compare) {
|
||||||
|
HashMap<String, AdditionalBindingDetail> compBindings = new HashMap<String, AdditionalBindingDetail>();
|
||||||
|
if (compare && compDef.getBinding().getAdditional() != null) {
|
||||||
|
for (ElementDefinitionBindingAdditionalComponent ab : compDef.getBinding().getAdditional()) {
|
||||||
|
AdditionalBindingDetail abr = additionalBinding(ab);
|
||||||
|
if (compBindings.containsKey(abr.getKey())) {
|
||||||
|
abr.incrementCount();
|
||||||
|
}
|
||||||
|
compBindings.put(abr.getKey(), abr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ElementDefinitionBindingAdditionalComponent ab : definition.getBinding().getAdditional()) {
|
||||||
|
AdditionalBindingDetail abr = additionalBinding(ab);
|
||||||
|
if (compare && compDef != null) {
|
||||||
|
AdditionalBindingDetail match = null;
|
||||||
|
do {
|
||||||
|
match = compBindings.get(abr.getKey());
|
||||||
|
if (abr.alreadyMatched())
|
||||||
|
abr.incrementCount();
|
||||||
|
} while (match!=null && abr.alreadyMatched());
|
||||||
|
if (match!=null)
|
||||||
|
abr.setCompare(match);
|
||||||
|
bindings.add(abr);
|
||||||
|
if (abr.compare!=null)
|
||||||
|
compBindings.remove(abr.compare.getKey());
|
||||||
|
} else
|
||||||
|
bindings.add(abr);
|
||||||
|
}
|
||||||
|
for (AdditionalBindingDetail b: compBindings.values()) {
|
||||||
|
b.removed = true;
|
||||||
|
bindings.add(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.hl7.fhir.r5.model.UriType;
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
||||||
import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer.InternalMarkdownProcessor;
|
import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer.InternalMarkdownProcessor;
|
||||||
|
import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer.SourcedElementDefinition;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||||
|
@ -157,6 +158,25 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public class SourcedElementDefinition {
|
||||||
|
private StructureDefinition profile;
|
||||||
|
private ElementDefinition definition;
|
||||||
|
|
||||||
|
|
||||||
|
protected SourcedElementDefinition(StructureDefinition profile, ElementDefinition definition) {
|
||||||
|
super();
|
||||||
|
this.profile = profile;
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
public StructureDefinition getProfile() {
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
public ElementDefinition getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public class InternalMarkdownProcessor implements IMarkdownProcessor {
|
public class InternalMarkdownProcessor implements IMarkdownProcessor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1320,6 +1340,22 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (logicalModel) {
|
||||||
|
List<SourcedElementDefinition> ancestors = new ArrayList<>();
|
||||||
|
getAncestorElements(profile, ancestors);
|
||||||
|
if (ancestors.size() > 0) {
|
||||||
|
c.addPiece(gen.new Piece("br"));
|
||||||
|
c.addPiece(gen.new Piece(null, "Elements defined in Ancestors: ", null));
|
||||||
|
boolean first = true;
|
||||||
|
for (SourcedElementDefinition ed : ancestors) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
c.addPiece(gen.new Piece(null, ", ", null));
|
||||||
|
c.addPiece(gen.new Piece(ed.getProfile().getWebPath(), (isAttr(ed) ? "@" : "")+ed.getDefinition().getName(), ed.getDefinition().getDefinition()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (definition.getPath().endsWith("url") && definition.hasFixed()) {
|
if (definition.getPath().endsWith("url") && definition.hasFixed()) {
|
||||||
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen")));
|
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen")));
|
||||||
|
@ -1552,6 +1588,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
AdditionalBindingsRenderer abr = new AdditionalBindingsRenderer(context.getPkp(), corePath, profile, definition.getPath(), rc, null, this);
|
AdditionalBindingsRenderer abr = new AdditionalBindingsRenderer(context.getPkp(), corePath, profile, definition.getPath(), rc, null, this);
|
||||||
|
abr.seeAdditionalBindings(definition, null, false);
|
||||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) {
|
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) {
|
||||||
abr.seeMaxBinding(ToolingExtensions.getExtension(binding, ToolingExtensions.EXT_MAX_VALUESET));
|
abr.seeMaxBinding(ToolingExtensions.getExtension(binding, ToolingExtensions.EXT_MAX_VALUESET));
|
||||||
}
|
}
|
||||||
|
@ -1651,6 +1688,26 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isAttr(SourcedElementDefinition ed) {
|
||||||
|
for (Enumeration<PropertyRepresentation> t : ed.getDefinition().getRepresentation()) {
|
||||||
|
if (t.getValue() == PropertyRepresentation.XMLATTR) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getAncestorElements(StructureDefinition profile, List<SourcedElementDefinition> ancestors) {
|
||||||
|
StructureDefinition base = context.getContext().fetchResource(StructureDefinition.class, profile.getBaseDefinition());
|
||||||
|
if (base != null) {
|
||||||
|
getAncestorElements(base, ancestors);
|
||||||
|
for (ElementDefinition ed : base.getDifferential().getElement()) {
|
||||||
|
if (Utilities.charCount(ed.getPath(), '.') == 1) {
|
||||||
|
ancestors.add(new SourcedElementDefinition(base, ed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List<Extension> list, String start, boolean bold) {
|
private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List<Extension> list, String start, boolean bold) {
|
||||||
List<CanonicalType> clist = new ArrayList<>();
|
List<CanonicalType> clist = new ArrayList<>();
|
||||||
|
|
|
@ -686,6 +686,9 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
||||||
|
|
||||||
private ValidationResult validateCode(String path, Coding code, CodeSystem cs, CodeableConcept vcc, ValidationProcessInfo info) {
|
private ValidationResult validateCode(String path, Coding code, CodeSystem cs, CodeableConcept vcc, ValidationProcessInfo info) {
|
||||||
ConceptDefinitionComponent cc = cs.hasUserData("tx.cs.special") ? ((SpecialCodeSystem) cs.getUserData("tx.cs.special")).findConcept(code) : findCodeInConcept(cs.getConcept(), code.getCode(), allAltCodes);
|
ConceptDefinitionComponent cc = cs.hasUserData("tx.cs.special") ? ((SpecialCodeSystem) cs.getUserData("tx.cs.special")).findConcept(code) : findCodeInConcept(cs.getConcept(), code.getCode(), allAltCodes);
|
||||||
|
if (cc == null) {
|
||||||
|
cc = findSpecialConcept(code, cs);
|
||||||
|
}
|
||||||
if (cc == null) {
|
if (cc == null) {
|
||||||
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
|
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
|
||||||
String msg = context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_FRAGMENT, code.getCode(), cs.getVersionedUrl());
|
String msg = context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_FRAGMENT, code.getCode(), cs.getVersionedUrl());
|
||||||
|
@ -759,6 +762,28 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ConceptDefinitionComponent findSpecialConcept(Coding c, CodeSystem cs) {
|
||||||
|
// handling weird special cases in v2 code systems
|
||||||
|
if ("http://terminology.hl7.org/CodeSystem/v2-0203".equals(cs.getUrl())) {
|
||||||
|
String code = c.getCode();
|
||||||
|
if (code != null && code.startsWith("NN") && code.length() > 3) {
|
||||||
|
ConceptDefinitionComponent cd = findCountryCode(code.substring(2));
|
||||||
|
if (cd != null) {
|
||||||
|
return new ConceptDefinitionComponent(code).setDisplay("National Identifier for "+cd.getDisplay());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 0396: HL7nnnn, IBTnnnn, ISOnnnn, X12Dennnn, 99zzz
|
||||||
|
// 0335: PRNxxx
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ConceptDefinitionComponent findCountryCode(String code) {
|
||||||
|
ValidationResult vr = context.validateCode(new ValidationOptions(), "urn:iso:std:iso:3166", null, code, null);
|
||||||
|
return vr == null || !vr.isOk() ? null : new ConceptDefinitionComponent(code).setDisplay(vr.getDisplay()).setDefinition(vr.getDefinition());
|
||||||
|
}
|
||||||
|
|
||||||
private IssueSeverity dispWarning() {
|
private IssueSeverity dispWarning() {
|
||||||
return options.isDisplayWarningMode() ? IssueSeverity.WARNING : IssueSeverity.ERROR;
|
return options.isDisplayWarningMode() ? IssueSeverity.WARNING : IssueSeverity.ERROR;
|
||||||
}
|
}
|
||||||
|
@ -811,15 +836,6 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String gen(Coding code) {
|
|
||||||
if (code.hasSystem()) {
|
|
||||||
return code.getSystem()+"#"+code.getCode();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String getValueSetSystemOrNull() throws FHIRException {
|
private String getValueSetSystemOrNull() throws FHIRException {
|
||||||
if (valueset == null) {
|
if (valueset == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -6,6 +6,6 @@ public class CommonPackages {
|
||||||
public static final String VER_XVER = "0.0.12";
|
public static final String VER_XVER = "0.0.12";
|
||||||
|
|
||||||
public static final String ID_PUBPACK = "hl7.fhir.pubpack";
|
public static final String ID_PUBPACK = "hl7.fhir.pubpack";
|
||||||
public static final String VER_PUBPACK = "0.1.5";
|
public static final String VER_PUBPACK = "0.1.6";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,10 +394,10 @@ Does_not_match_slice_ = Does not match slice ''{0}'' (discriminator: {1})
|
||||||
Profile__does_not_match_for__because_of_the_following_profile_issues__ = Profile {0} does not match for {1} because of the following profile issues: {2}
|
Profile__does_not_match_for__because_of_the_following_profile_issues__ = Profile {0} does not match for {1} because of the following profile issues: {2}
|
||||||
This_element_does_not_match_any_known_slice_ = This element does not match any known slice {0}
|
This_element_does_not_match_any_known_slice_ = This element does not match any known slice {0}
|
||||||
defined_in_the_profile = Defined in the profile
|
defined_in_the_profile = Defined in the profile
|
||||||
This_does_not_appear_to_be_a_FHIR_resource_unknown_name_ = This does not appear to be a FHIR resource (unknown name ''{0}'')
|
This_does_not_appear_to_be_a_FHIR_resource_unknown_name_ = This content cannot be parsed (unknown or unrecognised XML root element name ''{0}'')
|
||||||
This_cannot_be_parsed_as_a_FHIR_object_no_name = This cannot be parsed as a FHIR object (no name)
|
This_cannot_be_parsed_as_a_FHIR_object_no_name = This content cannot be parsed (no name)
|
||||||
This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_ = This does not appear to be a FHIR resource (unknown namespace/name ''{0}::{1}'')
|
This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_ = This content cannot be parsed (unknown or unrecognised XML Root element namespace/name ''{0}::{1}'')
|
||||||
This__cannot_be_parsed_as_a_FHIR_object_no_namespace = This ''{0}'' cannot be parsed as a FHIR object (no namespace)
|
This__cannot_be_parsed_as_a_FHIR_object_no_namespace = This ''{0}'' cannot be parsed (no namespace on the XML Root element)
|
||||||
Unable_to_find_resourceType_property = Unable to find resourceType property
|
Unable_to_find_resourceType_property = Unable to find resourceType property
|
||||||
Error_parsing_JSON_the_primitive_value_must_be_a_string = Error parsing JSON: the primitive value must be a string
|
Error_parsing_JSON_the_primitive_value_must_be_a_string = Error parsing JSON: the primitive value must be a string
|
||||||
Error_parsing_JSON_the_primitive_value_must_be_a_number = Error parsing JSON: the primitive value must be a number
|
Error_parsing_JSON_the_primitive_value_must_be_a_number = Error parsing JSON: the primitive value must be a number
|
||||||
|
|
|
@ -1169,7 +1169,7 @@ public class StructureMapValidator extends BaseValidator {
|
||||||
Element g = (Element) grp.getTargetGroup().getUserData("element.source");
|
Element g = (Element) grp.getTargetGroup().getUserData("element.source");
|
||||||
if (g.hasUserData("structuremap.parameters")) {
|
if (g.hasUserData("structuremap.parameters")) {
|
||||||
VariableSet pvars = (VariableSet) g.getUserData("structuremap.parameters");
|
VariableSet pvars = (VariableSet) g.getUserData("structuremap.parameters");
|
||||||
rule(errors, "2023-03-01", IssueType.INVALID, dependent.line(), dependent.col(), stack.getLiteralPath(), pvars.matches(lvars), I18nConstants.SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE, grp.getTargetGroup().getName(), pvars.summary(), lvars.summary());
|
warning(errors, "2023-03-01", IssueType.INVALID, dependent.line(), dependent.col(), stack.getLiteralPath(), pvars.matches(lvars), I18nConstants.SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE, grp.getTargetGroup().getName(), pvars.summary(), lvars.summary());
|
||||||
} else {
|
} else {
|
||||||
g.setUserData("structuremap.parameters", lvars);
|
g.setUserData("structuremap.parameters", lvars);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,27 @@ v: {
|
||||||
"code" : "US",
|
"code" : "US",
|
||||||
"system" : "urn:iso:std:iso:3166",
|
"system" : "urn:iso:std:iso:3166",
|
||||||
"version" : "2018",
|
"version" : "2018",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "urn:iso:std:iso:3166",
|
||||||
|
"code" : "FIN"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"display" : "Finland",
|
||||||
|
"code" : "FIN",
|
||||||
|
"system" : "urn:iso:std:iso:3166",
|
||||||
|
"version" : "2018",
|
||||||
"unknown-systems" : "",
|
"unknown-systems" : "",
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
|
|
Loading…
Reference in New Issue