예제 #1
0
    def __get_eligible_cases__(self):
        """
        Returns a list of eligible cases using the settings object
        """
        cases = get_cases_from_bwv(self.opening_date, self.projects,
                                   self.stadia)
        LOGGER.info("Total list of cases: {}".format(len(cases)))

        filter_stadia = self.__get_filter_stadia__()

        LOGGER.info("Filter stadia: {}".format(str(filter_stadia)))
        LOGGER.info("Exclude stadia: {}".format(str(self.exclude_stadia)))
        LOGGER.info("Projects: {}".format(str(self.projects)))
        LOGGER.info("Opening date: {}".format(str(self.opening_date)))

        filtered_cases = filter_cases(cases, filter_stadia)
        LOGGER.info("Total cases after filtering stadia: {}".format(
            len(filtered_cases)))

        filtered_cases = filter_out_cases(filtered_cases, self.exclude_stadia)
        LOGGER.info("Total cases after excluding stadia: {}".format(
            len(filtered_cases)))

        filtered_cases = filter_cases_with_missing_coordinates(filtered_cases)
        LOGGER.info(
            "Total cases after filtering on missing coordinates: {}".format(
                len(filtered_cases)))

        filtered_cases = filter_cases_with_postal_code(filtered_cases,
                                                       self.postal_code_ranges)
        LOGGER.info("Total cases after filtering on postal codes: {}".format(
            len(filtered_cases)))

        exclude_cases = [{"id": case.case_id} for case in self.exclude_cases]
예제 #2
0
 def get_case_ids_to_score(self):
     """
     Returns a list of case ids which are eligible for scoring
     """
     cases = get_cases_from_bwv(
         SCORE_STARTING_FROM_DATE,
         self.get_projects_to_score(),
         self.get_stadia_to_score(),
     )
     case_ids = list(set([case.get("id") for case in cases]))
     return case_ids
예제 #3
0
def get_case_ids_to_score(model_name, use_zaken_backend=False):
    """
    Returns a list of case ids which are eligible for scoring
    """
    case_ids = []
    if use_zaken_backend:
        pass
    else:
        cases = get_cases_from_bwv(
            STARTING_FROM_DATE,
            get_projects_to_score(model_name),
            get_stadia_to_score(model_name),
        )
        case_ids = list(set([case.get("id") for case in cases]))
    return case_ids
예제 #4
0
 def get_case_ids_to_score(self, use_zaken_backend=False):
     """
     Returns a list of case ids which are eligible for scoring
     """
     case_ids = []
     if use_zaken_backend:
         cases = get_fraudprediction_cases_from_AZA_by_model_name(
             self.model_name)
         case_ids = [case.get("id") for case in cases if case.get("id")]
     else:
         cases = get_cases_from_bwv(
             STARTING_FROM_DATE,
             self.get_projects_to_score(),
             self.get_stadia_to_score(),
         )
         case_ids = list(set([case.get("id") for case in cases]))
     return case_ids
        """
        returns a list of cases which are already in itineraries for a given date
        """
        itineraries = Itinerary.objects.filter(created_at=date)
        itineraries = [itinerary.get_cases() for itinerary in itineraries]
        cases = flatten(itineraries)

        return cases

    def get_unplanned_cases(date, stadium, projects):
        """
        Returns a list of unplanned cases which
        """
        planned_cases = Itinerary.get_cases_for_date(date)
        exclude_cases = [{"id": case.case_id} for case in planned_cases]
        all_cases = get_cases_from_bwv(STARTING_FROM_DATE, projects, [stadium])
        cases = remove_cases_from_list(all_cases, exclude_cases)

        return cases

    def add_team_members(self, user_ids):
        """
        Adds team members to this itinerary
        """
        for user_id in user_ids:
            user = User.objects.get(id=user_id)
            ItineraryTeamMember.objects.create(user=user, itinerary=self)

    def clear_team_members(self):
        """
        Removes all team members from this itinerary