validation fixes
This commit is contained in:
parent
86a3a56c42
commit
456ab88b9c
|
@ -43,6 +43,7 @@ import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.formats.FormatUtilities;
|
import org.hl7.fhir.r5.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
@ -92,10 +93,13 @@ public abstract class ParserBase {
|
||||||
public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
|
public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
|
||||||
|
|
||||||
public boolean isPrimitive(String code) {
|
public boolean isPrimitive(String code) {
|
||||||
return Utilities.existsInList(code, "boolean", "integer", "integer64", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "url", "canonical");
|
StructureDefinition sd = context.fetchTypeDefinition(code);
|
||||||
|
if (sd != null) {
|
||||||
|
return sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Utilities.existsInList(code, "boolean", "integer", "integer64", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "uuid", "xhtml", "url", "canonical");
|
||||||
|
|
||||||
// StructureDefinition sd = context.fetchTypeDefinition(code);
|
|
||||||
// return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IWorkerContext context;
|
protected IWorkerContext context;
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class XmlParser extends ParserBase {
|
||||||
int col = Utilities.parseInt(extractVal(e.getMessage(), "columnNumber"), 0);
|
int col = Utilities.parseInt(extractVal(e.getMessage(), "columnNumber"), 0);
|
||||||
logError(line, col, "(xml)", IssueType.INVALID, e.getMessage().substring(e.getMessage().lastIndexOf(";")+1).trim(), IssueSeverity.FATAL);
|
logError(line, col, "(xml)", IssueType.INVALID, e.getMessage().substring(e.getMessage().lastIndexOf(";")+1).trim(), IssueSeverity.FATAL);
|
||||||
} else {
|
} else {
|
||||||
logError(0, 0, "(syntax)", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
logError(0, 0, "(xml)", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
||||||
}
|
}
|
||||||
doc = null;
|
doc = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1843,3 +1843,13 @@ v: {
|
||||||
"error" : "Unable to find code 2 in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20220731); The code \"2\" is not valid in the system http://snomed.info/sct; The code provided (http://snomed.info/sct#2) is not valid in the value set 'All codes known to the system' (from http://tx.fhir.org/r4)"
|
"error" : "Unable to find code 2 in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20220731); The code \"2\" is not valid in the system http://snomed.info/sct; The code provided (http://snomed.info/sct#2) is not valid in the value set 'All codes known to the system' (from http://tx.fhir.org/r4)"
|
||||||
}
|
}
|
||||||
-------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://snomed.info/sct",
|
||||||
|
"code" : "56248011000036107",
|
||||||
|
"display" : "Panadol 500 mg tablet, 50"
|
||||||
|
}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Unable to find code 56248011000036107 in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20220731); The code \"56248011000036107\" is not valid in the system http://snomed.info/sct; The code provided (http://snomed.info/sct#56248011000036107) is not valid in the value set 'All codes known to the system' (from http://tx.fhir.org/r4)"
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue