Beispiel #1
0
    def perform(self):
        """
        Main perform to do all necessary calculations for indicator.

        Returns: List of Records with lines per project and client_line for overall planning.

        """
        df = self.aggregate(
            df=self.apply_business_rules(),
            by=["project", "hasdatum"],
            agg_function="size",
        )

        line_list = []
        record_list = RecordList()
        if not df.empty:
            for project, df in df.groupby(level=0):
                if len(df):
                    line_project = self._make_project_line(project=project,
                                                           df=df)
                    record_list.append(self.to_record(line_project))
                    line_list.append(line_project)

            line_client = concat(line_list,
                                 name=self.indicator_name,
                                 project="client_aggregate")
            record_list.append(self.to_record(line_client))

        return record_list
    def perform(self):
        """
        Main perform to do all necessary calculations for indicator.

        Returns: List of Records with line per project.

        """
        df = self.apply_business_rules()

        line_list = []
        record_list = RecordList()
        if not df.empty:
            for project, df in df.groupby(level=0):
                if len(df):
                    line_project = self._make_project_line(project=project,
                                                           df=df)
                    line_list.append(line_project)
                    record_list.append(self.to_record(line_project))

            line_client = concat(line_list,
                                 name=self.indicator_name,
                                 project="client_aggregate")
            record_list.append(self.to_record(line_client))

        return record_list
Beispiel #3
0
    def perform(self):
        """Adds for each project a record to the record_list that contains the line made at _make_project_line.

        Returns:
            List of records which are ready for sending to the firestore.
        """
        line_list = []
        record_list = RecordList()
        for project in self.project_info:
            line_project = self._make_project_line(project)
            if line_project:
                line_list.append(line_project)
                record_list.append(self.to_record(line_project))
        if line_list:
            line_client = concat(line_list,
                                 name=self.indicator_name,
                                 project="client_aggregate")
            line_list.append(line_client)
            record_list.append(self.to_record(line_client))
        return record_list
    def perform(self):
        """
        Main perform to do all necessary calculations for indicator.

        Returns: List of Records with lines per project.

        """
        df = self.aggregate(df=self.apply_business_rules())

        line_list = []
        record_list = RecordList()
        if not df.empty:
            for project, timeseries in df.groupby(level=0):
                if len(timeseries):
                    if self.type_total_amount:
                        max_value = self.project_info[project][self.type_total_amount]
                    else:
                        max_value = None
                    line_project = TimeseriesLine(
                        data=timeseries.droplevel(0),
                        name=self.indicator_name,
                        max_value=max_value,
                        project=project,
                    )
                    line_list.append(line_project)
                    record_list.append(self.to_record(line_project))

            line_client = concat(
                line_list, name=self.indicator_name, project="client_aggregate"
            )
            line_list.append(line_client)
            record_list.append(self.to_record(line_client))

        if self.return_lines:
            return line_list
        else:
            return record_list