microsoft / microsoft/fhir-server
X-Provenance on transaction bundle only adds Provenance for first Resource
- Dominant language
- TSQL
- Stars
- 1.4k
- Forks
- 592
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 41
Description
**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
Contributor guide
Research direction
Start by reproducing the POST transaction Bundle with the X-Provenance header and the Patient and Encounter entries shown in the issue. Trace the transaction-bundle handling and provenance association entry points, then verify that every resource created or updated by the transaction has a linked Provenance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100