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) {
if (theEmpiRulesJson.getMdmTypes() == null) {
throw new ConfigurationException("mdmTypes must be set to a list of resource types.");
}
for (String resourceType: theEmpiRulesJson.getMdmTypes()) {
validateTypeHasIdentifier(resourceType);
}

View File

@ -1,9 +1,11 @@
package ca.uhn.fhir.empi.rules.config;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.empi.BaseR4Test;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.DefaultResourceLoader;
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.Matchers.startsWith;
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 {
@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
public void testValidate() throws IOException {
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
public void testMatcherduplicateName() throws IOException {
try {

View File

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