fix validation issues on HL7 publisher

This commit is contained in:
Grahame Grieve 2023-12-11 16:56:27 +11:00
parent 9fae571412
commit de7dc3023d
4 changed files with 25 additions and 4 deletions

View File

@ -5,13 +5,15 @@ public class HL7WorkGroups {
public static class HL7WorkGroup {
private String link;
private String name;
private String name2;
private String code;
protected HL7WorkGroup(String code, String name, String link) {
protected HL7WorkGroup(String code, String name, String name2, String link) {
super();
this.code = code;
this.name = name;
this.name2 = name2;
this.link = link;
}
public String getLink() {
@ -20,6 +22,9 @@ public class HL7WorkGroups {
public String getName() {
return name;
}
public String getName2() {
return name2;
}
public String getCode() {
return code;
}
@ -27,9 +32,10 @@ public class HL7WorkGroups {
public static HL7WorkGroup find(String wg) {
String name = nameForWG(wg);
String name2 = name2ForWG(wg);
String url = urlForWG(wg);
if (name != null) {
return new HL7WorkGroup(wg, name, url);
return new HL7WorkGroup(wg, name, name2, url);
} else {
return null;
}
@ -125,7 +131,7 @@ public class HL7WorkGroups {
case "sd": return "Structured Documents";
case "sec": return "Security";
case "soa": return "Services Oriented Architecture";
case "ti": return "Vocabulary";
case "ti": return "Terminology Infrastructure";
case "tsmg": return "Terminology Services Management Group (TSMG)";
case "us": return "US Realm Steering Committee";
case "v2": return "V2 Management Group";
@ -134,5 +140,12 @@ public class HL7WorkGroups {
return null;
}
private static String name2ForWG(String wg) {
switch (wg) {
case "ti": return "Vocabulary";
case "vocab": return "Vocabulary";
}
return null;
}
}

View File

@ -999,6 +999,7 @@ public class I18nConstants {
public static final String VALIDATION_HL7_WG_NEEDED = "VALIDATION_HL7_WG_NEEDED";
public static final String VALIDATION_HL7_WG_UNKNOWN = "VALIDATION_HL7_WG_UNKNOWN";
public static final String VALIDATION_HL7_PUBLISHER_MISMATCH = "VALIDATION_HL7_PUBLISHER_MISMATCH";
public static final String VALIDATION_HL7_PUBLISHER_MISMATCH2 = "VALIDATION_HL7_PUBLISHER_MISMATCH2";
public static final String VALIDATION_HL7_WG_URL = "VALIDATION_HL7_WG_URL";
public static final String VALIDATION_HL7_PUBLISHER_MISSING = "VALIDATION_HL7_PUBLISHER_MISSING";
public static final String TYPE_SPECIFIC_CHECKS_DT_QTY_UCUM_ANNOTATIONS = "TYPE_SPECIFIC_CHECKS_DT_QTY_UCUM_ANNOTATIONS";

View File

@ -1060,6 +1060,7 @@ BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_NO_MATCH_REASON = The {1} resource did no
VALIDATION_HL7_WG_NEEDED = When HL7 is publishing a resource, the owning committee must be stated using the {0} extension
VALIDATION_HL7_WG_UNKNOWN = The nominated WG ''{0}'' is unknown
VALIDATION_HL7_PUBLISHER_MISMATCH = The nominated WG ''{0}'' means that the publisher should be ''{1}'' but ''{2}'' was found
VALIDATION_HL7_PUBLISHER_MISMATCH2 = The nominated WG ''{0}'' means that the publisher should be either ''{1}''or ''{2}'' but ''{3}'' was found
VALIDATION_HL7_WG_URL = The nominated WG ''{0}'' means that the contact url should be ''{1}'' but it was not found
VALIDATION_HL7_PUBLISHER_MISSING = When HL7 is publishing a resource, the publisher must be provided, and for WG ''{0}'' it should be ''{1}''
TYPE_SPECIFIC_CHECKS_DT_QTY_UCUM_ANNOTATIONS_NO_UNIT = UCUM Codes that contain human readable annotations like {0} can be misleading (e.g. they are ignored when comparing units). Best Practice is not to depend on annotations in the UCUM code, so this usage should be checked, and the Quantity.unit SHOULD contain the annotation

View File

@ -5578,7 +5578,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (rule(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), wgd != null, I18nConstants.VALIDATION_HL7_WG_UNKNOWN, wg)) {
String rpub = "HL7 International / "+wgd.getName();
if (warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), pub != null, I18nConstants.VALIDATION_HL7_PUBLISHER_MISSING, wg, rpub)) {
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), rpub.equals(pub), I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH, wg, rpub, pub);
boolean ok = rpub.equals(pub);
if (!ok && wgd.getName2() != null) {
ok = ("HL7 International / "+wgd.getName2()).equals(pub);
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH2, wg, rpub, "HL7 International / "+wgd.getName2(), pub);
} else {
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH, wg, rpub, pub);
}
}
warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(),
Utilities.startsWithInList( wgd.getLink(), urls), I18nConstants.VALIDATION_HL7_WG_URL, wg, wgd.getLink());