Skip to content

Commit

Permalink
Merge branch 'rel_8_0' into jd-20250107-fix-NPE-mass-ingestion-with-p…
Browse files Browse the repository at this point in the history
…atient-compartment-interceptor
  • Loading branch information
jdar8 authored Jan 31, 2025
2 parents ab5faa4 + 8d60820 commit c85036c
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ public String getPropertyName() {
// Some of the types in the spec are not yet implemented as well.
// @see https://github.com/hapifhir/hapi-fhir/issues/5700
String TYPE_STRING = "string";
String TYPE_BOOLEAN = "boolean";
String TYPE_CODING = "Coding";
String TYPE_GROUP = "group";

Expand All @@ -800,6 +801,29 @@ public String getType() {
}
}

class BooleanConceptProperty extends BaseConceptProperty {
private final boolean myValue;

/**
* Constructor
*
* @param theName The name
*/
public BooleanConceptProperty(String theName, boolean theValue) {
super(theName);
myValue = theValue;
}

public boolean getValue() {
return myValue;
}

@Override
public String getType() {
return TYPE_BOOLEAN;
}
}

class CodingConceptProperty extends BaseConceptProperty {
private final String myCode;
private final String myCodeSystem;
Expand Down Expand Up @@ -1073,7 +1097,7 @@ class ValueSetExpansionOutcome {
private final IBaseResource myValueSet;
private final String myError;

private boolean myErrorIsFromServer;
private final boolean myErrorIsFromServer;

public ValueSetExpansionOutcome(String theError, boolean theErrorIsFromServer) {
myValueSet = null;
Expand Down Expand Up @@ -1199,7 +1223,7 @@ public LookupCodeResult setFound(boolean theFound) {
}

public void throwNotFoundIfAppropriate() {
if (isFound() == false) {
if (!isFound()) {
throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode()
+ "] in system[" + getSearchedForSystem() + "]");
}
Expand Down Expand Up @@ -1270,6 +1294,10 @@ private void populateProperty(
StringConceptProperty stringConceptProperty = (StringConceptProperty) theConceptProperty;
ParametersUtil.addPartString(theContext, theProperty, "value", stringConceptProperty.getValue());
break;
case TYPE_BOOLEAN:
BooleanConceptProperty booleanConceptProperty = (BooleanConceptProperty) theConceptProperty;
ParametersUtil.addPartBoolean(theContext, theProperty, "value", booleanConceptProperty.getValue());
break;
case TYPE_CODING:
CodingConceptProperty codingConceptProperty = (CodingConceptProperty) theConceptProperty;
ParametersUtil.addPartCoding(
Expand Down Expand Up @@ -1321,7 +1349,7 @@ class TranslateCodeRequest {
private final String myTargetValueSetUrl;
private final IIdType myResourceId;
private final boolean myReverse;
private List<IBaseCoding> myCodings;
private final List<IBaseCoding> myCodings;

public TranslateCodeRequest(List<IBaseCoding> theCodings, String theTargetSystemUrl) {
myCodings = theCodings;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
type: fix
issue: 6662
title: "Fixed remote terminology lookup results showing boolean properties as strings."
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Base;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.CodeableConcept;
Expand Down Expand Up @@ -457,6 +458,10 @@ private static BaseConceptProperty createConceptPropertyR4(final String theName,
StringType stringType = (StringType) theValue;
conceptProperty = new StringConceptProperty(theName, stringType.getValue());
break;
case IValidationSupport.TYPE_BOOLEAN:
BooleanType booleanType = (BooleanType) theValue;
conceptProperty = new BooleanConceptProperty(theName, booleanType.getValue());
break;
case IValidationSupport.TYPE_CODING:
Coding coding = (Coding) theValue;
conceptProperty =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ca.uhn.fhir.context.support.IValidationSupport.GroupConceptProperty;
import ca.uhn.fhir.context.support.IValidationSupport.LookupCodeResult;
import ca.uhn.fhir.context.support.IValidationSupport.StringConceptProperty;
import ca.uhn.fhir.context.support.IValidationSupport.BooleanConceptProperty;
import ca.uhn.fhir.context.support.LookupCodeRequest;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.test.utilities.validation.IValidationProviders;
Expand All @@ -17,17 +18,18 @@
import java.util.List;
import java.util.Optional;

import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_BOOLEAN;
import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_CODING;
import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_GROUP;
import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_STRING;
import static java.util.stream.IntStream.range;
import static org.assertj.core.api.Assertions.assertThat;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM_NAME;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM_VERSION;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.DISPLAY;
import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.LANGUAGE;
import static java.util.stream.IntStream.range;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hl7.fhir.common.hapi.validation.support.RemoteTerminologyServiceValidationSupport.createConceptProperty;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -198,7 +200,8 @@ default void verifyLookupCodeResult(LookupCodeRequest theRequest, LookupCodeResu
assertEquals(theExpectedResult.isCodeIsAbstract(), outcome.isCodeIsAbstract());

assertEquals(theExpectedResult.getProperties().size(), outcome.getProperties().size());
range(0, outcome.getProperties().size()).forEach(i -> assertEqualConceptProperty(theExpectedResult.getProperties().get(i), outcome.getProperties().get(i)));
range(0, outcome.getProperties().size()).forEach(i ->
assertEqualConceptProperty(theExpectedResult.getProperties().get(i), outcome.getProperties().get(i)));

assertEquals(theExpectedResult.getDesignations().size(), outcome.getDesignations().size());
range(0, outcome.getDesignations().size()).forEach(i -> assertEqualConceptDesignation(theExpectedResult.getDesignations().get(i), outcome.getDesignations().get(i)));
Expand All @@ -225,6 +228,11 @@ private void assertEqualConceptProperty(BaseConceptProperty theProperty, BaseCon
StringConceptProperty actual = (StringConceptProperty) theProperty;
assertEquals(expected.getValue(), actual.getValue());
}
case TYPE_BOOLEAN -> {
BooleanConceptProperty expected = (BooleanConceptProperty) theExpectedProperty;
IValidationSupport.BooleanConceptProperty actual = (BooleanConceptProperty) theProperty;
assertEquals(expected.getValue(), actual.getValue());
}
case TYPE_CODING -> {
CodingConceptProperty expected = (CodingConceptProperty) theExpectedProperty;
CodingConceptProperty actual = (CodingConceptProperty) theProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static Stream<Arguments> getPropertyValueListArguments() {
@ParameterizedTest
@MethodSource(value = "getPropertyValueArguments")
public void lookupCode_forCodeSystemWithProperty_returnsCorrectProperty(IBaseDatatype thePropertyValue) {
verifyLookupWithProperty(List.of(thePropertyValue), List.of());
verifyLookupWithProperty(List.of(thePropertyValue), List.of(0));
}

@ParameterizedTest
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@
<flexmark_version>0.64.8</flexmark_version>
<flyway_version>10.20.1</flyway_version>
<hibernate_version>6.6.4.Final</hibernate_version>
<logback_version>1.5.12</logback_version>
<logback_version>1.5.16</logback_version>
<!-- Update lucene version when you update hibernate-search version - These go together! -->
<hibernate_search_version>7.2.1.Final</hibernate_search_version>
<!-- Update lucene version when you update hibernate-search version - These go together! -->
Expand Down Expand Up @@ -1084,7 +1084,7 @@
<ebay_cors_filter_version>1.0.1</ebay_cors_filter_version>
<elastic_apm_version>1.52.0</elastic_apm_version>
<elasticsearch_version>8.15.3</elasticsearch_version>
<ucum_version>1.0.8</ucum_version>
<ucum_version>1.0.9</ucum_version>

<!-- Clinical Reasoning & CQL Support -->
<clinical-reasoning.version>3.17.0</clinical-reasoning.version>
Expand Down

0 comments on commit c85036c

Please sign in to comment.