Attachments

set_attachment_fact(self, file_to_upload, description: str, fact_id: str, html_rendering_hint: str = None) None

Set attachment fact for given model use case. Supported for CPD version >=4.6.5

Parameters:
  • file_to_upload (str) – Attachment file path to upload

  • description (str) – Description about the attachment file

  • fact_id (str) – Fact id for the attachment

  • html_rendering_hint (str) – (Optional) html rendering hint. Available options are in RenderingHints

A way to use me is:

>>> model_usecase.set_attachment_fact(file_to_upload="./artifacts/image.png",description=<file description>,fact_id=<custom fact id>)
>>> model_usecase.set_attachment_fact(file_to_upload="./artifacts/image.png",description=<file description>,fact_id=<custom fact id>,html_rendering_hint=<render hint>)
set_cell_attachment_fact(self, description: str, fact_id: str) None

Set attachment fact using captured cell output. Supported for CPD version >=4.6.5.

Parameters:
  • description (str) – Description about the cell facts attachment file

  • fact_id (str) – Fact id for the attachment

A way to use me is:

>>> model_usecase.set_cell_attachment_fact(description=<file description>,fact_id=<custom fact id>)
has_attachment(self, fact_id: str = None) bool

Check if attachment/s exist. Supported for CPD version >=4.6.5

Parameters:

fact_id (str, optional) – Id of attachment fact

Return type:

bool

The way to use me is :

>>> model_usecase.has_attachment()
>>> model_usecase.has_attachment(fact_id=<fact id>)
list_attachments(self, filter_by_factid: str = None, format: str = 'dict')

List available attachments facts. Supported for CPD version >=4.6.5

Parameters:
  • filter_by_factid (str) – (Optional) Fact id for the attachment to filter by

  • format (str) – Result output format (dict or str). Default to dict.

A way to use me is:

>>> model_usecase.list_attachments(format="str") # use this format if using output for `set_custom_fact()`
>>> model_usecase.list_attachments() # get all attachment facts
>>> model_usecase.list_attachments(filter_by_factid=<"fact_id_1">) # filter by associated fact_id_1
remove_attachment(self, fact_id: str)

Remove available attachments facts for given id. Supported for CPD version >=4.6.5

Parameters:

fact_id (str) – Fact id of the attachment

A way to use me is:

>>> model_usecase.remove_attachment(fact_id=<fact id of attachment>)
remove_all_attachments(self)

Remove all attachments facts for given asset. Supported for CPD version >=4.6.5

A way to use me is:

>>> model_usecase.remove_all_attachments()