Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patient/$match: Add remaining parameters #6447

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testCreateLinkWithMatchResultOnDifferentPartitions() {
myMdmSettings.setSearchAllPartitionForMatch(true);
createPatientOnPartition(buildJanePatient(), RequestPartitionId.fromPartitionId(1));

Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), null, null, new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
assertThat(result.getEntry()).hasSize(1);
}

Expand All @@ -63,7 +63,7 @@ public void testCreateLinkWithMatchResultOnDifferentPartitionsWithoutSearchAllPa
myMdmSettings.setSearchAllPartitionForMatch(false);
createPatientOnPartition(buildJanePatient(), RequestPartitionId.fromPartitionId(1));

Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), null, null, new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
assertThat(result.getEntry()).isEmpty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testMatch() {
Patient createdJane = createPatient(jane);
Patient newJane = buildJanePatient();

Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(newJane, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);

Bundle.BundleEntryComponent entry0 = result.getEntry().get(0);
Expand Down Expand Up @@ -118,7 +118,7 @@ public void testMatchOrder() throws Exception {

Patient newJane = buildJanePatient();

Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(newJane, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(2);

Bundle.BundleEntryComponent entry0 = result.getEntry().get(0);
Expand All @@ -142,7 +142,7 @@ public void testMismatch() throws Exception {
Patient paul = buildPaulPatient();
paul.setActive(true);

Bundle result = (Bundle) myMdmProvider.match(paul, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(paul, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).isEmpty();
}

Expand All @@ -154,7 +154,7 @@ public void testMatchWithEmptySearchParamCandidates() throws Exception {
Patient createdJane = createPatient(jane);
Patient newJane = buildJanePatient();

Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(newJane, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
assertEquals(createdJane.getId(), result.getEntryFirstRep().getResource().getId());
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public void testMatchWithCoarseDateGranularity() throws Exception {
}""";

IBaseResource coarseResource = myFhirContext.newJsonParser().parseResource(coarsePatient);
Bundle result = (Bundle) myMdmProvider.match((Patient) coarseResource, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match((Patient) coarseResource, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
}

Expand Down Expand Up @@ -268,7 +268,7 @@ public void testNicknameMatch() throws IOException {
Patient noMatchPatient = (Patient) myFhirContext.newJsonParser().parseResource(noMatchPatientJson);
createPatient(noMatchPatient);
{
Bundle result = (Bundle) myMdmProvider.match(noMatchPatient, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(noMatchPatient, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).isEmpty();
}

Expand All @@ -289,7 +289,7 @@ public void testNicknameMatch() throws IOException {

{
Patient nickPatient = (Patient) myFhirContext.newJsonParser().parseResource(nickPatientJson);
Bundle result = (Bundle) myMdmProvider.match(nickPatient, new SystemRequestDetails());
Bundle result = (Bundle) myMdmProvider.match(nickPatient, null, null, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,19 @@ public MdmProviderDstu3Plus(
/**
* Searches for matches for the provided patient resource
* @param thePatient - the patient resource
* @param theOnlyCertainMatches - (ignored by this implementation)
* @param theCount - (ignored by this implementation)
* @param theRequestDetails - the request details
* @return - any matches to the provided patient resource
*/
@Operation(name = ProviderConstants.EMPI_MATCH, typeName = "Patient")
public IBaseBundle match(
@OperationParam(name = ProviderConstants.MDM_MATCH_RESOURCE, min = 1, max = 1, typeName = "Patient")
IAnyResource thePatient,
@OperationParam(name = ProviderConstants.MDM_MATCH_ONLY_CERTAIN_MATCHES, min = 0, max = 1, typeName = "boolean")
IPrimitiveType<Boolean> theOnlyCertainMatches,
@OperationParam(name = ProviderConstants.MDM_MATCH_COUNT, min = 0, max = 1, typeName = "integer")
IPrimitiveType<Integer> theCount,
RequestDetails theRequestDetails) {
if (thePatient == null) {
throw new InvalidRequestException(Msg.code(1498) + "resource may not be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class ProviderConstants {

public static final String MDM_MATCH = "$mdm-match";
public static final String MDM_MATCH_RESOURCE = "resource";
public static final String MDM_MATCH_ONLY_CERTAIN_MATCHES = "onlyCertainMatches";
public static final String MDM_MATCH_COUNT = "count";
public static final String MDM_RESOURCE_TYPE = "resourceType";
public static final String MDM_MERGE_GOLDEN_RESOURCES = "$mdm-merge-golden-resources";
public static final String MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID = "fromGoldenResourceId";
Expand Down