2

I am building a minimalistic subscription service. Is there any way to check if a resource matches predefined search criteria? eg, if I have:

String criteria = "Observation?code=http://loinc.org|1975-2";
Observation observation = new Observation();

I am looking for a checkCriteria() operation or equivalent:

assert checkCriteria(observation, criteria) == true;

Thank you!

MAKZ
  • 165
  • 14

1 Answers1

0

There is a SearchParamMatcher class which fits the usage scenario you're asking.

import ca.uhn.fhir.jpa.searchparam.matcher.SearchParamMatcher;

//...

SearchParamMatcher searchParamMatcher = new SearchParamMatcher();

assert searchParamMatcher.match(criteria, observation, null) == true;
Oluwafemi Sule
  • 36,144
  • 1
  • 56
  • 81