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

History bundle entry fullUrl not produced correctly when using ClientIdStrategyEnum.ANY #5088

Closed
mlitcher opened this issue Jul 13, 2023 · 1 comment · Fixed by #5815
Closed
Assignees

Comments

@mlitcher
Copy link

Describe the bug:
When using client supplied resource ids, the fullUrl of the resources within a history bundle are not correctly generated. For example, the fullUrl produced when doing a GET {baseUrl}/Patient/clientSuppliedId1234/_history is:

{
  "resourceType": "Bundle",
  "id": "03dd2e54-b1c3-470f-8ef8-19a02e358560",
  "meta": {
    "lastUpdated": "2023-07-13T11:18:10.199-04:00"
  },
  "type": "history",
  "total": 1,
  "link": [
    {
      "relation": "self",
      "url": "http://localhost:8080/fhir/Patient/clientSuppliedId1234/_history"
    }
  ],
  "entry": [
    {
      "fullUrl": "Patient/Patient/clientSuppliedId1234",
      "resource": {
         ...
      }
    }
  ]
}

To Reproduce:
Steps to reproduce the behavior:

  1. Clone the hapi-fhir-jpaserver-starter project.
  2. Enable and update the hapi.fhir.client_id_strategy property to ANY.
  3. Start the local server (i.e. mvn clean spring-boot:run -Pboot).
  4. Using a synthetic patient resource produced from synthea, issue a PUT command using the "id" contained in the synthetic patient resource: PUT {baseUrl}/Patient/clientSuppliedId1234
  5. Access the patient resource history: GET {baseUrl}/Patient/clientSuppliedId1234/_history
  6. Note the incorrectly produced fullUrl attribute for the entry within the bundle.

Expected behavior:
The fullUrl should contain a legitimate resource URL which contains the base FHIR URL.

i.e. "fullUrl": "http://localhost:8080/fhir/Patient/clientSuppliedId1234"

Environment:

  • HAPI FHIR Version: 6.6.0
  • OS: macOS
  • Browser: Chrome
@mlitcher
Copy link
Author

mlitcher commented Aug 8, 2023

The method fetchEntities in the HistoryBuilder class, creates a PersistentIdToForcedIdMap object that results in a map of values like:

1 -> Patient/clientSuppliedId1234

The forced id is qualified with the resource type, however, the remaining logic in fetchEntities doesn't seem to account for that, and thus, the attribute myTransientForcedId is set to this value. That value is later used to create the resource id, and ultimately, the fullUrl seen in the history output.

I'm a little unclear whether there should be logic in fetchEntities to account for that, or whether the method translatePidsToForcedIds in the class IdHelperService should be altered to omit the resource type prefix? Anyone have thoughts on this?

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

Successfully merging a pull request may close this issue.

2 participants