-
Notifications
You must be signed in to change notification settings - Fork 526
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
base: main
Are you sure you want to change the base?
Conversation
src/Microsoft.Health.Fhir.Shared.Api/Controllers/IncludesController.cs
Fixed
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.Shared.Core/Features/Search/SearchOptionsFactory.cs
Fixed
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.SqlServer/Features/Search/SqlServerSearchService.cs
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.SqlServer/Features/Search/SqlServerSearchService.cs
Fixed
Show fixed
Hide fixed
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/Microsoft.Health.Fhir.Shared.Core/Features/Search/SearchOptionsFactory.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.Shared.Core/Features/Search/SearchOptionsFactory.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/IncludesOperationTestFixture.cs
Fixed
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/IncludesOperationTestFixture.cs
Fixed
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/IncludesOperationTestFixture.cs
Fixed
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/IncludesOperationTestFixture.cs
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/IncludesOperationTests.cs
Fixed
Show resolved
Hide resolved
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
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
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
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)