-
Notifications
You must be signed in to change notification settings - Fork 584
Hotfix: Skip Multiary Chained Expression For Rewriter #5621
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
Merged
mikaelweave
merged 18 commits into
hotfix/skip-chain-birthdate-optimization
from
personal/mikaelw/fix-dob-rewriter-has
Jun 17, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9c3462d
Reuse SMART search integration fixture (#5588)
mikaelweave 3e191c5
Fixes the $expand to return 404 when ValueSet not found (#5580)
rbans96 42d7489
Optimize slow query logger to reduce CPU usage (#5601)
apurvabhaleMS 4605738
Search param concurrency based on max last updated (#5576)
SergeyGaluzo 777005d
Correct search param pending status model (#5605)
SergeyGaluzo ff8a81d
Disable scalar temporal rewrite for chained searches (#5607)
mikaelweave 7769ecc
Fix Bulk Job Creation (#5609)
LTA-Thinking 5f350b6
[Bundles] Handling invalid bundle types (#5610)
fhibf abca618
Fix copy (#5612)
LTA-Thinking 2d43d43
Skip scalar temporal union rewrite for chained queries
mikaelweave 5787553
Clarify UNION handling, update chaining search tests
mikaelweave c00c7a5
cleanup for PR
mikaelweave 6d9df0e
Add SQL-only DOB E2E coverage
mikaelweave 7fe1340
Potential fix for pull request finding 'CodeQL / Useless assignment t…
mikaelweave 26e8ea4
Potential fix for pull request finding 'CodeQL / Missed opportunity t…
mikaelweave de59713
Merge origin/main and resolve conflicts
Copilot 9484916
Revert "Merge origin/main and resolve conflicts"
mikaelweave 7ac0d3e
fix whitespace
mikaelweave File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,28 @@ public async Task GivenAChainedSearchExpressionOverBirthdate_WhenSearched_ThenCo | |
| ValidateBundle(bundle, Fixture.SmithSnomedDiagnosticReport, Fixture.SmithLoincDiagnosticReport); | ||
| } | ||
|
|
||
| [HttpIntegrationFixtureArgumentSets(DataStore.SqlServer, Format.Json)] | ||
| [Fact] | ||
| public async Task GivenAChainedSearchExpressionOverBirthdateMonthPrecision_WhenSearched_ThenCorrectBundleShouldBeReturned() | ||
| { | ||
| string query = $"_tag={Fixture.Tag}&subject:Patient.birthdate=1990-05"; | ||
|
|
||
| Bundle bundle = await Client.SearchAsync(ResourceType.DiagnosticReport, query); | ||
|
|
||
| ValidateBundle(bundle, Fixture.SmithSnomedDiagnosticReport, Fixture.SmithLoincDiagnosticReport, Fixture.TrumanSnomedDiagnosticReport, Fixture.TrumanLoincDiagnosticReport); | ||
| } | ||
|
|
||
| [HttpIntegrationFixtureArgumentSets(DataStore.SqlServer, Format.Json)] | ||
| [Fact] | ||
| public async Task GivenAChainedSearchExpressionOverBirthdateDayWithAdditionalCriteriaOnTheSameTarget_WhenSearched_ThenCorrectBundleShouldBeReturned() | ||
| { | ||
| string query = $"_tag={Fixture.Tag}&subject:Patient.birthdate={Fixture.SmithPatientBirthDate}&subject:Patient.family=Smith"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this affects your test, but multiple chain searches are applied as OR, not AND like every other FHIR search parameter. |
||
|
|
||
| Bundle bundle = await Client.SearchAsync(ResourceType.DiagnosticReport, query); | ||
|
|
||
| ValidateBundle(bundle, Fixture.SmithSnomedDiagnosticReport, Fixture.SmithLoincDiagnosticReport); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task GivenAChainedSearchExpressionOverASimpleParameter_WhenSearchedWithPaging_ThenCorrectBundleShouldBeReturned() | ||
| { | ||
|
|
@@ -144,6 +166,86 @@ public async Task GivenAReverseChainSearchExpressionOverASimpleParameter_WhenSea | |
| ValidateBundle(bundle, Fixture.TrumanPatient); | ||
| } | ||
|
|
||
| [HttpIntegrationFixtureArgumentSets(DataStore.SqlServer, Format.Json)] | ||
| [Theory] | ||
| [InlineData(false)] | ||
| [InlineData(true)] | ||
| public async Task GivenAReverseChainSearchExpressionCombinedWithAnExactDayBirthdate_WhenSearched_ThenCorrectBundleShouldBeReturned(bool includeAccurateTotal) | ||
| { | ||
| string query = $"_tag={Fixture.Tag}&birthdate={Fixture.SmithPatientBirthDate}&_has:Observation:patient:code={Fixture.SnomedCode}"; | ||
| if (includeAccurateTotal) | ||
| { | ||
| query += "&_total=accurate"; | ||
| } | ||
|
|
||
| Bundle bundle = await Client.SearchAsync(ResourceType.Patient, query); | ||
|
|
||
| if (includeAccurateTotal) | ||
| { | ||
| Assert.Equal(1, bundle.Total.GetValueOrDefault()); | ||
| } | ||
|
|
||
| ValidateBundle(bundle, Fixture.SmithPatient); | ||
| } | ||
|
|
||
| #if !Stu3 | ||
| [HttpIntegrationFixtureArgumentSets(DataStore.SqlServer, Format.Json)] | ||
| [Fact] | ||
| public async Task GivenAReverseChainSearchExpressionOverImagingStudyStartedCombinedWithAnExactDayBirthdateAndTag_WhenSearchedWithPost_ThenCorrectBundleShouldBeReturned() | ||
| { | ||
| string tenantTagCode = Guid.NewGuid().ToString("N"); | ||
| var tenantMeta = new Meta | ||
| { | ||
| Tag = new List<Coding> | ||
| { | ||
| new Coding(Fixture.TenantTagSystem, tenantTagCode), | ||
| }, | ||
| }; | ||
|
|
||
| Patient imagingStudyExactDayPatient = (await Client.CreateAsync( | ||
| new Patient | ||
| { | ||
| Meta = tenantMeta, | ||
| BirthDate = Fixture.ImagingStudyPatientBirthDate, | ||
| })).Resource; | ||
|
|
||
| Patient imagingStudyMonthPrecisionPatient = (await Client.CreateAsync( | ||
| new Patient | ||
| { | ||
| Meta = tenantMeta, | ||
| BirthDate = Fixture.ImagingStudyMonthPrecisionPatientBirthDate, | ||
| })).Resource; | ||
|
|
||
| await Client.CreateAsync( | ||
| new ImagingStudy | ||
| { | ||
| Meta = tenantMeta, | ||
| Status = ImagingStudy.ImagingStudyStatus.Available, | ||
| Subject = new ResourceReference($"Patient/{imagingStudyExactDayPatient.Id}"), | ||
| Started = Fixture.ImagingStudyStarted, | ||
| }); | ||
|
|
||
| await Client.CreateAsync( | ||
| new ImagingStudy | ||
| { | ||
| Meta = tenantMeta, | ||
| Status = ImagingStudy.ImagingStudyStatus.Available, | ||
| Subject = new ResourceReference($"Patient/{imagingStudyMonthPrecisionPatient.Id}"), | ||
| Started = Fixture.ImagingStudyStarted, | ||
| }); | ||
|
|
||
| Bundle bundle = await Client.SearchPostAsync( | ||
| ResourceType.Patient.ToString(), | ||
| null, | ||
| default, | ||
| ("_has:ImagingStudy:patient:started", Fixture.ImagingStudyStarted), | ||
| ("birthdate", Fixture.ImagingStudyPatientBirthDate), | ||
| ("_tag", $"{Fixture.TenantTagSystem}|{tenantTagCode}")); | ||
|
|
||
| ValidateBundle(bundle, imagingStudyExactDayPatient, imagingStudyMonthPrecisionPatient); | ||
| } | ||
| #endif | ||
|
|
||
| [Fact] | ||
| public async Task GivenAReverseChainSearchExpressionWithMultipleTargetTypes_WhenSearched_ThenCorrectBundleShouldBeReturned() | ||
| { | ||
|
|
@@ -400,6 +502,16 @@ public ClassFixture(DataStore dataStore, Format format, TestFhirServerFactory te | |
|
|
||
| public string OrganizationIdentifier { get; } = Guid.NewGuid().ToString(); | ||
|
|
||
| #if !Stu3 | ||
| public string TenantTagSystem { get; } = "urn:tenantId"; | ||
|
|
||
| public string ImagingStudyPatientBirthDate { get; } = "2018-06-06"; | ||
|
|
||
| public string ImagingStudyMonthPrecisionPatientBirthDate { get; } = "2018-06"; | ||
|
|
||
| public string ImagingStudyStarted { get; } = "2018-02-02T05:00:00.000"; | ||
| #endif | ||
|
|
||
| public Patient SmithPatient { get; private set; } | ||
|
|
||
| public DiagnosticReport SmithSnomedDiagnosticReport { get; private set; } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Nit: should these be a theory?