Details

    • Type: Story
    • Status: Accepted
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Complexity:
      Low
    • Sprint:
      Allergies Sprint 1

      Description

      Create an Allergies class to represent patient allergies.

      class Allergies implements List<Allergy> {
      
        public static final String UNKNOWN = "unknown";
        public static final String NO_KNOWN_ALLERGIES = "no known allergies";
        public static final String SEE_LIST = "see list";
      
        private String allergyStatus = UNKNOWN;
        private List<Allergy> allergies;
      
        boolean add(Allergy allergy) {
          allergyStatus = SEE_LIST;
          return getAllergies().add(allergy);
        }
      
        boolean remove(Allergy allergy) {
          boolean result = getAllergies().remove(allergy);
          if (allergies.isEmpty()) allergyStatus = UNKNOWN;
          return result;
        }
      
        void clear() {
          allergyStatus = UNKNOWN;
          allergies.clear();
        }
      
        void confirmNoKnownAllergies() throws APIException {
          if (!getAllergies().isEmpty())
            throw new APIException("Cannot confirm no known allergies if allergy list is not empty");
          allergyStatus = NO_KNOWN_ALLERGIES;
        }
      
        boolean equals(Object o) {
          if (o instanceof String)
            return allergyStatus.equals(o);
          ...
        }
      
        ...
      }
      

      The allergyStatus should be persisted in a new patient.allergy_status column. The allergies should be persisted within the allergies table. Anytime either of these (allergyStatus and allergies) are updated within the database, it should be done within a transaction to ensure that they are kept in sync.

        Gliffy Diagrams

          Attachments

            Issue Links

              Attachments-Category-Modification

                Activity

                  People

                  • Assignee:
                    shasha Shasha Liu
                    Reporter:
                    dkayiwa Daniel Kayiwa
                  • Votes:
                    0 Vote for this issue
                    Watchers:
                    7 Start watching this issue

                    Dates

                    • Created:
                      Updated:
                      Resolved:

                      Time Tracking

                      Estimated:
                      Original Estimate - 1 day
                      1d
                      Remaining:
                      Time Spent - 4 hours Remaining Estimate - 4 hours
                      4h
                      Logged:
                      Time Spent - 4 hours Remaining Estimate - 4 hours
                      4h