hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
1.97k stars 1.3k forks source link

MDM: Wrong MDM EID Create Scenarios #3495

Open KostiantynBondarenko opened 2 years ago

KostiantynBondarenko commented 2 years ago

Issue: According to the scheme https://hapifhir.io/hapi-fhir/docs/images/empi-create-2.svg in hapi documentation the generated EID should be assigned to the new resource, but the resource does not change.

To Reproduce Steps to reproduce the behavior:

  1. Create new Patient with no external EID
  2. System will generate an EID with an internal system and create Golden Record. New person created without EID

Environment:

Expected: empi-create-2

Actual: empi-create-2-svg (1)

tadgh commented 2 years ago

Hey thanks for reporting this, I'll have a look

tadgh commented 2 years ago

Hey @KostiantynBondarenko , I just checked this out in test, and it seems to be working fine. Can you provide some replication steps? Here is a sample test you can run, if you paste it into the MdmMatchLinkSvcTest.java class.


    @Test
    public void testInternalEidIsAssignedAndIspropagated() {
        Patient janePatient = createPatient(buildJanePatient());

        IAnyResource goldenResource = myGoldenResourceHelper.createGoldenResourceFromMdmSourceResource(janePatient, new MdmTransactionContext(MdmTransactionContext.OperationType.CREATE_RESOURCE));
        myMdmLinkSvc.updateLink(goldenResource, janePatient, MdmMatchOutcome.NEW_GOLDEN_RESOURCE_MATCH, MdmLinkSourceEnum.AUTO, createContextForCreate("Patient"));

        assertTrue(janePatient.getIdentifier().stream().anyMatch(id -> id.getSystem().equalsIgnoreCase(HAPI_ENTERPRISE_IDENTIFIER_SYSTEM)));
        assertTrue(((Patient)goldenResource).getIdentifier().stream().anyMatch(id -> id.getSystem().equalsIgnoreCase(HAPI_ENTERPRISE_IDENTIFIER_SYSTEM)));
    }