Describe the bug
A clear and concise description of what the bug is.
{
"severity": "warning",
"code": "code-invalid",
"details": {
"text": "Code 'hl7-fhir-opn' is invalid"
},
"expression": [
"Endpoint.connectionType"
]
}
Environment
Which version of IBM FHIR Server? latest release / main
To Reproduce
Steps to reproduce the behavior:
- Create an test project linked to fhir-ig-davinci-plannet
- Create an Endpoint without a display name
Endpoint.Builder builder = Endpoint.builder();
builder.setValidating(false);
builder.meta(Meta.builder()
.profile(
Canonical.of("http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-Endpoint"))
.lastUpdated(Instant.now())
.build());
builder.connectionType(Coding.builder()
.code(Code.of("hl7-fhir-opn"))
.system(Uri.of("http://hl7.org/fhir/us/davinci-pdex-plan-net/CodeSystem/EndpointConnectionTypeCS"))
.build());
System.out.println(builder.build());
Endpoint endpoint = builder.build()
- Run the following:
List<Issue> issues = FHIRValidator.validator().validate(endpoint);
issues.forEach(System.out::println);
- Generates the following warning...
{
"severity": "warning",
"code": "code-invalid",
"details": {
"text": "Code 'hl7-fhir-opn' is invalid"
},
"expression": [
"Endpoint.connectionType"
]
}
To work around the issue...
//.display("HL7 FHIR Operation") // Commented out we emit a warning
{
"system": "http://hl7.org/fhir/us/davinci-pdex-plan-net/CodeSystem/EndpointConnectionTypeCS",
"code": "hl7-fhir-opn",
"display": "HL7 FHIR Operation"
}
private ValidationOutcome validateCode(CodeSystem codeSystem, Coding coding, boolean result, LookupOutcome outcome) {
java.lang.String message = null;
if (!result && coding != null && coding.getCode() != null) {
message = java.lang.String.format("Code '%s' is invalid", coding.getCode().getValue());
}
if (result && outcome != null && coding != null &&
outcome.getDisplay() != null && coding.getDisplay() != null &&
outcome.getDisplay().getValue() != null && coding.getDisplay().getValue() != null) {
java.lang.String system = null;
if (coding.getSystem() != null) {
system = coding.getSystem().getValue();
} else if (codeSystem != null && codeSystem.getUrl() != null) {
system = codeSystem.getUrl().getValue();
}
boolean caseSensitive = (codeSystem != null) ? CodeSystemSupport.isCaseSensitive(codeSystem) : false;
if (codeSystem == null && system != null) {
java.lang.String version = (coding.getVersion() != null) ? coding.getVersion().getValue() : null;
java.lang.String url = (version != null) ? system + "|" + version : system;
caseSensitive = CodeSystemSupport.isCaseSensitive(url);
}
result = caseSensitive ? outcome.getDisplay().equals(coding.getDisplay()) : normalize(outcome.getDisplay().getValue()).equals(normalize(coding.getDisplay().getValue()));
message = !result ? java.lang.String.format("The display '%s' is incorrect for code '%s' from code system '%s'", coding.getDisplay().getValue(), coding.getCode().getValue(), system) : null;
}
return ValidationOutcome.builder()
.result(result ? Boolean.TRUE : Boolean.FALSE)
.message((message != null) ? string(message) : null)
.display((outcome != null) ? outcome.getDisplay() : null)
.build();
}
Expected behavior
A clear and concise description of what you expected to happen.
Expected this to work without a display
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug is.
Environment
Which version of IBM FHIR Server? latest release / main
To Reproduce
Steps to reproduce the behavior:
To work around the issue...
Expected behavior
A clear and concise description of what you expected to happen.
Expected this to work without a display
Additional context
Add any other context about the problem here.