Merge branch 'gg_20201105-remove-person-references' of github.com:jamesagnew/hapi-fhir into gg_20201105-remove-person-references

This commit is contained in:
Nick Goupinets 2020-11-16 19:19:19 -05:00
commit 70284b2574
3 changed files with 26 additions and 1 deletions

View File

@ -72,6 +72,9 @@ public class EmpiRuleValidator implements IEmpiRuleValidator {
} }
public void validateMdmTypes(EmpiRulesJson theEmpiRulesJson) { public void validateMdmTypes(EmpiRulesJson theEmpiRulesJson) {
if (theEmpiRulesJson.getMdmTypes() == null) {
throw new ConfigurationException("mdmTypes must be set to a list of resource types.");
}
for (String resourceType: theEmpiRulesJson.getMdmTypes()) { for (String resourceType: theEmpiRulesJson.getMdmTypes()) {
validateTypeHasIdentifier(resourceType); validateTypeHasIdentifier(resourceType);
} }

View File

@ -1,9 +1,11 @@
package ca.uhn.fhir.empi.rules.config; package ca.uhn.fhir.empi.rules.config;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.empi.BaseR4Test; import ca.uhn.fhir.empi.BaseR4Test;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
@ -14,8 +16,18 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class EmpiRuleValidatorTest extends BaseR4Test { public class EmpiRuleValidatorTest extends BaseR4Test {
@BeforeEach
public void before() {
when(mySearchParamRetriever.getActiveSearchParam("Patient", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("Practitioner", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("Medication", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("AllergyIntolerance", "identifier")).thenReturn(null);
}
@Test @Test
public void testValidate() throws IOException { public void testValidate() throws IOException {
try { try {
@ -76,6 +88,16 @@ public class EmpiRuleValidatorTest extends BaseR4Test {
} }
} }
@Test
public void testInvalidMdmType() throws IOException {
try {
setEmpiRuleJson("bad-rules-missing-mdm-types.json");
fail();
} catch (ConfigurationException e) {
assertThat(e.getMessage(), startsWith("mdmTypes must be set to a list of resource types."));
}
}
@Test @Test
public void testMatcherduplicateName() throws IOException { public void testMatcherduplicateName() throws IOException {
try { try {

View File

@ -8,7 +8,7 @@
"resourcePath" : "name.given", "resourcePath" : "name.given",
"similarity" : { "similarity" : {
"algorithm": "COSINE", "algorithm": "COSINE",
"threshold": 0.8 "matchThreshold": 0.8
} }
}], }],
"matchResultMap" : { "matchResultMap" : {