Skip to content

$mdm-link-history ordering is incorrect when client-assigned ID and PID are different #5102

Closed
@jmarchionatto

Description

@jmarchionatto

Problem Statement

When a client creates a resource via PUT request, they can assign a client-assigned ID. The DB will also assign its own PID, and the PID can be mapped to the client-assigned ID.

When the results for $mdm-link-history are ordered, they are ordered by PID instead of client-assigned ID (see MdmLinkDaoJpaImpl:390), but PIDs are generally not what the client sees, meaning from a user perspective, the results still appear not to be in the correct order.

Steps to Reproduce

  1. Start and configure Smile with MDM
  2. PUT Patient/456a with id 456a in the body --> is assigned to PID Patient/1; new GR is created with PID Patient/2
  3. PUT Patient/123a with the same body (but change id to 123a) --> is assigned to PID Patient/3; matches with GR with PID Patient/2
  4. Do a $mdm-query-links to find the ID of the golden resource the Patients match to
  5. Perform a $mdm-link-history?goldenResourceId=<golden resource id>

Observed Results

The$mdm-link-history response will return with the order Patient/456a (PID Patient/1), Patient/123a (PID Patient/3). This is in ascending order by PID, which is Patient/1, Patient/3, but appears in descending order to the user who sees the client assigned IDs in the response Patient/456a, Patient/123a

Expected Results

The order of results should be ascending by client-assigned IDs instead of by PIDs (ie. should be Patient/123a, Patient/456a)

Environment (please complete the following information):
HAPI FHIR Version: v6.6.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions