openmrs-core
openmrs-core copied to clipboard
TRUNK-4954:ObsService.saveObs should throw a validation message if the obs and its encounter point to different persons
Added a validation exception on saving an obs if the obs and its encounter point to different persons
Ticket ID:https://issues.openmrs.org/browse/TRUNK-4954
Coverage increased (+0.003%) to 63.628% when pulling 965ab53794a16b144e40e1ae78b72dd68fb84451 on HerbertYiga:TRUNK-4954 into f557f41272968e1b34bbeba92e6557703714a790 on openmrs:master.
got all the tests passing,@dkayiwa how does this pr look to you?
@ibacher hi ian,while trying to squash this ,i use git rebase -i master,but i get a couple of commits for which i didnot even make as seen here https://pastebin.com/kMdumzPD any idea about the cause of this?
@HerbertYiga You did a rebase on master
rather than the TRUNK-4954
branch, which gives Git permission to rewrite the root commit of this branch. Essentially, if you complete that rebase, it will squash your commits with all the commits that have been written to master since you first created this branch. Since there aren't any conflicts with this branch, I would recommend not trying to do a rebase at all. We can squash the commits via the GitHub tools when this is ready to go.
If you do want to squash just the relevant commits, run git rebase -i HEAD~3
(3 comes from the fact that there are three commits on this branch).
@ibacher on introducing
if (obs.getPerson() != null && obs.getPerson().getIsPatient() && obs.getEncounter() != null && obs.getEncounter().getPatient() != null) { errors.reject("Person objects of the obs and the encounter do not match"); } i run into a stack over flow error,https://pastebin.com/TaSJ729z by the way @ibacher to me the the above code simply checks if a patient exists for a given person having the observation and if a patient exists in an given observation for a given a encounter but never checks if the patient objects for both scenarios
Am wondering if there is no scenario of all the above not being null,but at the same time patient objects are not the same
@HerbertYiga So the overall code for that if statement should be something like this:
if (obs.getPerson() != null && obs.getPerson().getIsPatient() && obs.getEncounter() != null && obs.getEncounter().getPatient() != null) {
if (!obs.getPerson().equals(obs.getEncounter().getPatient().getPerson())) {
errors.reject("Person objects of the obs and the encounter do not match");
}
}
I.e., we do still need to check that the two persons are equal.
@HerbertYiga So the overall code for that if statement should be something like this:
if (obs.getPerson() != null && obs.getPerson().getIsPatient() && obs.getEncounter() != null && obs.getEncounter().getPatient() != null) { if (!obs.getPerson().equals(obs.getEncounter().getPatient().getPerson())) { errors.reject("Person objects of the obs and the encounter do not match"); } }
I.e., we do still need to check that the two persons are equal.
perfect
Hmmmm... and the stack overflow error doesn't occur when the obs.getPerson().getIsPatient()
call is absent?
Hmmmm... and the stack overflow error doesn't occur when the
obs.getPerson().getIsPatient()
call is absent?
ohh it still occurs
i run into a stack over flow error
@HerbertYiga So, I tried checking out this branch and then applying my suggested code above and I don't get the stack overflow error (it's a bit hard to diagnosis since I can't see the call that originally kicked it off).
i run into a stack over flow error
@HerbertYiga So, I tried checking out this branch and then applying my suggested code above and I don't get the stack overflow error (it's a bit hard to diagnosis since I can't see the call that originally kicked it off).
with this,
if (obs.getPerson() != null && obs.getPerson().getIsPatient() && obs.getEncounter() != null && obs.getEncounter().getPatient() != null) { if (!obs.getPerson().equals(obs.getEncounter().getPatient().getPerson())) { errors.reject("Person objects of the obs and the encounter do not match"); } }
i dont get any stack overflow,i have simply fixed some failing tests preparing to make a commit
@ibacher just tried to fix a couple of things for this,
@ibacher hi ian,does this look good to be merged!
@dkayiwa hi Daniel, do you think this is good to be merged?
@HerbertYiga not without some tests.
not without some tests.
aright will ping you when am done on them @dkayiwa
not without some tests.
@dkayiwa added tests for this, thanks for all the reviews
@mozzy11 @dkayiwa does this look good for merging?
hi @dkayiwa does this look good enough for merging?
@HerbertYiga can you respond to Mozzy's comments above?
@HerbertYiga can you respond to Mozzy's comments above?
@gracepotma Responding to @mozzy11's comment, the test available already covers that
@HerbertYiga can you assert in your test unit that the obs and its encounter point to different persons ??
hi @dkayiwa does this now look good enough?
Hello @HerbertYiga , did you respond to @mozzy11 comment above?
cc @HerbertYiga . Kindly respond to the above message.Thanks.
tl;dr our action detected no activity on this PR and will close it in 30 days if the stale label is not removed.
OpenMRS welcomes your contribution! It means a lot to us that you want to contribute to equity in healthcare!
This PR has not seen any activity in the last 5 months. That is why we wanted to check whether you are still working on it or need assistance from our side. Please note that this is an automated message and we might very well be the reason why there has not been any activity lately. We certainly do not want to discourage you from contributing. We do need to be honest in that OpenMRS has limited resources for reviewing PRs.
If you do not have time to continue the work or have moved on you don’t need to do anything. We will automatically close the PR in 30 days. We hope to see you back soon :) If you would like to continue working on it or require help from us please remove the stale label and respond by commenting on the issue.
tl;dr closing this PR since it has not seen any activity in the last 6 months.
OpenMRS welcomes your contribution! It means a lot to us that you want to contribute to equity in healthcare! We certainly do not want to discourage you from contributing. We do need to be honest in that OpenMRS has limited resources for reviewing PRs. Your PR has not seen any activity in the last 6 months. This is why we have decided to close this PR for now. This allows us OpenMRS reviewers to focus our limited time to review all other PRs in a timely and professional manner.
Please feel free to reassign yourself to the issue you worked on in our JIRA when you have time to focus on it. After that reopen a new PR and we will be glad to work with you to get your contribution merged. Thank you very much for your help and understanding :)