watchful.enricher module
This script provides the abstract Enricher class interface to be
inherited in your custom enricher class, where you can then implement your
custom data enrichment functions and models within enrich_row(). Refer to
https://github.com/Watchfulio/watchful-py/blob/main/examples/enrichment_intro.ipynb
for a tutorial on how to implement your custom enricher class.
- class watchful.enricher.Enricher[source]
Bases:
objectThis is the abstract class that customized enricher classes should inherit, and then implement the abstract methods
__init__()andenrich_row().- abstract enrich_row(row: Dict[str | None, str | None]) List[List[Tuple[List[Tuple[int]] | Dict[str, List[str]] | str | None]]][source]
In this method, we use our variables from
self.enrichment_argsinitialized in__init__()to enrich our data, row by row. The return value is our enriched row. Thisenrich_row()method needs to be implemented in your enricher class.- Parameters:
row (Dict[Optional[str], Optional[str]]) – A dictionary containing string keys as the column names and string values as the cell values, one for each cell of the row; the rows are read using
csv.readeron a csv file representing the dataset.- Returns:
A list of
attributes.EnrichedCellcontaining the attributes for each cell, for the entire row.- Return type:
List[attributes.EnrichedCell]