Callable ======== A **Callable** is the base class representing a function available in a Pipeline. Definition ---------- Constructor ^^^^^^^^^^^ .. py:class:: controller.callable.Callable(self, type: CallableType, id: str, params: CallableParameters) The base abstract class representing a function available for execution in a Pipeline. :param type: The type of this Callable. :type type: CallableType :param id: The unique identifier of this Callable. Also referred to as ``callable_id`` in documentations for specific Callables. :type id: str :param params: The parameters of this Callable. Refer to the documentation for a specific Callable for details. :type params: CallableParameters Methods ^^^^^^^ .. py:method:: controller.callable.Callable.check_params(self, params: CallableParameters) -> boolean :abstractmethod: Function parameters validation logic. This function should contain code that ensures all passed parameters are valid values. Overriden by subclasses to implement the actual parameter validation logic. .. py:method:: controller.callable.Callable.exec(self, data: pd.DataFrame, **kwargs) -> pd.DataFrame :abstractmethod: Function call logic. This function should contain the actual execution logic that will result in some transformed data. Overriden by subclasses to implement the actual execution logic. :param data: Known as the **target DataFrame**, which contains data to be transformed. All operations in the callable implementation are done on this DataFrame. This is injected at runtime and is not exposed during Callable instantiation. :type data: pd.DataFrame :param kwargs: Additional keyword arguments that may be passed to the Callable. This is injected at runtime as well using entries in the instance variable ``params``. :return: Known as the **output DataFrame**, which is the result of the execution. Usage ^^^^^ To implement new Callables, refer to the documentation for specific Callable types listed below. Output conventions ^^^^^^^^^^^^^^^^^^ The output of a Callable is the **return value** of its ``exec()`` method. All Callables **must** return a DataFrame, known as the **output DataFrame**, that contains all data required for subsequent Callables to use. - The DataFrame is **headered** (i.e. columns are named). - The column name must start with the ``id`` followed by a period. That is, the column name must start with ``.`` - Further restrictions on column names may be specified in individual Callables. Consult their documentations for more information. - The DataFrame is **single-indexed**. The pipeline runner does **not** support aggregation of other types of DataFrames, such as multi-index DataFrames. - It is up to individual Callables to specify how multi-level DataFrames returned from functions are flattened such that the output DataFrame is single-indexed. Types of Callables ------------------ Callables are separated into different types. Each type specifies the nature of what operations a Callable is responsible for and governs the format of output DataFrame of that Callable. .. toctree:: :maxdepth: 1 Types/Extractor Types/Transformer Types/Outputter List of Callables ----------------- .. note:: Callable instances are not supposed to be instantiated using the constructor, but rather through methods provided in the Pipeline API. As a result, the Definition section for a specific Callable does **not** document the constructor or the internal implementation. Rather, it describes the parameters that are required to configure the Callable when it is instantiated. The signature in the documentation may be considered to have unpacked the ``CallableParameters`` object into keyword parameters. This is intentional since the generic ``CallableParameters`` object (inherited from the base Callable class) is only unpacked and passed to the ``exec`` method when the Callable is executed. In short, you may refer to both the Definition and Parameters sections, when instantiating a Callable via the Pipeline API. Do **not** treat the documentation to be describing the Callable constructor. Extractors ^^^^^^^^^^ .. toctree:: :maxdepth: 1 Implementations/Extractors/Query Transformers ^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 Implementations/Transformers/Aggregate Implementations/Transformers/Filter Implementations/Transformers/Max Implementations/Transformers/Mean Implementations/Transformers/Median Implementations/Transformers/Min Implementations/Transformers/PivotTable Implementations/Transformers/Quantile Implementations/Transformers/StandardDeviation Implementations/Transformers/TTest Outputters ^^^^^^^^^^ .. toctree:: :maxdepth: 1 Implementations/Outputters/BarChart Implementations/Outputters/CorrelationPlot Implementations/Outputters/CSV Implementations/Outputters/Histogram Implementations/Outputters/LineChart Implementations/Outputters/PieChart Implementations/Outputters/RegressionPlot Implementations/Outputters/ScatterPlot Other Callable objects ---------------------- .. toctree:: :maxdepth: 1 Implementations/OtherObjects/AggregationFunction Implementations/OtherObjects/ColumnReference Implementations/OtherObjects/FilterCondition Implementations/OtherObjects/QueryCondition