Skip to content

Parameter does not take effect for $mdm-match. count, onlyCertainMatches #6759

@zero-zero-senven

Description

@zero-zero-senven

Describe the bug

I read the hl7 specification : patient-operation-match and found here should support more parameters, such as the count, I found not take effect at the time of use, and track the source code, find here is not to read the specified parameters, Is this a bug or is it unnecessary to deal with? (As far as I know, all matches were read and the data possible_match was possible_match. Is it necessary to apply count?)

Code

The code snippet in question:

public IBaseBundle getMatchesAndPossibleMatchesForResource(
			IAnyResource theResource, String theResourceType, RequestDetails theRequestDetails) {
		RequestPartitionId requestPartitionId;
		if (myMdmSettings.getSearchAllPartitionForMatch()) {
			requestPartitionId = RequestPartitionId.allPartitions();
		} else {
			requestPartitionId = myRequestPartitionHelperSvc.determineReadPartitionForRequestForSearchType(
					theRequestDetails, theResourceType);
		}
		List<MatchedTarget> matches =
				myMdmMatchFinderSvc.getMatchedTargets(theResourceType, theResource, requestPartitionId);
		matches.sort(
				Comparator.comparing((MatchedTarget m) -> m.getMatchResult().getNormalizedScore())
						.reversed());

		BundleBuilder builder = new BundleBuilder(myFhirContext);
		builder.setBundleField("type", "searchset");
		builder.setBundleField("id", UUID.randomUUID().toString());
		builder.setMetaField("lastUpdated", builder.newPrimitive("instant", new Date()));

		IBaseBundle retVal = builder.getBundle();
		for (MatchedTarget next : matches) {
			boolean shouldKeepThisEntry = next.isMatch() || next.isPossibleMatch();
			if (!shouldKeepThisEntry) {
				continue;
			}

			IBase entry = builder.addEntry();
			builder.addToEntry(entry, "resource", next.getTarget());

			IBaseBackboneElement search = builder.addSearch(entry);
			toBundleEntrySearchComponent(builder, search, next);
		}
		return retVal;
	}

code reference:

public IBaseBundle getMatchesAndPossibleMatchesForResource(

To Reproduce

  1. custom mdm-setting
  2. call {baseUrl}/Patient/$match, and use complete parameter : resource, count,onlyCertainMatches
  3. observe the number of matches returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions