Patient Merge Functionality

Later comments by @darius and @akhilmalhotra seem to suggest that we should loosen the constraints and allow merging patients with active orders for the same concept as long as they are not drug orders .

So if I’m understanding the history:

  • a Bahmni implementation team asked to make Patient Merging more permissive
  • we had an OpenMRS design discussion and came up with the most permissive approach we felt comfortable with
  • (and we said, go ahead and implement this)
  • the Bahmni implementation wants to be less permissive that our proposed design (but still more permissive than the current code).

So as I understand it, compared to our proposal above you are simplifying the logic a bunch. You’re proposing to just say you cannot merge two patients if both have active orders of the same order type.

That logic sounds fine to me (especially since you’re the ones writing the code!)

But @wyclif’s comment makes it sound like what was implemented is different than this. Is this just a misunderstanding, and the “same concept” clause is now irrelevant because things are already being blocked by another check for active orders by type?

So in summary, what patients are they proposing that can’t be merged?

I think @akhilmalhotra is saying that you cannot merge two patient records if they both have any active orders that have the same type.

Examples:

  • A has an active drug order for aspirin, B has an active drug order for tylenol => cannot merge
  • A has an active lab order for CBC, B has an active lab order for Chem10 => cannot merge
  • A has an active drug order for aspirin, B has an active lab order for Chem10 => Merge OK

(Edited to fix typo)

I would think for the scenario where A has an active drug order for aspirin, B has an active lab order for Chem10, we shouldn’t merge those, I thought we should never merge patients if any has any active drug orders

We do want to allow merging in that case.

This is meant to apply when both patients have active drug orders, not when a single record has them.

@darius is right.

Just re-iterating what we have implemented.

  • A has active drug order, B has active drug order ==> Cannot merge

  • A has active lab order, B has active lab order ==> Cannot merge

  • A has active drug order, B has active lab order ==> Can merge

Are these rules specific to drug and lab orders? Or was it implemented more genetically – i.e.,

  • A and B both have active order of same order type ==> Cannot merge

  • A and B have active orders (or not), but there are no cases where both A and B have active orders of the same order type ==> Can merge

@burke Its built generically and not specific to drug and lab orders. Just like the examples you have mentioned.

1 Like

If that’s the behavior we’ve agreed on then the logic in @akhilmalhotra is fine. @akhilmalhotra there is some comments on the PR to clean up the unit tests.