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

Add support for nested filtering using combinations of AND and OR operations #2710

Open
allan-on opened this issue Oct 31, 2024 · 2 comments
Assignees

Comments

@allan-on
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, it isn't possible to perform complex search operations where you can filter resources by combining AND and OR operations.

Describe the solution you'd like
The SDK search functionality should be extended to support complex search filter operations such as searching for active patients whose name contains the search term OR identifier is equal to the search term/value.

fhirEngine.search<Patient> {
	 filter(Patient.Active, {
	   value = "true"
	   modifier = StringFilterModifier.MATCHES_EXACTLY
	 })
	 
	 operation(Operation.OR) {
		 filter(Patient.GIVEN, {
		   value = "Jay"
		   modifier = StringFilterModifier.CONTAINS
		 })
		 
		 operation(Operation.AND) {
		     filter(Patient.IDENTIFIER, {
			   value = "Jay"
			   modifier = StringFilterModifier.CONTAINS
			 })
		 
		     filter(Patient.IDENTIFIER, {
			   value = "Official"
			   modifier = StringFilterModifier.CONTAINS
			 })
		 }

	}
	
        operation = AND
}

The preferred implementation is to use the operation = AND|OR added to each filter.
Each filter can have sub-filters, with a function to group filters together.

search{
  filter{
    filter(name, value)
    filter(name, value)
    operation = OR
  }
  filter(name, value)
  operation = AND
}

Describe alternatives you've considered

  1. Using a custom search param that will extract all the required items, i.e. Patient.name, Patient.identifier into the StringIndexEntity table.

Additional context
Add any other context or screenshots about the feature request here.

Would you like to work on the issue?
Please state if this issue should be assigned to you or who you think could help to solve this issue.

@allan-on
Copy link
Contributor Author

Doing a similar search using Search filters on a HAPI Server is supported, and the expression would be, for example:

 https://my-fhir-server.org/fhir/Patient?_filter=active eq false and (identifier eq 90007 and name eq Bari)

@dubdabasoduba
Copy link
Collaborator

dubdabasoduba commented Nov 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

No branches or pull requests

3 participants