Partial removal of getPersonFromTarget

This commit is contained in:
Tadgh 2020-11-05 13:41:01 -05:00
parent 5797cd0682
commit 656b8aeba7
9 changed files with 70 additions and 81 deletions

View File

@ -9,6 +9,7 @@ import ca.uhn.fhir.empi.model.EmpiTransactionContext;
import ca.uhn.fhir.empi.rules.svc.EmpiResourceMatcherSvc;
import ca.uhn.fhir.empi.util.EIDHelper;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.dao.data.IEmpiLinkDao;
@ -110,6 +111,9 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
protected ServletRequestDetails myRequestDetails;
@Autowired
private DaoRegistry myDaoRegistry;
@BeforeEach
public void beforeSetRequestDetails() {
myRequestDetails = new ServletRequestDetails(myInterceptorBroadcaster);
@ -269,11 +273,14 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
assertEquals(theExpectedCount, myEmpiLinkDao.count());
}
protected Person getPersonFromTarget(IAnyResource theBaseResource) {
protected IAnyResource getSourceResourceFromTargetResource(IAnyResource theBaseResource) {
String resourceType = theBaseResource.getIdElement().getResourceType();
IFhirResourceDao relevantDao = myDaoRegistry.getResourceDao(resourceType);
Optional<EmpiLink> matchedLinkForTargetPid = myEmpiLinkDaoSvc.getMatchedLinkForTargetPid(myIdHelperService.getPidOrNull(theBaseResource));
if (matchedLinkForTargetPid.isPresent()) {
Long personPid = matchedLinkForTargetPid.get().getSourceResourcePid();
return (Person) myPersonDao.readByPid(new ResourcePersistentId(personPid));
Long sourceResourcePid = matchedLinkForTargetPid.get().getSourceResourcePid();
return (IAnyResource) relevantDao.readByPid(new ResourcePersistentId(sourceResourcePid));
} else {
return null;
}

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Enumerations;
@ -207,7 +208,7 @@ public class EmpiStorageInterceptorIT extends BaseEmpiR4Test {
jane = addExternalEID(jane, "some_new_eid");
EmpiHelperR4.OutcomeAndLogMessageWrapper outcomeWrapper = myEmpiHelper.updateWithLatch(jane);
Person person = getPersonFromTarget(jane);
IAnyResource person = getSourceResourceFromTargetResource(jane);
List<CanonicalEID> externalEids = myEIDHelper.getExternalEid(person);
assertThat(externalEids, hasSize(1));
assertThat("some_new_eid", is(equalTo(externalEids.get(0).getValue())));

View File

@ -34,9 +34,15 @@ public abstract class BaseSourceResourceMatcher extends TypeSafeMatcher<IAnyReso
protected Long getMatchedResourcePidFromResource(IAnyResource theResource) {
Long retval;
EmpiLink matchLink = getMatchedEmpiLink(theResource);
myTargetType = matchLink.getEmpiTargetType();
//TODO if this is already a golden record resource, we can just use its PID instead of doing a lookup.
retval = matchLink == null ? null : matchLink.getSourceResourcePid();
if (matchLink == null) {
retval = myIdHelperService.getPidOrNull(theResource);
myTargetType = "unkown";
} else {
retval = matchLink.getSourceResourcePid();
myTargetType = matchLink.getEmpiTargetType();
}
return retval;
}

View File

@ -4,8 +4,8 @@ import ca.uhn.fhir.empi.api.EmpiLinkSourceEnum;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.entity.EmpiLink;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Person;
import org.hl7.fhir.r4.model.StringType;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@ -27,7 +27,7 @@ public abstract class BaseLinkR4Test extends BaseProviderR4Test {
DaoConfig myDaoConfig;
protected Patient myPatient;
protected Person myPerson;
protected IAnyResource myPerson;
protected EmpiLink myLink;
protected StringType myPatientId;
protected StringType myPersonId;
@ -41,7 +41,7 @@ public abstract class BaseLinkR4Test extends BaseProviderR4Test {
myPatient = createPatientAndUpdateLinks(buildPaulPatient());
myPatientId = new StringType(myPatient.getIdElement().getValue());
myPerson = getPersonFromTarget(myPatient);
myPerson = getSourceResourceFromTargetResource(myPatient);
myPersonId = new StringType(myPerson.getIdElement().getValue());
myVersionlessPersonId = new StringType(myPerson.getIdElement().toVersionless().getValue());

View File

@ -5,8 +5,8 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.test.concurrency.PointcutLatch;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Person;
import org.hl7.fhir.r4.model.Practitioner;
import org.hl7.fhir.r4.model.StringType;
import org.junit.jupiter.api.AfterEach;
@ -25,7 +25,7 @@ public class EmpiProviderBatchR4Test extends BaseLinkR4Test {
protected Practitioner myPractitioner;
protected StringType myPractitionerId;
protected Person myPractitionerPerson;
protected IAnyResource myPractitionerPerson;
protected StringType myPractitionerPersonId;
@Autowired
@ -38,7 +38,7 @@ public class EmpiProviderBatchR4Test extends BaseLinkR4Test {
super.before();
myPractitioner = createPractitionerAndUpdateLinks(buildPractitionerWithNameAndId("some_pract", "some_pract_id"));
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
myPractitionerPerson = getPersonFromTarget(myPractitioner);
myPractitionerPerson = getSourceResourceFromTargetResource(myPractitioner);
myPractitionerPersonId = new StringType(myPractitionerPerson.getIdElement().getValue());
myInterceptorService.registerAnonymousInterceptor(Pointcut.EMPI_AFTER_PERSISTED_RESOURCE_CHECKED, afterEmpiLatch);
}

View File

@ -6,11 +6,11 @@ import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Person;
import org.hl7.fhir.r4.model.Practitioner;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.fail;
public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
protected Practitioner myPractitioner;
protected StringType myPractitionerId;
protected Person myPractitionerPerson;
protected IAnyResource myPractitionerPerson;
protected StringType myPractitionerPersonId;
@BeforeEach
@ -37,7 +37,7 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
super.before();
myPractitioner = createPractitionerAndUpdateLinks(new Practitioner());
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
myPractitionerPerson = getPersonFromTarget(myPractitioner);
myPractitionerPerson = getSourceResourceFromTargetResource(myPractitioner);
myPractitionerPersonId = new StringType(myPractitionerPerson.getIdElement().getValue());
}
@ -81,11 +81,11 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
createPatientAndUpdateLinks(buildJanePatient());
createPatientAndUpdateLinks(buildJanePatient());
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildJanePatient());
Person person = getPersonFromTarget(patientAndUpdateLinks);
IAnyResource person = getSourceResourceFromTargetResource(patientAndUpdateLinks);
assertThat(person, is(notNullValue()));
myEmpiProviderR4.clearEmpiLinks(null, myRequestDetails);
assertNoPatientLinksExist();
person = getPersonFromTarget(patientAndUpdateLinks);
person = getSourceResourceFromTargetResource(patientAndUpdateLinks);
assertThat(person, is(nullValue()));
}
@ -95,8 +95,8 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildPaulPatient());
Person personFromTarget = getPersonFromTarget(patientAndUpdateLinks);
Person personFromTarget2 = getPersonFromTarget(patientAndUpdateLinks1);
IAnyResource personFromTarget = getSourceResourceFromTargetResource(patientAndUpdateLinks);
IAnyResource personFromTarget2 = getSourceResourceFromTargetResource(patientAndUpdateLinks1);
linkPersons(personFromTarget, personFromTarget2);
//SUT
@ -113,9 +113,9 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
Patient patientAndUpdateLinks2 = createPatientAndUpdateLinks(buildFrankPatient());
Person personFromTarget = getPersonFromTarget(patientAndUpdateLinks);
Person personFromTarget1 = getPersonFromTarget(patientAndUpdateLinks1);
Person personFromTarget2 = getPersonFromTarget(patientAndUpdateLinks2);
IAnyResource personFromTarget = getSourceResourceFromTargetResource(patientAndUpdateLinks);
IAnyResource personFromTarget1 = getSourceResourceFromTargetResource(patientAndUpdateLinks1);
IAnyResource personFromTarget2 = getSourceResourceFromTargetResource(patientAndUpdateLinks2);
// A -> B -> C -> A linkages.
linkPersons(personFromTarget, personFromTarget1);
@ -130,12 +130,9 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
}
private void linkPersons(Person theSourcePerson, Person theTargetPerson) {
Person.PersonLinkComponent plc1 = new Person.PersonLinkComponent();
plc1.setAssurance(Person.IdentityAssuranceLevel.LEVEL2);
plc1.setTarget(new Reference(theTargetPerson.getIdElement().toUnqualifiedVersionless()));
theSourcePerson.getLink().add(plc1);
myPersonDao.update(theSourcePerson);
//TODO GGG
private void linkPersons(IAnyResource theSourcePerson, IAnyResource theTargetPerson) {
throw new UnsupportedOperationException("We need to fix this!");
}
@Test

View File

@ -5,6 +5,8 @@ import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.jpa.entity.EmpiLink;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Parameters;
@ -68,8 +70,8 @@ public class EmpiProviderQueryLinkR4Test extends BaseLinkR4Test {
// Add a third patient
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
IdType patientId = patient.getIdElement().toVersionless();
Person person = getPersonFromTarget(patient);
IdType personId = person.getIdElement().toVersionless();
IAnyResource person = getSourceResourceFromTargetResource(patient);
IIdType personId = person.getIdElement().toVersionless();
Parameters result = myEmpiProviderR4.queryLinks(null, null, null, myLinkSource, myRequestDetails);
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(result));

View File

@ -5,9 +5,9 @@ import ca.uhn.fhir.empi.model.CanonicalEID;
import ca.uhn.fhir.empi.util.EIDHelper;
import ca.uhn.fhir.jpa.empi.BaseEmpiR4Test;
import ca.uhn.fhir.jpa.entity.EmpiLink;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Person;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
@ -50,7 +50,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
assertLinksCreatedNewResource(true);
assertLinksMatchedByEid(false);
Person janePerson = getPersonFromTarget(patient);
IAnyResource janePerson = getSourceResourceFromTargetResource(patient);
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
String foundHapiEid = hapiEid.get(0).getValue();
@ -65,9 +65,9 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
//We want to make sure the patients were linked to the same person.
assertThat(patient, is(sameSourceResourceAs(janePatient)));
Person person = getPersonFromTarget(patient);
Patient sourcePatient = (Patient)getSourceResourceFromTargetResource(patient);
List<Identifier> identifier = person.getIdentifier();
List<Identifier> identifier = sourcePatient.getIdentifier();
//The collision should have kept the old identifier
Identifier firstIdentifier = identifier.get(0);
@ -112,7 +112,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
addExternalEID(patient2, "id_6");
//At this point, there should be 5 EIDs on the person
Person personFromTarget = getPersonFromTarget(patient2);
Patient personFromTarget = (Patient)getSourceResourceFromTargetResource(patient2);
assertThat(personFromTarget.getIdentifier(), hasSize(5));
updatePatientAndUpdateLinks(patient2);
@ -122,7 +122,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
assertThat(patient1, is(sameSourceResourceAs(patient2)));
personFromTarget = getPersonFromTarget(patient2);
personFromTarget = (Patient) getSourceResourceFromTargetResource(patient2);
assertThat(personFromTarget.getIdentifier(), hasSize(6));
}
@ -149,7 +149,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
assertThat(possibleDuplicates, hasSize(1));
List<Long> duplicatePids = Stream.of(patient1, patient2)
.map(this::getPersonFromTarget)
.map(this::getSourceResourceFromTargetResource)
.map(myIdHelperService::getPidOrNull)
.collect(Collectors.toList());

View File

@ -100,8 +100,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
@Test
public void testWhenMatchOccursOnPersonThatHasBeenManuallyNOMATCHedThatItIsBlocked() {
Patient originalJane = createPatientAndUpdateLinks(buildJanePatient());
IBundleProvider search = myPersonDao.search(new SearchParameterMap());
IAnyResource janePerson = (IAnyResource) search.getResources(0, 1).get(0);
IAnyResource janePerson = getSourceResourceFromTargetResource(originalJane);
//Create a manual NO_MATCH between janePerson and unmatchedJane.
Patient unmatchedJane = createPatient(buildJanePatient());
@ -196,7 +195,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
// Existing Person with system-assigned EID found linked from matched Patient. incoming Patient has EID. Replace Person system-assigned EID with Patient EID.
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
Person janePerson = getPersonFromTarget(patient);
IAnyResource janePerson = getSourceResourceFromTargetResource(patient);
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
String foundHapiEid = hapiEid.get(0).getValue();
@ -206,9 +205,9 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
//We want to make sure the patients were linked to the same person.
assertThat(patient, is(sameSourceResourceAs(janePatient)));
Person person = getPersonFromTarget(patient);
Patient sourcePatient = (Patient)getSourceResourceFromTargetResource(patient);
List<Identifier> identifier = person.getIdentifier();
List<Identifier> identifier = sourcePatient.getIdentifier();
//The collision should have kept the old identifier
Identifier firstIdentifier = identifier.get(0);
@ -264,7 +263,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
List<Long> duplicatePids = Stream.of(patient1, patient2)
.map(this::getPersonFromTarget)
.map(this::getSourceResourceFromTargetResource)
.map(myIdHelperService::getPidOrNull)
.collect(Collectors.toList());
@ -421,45 +420,22 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
assertThat(patient3, is(sameSourceResourceAs(patient)));
}
@Test
public void testAutoMatchesGenerateAssuranceLevel3() {
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
Person janePerson = getPersonFromTarget(patient);
Person.PersonLinkComponent linkFirstRep = janePerson.getLinkFirstRep();
assertThat(linkFirstRep.getTarget().getReference(), is(equalTo(patient.getIdElement().toVersionless().toString())));
assertThat(linkFirstRep.getAssurance(), is(equalTo(Person.IdentityAssuranceLevel.LEVEL2)));
}
@Test
public void testManualMatchesGenerateAssuranceLevel4() {
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
Person janePerson = getPersonFromTarget(patient);
myEmpiLinkSvc.updateLink(janePerson, patient, EmpiMatchOutcome.NEW_PERSON_MATCH, EmpiLinkSourceEnum.MANUAL, createContextForCreate());
janePerson = getPersonFromTarget(patient);
Person.PersonLinkComponent linkFirstRep = janePerson.getLinkFirstRep();
assertThat(linkFirstRep.getTarget().getReference(), is(equalTo(patient.getIdElement().toVersionless().toString())));
assertThat(linkFirstRep.getAssurance(), is(equalTo(Person.IdentityAssuranceLevel.LEVEL3)));
}
//Case #1
@Test
public void testPatientUpdateOverwritesPersonDataOnChanges() {
Patient janePatient = createPatientAndUpdateLinks(buildJanePatient());
Person janePerson = getPersonFromTarget(janePatient);
Patient janeSourcePatient = (Patient)getSourceResourceFromTargetResource(janePatient);
//Change Jane's name to paul.
Patient patient1 = buildPaulPatient();
patient1.setId(janePatient.getId());
Patient janePaulPatient = updatePatientAndUpdateLinks(patient1);
assertThat(janePerson, is(sameSourceResourceAs(janePaulPatient)));
assertThat(janeSourcePatient, is(sameSourceResourceAs(janePaulPatient)));
//Ensure the related person was updated with new info.
Person personFromTarget = getPersonFromTarget(janePaulPatient);
HumanName nameFirstRep = personFromTarget.getNameFirstRep();
Patient sourcePatientFromTarget = (Patient) t geetSourceResourceFromTargetResource(janePaulPatient);
HumanName nameFirstRep = sourcePatientFromTarget.getNameFirstRep();
assertThat(nameFirstRep.getGivenAsSingleString(), is(equalToIgnoringCase("paul")));
}
@ -469,7 +445,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
paul.setGender(Enumerations.AdministrativeGender.MALE);
paul = createPatientAndUpdateLinks(paul);
Person personFromTarget = getPersonFromTarget(paul);
Person personFromTarget = getSourceResourceFromTargetResource(paul);
assertThat(personFromTarget.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
Patient paul2 = buildPaulPatient();
@ -479,7 +455,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
assertThat(paul2, is(sameSourceResourceAs(paul)));
//Newly matched patients aren't allowed to overwrite Person Attributes unless they are empty, so gender should still be set to male.
Person paul2Person = getPersonFromTarget(paul2);
Person paul2Person = getSourceResourceFromTargetResource(paul2);
assertThat(paul2Person.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
}
@ -491,7 +467,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
paul.getBirthDateElement().setValueAsString(incorrectBirthdate);
paul = createPatientAndUpdateLinks(paul);
Person personFromTarget = getPersonFromTarget(paul);
Person personFromTarget = getSourceResourceFromTargetResource(paul);
assertThat(personFromTarget.getBirthDateElement().getValueAsString(), is(incorrectBirthdate));
String correctBirthdate = "1990-06-28";
@ -499,7 +475,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
paul = updatePatientAndUpdateLinks(paul);
personFromTarget = getPersonFromTarget(paul);
personFromTarget = getSourceResourceFromTargetResource(paul);
assertThat(personFromTarget.getBirthDateElement().getValueAsString(), is(equalTo(correctBirthdate)));
assertLinkCount(1);
}
@ -511,10 +487,10 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
String EID_2 = "456";
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
Person originalPaulPerson = getPersonFromTarget(paul);
Person originalPaulPerson = getSourceResourceFromTargetResource(paul);
Patient jane = createPatientAndUpdateLinks(addExternalEID(buildJanePatient(), EID_2));
Person originalJanePerson = getPersonFromTarget(jane);
Person originalJanePerson = getSourceResourceFromTargetResource(jane);
clearExternalEIDs(paul);
addExternalEID(paul, EID_2);
@ -531,7 +507,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
String EID_2 = "456";
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
Person originalPaulPerson = getPersonFromTarget(paul);
Person originalPaulPerson = getSourceResourceFromTargetResource(paul);
String oldEid = myEidHelper.getExternalEid(originalPaulPerson).get(0).getValue();
assertThat(oldEid, is(equalTo(EID_1)));
@ -542,7 +518,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
assertNoDuplicates();
Person newlyFoundPaulPerson = getPersonFromTarget(paul);
Person newlyFoundPaulPerson = getSourceResourceFromTargetResource(paul);
assertThat(originalPaulPerson, is(sameSourceResourceAs(newlyFoundPaulPerson)));
String newEid = myEidHelper.getExternalEid(newlyFoundPaulPerson).get(0).getValue();
assertThat(newEid, is(equalTo(EID_2)));
@ -597,12 +573,12 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
jane.setActive(true);
Patient janePatient = createPatientAndUpdateLinks(jane);
Person janePerson = getPersonFromTarget(janePatient);
Person janePerson = getSourceResourceFromTargetResource(janePatient);
Patient paul = buildPaulPatient();
paul.setActive(true);
Patient paulPatient = createPatientAndUpdateLinks(paul);
Person paulPerson = getPersonFromTarget(paulPatient);
Person paulPerson = getSourceResourceFromTargetResource(paulPatient);
paulPatient.setBirthDate(jane.getBirthDate());
paulPatient.setName(jane.getName());
@ -610,7 +586,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
myEmpiMatchLinkSvc.updateEmpiLinksForEmpiTarget(paulPatient, createContextForUpdate());
assertThat(paulPerson.getBirthDate(), is(nullValue()));
paulPerson = getPersonFromTarget(paulPatient);
paulPerson = getSourceResourceFromTargetResource(paulPatient);
assertThat(paulPerson.getBirthDate(), is(notNullValue()));
}
}