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

X-Provenance on transaction bundle only adds Provenance for first Resource #3361

Open
LodewijkSioen opened this issue Jun 19, 2023 · 7 comments
Labels
Bug Bug bug bug. VSTS-Backlog On VSTS Backlog

Comments

@LodewijkSioen
Copy link

LodewijkSioen commented Jun 19, 2023

Describe the bug
When adding the X-Provenance header to a POST of a Transaction Bundle, only the first resource that is created or updated will have a linked Provenance.

FHIR Version?
R4

Data provider?
SQL Server

To Reproduce
Steps to reproduce the behavior:

Add some resources in a Transaction:

POST https://server_url
content-type: application/json
X-Provenance: { "resourceType": "Provenance", "recorded": "2023-06-19T11:05:24+02:00", "agent": [ { "who": { "reference": "Device/Test" } } ]  }

{
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {
            "fullUrl": "Patient?identifier=urn%3Apatient%7C6108116119",
            "resource": {
                "resourceType": "Patient",
                "identifier": [
                    {
                        "system": "urn:patient",
                        "value": "6108116119"
                    }
                ],
                "name": [
                    {
                        "family": "Doe",
                        "given": [
                            "Jane"
                        ]
                    }
                ]
            },
            "request": {
                "method": "PUT",
                "url": "Patient?identifier=urn%3Apatient%7C6108116119"
            }
        },
        {
            "fullUrl": "Encounter?identifier=urn%3Adossier%7C80554680",
            "resource": {
                "resourceType": "Encounter",                
                "identifier": [
                    {
                        "system": "urn:dossier",
                        "value": "80554680"
                    }
                ],
                "status": "in-progress",
                "class": {
                    "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                    "code": "IMP"
                },
                "subject": {
                    "reference": "Patient?identifier=urn%3Apatient%7C6108116119"
                },
                "period": {
                    "start": "2014-12-11T08:31:00+01:00"
                }
            },
            "request": {
                "method": "PUT",
                "url": "Encounter?identifier=urn%3Adossier%7C80554680"
            }
        }
    ]
}

Only the patient will have a linked Provenance.

Expected behavior
Every Resource that has been created or updated by the transaction should have a linked Provenance.

Actual behavior
Only the first Resource created or updaten by the transaction has a linked Provenance.

AB#104579

@LodewijkSioen LodewijkSioen added the Bug Bug bug bug. label Jun 19, 2023
@brendankowitz
Copy link
Member

Thanks for reporting this @LodewijkSioen.
@fhibf can you take a look at this?

@LodewijkSioen
Copy link
Author

Related (but perhaps for another issue): I've been looking at your FhirClient and noticed that it is not possible to add the provenance header to the following operations:

  • Delete
  • Patch (both json and fhir)
  • Post (though this is a wierd one)
  • PostBundle

Also, as a user of the Client, it would be nice to pass a Provenance object instead of a string.

@LodewijkSioen
Copy link
Author

One more thing to think about: If using the X-Provenance header on a (transaction) bundle, should you create one Provenance per resource created/updated. Or should you create only one Provenance with multiple references in Target.

(I would think the last one)

@EXPEkesheth
Copy link
Collaborator

EXPEkesheth commented Jul 31, 2023

@LodewijkSioen thanks for reaching out ! Provenance header is used during PUT and POST. Will add work item in the backlog to address the issue related to not enabling for Patch, PostBundle and Post. #110273

FHIR spec does not call out support for Delete operation. https://www.hl7.org/fhir/provenance.html.
For the question related to the creating one provenance per resource or one provenance with multiple references in the target, have reached out to FHIR community.

@LodewijkSioen
Copy link
Author

Another thing: I was expecting the target in the Provenace resource to be version-specific. I was suprised to find out it wasn't.

@EXPEkesheth
Copy link
Collaborator

EXPEkesheth commented Oct 2, 2023

@LodewijkSioen - thanks for reporting. In the spec, it states target usually should be version specific. Item created in the backlog: #112074

Is this a blocker for you or nice to have?

@LodewijkSioen
Copy link
Author

I would consider it a blocker, but I have a workaround by adding Provenance manually to a transaction bundle. It also misses the version, but at least I have a Provenance resource for everything in the Bundle.

@EXPEkesheth EXPEkesheth added the VSTS-Backlog On VSTS Backlog label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug bug bug. VSTS-Backlog On VSTS Backlog
Projects
None yet
Development

No branches or pull requests

3 participants