-
Notifications
You must be signed in to change notification settings - Fork 528
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
[Enhancement] Optimizations for Bundle serialization #3733
Open
brendankowitz
wants to merge
9
commits into
main
Choose a base branch
from
personal/bkowitz/bundle-perf-serialization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76e70fc
to
93bb5cd
Compare
src/Microsoft.Health.Fhir.Shared.Api/Features/Formatters/FhirXmlOutputFormatter.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleSerializer.cs
Fixed
Show fixed
Hide fixed
12498cd
to
af3c7fe
Compare
src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleSerializer.cs
Fixed
Show fixed
Hide fixed
af3c7fe
to
055a106
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
ed37f06
to
96b8305
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleSerializer.cs
Dismissed
Show dismissed
Hide dismissed
fhibf
previously approved these changes
Apr 18, 2024
brendankowitz
commented
May 1, 2024
src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs
Show resolved
Hide resolved
e174636
to
1ca2a54
Compare
…text instead of serialization.
…tionOutcomes in the bundle.
1ca2a54
to
33979c2
Compare
var rawComponent = component as RawBundleEntryComponent; | ||
var rawOutcomeComponent = component?.Response as RawBundleResponseComponent; | ||
|
||
b.WriteOptionalString("fullUrl", component.FullUrl) |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null Warning
Variable may be null at this access as suggested by null check.
component
Error loading related location
Loading this
Error loading related location
Loading
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Azure API for FHIR
Label denotes that the issue or PR is relevant to the Azure API for FHIR
Azure Healthcare APIs
Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs
Enhancement-Refactor
Refactor on existing functionality.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
High-level goals:
Sequence of requests:
Details:
This pull request primarily involves changes to the
Microsoft.Health.Fhir.Core
project to improve serialization and deserialization of FHIR resources. The most significant changes include refactoring theRawResourceElementExtensions.cs
andResourceDeserializer.cs
files to enhance serialization and deserialization respectively, adding a newSubRequest.cs
class, and modifying theResourceDeserializer.cs
andRawResourceElement.cs
files to improve resource deserialization.Major changes:
Serialization improvements:
src/Microsoft.Health.Fhir.Core/Extensions/RawResourceElementExtensions.cs
: Refactored theSerializeToStreamAsUtf8Json
method to use a memory stream for serialization, and added a newSerializeToBytes
method for byte array serialization. [1] [2] [3]Deserialization improvements:
src/Microsoft.Health.Fhir.Core/Features/Persistence/ResourceDeserializer.cs
: Added aRecyclableMemoryStreamManager
for reusable memory streams, and changed theDeserializeRaw
andDeserializeRawResourceElement
methods to accept aRawResource
object instead of a string. [1] [2] [3]New class addition:
src/Microsoft.Health.Fhir.Core/Features/Context/SubRequest.cs
: Added a newSubRequest
class.Resource deserialization changes:
src/Microsoft.Health.Fhir.Core/Models/RawResourceElement.cs
: Added a new constructor to theRawResourceElement
class that accepts aRawResource
object and an instance type.src/Microsoft.Health.Fhir.Core/Features/Persistence/ResourceTypeDetector.cs
: Added a newResourceTypeDetector
class to find the resource type of a given FHIR JSON.Minor changes:
docs/rest/SearchExamples.http
: Added ax-bundle-processing-logic: Parallel
header to the HTTP request.src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Formatters/FhirJsonInputFormatterTests.cs
: Updated theFhirJsonInputFormatter
constructor calls to include aFhirRequestContextAccessor
object. [1] [2]src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleHandlerEdgeCaseTests.cs
: AddedDeserializers.ResourceDeserializer
to theBundleHandler
constructor call.src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleHandlerTests.cs
: AddedDeserializers.ResourceDeserializer
to theBundleHandler
constructor call.src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleSerializerTests.cs
: Updated theBundleSerializerTests
to handleOperationOutcome
resources differently, and removed theBundleSerializer
object. [1] [2] [3]Related issues
Addresses AB#117384
Testing
Adds tests, existing e2e tests. Manual testing.
FHIR Team Checklist
Semver Change (docs)
Patch (enhancement)