Example #1
0
    def allowed_to_forward(self, episode_case):
        if not self.case_types_and_users_allowed(episode_case):
            return False

        case_properties = episode_case.dynamic_case_properties()
        not_sent = case_properties.get(
            "event_{}".format(DIAGNOSIS_AND_NOTIFICATION_EVENT)) != "sent"
        enrolled_in_private_sector = case_properties.get(
            ENROLLED_IN_PRIVATE) == 'true'
        return (case_properties.get("bets_first_prescription_voucher_redeemed")
                == 'true' and not_sent
                and enrolled_in_private_sector and case_properties_changed(
                    episode_case, ['bets_first_prescription_voucher_redeemed'])
                and is_valid_episode_submission(episode_case)
                and not is_migrated_uatbc_episode(episode_case))
Example #2
0
    def allowed_to_forward(self, episode_case):
        if not self.case_types_and_users_allowed(episode_case):
            return False

        case_properties = episode_case.dynamic_case_properties()
        prescription_total_days = _cast_to_int(
            case_properties.get("prescription_total_days", 0))
        treatment_options = case_properties.get("treatment_options")
        if treatment_options == "fdc":
            meets_days_threshold = prescription_total_days >= 168
        else:
            meets_days_threshold = prescription_total_days >= 180

        enrolled_in_private_sector = case_properties.get(
            ENROLLED_IN_PRIVATE) == 'true'
        not_sent = case_properties.get(
            "event_{}".format(TREATMENT_180_EVENT)) != "sent"
        return (meets_days_threshold and case_properties_changed(
            episode_case, ['prescription_total_days']) and not_sent
                and enrolled_in_private_sector
                and is_valid_episode_submission(episode_case)
                and not is_migrated_uatbc_episode(episode_case))