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 the _filter search parameter in Subscription.criteria #3627

Open
ThatOneBro opened this issue Dec 29, 2023 · 1 comment
Open
Labels
subscriptions Features and fixes related to subscriptions

Comments

@ThatOneBro
Copy link
Member

Currently it's not possible to use _filter search parameter for Subscription.criteria. This is because the internal function matchesCriteria() makes use of the in-memory search, which currently has some limitations, one of which is the inability to use _filter.

_filter can be really useful, especially for complex queries where a logical OR is needed, so it would be great if we could get this added to Subscription.criteria, especially once WebSocket subscriptions are available for usage.

For example, a criteria for Communication resources representing a live chat session could be written as such:
Communication?patient={patientId}&_filter=(sender re Practitioner/123 or recipient re Practitioner/123)

However in the current system without _filter, we would have to create two Subscriptions, each with a criteria representing either side of the or operator in the _filter parameter above. That means adding the _filter search parameter for Subscription.criteria could reduce total subscriptions across all clients by half for a chat service modeled by Medplum's WebSocket subscriptions.

I can see two solutions; either seems like a decent path forward for.

  1. Add the appropriate _filter query parameter to the in-memory search implementation. Probably better for performance.
  2. Migrate subscription matchesCriteria() to database search. Maybe less work (?)
@ThatOneBro ThatOneBro added this to the Milestone Quality milestone Dec 29, 2023
@reshmakh reshmakh added the subscriptions Features and fixes related to subscriptions label Dec 31, 2023
@Dharshan-K
Copy link
Contributor

Hi, @ThatOneBro , I am interested in this issue. Can you guide to implement this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subscriptions Features and fixes related to subscriptions
Projects
Status: No status
Development

No branches or pull requests

3 participants