def line_to_record(self, line: object):
        """This functions takes a line object and adds it as a record to the record list.

        Args:
            line (object)
        """

        if line.name == "work_stock_amount_indicator":
            self.record_list.append(
                LineRecord(
                    record=line,
                    collection="Lines",
                    graph_name=f"{line.name}",
                    phase=self.phase_data["name"],
                    client=self.client,
                    project=self.project,
                    resample_method="mean",
                )
            )
            self.record_list.append(
                LineRecord(
                    record=line,
                    collection="Lines",
                    graph_name=f"{line.name}_units",
                    phase=self.phase_data["name"],
                    client=self.client,
                    project=self.project,
                    resample_method="mean",
                )
            )
        else:
            self.record_list.append(
                LineRecord(
                    record=line,
                    collection="Lines",
                    graph_name=f"{line.name}",
                    phase=self.phase_data["name"],
                    client=self.client,
                    project=self.project,
                )
            )
            self.record_list.append(
                LineRecord(
                    record=line,
                    collection="Lines",
                    graph_name=f"{line.name}_units",
                    phase=self.phase_data["name"],
                    client=self.client,
                    project=self.project,
                    to_be_normalized=False,
                    percentage=False,
                )
            )
Exemplo n.º 2
0
    def test_line_record(self):
        data = PointLine(pd.Series([1, 2, 3, 4, 5]))
        collection = 'Lines'
        client = 'kpn'
        graph_name = 'test'
        phase = 'lasap'
        record = LineRecord(record=data,
                            collection=collection,
                            client=client,
                            graph_name=graph_name,
                            phase=phase)

        assert record._validate(data)
        assert record._transform(data) == data
    def to_record(self, line):
        """
        Turns a TimeseriesLine into a record
        Args:
            line: TimeSeriesLine to be turned into a record

        Returns: LineRecord containing all data

        """
        if line:
            record = LineRecord(
                record=line,
                collection="Indicators",
                graph_name=f"{line.name}",
                phase="oplever",
                client=self.client,
                project=line.project,
                to_be_integrated=False,
                to_be_normalized=False,
                to_be_splitted_by_year=True,
                percentage=False,
            )
        else:
            record = None
        return record
Exemplo n.º 4
0
 def to_record(self, line, project, cluster):
     return LineRecord(
         record=line,
         collection="Indicators",
         graph_name=f"RedenNAindicator_{cluster}",
         phase="oplever",
         client=self.client,
         project=project,
         to_be_integrated=False,
         percentage=False,
         to_be_normalized=False,
     )
Exemplo n.º 5
0
 def to_record(self, project, line):
     if not self.graph_name:
         raise NotImplementedError(
             "Please use child class, graph name is derived from there.")
     return LineRecord(
         line,
         collection="Indicators",
         graph_name=self.graph_name,
         to_be_normalized=False,
         phase="oplever",
         project=project,
         client=self.client,
     )
Exemplo n.º 6
0
 def to_record(self, line):
     return LineRecord(
         record=line,
         collection="Indicators",
         graph_name=f"{line.name}",
         phase="oplever",
         client=self.client,
         project=line.project,
         to_be_integrated=False,
         to_be_normalized=False,
         to_be_splitted_by_year=True,
         percentage=False,
     )
 def to_record(self, line):
     if line:
         record = LineRecord(
             record=line,
             collection="Indicators",
             graph_name=self.indicator_name,
             phase="oplever",
             client=self.client,
             project=line.project,
             to_be_integrated=True,
             to_be_normalized=True,
             to_be_splitted_by_year=True,
             percentage=True,
         )
     else:
         record = None
     return record
 def to_record(self, line, afsluitcode):
     if line:
         record = LineRecord(
             record=line,
             collection="Indicators",
             graph_name=f"{line.name}",
             phase=afsluitcode,
             client=self.client,
             project=line.project,
             to_be_integrated=False,
             to_be_normalized=False,
             to_be_splitted_by_year=True,
             percentage=False,
         )
     else:
         record = None
     return record