Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5691

Updated Patient does not update Patient Date Changed

    XMLWordPrintable

Details

    • Bug
    • Status: In Progress
    • Should
    • Resolution: Unresolved
    • Platform 2.4.0
    • None
    • None
    • Undetermined

    Description

      In 2.3.x and 2.4.x, updating a Patient no longer sets the "dateChanged" property of a Patient, thought it does still update the Person dateChanged.

      This appears to have been caused by TRUNK-5492.

      This likely exposes a problem with our modelling of Person and Patient, and our hacky workaround to make Person and Patient maintain separate dateChanged states.

      This test, which passes in 2.2.x but fails in 2.3.x and 2.4.x, demostrates the issue:

      @Test
      public void updatedPatientShouldUpdatePatientDateChanged() throws Exception {
      
         Calendar cal = Calendar.getInstance();
         cal.set(Calendar.HOUR, 0);
         cal.set(Calendar.MINUTE, 0);
         cal.set(Calendar.SECOND, 0);
         cal.set(Calendar.MILLISECOND, 0);
         Date today = cal.getTime();
         
      
         Patient patient6 = patientService.getPatient(6);
         patient6.setAllergyStatus(Allergies.NO_KNOWN_ALLERGIES);
         patientService.savePatient(patient6);
         
         Context.flushSession();
         Context.clearSession();
         
         Patient updatedPatient6 = patientService.getPatient(6);
         assertTrue(updatedPatient6.getPersonDateChanged().after(today) || updatedPatient6.getPersonDateChanged().equals(today));
         // the following assertion will fails against Core 2.3.x and 2.4.x
         assertTrue(updatedPatient6.getDateChanged().after(today) || updatedPatient6.getDateChanged().equals(today));
         
      }

      One solution may be to remove the auditable fields that are duplicated on both Patient and Person, and remove the ability to distinguish between a "Person" and a "Patient" when it comes to auditing.

      Thoughts dkayiwa burke mseaton?

       

       

      Gliffy Diagrams

        Attachments

          Activity

            People

              corneliouzbett Bett Kipchumba
              mogoodrich Mark Goodrich
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: