Details
-
Bug
-
Status: Closed
-
TBD
-
Resolution: Fixed
-
None
-
None
-
None
Description
In core, the PatientState domain object has a "voidLastState(ProgramWorkflow)" utility method that voided the last (most recent) patient state for that patient within the specified workflow. This is what the REST module delegates to when deleting a state RESTfully.
There's some business logic built int the method, namely that it sets the end date of the "next-to-last" patient state to null, which is generally the "right" behavior. That is if you have:
Pre-ART: Oct 1, 2017 to Oct 5, 2017
On ART: Oct 5 to Present
And delete, "On ART", you end up with:
Pre-ART: Oct 1, 2017 to Present
The case when this doesn't seem right is when a program is completed... for instance, say you have:
Program Completion Date: Oct 20, 2017
Pre-ART: Oct 1, 2017 to Oct 5, 2017
On ART: Oct 5 to Octo 20, 2017
If you delete the "On ART" in this case, you end up with:
Program Completion Date: Oct 20, 2017
Pre-ART: Oct 1, 2017 to Present
The correct logic is to set the end date of the next-to-last state to "null" if the program has not been completed, but, if not, set it to the completion date of the program.
This functionality has been implemented in the following feature branch:
https://github.com/openmrs/openmrs-core/commit/abdb6bfdc15471ca35e655130cf3a0d9a6264d03
... but should not be added until TRUNK-5230 is completed for consistency.
There was talk of backporting these, features, but I think it's fine to just apply them to the latest master at this point... but note that this feature branch was made off of 1.10.x, so you may want/need to cherry pick this commit into the master branch.
Gliffy Diagrams
Attachments
Issue Links
- is related to
-
TRUNK-5230 PatientProgram: When completing a program, the end date of the most recent state in each workflow should be set to the completion date of the program
-
- Closed
-
- relates to
-
TRUNK-5229 PatientProgram: If you transition to a new state when a program is complete, the state end date should be set to the completion date of the program
-
- Closed
-