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

Transaction bundle not checking ID for PUT request #721

Open
declankieran-nhsd opened this issue Aug 15, 2024 · 2 comments
Open

Transaction bundle not checking ID for PUT request #721

declankieran-nhsd opened this issue Aug 15, 2024 · 2 comments

Comments

@declankieran-nhsd
Copy link

I can post

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {
      "fullUrl": "Organization/Organization-RL121",
      "resource": {
        "resourceType": "Organization",
        "id": "Organization-RL121",
        "identifier": [
          {
            "system": "https://fhir.nhs.uk/Id/ods-organization-code",
            "value": "HealthcareService-GlanClwyd-Medicine"
          }
        ],
        "active": true,
        "type": [
          {
            "coding": [
              {
                "system": "http://snomed.info/sct",
                "code": "22232009",
                "display": "Hospital"
              }
            ]
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Organization/RL121"
      }
    },
    {
      "fullUrl": "Location/Location-RL121",
      "resource": {
        "resourceType": "Location",
        "id": "Location-GlanClwydHospital",
        "identifier": [
          {
            "system": "urn:ietf:rfc:3986",
            "value": "urn:oid:2.16.840.1.113883.2.1.8.1.5.109"
          }
        ],
        "status": "active",
        "mode": "instance",
        "type": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
                "code": "HOSP",
                "display": "Hospital"
              }
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "+44 1745 583910"
          }
        ],
        "physicalType": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
              "code": "si",
              "display": "Site"
            }
          ]
        }
      },
      "request": {
        "method": "PUT",
        "url": "Location/Location-RL121"
      }
    },
    {
      "fullUrl": "HealthcareService/HealthcareService-RL121",
      "resource": {
        "resourceType": "HealthcareService",
        "id": "HealthcareService-RL121",
        "meta": {
          "tag": [
            {
              "system": "http://fhir.synanetics.com/ui/icon",
              "code": "MedicineIcon"
            }
          ]
        },
        "active": true,
        "providedBy": {
          "reference": "Organization/Organization-RL121"
        },
        "category": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/service-category",
                "code": "27",
                "display": "Specialist Medical"
              }
            ]
          }
        ],
        "location": [
          {
            "reference": "Location/Location-RL121"
          }
        ],
        "name": "Medicine",
        "coverageArea": [
          {
            "reference": "Location/Location-RL121"
          }
        ],
        "availableTime": [
          {
            "availableStartTime": "07:00:00",
            "availableEndTime": "17:00:00"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "HealthcareService/HealthcareService-RL121"
      }
    }
  ]
}

and get 201's for all three resources

{
    "resourceType": "Bundle",
    "id": "9e4c0c22-dc07-4a8a-99ca-1da892f11609",
    "type": "transaction-response",
    "link": [
        {
            "relation": "self",
            "url": "http://localhost:8080/fhir"
        }
    ],
    "entry": [
        {
            "response": {
                "status": "201 Created",
                "location": "Organization/RL121/_history/1",
                "etag": "1",
                "lastModified": "2024-08-15T10:45:49.444+00:00",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "issue": [
                        {
                            "severity": "information",
                            "code": "informational",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
                                        "code": "SUCCESSFUL_UPDATE_AS_CREATE",
                                        "display": "Update as create succeeded."
                                    }
                                ]
                            },
                            "diagnostics": "Successfully created resource \"Organization/RL121/_history/1\" using update as create (ie. create with client assigned ID). Took 151ms."
                        }
                    ]
                }
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "Location/Location-RL121/_history/1",
                "etag": "1",
                "lastModified": "2024-08-15T10:45:49.444+00:00",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "issue": [
                        {
                            "severity": "information",
                            "code": "informational",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
                                        "code": "SUCCESSFUL_UPDATE_AS_CREATE",
                                        "display": "Update as create succeeded."
                                    }
                                ]
                            },
                            "diagnostics": "Successfully created resource \"Location/Location-RL121/_history/1\" using update as create (ie. create with client assigned ID). Took 20ms."
                        }
                    ]
                }
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "HealthcareService/HealthcareService-RL121/_history/1",
                "etag": "1",
                "lastModified": "2024-08-15T10:45:49.444+00:00",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "issue": [
                        {
                            "severity": "information",
                            "code": "informational",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
                                        "code": "SUCCESSFUL_UPDATE_AS_CREATE",
                                        "display": "Update as create succeeded."
                                    }
                                ]
                            },
                            "diagnostics": "Successfully created resource \"HealthcareService/HealthcareService-RL121/_history/1\" using update as create (ie. create with client assigned ID). Took 77ms."
                        }
                    ]
                }
            }
        }
    ]
}

However, the ID of the Organization resource is Organization-RL121, but the request is a PUT and has a different value for the ID in the URL, i.e.

      "request": {
        "method": "PUT",
        "url": "Organization/RL121"
      }

Expected behaviour would be an error for the entire transaction.

@tadgh
Copy link
Collaborator

tadgh commented Aug 15, 2024

Hey there! Could you please include the version of HAPI-FHIR you are seeing this issue against?

@declankieran-nhsd
Copy link
Author

Hi @tadgh , sorry! its v7.2.0. I was just running a latest docker image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants