CluedIn Python SDK 2.4.0
What's Changed
Added support for CluedIn Rules:
cluedin.rules.RuleScope- an enumeration of rule scopes:DATA_PART,ENTITY,SURVIVORSHIP.cluedin.rules.get_rules(context: Context, scope=RuleScope.DATA_PART) -> dict- returns all rules for a given scope. This method returns a JSON-response serialized into adict.cluedin.rules.get_rule(context: Context, rule_id: str) -> dict- returns a rule by ID. This method returns a JSON-response serialized into adict.
Evaluator
-
cluedin.rules.evaluator.default_get_property_name(field: str) -> str- returns a default property name for a given field. Used to map CluedIn Rules fields to your fields. -
cluedin.rules.evaluator.default_get_value(field: str, obj: dict) -> Any- returns a default value for a given field. Used to map CluedIn Rules fields to your fields. -
cluedin.rules.Evaluator- a class to evaluate CluedIn Rules. -
cluedin.rules.Evaluator.evaluate(context: Context, rule: dict, obj: dict) -> bool- evaluates a rule for an object. Returns a Boolean:get_matching_objects(self, objects) -> list- returns a list of objects that match the rule.object_matches_rules(self, obj) -> bool- returnsTrueif an object matches the rule.explain(self) -> str- returns an explanation of the rule (in pandasDataFrame.queryterms).
Operators
cluedin.rules.operators.default_get_operator(operator_id) -> Any- returns a default operator for a given operator ID. Used to map CluedIn Rules operators to your operators.
You can add custom operatiors (see test_operators.py for examples), but the following CluedIn Rules operators are supported out of the box:
Is Not TrueIs TrueBegins WithBetweenContainsEnds WithEqualsExistsGreaterGreater or EqualInIs FalseIs Not NullIs NullIs TrueLessLess or EqualMatches patternNot Begins WithNot BetweenNot ContainsNot Ends WithNot EqualDoes Not ExistNot InDoes not match pattern
Full Changelog: https://github.com/romaklimenko/cluedin/compare/2.3.0...2.4.0