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

Implementing $includes operation with paging. #4810

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

tarunmathew12
Copy link
Contributor

@tarunmathew12 tarunmathew12 commented Feb 3, 2025

Description

The PR contains the implementation of the $includes operation (explained in the spec below) including UT/E2E tests.

[$includes operation spec]
https://microsoft.sharepoint.com/:w:/t/msh/EaYsMkWJsVxNpaHhokCQbQcBxHtWbL8u80sTsENnKYNnPA?e=O1gE7h

Related issues

Addresses [issue #138967].
User Story 138967: Implement a new $include operation.

Testing

Manually tested. Automated tests being added.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@tarunmathew12 tarunmathew12 added New Feature Label for a new feature in FHIR OSS Open source This change is only relevant to the OSS code or release. labels Feb 3, 2025
@tarunmathew12 tarunmathew12 added this to the 2Wk09 milestone Feb 3, 2025
@tarunmathew12 tarunmathew12 requested a review from a team as a code owner February 3, 2025 22:48
@tarunmathew12
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tarunmathew12
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move this from API to Core?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Route names are needed to create the related link in a bundle response. For example, when a number of included resources exceeds the max count (CoreFeatureConfiguration.DefaultIncludeCountPerSearch) for an initial search request (e.g. "GET {{hostname}}/Patient?_revinclude=..."), the related link for $includes must be created in a bundle response that requires a different route name ("Includes") than one for the search request being processed ("SearchResources") since the related link will look like "{{hostname}}/Patient/$includes?_revinclude=". (Please check changes in BundleFactory.CreateLink.)
I chose to move the file (and a few others) to Core over hardcoding the route name. Please let me know if you have any suggestions. Thank you.

MatchResourceTypeId = tid;
MatchResourceSurrogateIdMin = sid0;
MatchResourceSurrogateIdMax = sid1;
initialized = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an include CT valid without the two include values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when the includes continuation token is created for an initial search request, these two values for include resources are null, so a bundle response for the 1st $includes request will contain included resources from the beginning (an included resource with the smallest resource type id and surrogate id).
Please note that a bundle response for the initial search request will not have any included resources if its number exceeds the include count in appsettings per conversation with Brendan and Jared.

@tarunmathew12 tarunmathew12 changed the title [Do Not Review] Implementing $includes operation with paging. Implementing $includes operation with paging. Feb 13, 2025
await base.OnInitializedAsync();
var bundle = TagResources((Bundle)Samples.GetJsonSample(ResourceFileName).ToPoco());
var response = await TestFhirClient.PostBundleAsync(bundle);
((List<Resource>)_patientResources).AddRange(

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

Questionable cast from abstract 'IList' to concrete implementation 'List'.
response.Resource.Entry
.Select(x => x.Resource)
.Where(x => x.TypeName.Equals(KnownResourceTypes.Patient, StringComparison.OrdinalIgnoreCase)));
((List<Resource>)_relatedResources).AddRange(

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

Questionable cast from abstract 'IList' to concrete implementation 'List'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature Label for a new feature in FHIR OSS Open source This change is only relevant to the OSS code or release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants