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

Support wildcard on _include #3200

Open
healthbjk opened this issue Nov 1, 2023 · 0 comments
Open

Support wildcard on _include #3200

healthbjk opened this issue Nov 1, 2023 · 0 comments
Labels
search Features and fixes related to search

Comments

@healthbjk
Copy link

Today, Medplum supports the _include search result parameter.

It also handles include iteration, iterating through references as a chain and including those in the search Bundle result.

It does not handle the wildcard in any form today:

function parseIncludeTarget(input: string): IncludeTarget {
  const parts = input.split(':');

  if (parts.includes('*')) {
    throw new OperationOutcomeError(badRequest(`'*' is not supported as a value for search inclusion parameters`));
  }

  if (parts.length === 1) {
    // Full wildcard, not currently supported
    throw new OperationOutcomeError(
      badRequest(`Invalid include value '${input}': must be of the form ResourceType:search-parameter`)
    );
...

The wildcard is somewhat nice - there's a limited number of possible included resource types per each resource, defined as the search parameters of that resource that have type reference.

Supporting wildcard allows for easier retrieval of related data in one API call without the client having to look up and maintain the list of reference type search parameters.

One way to limit this feature is to only allow the wildcard when the iterate modifier is not used, to prevent large (possibly indefinite?) chains of iteration.

@reshmakh reshmakh added the search Features and fixes related to search label Nov 2, 2023
@rahul1 rahul1 added this to the Milestone Quality milestone Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
search Features and fixes related to search
Projects
Status: No status
Development

No branches or pull requests

3 participants