def try_to_update_cur_outcome(self):
     print("Entering try_to_update_cur_outcome...")
     print("    current effect: %s" % self.cur_effect)
     
     e1, n1, e2, n2 = self.ma_unit.get_raw_data_for_groups(self.cur_groups)
     print("    e1: %s, n1: %s, e2: %s, n2: %s" % (str(e1),str(n1),str(e2),str(n2)))
     
     two_arm_raw_data_ok = not any([self._isBlank(x) for x in [e1, n1, e2, n2]])
     one_arm_raw_data_ok = not any([self._isBlank(x) for x in [e1, n1]])
     curr_effect_is_one_arm = self.cur_effect in BINARY_ONE_ARM_METRICS
     curr_effect_is_two_arm = self.cur_effect in BINARY_TWO_ARM_METRICS
     
     # if None is in the raw data, should we clear out current outcome?
     if two_arm_raw_data_ok or (curr_effect_is_one_arm and one_arm_raw_data_ok):
         if curr_effect_is_two_arm:
             est_and_ci_d = meta_py_r.effect_for_study(e1, n1, e2, n2, metric=self.cur_effect, conf_level=self.CI_spinbox.value())
         else:
             # binary, one-arm
             est_and_ci_d = meta_py_r.effect_for_study(e1, n1, two_arm=False, metric=self.cur_effect, conf_level=self.CI_spinbox.value())
     
         display_est, display_low, display_high = est_and_ci_d["display_scale"]
         self.ma_unit.set_display_effect_and_ci(self.cur_effect, self.group_str, display_est, display_low, display_high)                            
         est, low, high = est_and_ci_d["calc_scale"]  # calculation (e.g., log) scale
         self.ma_unit.set_effect_and_ci(self.cur_effect, self.group_str, est, low, high)
         self.set_current_effect()
    def try_to_update_cur_outcome(self):
        e1, n1, e2, n2 = self.ma_unit.get_raw_data_for_groups(self.cur_groups)
        print("e1: %s, n1: %s, e2: %s, n2: %s" %
              (str(e1), str(n1), str(e2), str(n2)))

        two_arm_raw_data_ok = not any(
            [self._isBlank(x) for x in [e1, n1, e2, n2]])
        one_arm_raw_data_ok = not any([self._isBlank(x) for x in [e1, n1]])
        curr_effect_is_one_arm = self.cur_effect in BINARY_ONE_ARM_METRICS
        curr_effect_is_two_arm = self.cur_effect in BINARY_TWO_ARM_METRICS

        # if None is in the raw data, should we clear out current outcome?
        if two_arm_raw_data_ok or (curr_effect_is_one_arm
                                   and one_arm_raw_data_ok):
            if curr_effect_is_two_arm:
                est_and_ci_d = meta_py_r.effect_for_study(
                    e1,
                    n1,
                    e2,
                    n2,
                    metric=self.cur_effect,
                    conf_level=self.global_conf_level)
            else:
                # binary, one-arm
                est_and_ci_d = meta_py_r.effect_for_study(
                    e1,
                    n1,
                    two_arm=False,
                    metric=self.cur_effect,
                    conf_level=self.global_conf_level)

            est, low, high = est_and_ci_d[
                "calc_scale"]  # calculation (e.g., log) scale
            self.ma_unit.set_effect_and_ci(self.cur_effect,
                                           self.group_str,
                                           est,
                                           low,
                                           high,
                                           mult=self.mult)
            self.set_current_effect()
    def update_outcome_if_possible(self, study_index):
        """
        Checks the parametric study to ascertain if enough raw data has been
        entered to compute the outcome. If so, the outcome is computed and
        displayed.
        """
        est, lower, upper = None, None, None

        data_type = self.get_current_outcome_type(get_str=False)
        if self.raw_data_is_complete_for_study(study_index):
            if data_type == BINARY:
                e1, n1, e2, n2 = self.get_cur_raw_data_for_study(study_index)
                est, lower, upper = meta_py_r.effect_for_study(e1, n1, e2, n2)
            elif data_type == CONTINUOUS:
                n1, m1, se1, n2, m2, se2 = self.get_cur_raw_data_for_study(study_index)
                est, lower, upper = meta_py_r.continuous_effect_for_study(n1, m1, se1, n2, m2, se2)

        ma_unit = self.get_current_ma_unit_for_study(study_index)
        # now set the effect size & CIs
        ma_unit.set_effect_and_ci(self.current_effect, est, lower, upper)