Custom Facts
- set_custom_fact(self, fact_id: str, value: Any) None
Set custom fact by given id.
- Parameters:
fact_id (str) – Custom fact id.
value (any) – Value of custom fact. It can be string, integer, date. if custom fact definition attribute is_array is set to True, value can be a string or list of strings.
A way you might use me is:
>>> model_usecase.set_custom_fact(fact_id="custom_int",value=50) >>> model_usecase.set_custom_fact(fact_id="custom_string",value="test") # allowed if attribute property `is_array` is true. >>> model_usecase.set_custom_fact(fact_id="custom_string",value=["test","test2"])
- set_custom_facts(self, facts_dict: Dict[str, Any]) None
Set multiple custom facts.
- Parameters:
facts_dict (dict) – Multiple custom facts. Example: {id: value, id1: value1, …}
A way you might use me is:
>>> model_usecase.set_custom_facts({"fact_1": 2, "fact_2": "test", "fact_3":["data1","data2"]})
- get_custom_facts(self) Dict
Get all defined custom facts for model_entry_user fact type.
- Return type:
dict
A way you might use me is:
>>> model_usecase.get_custom_facts()
- get_all_facts(self) Dict
Get all facts related to asset.
- Return type:
dict
A way you might use me is:
>>> model_usecase.get_all_facts()
- get_facts_by_type(self, facts_type: str = None) Dict
Get custom facts by asset type.
- Parameters:
facts_type (str) – (Optional) Custom facts asset type.
- Return type:
dict
A way you might use me is:
>>> model_usecase.get_facts_by_type(facts_type=<type name>) >>> model_usecase.get_facts_by_type() # default to model_entry_user type
- get_custom_fact_by_id(self, fact_id: str)
Get custom fact value/s by id
- Parameters:
fact_id (str) – Custom fact id to retrieve.
A way you might use me is:
>>> model_usecase.get_custom_fact_by_id(fact_id="fact_id")
- remove_custom_fact(self, fact_id: str) None
Remove custom fact by id
- Parameters:
fact_id (str) – Custom fact id value/s to remove.
A way you might use me is:
>>> model_usecase.remove_custom_fact(fact_id=<fact_id>)
- remove_custom_facts(self, fact_ids: List[str]) None
Remove multiple custom facts ids
- Parameters:
fact_ids (list) – Custom fact ids to remove.
A way you might use me is:
>>> model_usecase.remove_custom_facts(fact_ids=["id1","id2"])