scandihealth / lpr3-docs

https://scandihealth.github.io/lpr3-docs/
MIT License
11 stars 7 forks source link

LPR3 error: Procedure could not be found for nullify [5864] #266

Closed clausheinecke closed 5 years ago

clausheinecke commented 5 years ago

We get this error when we delete a Kontakt with the Kontakttype "Fysisk fremmøde" and that Kontakt has a procedure attached. billede

The error message states that the procedure does not exists in LPR - but it does. billede

We want to keep the procedure in LPR. Can you help us understand what the issue is? We believe that we have created the CDA according to the specs.

TueCN commented 5 years ago

@clausheinecke could you please attach 1) The XML that creates the existing Kontakt+Procedure (press the "Hent råfil" button in the UI) 2) The input XML that gives the error you want help to understand

We want to keep the procedure in LPR.

What do you mean by this? If you delete a Kontakt, all data under the Kontakt is also deleted.

clausheinecke commented 5 years ago

This is our CDA that should delete the Kontakt and as I understand it also tries to resubmit the procedurecode, so we can keep the code in LPR (now linked to the Forløbselement). Deletion CDA.txt

And this is the latest accepted CDA: Latest CDA.txt

TueCN commented 5 years ago

Hmmm, your "Deletion" document is not an append of "Latest". Latest has version 142 and extension FE212836-1009-11E9-BFC0-A1058FF62DB0, Deletion specifies a parentDocument with extension A7795710-1009-11E9-8C1F-A1058FF62DB0 and version 136.

This means that either "Latest" is not the latest document or your "Deletion" xml references a non-existing document. Were you viewing an older version when you downloaded the XML? (you get the XML for the version you are currently viewing)

clausheinecke commented 5 years ago

Here is the latest example of almost the same issue. This time it's a diagnosis we can't nullify when we change a Kontakt from "Fysisk fremmøde" to an "internal kontakt" which we don't report. Nullify diagnosis.txt

clausheinecke commented 5 years ago

I suspect that when we delete a Kontakt we don't have to delete associated diagnosis and procedures. When we delete a Kontakt, you delete everything associated with the Kontakt, right?

TueCN commented 5 years ago

@clausheinecke yes when we delete a Kontakt, all data referencing the encounter directly is also deleted. See https://scandihealth.github.io/lpr3-docs/aspects/index.html#id-usage-and-referencing-in-lpr3

Act, Procedure and Observation references the Encounter/Episode of Care, which means that e.g. nullifying the Encounter also nullifies all entities that points toward the Encounter (elements "under" the encounter).

Nullifying only the Act/Procedure/Observation that points towards the encounter removes only the entity itself and the encounter is left unchanged.

The same goes for nullifying an Episode of Care which removes all Encounters and transitively all activities below it.

TueCN commented 5 years ago

@clausheinecke your latest example only contains the nullification. I need all the related documents so I can reproduce the error on our internal test environment.

<relatedDocument typeCode="APND">
    <parentDocument classCode="DOCCLIN" moodCode="EVN">
        <id extension="BAFE979C-1800-11E9-AECC-A1058FF62DB0" root="7DE75B7A-B340-11E8-B441-A1058FF62DB0"></id>
        <setId assigningAuthorityName="EPC" root="7DE75B7A-B340-11E8-B441-A1058FF62DB0"></setId>
        <versionNumber value="119"></versionNumber>
    </parentDocument>
</relatedDocument>

I need the XML for all the related documents in the set, before I can be certain I am reproducing the issue the same you you are.

So I need doucment BAFE979C-1800-11E9-AECC-A1058FF62DB0, and its related documents (if any).

clausheinecke commented 5 years ago

Ok - Here is a new example with (I hope) everything you need. This is our file that were accepted: OK data.txt

And this the data inLPR right after I send submitted our data: LPR data.txt

And here is the file, where I update the kontakt (I'll delete the Kontakt): Update from SP.txt

And then I get this message from LPR: billede

TueCN commented 5 years ago

@clausheinecke the XML you attached is not the full set so I cannot submit the XML documents to our internal test ennvironment (the attachhed "OK.data.txt" has a related document).

However, I started analyzing your XML and as you mentioned, I can see you try to nullify both a Kontakt and a Diagnose that belongs to that Kontakt.

As I mentioned previously, when you delete an encounter, everything directly referencing that encounter is also deleted.

I believe that LPR processesses nullification acts in the order they are listed in the input XML and your XML lists the Kontakt nullification act before the Diagnose nullification act. So because the Kontakt nullification is processed before the Diagnose nullification, the Diagnose has already been deleted when processing the Diagnose nullification, and therefore you get your "DIAGNOSIS COULD NOT BE FOUND FOR NULLIFY" error message (which is your system's interpretation of LPR's response: EXTERNAL_CONDITION_OBSERVATION_NOT_FOUND)

The general solution would be to always only include the "root" element of what you want to delete (only the Kontakt and nothing "under" the Kontakt). The same would go for any other roots, e.g. when deleting a Diagnose all the ResultatIndberetning elements referencing that Diagnose are also automatically deleted and must not be also included in the nullify message.

Hope that clears up the problem :)

clausheinecke commented 5 years ago

Thx, Tue. Your last post was helpful. Can you verify that our interpretation (see below) of your design is correct?

Epic writes: The feedback we got from DXC helps a lot, thanks! Knowing that DXC is filing data to their database element-by-element as they read the XML message (and not after processing the full document) I see where this error comes from.

I find it's easier to think about this issue with a visual example: Inline image billede

Lets say we have a pathway element with two kontakts (kontakts A and B), and both kontakt has one procedure (procedures 1 and 2). If a user in Epic deletes Kontakt A and procedure 1, Epic will communicate this change to DXC with a new CDA message that documents both changes.

Let's say that the XML element nullifying Kontakt A appears higher up in the document than the XML element nullifying procedure 1. Reading post #9, I believe DXC reads the nullification of kontakt A and immediately deleted that kontakt (and all linked objects). As a result, their database would appear as follows: Inline image billede

Later in that same CDA message, DXC reads the nullification of procedure 1. DXC checks their database, but no longer sees procedure 1, and throws the error we're seeing here. Obviously this is a very simplified example, so extrapolating further I would imagine that we could also see this issue in similar cases, such as: •A Pathway Element is nullified prior to a procedure that points to that pathway element •A kontakt is nullified prior to a diagnosis or result report that points to that kontakt •A procedure is nullified before a result report that points to that procedure

clausheinecke commented 5 years ago

Are we the only ones getting this error?

TueCN commented 5 years ago

@clausheinecke yes, your interpretation describes the LPR functionality as it exists today

clausheinecke commented 5 years ago

And do other regions get the same error as we do? Or don't they have the same issue as we do?

TueCN commented 5 years ago

Seemingly not. We have not heard of anyone else that has had the same issue.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.