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

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

Open
zero-zero-senven opened this issue Feb 25, 2025 · 0 comments

Comments

@zero-zero-senven
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant