Merge pull request #1192 from hapifhir/gg-202303-cm-validation
Gg 202303 cm validation
This commit is contained in:
commit
485483829c
|
@ -19,7 +19,7 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
|
|
|
@ -108,9 +108,17 @@ public class FmlParser extends ParserBase {
|
|||
parseGroup(result, lexer);
|
||||
}
|
||||
} catch (FHIRLexerException e) {
|
||||
logError("2023-02-24", e.getLocation().getLine(), e.getLocation().getColumn(), "??", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
||||
if (policy == ValidationPolicy.NONE) {
|
||||
throw e;
|
||||
} else {
|
||||
logError("2023-02-24", e.getLocation().getLine(), e.getLocation().getColumn(), "??", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logError("2023-02-24", -1, -1, "?", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
||||
if (policy == ValidationPolicy.NONE) {
|
||||
throw e;
|
||||
} else {
|
||||
logError("2023-02-24", -1, -1, "?", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
|
||||
}
|
||||
}
|
||||
result.setIgnorePropertyOrder(true);
|
||||
return result;
|
||||
|
|
|
@ -698,5 +698,15 @@ public class CodeSystemUtilities {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean checkDisplay(CodeSystem cs, ConceptDefinitionComponent cd, String display) {
|
||||
List<String> displays = getDisplays(cs, cd);
|
||||
for (String s : displays) {
|
||||
if (s.equalsIgnoreCase(display)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TestingUtilities extends BaseTestingUtilities {
|
|||
fcontext.loadFromPackage(utg, new TestPackageLoader(Utilities.strings("CodeSystem", "ValueSet")));
|
||||
}
|
||||
if (!fcontext.hasPackage("hl7.fhir.uv.extensions", null)) {
|
||||
NpmPackage ext = pcm.loadPackage("hl7.fhir.uv.extensions", "current");
|
||||
NpmPackage ext = pcm.loadPackage("hl7.fhir.uv.extensions", "1.0.0");
|
||||
System.out.println("Loading Extensions: "+ext.name()+"#"+ext.version());
|
||||
fcontext.loadFromPackage(ext, new TestPackageLoader(Utilities.strings("CodeSystem", "ValueSet", "StructureDefinition")));
|
||||
}
|
||||
|
|
|
@ -157,8 +157,7 @@ public class ConceptMapValidator extends BaseValidator {
|
|||
if (warningOrError(srcCS.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_CODE_INVALID, c, srcCS.getVersionedUrl())) {
|
||||
Element display = src.getNamedChild("display");
|
||||
if (display != null) {
|
||||
List<String> displays = CodeSystemUtilities.getDisplays(srcCS, cd);
|
||||
ok = rule(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), displays.contains(display.getValue()), I18nConstants.CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID, display.getValue(), displays) && ok;
|
||||
warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), CodeSystemUtilities.checkDisplay(srcCS, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(srcCS, cd));
|
||||
}
|
||||
} else {
|
||||
ok = false;
|
||||
|
@ -183,9 +182,8 @@ public class ConceptMapValidator extends BaseValidator {
|
|||
ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(tgtCS, c);
|
||||
if (warningOrError(tgtCS.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_CODE_INVALID, c, tgtCS.getVersionedUrl())) {
|
||||
Element display = tgt.getNamedChild("display");
|
||||
if (display != null) {
|
||||
List<String> displays = CodeSystemUtilities.getDisplays(tgtCS, cd);
|
||||
ok = rule(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), displays.contains(display.getValue()), I18nConstants.CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID, display.getValue(), displays) && ok;
|
||||
if (display != null) {
|
||||
warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), CodeSystemUtilities.checkDisplay(tgtCS, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(tgtCS, cd));
|
||||
}
|
||||
} else {
|
||||
ok = false;
|
||||
|
|
Loading…
Reference in New Issue