How to get latest version of voided Observation

Hi All, @darius, @dkayiwa, @bharatak
As part of the Data Quality Feature of Bahmni, user can edit an observation(retrieved using the uuid) to fix the issues. This was all fine till OpenMRS 2.0. With OpenMRS 2.x, when an observation is edited (one scenario edits obsDateTime of entire obs tree) results in voiding itself and recreating new observation tree making the old uuid of old obs tree no more valid. This creates a need for a way to retrieve latest version of observation when a uuid of voided observation is given.
Any ideas around this? As of now ObsService has getObsByUuid, does it make sense to add a new method something like getLatestObsByUuid?

We definitely need an ObsService.getRevisionObs(Obs) method, we have a similar method but for Orders i.e Order.getRevisionOrder(Order) and we should do the same for Observations

@swathivarkala do you mind creating a ticket and we implement it as a new feature

Hi @wyclif, Here is the ticket Is it possible to get this as part of 2.1.0?? If not we will have to do this in Bahmni custom bahmni-core omod for now and re-factor it when this comes with openmrs. Thank you.

@swathivarkala do you have someone ready to work on it?

@dkayiwa, i can work on it.

The alpha is already out and hence no new features. But since this is a small addition, i would go for breaking the rules a bit to back port it, instead of having to do it in a custom module.

Great, so shall i start working on it? Is there any time line for this to be completed?

I would say, go and finish it as soon as possible.

Okay. Thank you.

Hi @dkayiwa @wyclif ,

  • Added getRevisedObs(Obs) in ObsService as below :
  • Added getRevisedObs(Obs) in ObsDAO
  • Added shouldGetRevisedObs test case in ObsServiceTest

Does this makes sense? Can i create pull request?

I would prefer doing the review from a pull request. :slight_smile:


Thank you.

Since the Bahmni team is steering the 2.1 release, feel free to make the call on whether to include it in 2.1, I personally have no objection. I added some comments to the pull request but it looks good in general, thanks for working on it!

Thank you @wyclif, did the changes accordingly. We need these changes in 2.1.

Merged and forward ported to master!

1 Like