Copying an Obs doesn't copy over an associated Order

Hello all–

When copying an Obs, any order associated with that Obs is not copied over. This seems incorrect to me, particularly because since Obs are immutable, whenever an Obs is modified it is “copied”, resulting in the loss of any linkage to an Order.

However, there is one unit test that expects this behavior:

Do we need to special case this? It seems like this test is assuring that when an Encounter is transferred from one patient to another, we don’t copy over any Orders associated with that Encounter, which seems fine to me. But do we really need to make sure any Obs on that Encounter that were linked to an order no longer are? I assume the point of this ticket was to make sure that Orders aren’t inadvertently transferred from one patient to another. But the “Order” on an Obs refers to the the Order that resulted in this Obs (as I understand it). I don’t think we want to lose this information?

fyi @dkayiwa @mseaton @burke

Take care, Mark

I’d agree with you @mogoodrich, it would seem that this connection to the order should be preserved.

This commit was done as part of this ticket

After having looked at it again, i believe that @mogoodrich you are correct. We should have fixed it in a way that does not require the removal of this line from newObs.setOrder(obsToCopy.getOrder());

Thanks @mseaton @dkayiwa… in the coming days I will add back in the line that copies over the Orders when copying an Obs and then also change the “transferEncounter” test so that it doesn’t expect the Orders to be removed.