Resolved EmpiProviderClearLinkR4Tests and misc src to gld renames
This commit is contained in:
parent
1fc9689943
commit
9df0c16b95
|
@ -302,7 +302,7 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
|
||||||
assertEquals(theExpectedCount, myEmpiLinkDao.count());
|
assertEquals(theExpectedCount, myEmpiLinkDao.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IAnyResource getSourceResourceFromTargetResource(IAnyResource theBaseResource) {
|
protected IAnyResource getGoldenResourceFromTargetResource(IAnyResource theBaseResource) {
|
||||||
String resourceType = theBaseResource.getIdElement().getResourceType();
|
String resourceType = theBaseResource.getIdElement().getResourceType();
|
||||||
IFhirResourceDao relevantDao = myDaoRegistry.getResourceDao(resourceType);
|
IFhirResourceDao relevantDao = myDaoRegistry.getResourceDao(resourceType);
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class EmpiStorageInterceptorIT extends BaseEmpiR4Test {
|
||||||
jane = addExternalEID(jane, "some_new_eid");
|
jane = addExternalEID(jane, "some_new_eid");
|
||||||
|
|
||||||
EmpiHelperR4.OutcomeAndLogMessageWrapper outcomeWrapper = myEmpiHelper.updateWithLatch(jane);
|
EmpiHelperR4.OutcomeAndLogMessageWrapper outcomeWrapper = myEmpiHelper.updateWithLatch(jane);
|
||||||
IAnyResource person = getSourceResourceFromTargetResource(jane);
|
IAnyResource person = getGoldenResourceFromTargetResource(jane);
|
||||||
List<CanonicalEID> externalEids = myEIDHelper.getExternalEid(person);
|
List<CanonicalEID> externalEids = myEIDHelper.getExternalEid(person);
|
||||||
assertThat(externalEids, hasSize(1));
|
assertThat(externalEids, hasSize(1));
|
||||||
assertThat("some_new_eid", is(equalTo(externalEids.get(0).getValue())));
|
assertThat("some_new_eid", is(equalTo(externalEids.get(0).getValue())));
|
||||||
|
|
|
@ -41,7 +41,7 @@ public abstract class BaseLinkR4Test extends BaseProviderR4Test {
|
||||||
myPatient = createPatientAndUpdateLinks(buildPaulPatient());
|
myPatient = createPatientAndUpdateLinks(buildPaulPatient());
|
||||||
myPatientId = new StringType(myPatient.getIdElement().getValue());
|
myPatientId = new StringType(myPatient.getIdElement().getValue());
|
||||||
|
|
||||||
mySourcePatient = getSourceResourceFromTargetResource(myPatient);
|
mySourcePatient = getGoldenResourceFromTargetResource(myPatient);
|
||||||
mySourcePatientId = new StringType(mySourcePatient.getIdElement().getValue());
|
mySourcePatientId = new StringType(mySourcePatient.getIdElement().getValue());
|
||||||
myVersionlessPersonId = new StringType(mySourcePatient.getIdElement().toVersionless().getValue());
|
myVersionlessPersonId = new StringType(mySourcePatient.getIdElement().toVersionless().getValue());
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class EmpiProviderBatchR4Test extends BaseLinkR4Test {
|
||||||
super.before();
|
super.before();
|
||||||
myPractitioner = createPractitionerAndUpdateLinks(buildPractitionerWithNameAndId("some_pract", "some_pract_id"));
|
myPractitioner = createPractitionerAndUpdateLinks(buildPractitionerWithNameAndId("some_pract", "some_pract_id"));
|
||||||
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
|
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
|
||||||
myGoldenPractitier = getSourceResourceFromTargetResource(myPractitioner);
|
myGoldenPractitier = getGoldenResourceFromTargetResource(myPractitioner);
|
||||||
myGoldenPractitionerId = new StringType(myGoldenPractitier.getIdElement().getValue());
|
myGoldenPractitionerId = new StringType(myGoldenPractitier.getIdElement().getValue());
|
||||||
myInterceptorService.registerAnonymousInterceptor(Pointcut.EMPI_AFTER_PERSISTED_RESOURCE_CHECKED, afterEmpiLatch);
|
myInterceptorService.registerAnonymousInterceptor(Pointcut.EMPI_AFTER_PERSISTED_RESOURCE_CHECKED, afterEmpiLatch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ca.uhn.fhir.jpa.empi.provider;
|
package ca.uhn.fhir.jpa.empi.provider;
|
||||||
|
|
||||||
import ca.uhn.fhir.empi.api.EmpiConstants;
|
import ca.uhn.fhir.empi.api.EmpiConstants;
|
||||||
|
import ca.uhn.fhir.empi.api.EmpiLinkSourceEnum;
|
||||||
import ca.uhn.fhir.jpa.entity.EmpiLink;
|
import ca.uhn.fhir.jpa.entity.EmpiLink;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
@ -19,6 +20,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.empi.api.EmpiMatchOutcome.POSSIBLE_MATCH;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
|
@ -38,7 +40,7 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
super.before();
|
super.before();
|
||||||
myPractitioner = createPractitionerAndUpdateLinks(new Practitioner());
|
myPractitioner = createPractitionerAndUpdateLinks(new Practitioner());
|
||||||
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
|
myPractitionerId = new StringType(myPractitioner.getIdElement().getValue());
|
||||||
myPractitionerSourceResource = getSourceResourceFromTargetResource(myPractitioner);
|
myPractitionerSourceResource = getGoldenResourceFromTargetResource(myPractitioner);
|
||||||
myPractitionerSourceResourceId = new StringType(myPractitionerSourceResource.getIdElement().getValue());
|
myPractitionerSourceResourceId = new StringType(myPractitionerSourceResource.getIdElement().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +84,11 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
createPatientAndUpdateLinks(buildJanePatient());
|
createPatientAndUpdateLinks(buildJanePatient());
|
||||||
createPatientAndUpdateLinks(buildJanePatient());
|
createPatientAndUpdateLinks(buildJanePatient());
|
||||||
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildJanePatient());
|
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
IAnyResource person = getSourceResourceFromTargetResource(patientAndUpdateLinks);
|
IAnyResource person = getGoldenResourceFromTargetResource(patientAndUpdateLinks);
|
||||||
assertThat(person, is(notNullValue()));
|
assertThat(person, is(notNullValue()));
|
||||||
myEmpiProviderR4.clearEmpiLinks(null, myRequestDetails);
|
myEmpiProviderR4.clearEmpiLinks(null, myRequestDetails);
|
||||||
assertNoPatientLinksExist();
|
assertNoPatientLinksExist();
|
||||||
person = getSourceResourceFromTargetResource(patientAndUpdateLinks);
|
person = getGoldenResourceFromTargetResource(patientAndUpdateLinks);
|
||||||
assertThat(person, is(nullValue()));
|
assertThat(person, is(nullValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +98,8 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
|
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildPaulPatient());
|
Patient patientAndUpdateLinks = createPatientAndUpdateLinks(buildPaulPatient());
|
||||||
|
|
||||||
IAnyResource personFromTarget = getSourceResourceFromTargetResource(patientAndUpdateLinks);
|
IAnyResource personFromTarget = getGoldenResourceFromTargetResource(patientAndUpdateLinks);
|
||||||
IAnyResource personFromTarget2 = getSourceResourceFromTargetResource(patientAndUpdateLinks1);
|
IAnyResource personFromTarget2 = getGoldenResourceFromTargetResource(patientAndUpdateLinks1);
|
||||||
linkPersons(personFromTarget, personFromTarget2);
|
linkPersons(personFromTarget, personFromTarget2);
|
||||||
|
|
||||||
//SUT
|
//SUT
|
||||||
|
@ -122,9 +124,9 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
|
Patient patientAndUpdateLinks1 = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
Patient patientAndUpdateLinks2 = createPatientAndUpdateLinks(buildFrankPatient());
|
Patient patientAndUpdateLinks2 = createPatientAndUpdateLinks(buildFrankPatient());
|
||||||
|
|
||||||
IAnyResource personFromTarget = getSourceResourceFromTargetResource(patientAndUpdateLinks);
|
IAnyResource personFromTarget = getGoldenResourceFromTargetResource(patientAndUpdateLinks);
|
||||||
IAnyResource personFromTarget1 = getSourceResourceFromTargetResource(patientAndUpdateLinks1);
|
IAnyResource personFromTarget1 = getGoldenResourceFromTargetResource(patientAndUpdateLinks1);
|
||||||
IAnyResource personFromTarget2 = getSourceResourceFromTargetResource(patientAndUpdateLinks2);
|
IAnyResource personFromTarget2 = getGoldenResourceFromTargetResource(patientAndUpdateLinks2);
|
||||||
|
|
||||||
// A -> B -> C -> A linkages.
|
// A -> B -> C -> A linkages.
|
||||||
linkPersons(personFromTarget, personFromTarget1);
|
linkPersons(personFromTarget, personFromTarget1);
|
||||||
|
@ -133,6 +135,9 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
|
|
||||||
//SUT
|
//SUT
|
||||||
Parameters parameters = myEmpiProviderR4.clearEmpiLinks(null, myRequestDetails);
|
Parameters parameters = myEmpiProviderR4.clearEmpiLinks(null, myRequestDetails);
|
||||||
|
|
||||||
|
printLinks();
|
||||||
|
|
||||||
assertNoPatientLinksExist();
|
assertNoPatientLinksExist();
|
||||||
IBundleProvider search = myPatientDao.search(buildSourceResourceParameterMap());
|
IBundleProvider search = myPatientDao.search(buildSourceResourceParameterMap());
|
||||||
assertThat(search.size(), is(equalTo(0)));
|
assertThat(search.size(), is(equalTo(0)));
|
||||||
|
@ -140,8 +145,10 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO GGG unclear if we actually need to reimplement this.
|
//TODO GGG unclear if we actually need to reimplement this.
|
||||||
private void linkPersons(IAnyResource theSourcePerson, IAnyResource theTargetPerson) {
|
private void linkPersons(IAnyResource theGoldenResource, IAnyResource theTargetResource) {
|
||||||
throw new UnsupportedOperationException("We need to fix this!");
|
// TODO NG - Should be ok to leave this - not really
|
||||||
|
// throw new UnsupportedOperationException("We need to fix this!");
|
||||||
|
myEmpiLinkDaoSvc.createOrUpdateLinkEntity(theGoldenResource, theTargetResource, POSSIBLE_MATCH, EmpiLinkSourceEnum.AUTO, createContextForCreate("Patient"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -163,7 +170,7 @@ public class EmpiProviderClearLinkR4Test extends BaseLinkR4Test {
|
||||||
myEmpiProviderR4.clearEmpiLinks(new StringType("Observation"), myRequestDetails);
|
myEmpiProviderR4.clearEmpiLinks(new StringType("Observation"), myRequestDetails);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertThat(e.getMessage(), is(equalTo("$empi-clear does not support resource type: Observation")));
|
assertThat(e.getMessage(), is(equalTo("$mdm-clear does not support resource type: Observation")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class EmpiProviderQueryLinkR4Test extends BaseLinkR4Test {
|
||||||
// Add a third patient
|
// Add a third patient
|
||||||
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
|
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
IdType patientId = patient.getIdElement().toVersionless();
|
IdType patientId = patient.getIdElement().toVersionless();
|
||||||
IAnyResource person = getSourceResourceFromTargetResource(patient);
|
IAnyResource person = getGoldenResourceFromTargetResource(patient);
|
||||||
IIdType personId = person.getIdElement().toVersionless();
|
IIdType personId = person.getIdElement().toVersionless();
|
||||||
|
|
||||||
Parameters result = myEmpiProviderR4.queryLinks(null, null, null, myLinkSource, myRequestDetails);
|
Parameters result = myEmpiProviderR4.queryLinks(null, null, null, myLinkSource, myRequestDetails);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
|
||||||
assertLinksCreatedNewResource(true);
|
assertLinksCreatedNewResource(true);
|
||||||
assertLinksMatchedByEid(false);
|
assertLinksMatchedByEid(false);
|
||||||
|
|
||||||
IAnyResource janePerson = getSourceResourceFromTargetResource(patient);
|
IAnyResource janePerson = getGoldenResourceFromTargetResource(patient);
|
||||||
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
|
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
|
||||||
String foundHapiEid = hapiEid.get(0).getValue();
|
String foundHapiEid = hapiEid.get(0).getValue();
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
|
||||||
//We want to make sure the patients were linked to the same person.
|
//We want to make sure the patients were linked to the same person.
|
||||||
assertThat(patient, is(sameSourceResourceAs(janePatient)));
|
assertThat(patient, is(sameSourceResourceAs(janePatient)));
|
||||||
|
|
||||||
Patient sourcePatient = (Patient)getSourceResourceFromTargetResource(patient);
|
Patient sourcePatient = (Patient) getGoldenResourceFromTargetResource(patient);
|
||||||
|
|
||||||
List<Identifier> identifier = sourcePatient.getIdentifier();
|
List<Identifier> identifier = sourcePatient.getIdentifier();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
|
||||||
addExternalEID(patient2, "id_6");
|
addExternalEID(patient2, "id_6");
|
||||||
|
|
||||||
//At this point, there should be 5 EIDs on the person
|
//At this point, there should be 5 EIDs on the person
|
||||||
Patient personFromTarget = (Patient)getSourceResourceFromTargetResource(patient2);
|
Patient personFromTarget = (Patient) getGoldenResourceFromTargetResource(patient2);
|
||||||
assertThat(personFromTarget.getIdentifier(), hasSize(5));
|
assertThat(personFromTarget.getIdentifier(), hasSize(5));
|
||||||
|
|
||||||
updatePatientAndUpdateLinks(patient2);
|
updatePatientAndUpdateLinks(patient2);
|
||||||
|
@ -122,7 +122,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
|
||||||
|
|
||||||
assertThat(patient1, is(sameSourceResourceAs(patient2)));
|
assertThat(patient1, is(sameSourceResourceAs(patient2)));
|
||||||
|
|
||||||
personFromTarget = (Patient) getSourceResourceFromTargetResource(patient2);
|
personFromTarget = (Patient) getGoldenResourceFromTargetResource(patient2);
|
||||||
assertThat(personFromTarget.getIdentifier(), hasSize(6));
|
assertThat(personFromTarget.getIdentifier(), hasSize(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class EmpiMatchLinkSvcMultipleEidModeTest extends BaseEmpiR4Test {
|
||||||
assertThat(possibleDuplicates, hasSize(1));
|
assertThat(possibleDuplicates, hasSize(1));
|
||||||
|
|
||||||
List<Long> duplicatePids = Stream.of(patient1, patient2)
|
List<Long> duplicatePids = Stream.of(patient1, patient2)
|
||||||
.map(this::getSourceResourceFromTargetResource)
|
.map(this::getGoldenResourceFromTargetResource)
|
||||||
.map(myIdHelperService::getPidOrNull)
|
.map(myIdHelperService::getPidOrNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
@Test
|
@Test
|
||||||
public void testWhenMatchOccursOnPersonThatHasBeenManuallyNOMATCHedThatItIsBlocked() {
|
public void testWhenMatchOccursOnPersonThatHasBeenManuallyNOMATCHedThatItIsBlocked() {
|
||||||
Patient originalJane = createPatientAndUpdateLinks(buildJanePatient());
|
Patient originalJane = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
IAnyResource janePerson = getSourceResourceFromTargetResource(originalJane);
|
IAnyResource janePerson = getGoldenResourceFromTargetResource(originalJane);
|
||||||
|
|
||||||
//Create a manual NO_MATCH between janePerson and unmatchedJane.
|
//Create a manual NO_MATCH between janePerson and unmatchedJane.
|
||||||
Patient unmatchedJane = createPatient(buildJanePatient());
|
Patient unmatchedJane = createPatient(buildJanePatient());
|
||||||
|
@ -219,7 +219,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.
|
// 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());
|
Patient patient = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
|
|
||||||
IAnyResource janePerson = getSourceResourceFromTargetResource(patient);
|
IAnyResource janePerson = getGoldenResourceFromTargetResource(patient);
|
||||||
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
|
List<CanonicalEID> hapiEid = myEidHelper.getHapiEid(janePerson);
|
||||||
String foundHapiEid = hapiEid.get(0).getValue();
|
String foundHapiEid = hapiEid.get(0).getValue();
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
//We want to make sure the patients were linked to the same person.
|
//We want to make sure the patients were linked to the same person.
|
||||||
assertThat(patient, is(sameSourceResourceAs(janePatient)));
|
assertThat(patient, is(sameSourceResourceAs(janePatient)));
|
||||||
|
|
||||||
Patient sourcePatient = (Patient) getSourceResourceFromTargetResource(patient);
|
Patient sourcePatient = (Patient) getGoldenResourceFromTargetResource(patient);
|
||||||
|
|
||||||
List<Identifier> identifier = sourcePatient.getIdentifier();
|
List<Identifier> identifier = sourcePatient.getIdentifier();
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
|
|
||||||
|
|
||||||
List<Long> duplicatePids = Stream.of(patient1, patient2)
|
List<Long> duplicatePids = Stream.of(patient1, patient2)
|
||||||
.map(this::getSourceResourceFromTargetResource)
|
.map(this::getGoldenResourceFromTargetResource)
|
||||||
.map(myIdHelperService::getPidOrNull)
|
.map(myIdHelperService::getPidOrNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
@ -362,7 +362,6 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
* All other Person resources are marked as POSSIBLE_DUPLICATE of this first Person.
|
* All other Person resources are marked as POSSIBLE_DUPLICATE of this first Person.
|
||||||
*/
|
*/
|
||||||
Patient janePatient = createPatientAndUpdateLinks(buildJanePatient());
|
Patient janePatient = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
|
|
||||||
Patient janePatient2 = createPatient(buildJanePatient());
|
Patient janePatient2 = createPatient(buildJanePatient());
|
||||||
|
|
||||||
//In a normal situation, janePatient2 would just match to jane patient, but here we need to hack it so they are their
|
//In a normal situation, janePatient2 would just match to jane patient, but here we need to hack it so they are their
|
||||||
|
@ -473,8 +472,6 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
// Identifier janeSourceResourceId = janeSourceResourcePatient.getIdentifier().get(0);
|
// Identifier janeSourceResourceId = janeSourceResourcePatient.getIdentifier().get(0);
|
||||||
CanonicalEID janeId = myEidHelper.getHapiEid(janePatient).get(0);
|
CanonicalEID janeId = myEidHelper.getHapiEid(janePatient).get(0);
|
||||||
CanonicalEID janeSourceResourceId = myEidHelper.getHapiEid(janeSourceResourcePatient).get(0);
|
CanonicalEID janeSourceResourceId = myEidHelper.getHapiEid(janeSourceResourcePatient).get(0);
|
||||||
print(janePatient);
|
|
||||||
print(janeSourceResourcePatient);
|
|
||||||
|
|
||||||
// source and target EIDs must match, as target EID should be reset to the newly created EID
|
// source and target EIDs must match, as target EID should be reset to the newly created EID
|
||||||
assertEquals(janeId.getValue(), janeSourceResourceId.getValue());
|
assertEquals(janeId.getValue(), janeSourceResourceId.getValue());
|
||||||
|
@ -485,7 +482,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
@Test
|
@Test
|
||||||
public void testPatientUpdateOverwritesPersonDataOnChanges() {
|
public void testPatientUpdateOverwritesPersonDataOnChanges() {
|
||||||
Patient janePatient = createPatientAndUpdateLinks(buildJanePatient());
|
Patient janePatient = createPatientAndUpdateLinks(buildJanePatient());
|
||||||
Patient janeSourcePatient = (Patient) getSourceResourceFromTargetResource(janePatient);
|
Patient janeSourcePatient = (Patient) getGoldenResourceFromTargetResource(janePatient);
|
||||||
|
|
||||||
//Change Jane's name to paul.
|
//Change Jane's name to paul.
|
||||||
Patient patient1 = buildPaulPatient();
|
Patient patient1 = buildPaulPatient();
|
||||||
|
@ -495,7 +492,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
assertThat(janeSourcePatient, is(sameSourceResourceAs(janePaulPatient)));
|
assertThat(janeSourcePatient, is(sameSourceResourceAs(janePaulPatient)));
|
||||||
|
|
||||||
//Ensure the related person was updated with new info.
|
//Ensure the related person was updated with new info.
|
||||||
Patient sourcePatientFromTarget = (Patient) getSourceResourceFromTargetResource(janePaulPatient);
|
Patient sourcePatientFromTarget = (Patient) getGoldenResourceFromTargetResource(janePaulPatient);
|
||||||
HumanName nameFirstRep = sourcePatientFromTarget.getNameFirstRep();
|
HumanName nameFirstRep = sourcePatientFromTarget.getNameFirstRep();
|
||||||
|
|
||||||
// TODO NG attribute propagation has been removed - revisit once source survivorship rules are defined
|
// TODO NG attribute propagation has been removed - revisit once source survivorship rules are defined
|
||||||
|
@ -508,7 +505,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
paul.setGender(Enumerations.AdministrativeGender.MALE);
|
paul.setGender(Enumerations.AdministrativeGender.MALE);
|
||||||
paul = createPatientAndUpdateLinks(paul);
|
paul = createPatientAndUpdateLinks(paul);
|
||||||
|
|
||||||
Patient sourcePatientFromTarget = (Patient) getSourceResourceFromTargetResource(paul);
|
Patient sourcePatientFromTarget = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
|
|
||||||
// TODO NG - rules haven't been determined yet revisit once implemented...
|
// TODO NG - rules haven't been determined yet revisit once implemented...
|
||||||
// assertThat(sourcePatientFromTarget.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
|
// assertThat(sourcePatientFromTarget.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
|
||||||
|
@ -520,7 +517,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
assertThat(paul2, is(sameSourceResourceAs(paul)));
|
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.
|
//Newly matched patients aren't allowed to overwrite Person Attributes unless they are empty, so gender should still be set to male.
|
||||||
Patient paul2Person = (Patient) getSourceResourceFromTargetResource(paul2);
|
Patient paul2Person = (Patient) getGoldenResourceFromTargetResource(paul2);
|
||||||
// assertThat(paul2Person.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
|
// assertThat(paul2Person.getGender(), is(equalTo(Enumerations.AdministrativeGender.MALE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +529,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
paul.getBirthDateElement().setValueAsString(incorrectBirthdate);
|
paul.getBirthDateElement().setValueAsString(incorrectBirthdate);
|
||||||
paul = createPatientAndUpdateLinks(paul);
|
paul = createPatientAndUpdateLinks(paul);
|
||||||
|
|
||||||
Patient sourcePatientFromTarget = (Patient) getSourceResourceFromTargetResource(paul);
|
Patient sourcePatientFromTarget = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
// TODO NG - rules haven't been determined yet revisit once implemented...
|
// TODO NG - rules haven't been determined yet revisit once implemented...
|
||||||
// assertThat(sourcePatientFromTarget.getBirthDateElement().getValueAsString(), is(incorrectBirthdate));
|
// assertThat(sourcePatientFromTarget.getBirthDateElement().getValueAsString(), is(incorrectBirthdate));
|
||||||
|
|
||||||
|
@ -541,7 +538,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
|
|
||||||
paul = updatePatientAndUpdateLinks(paul);
|
paul = updatePatientAndUpdateLinks(paul);
|
||||||
|
|
||||||
sourcePatientFromTarget = (Patient) getSourceResourceFromTargetResource(paul);
|
sourcePatientFromTarget = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
// TODO NG - rules haven't been determined yet revisit once implemented...
|
// TODO NG - rules haven't been determined yet revisit once implemented...
|
||||||
// assertThat(sourcePatientFromTarget.getBirthDateElement().getValueAsString(), is(equalTo(correctBirthdate)));
|
// assertThat(sourcePatientFromTarget.getBirthDateElement().getValueAsString(), is(equalTo(correctBirthdate)));
|
||||||
assertLinkCount(1);
|
assertLinkCount(1);
|
||||||
|
@ -554,10 +551,10 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
String EID_2 = "456";
|
String EID_2 = "456";
|
||||||
|
|
||||||
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
|
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
|
||||||
Patient originalPaulPatient = (Patient) getSourceResourceFromTargetResource(paul);
|
Patient originalPaulPatient = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
|
|
||||||
Patient jane = createPatientAndUpdateLinks(addExternalEID(buildJanePatient(), EID_2));
|
Patient jane = createPatientAndUpdateLinks(addExternalEID(buildJanePatient(), EID_2));
|
||||||
Patient originalJanePatient = (Patient) getSourceResourceFromTargetResource(jane);
|
Patient originalJanePatient = (Patient) getGoldenResourceFromTargetResource(jane);
|
||||||
|
|
||||||
clearExternalEIDs(paul);
|
clearExternalEIDs(paul);
|
||||||
addExternalEID(paul, EID_2);
|
addExternalEID(paul, EID_2);
|
||||||
|
@ -574,9 +571,7 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
String EID_2 = "456";
|
String EID_2 = "456";
|
||||||
|
|
||||||
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
|
Patient paul = createPatientAndUpdateLinks(addExternalEID(buildPaulPatient(), EID_1));
|
||||||
print(paul);
|
Patient originalPaulPatient = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
Patient originalPaulPatient = (Patient) getSourceResourceFromTargetResource(paul);
|
|
||||||
print(originalPaulPatient);
|
|
||||||
|
|
||||||
String oldEid = myEidHelper.getExternalEid(originalPaulPatient).get(0).getValue();
|
String oldEid = myEidHelper.getExternalEid(originalPaulPatient).get(0).getValue();
|
||||||
assertThat(oldEid, is(equalTo(EID_1)));
|
assertThat(oldEid, is(equalTo(EID_1)));
|
||||||
|
@ -584,15 +579,10 @@ public class EmpiMatchLinkSvcTest extends BaseEmpiR4Test {
|
||||||
clearExternalEIDs(paul);
|
clearExternalEIDs(paul);
|
||||||
addExternalEID(paul, EID_2);
|
addExternalEID(paul, EID_2);
|
||||||
|
|
||||||
System.out.println("Paul Before");
|
|
||||||
print(paul);
|
|
||||||
paul = updatePatientAndUpdateLinks(paul);
|
paul = updatePatientAndUpdateLinks(paul);
|
||||||
System.out.println("Paul After");
|
|
||||||
print(paul); // TODO NG - Paul after still has the EID - is it ok?
|
|
||||||
|
|
||||||
assertNoDuplicates();
|
assertNoDuplicates();
|
||||||
|
|
||||||
Patient newlyFoundPaulPatient = (Patient) getSourceResourceFromTargetResource(paul);
|
Patient newlyFoundPaulPatient = (Patient) getGoldenResourceFromTargetResource(paul);
|
||||||
assertThat(originalPaulPatient, is(sameSourceResourceAs(newlyFoundPaulPatient)));
|
assertThat(originalPaulPatient, is(sameSourceResourceAs(newlyFoundPaulPatient)));
|
||||||
String newEid = myEidHelper.getExternalEid(newlyFoundPaulPatient).get(0).getValue();
|
String newEid = myEidHelper.getExternalEid(newlyFoundPaulPatient).get(0).getValue();
|
||||||
assertThat(newEid, is(equalTo(EID_2)));
|
assertThat(newEid, is(equalTo(EID_2)));
|
||||||
|
|
Loading…
Reference in New Issue