-
Notifications
You must be signed in to change notification settings - Fork 157
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
Reference within a bundle could not be resolved with entry request conditional update #2769
Comments
So the first update is a conditional update So there's actually 5 cases there:
Which of these are working / aren't working with the local reference replacement stuff? I think what you're saying is in the case of One Match, no resource id provided, you're looking for us to replace the Would you mind trying something on your end? |
Thank you for the quick response! First question:
What I tested was the first case: "No matches, no id provided: The server creates the resource." The resources were created, but unfortunately partially with the wrong reference. Actually all the tests mentioned were executed to a fresh empty server. Second question:
I tried the conditional reference in the Observation.subject field, too. This works if "One Match, no resource id provided". But if there is no match, the error message is "Error resolving conditional reference: search returned no results" |
Thanks for the additional info. Of the five cases in conditional update, I assume our behavior is right on the last two failure cases (should fail the transaction and return an OperationOutcome). I do agree that it would be nice if the server could handle all of the 3 success cases of conditional update together with our bundle-local reference replacement feature, so thank you for opening this issue. Until we support such functionality, I think the workaround would be to perform the search from the client before invoking the transaction bundle request. If the resources exist, you can do a normal update in the bundle. If they don't, then you can do a normal create in the bundle. |
In #1869 all the ids and references will be resolved prior to any persistence operations (we do a prepare phase followed by a persist phase). This will probably need to be expanded to properly handle the issue outlined here. I'll take a look at this once the big refactor related to #1869 is working. |
We already have a test case FHIRRestHelperTest#testTransactionBundlePostWithBackwardsConditionalDependency which replicates this. The test will need to be updated if we change the bundle processing behavior. |
Running with the latest codebase on my local FHIR server, I validated the following 5 conditional update cases:
All ran successfully, returning the expected results. For the first case I used the bundle data provided in the issue description, running with the Patient resource first in the bundle, and running with the Observation resource first in the bundle. I also ran this case with a QuestionnaireResponse/Patient combination and an Encounter/Patient combination. |
Describe the bug
References within a transaction bundle could not be resolved, when:
Environment
Which version of IBM FHIR Server?
4.9.0
To Reproduce
Steps to reproduce the behavior:
Expected behavior
After uploading the bundle, the reference field in Observation.subject is expected to be resolved, e.g. updated by the new location of the Patient, but it stays like "urn:uuid:[id]".
Additional context
The following requests are also tested:
In the log of IBM FHIR server, a successful case and a failed case have different order of creating these two resources are different:
I suppose it is expected: first the patient is created, then the Observation should be created, so that the reference could be resolved.
The text was updated successfully, but these errors were encountered: