Compliance documentation templates

class datarobot.models.compliance_doc_template.ComplianceDocTemplate

A compliance documentation template. Templates are used to customize contents of AutomatedDocument.

Added in version v2.14.

Notes

Each section dictionary has the following schema:

  • title : title of the section

  • type : type of section. Must be one of “datarobot”, “user” or “table_of_contents”.

Each type of section has a different set of attributes described bellow.

Section of type "datarobot" represent a section owned by DataRobot. DataRobot sections have the following additional attributes:

  • content_id : The identifier of the content in this section. You can get the default template with get_default for a complete list of possible DataRobot section content ids.

  • sections : list of sub-section dicts nested under the parent section.

Section of type "user" represent a section with user-defined content. Those sections may contain text generated by user and have the following additional fields:

  • regularText : regular text of the section, optionally separated by \n to split paragraphs.

  • highlightedText : highlighted text of the section, optionally separated by \n to split paragraphs.

  • sections : list of sub-section dicts nested under the parent section.

Section of type "table_of_contents" represent a table of contents and has no additional attributes.

Variables:
  • id (str) – The ID of the template.

  • name (str) – The name of the template.

  • creator_id (str) – The ID of the user who created the template.

  • creator_username (str) – The username of the user who created the template.

  • org_id (str) – The ID of the organization the template belongs to.

  • sections (list of dicts) – The sections of the template describing the structure of the document. The section schema is described in Notes section, above.

  • project_type (ComplianceDocTemplateProjectType) – The project type of the template.

classmethod get_default(template_type=None)

Get a default DataRobot template. This template is used for generating compliance documentation when no template is specified.

Parameters:

template_type (str or None) – Type of the template. Currently supported values are “normal” and “time_series”

Returns:

template – the default template object with sections attribute populated with default sections.

Return type:

ComplianceDocTemplate

classmethod create_from_json_file(name, path, project_type=None)

Create a template with the specified name and sections in a JSON file.

This is useful when working with sections in a JSON file. Example:

default_template = ComplianceDocTemplate.get_default()
default_template.sections_to_json_file('path/to/example.json')
# ... edit example.json in your editor
my_template = ComplianceDocTemplate.create_from_json_file(
    name='my template',
    path='path/to/example.json'
)
Parameters:
  • name (str) – the name of the template, which must be unique.

  • path (str) – the path to find the JSON file at

  • project_type (ComplianceDocTemplateProjectType) – The project type of the template.

Returns:

template – The created template.

Return type:

ComplianceDocTemplate

classmethod create(name, sections, project_type=None)

Create a template with the specified name and sections.

Parameters:
  • name (str) – The name of the template, which must be unique.

  • sections (list) – List of section objects

  • project_type (ComplianceDocTemplateProjectType) – The project type of the template.

Returns:

template – The created template.

Return type:

ComplianceDocTemplate

classmethod get(template_id)

Retrieve a specific template.

Parameters:

template_id (str) – the id of the template to retrieve

Returns:

template – the retrieved template

Return type:

ComplianceDocTemplate

classmethod list(name_part=None, limit=None, offset=None, project_type=None)

Get a paginated list of compliance documentation template objects.

Parameters:
  • name_part (str or None) – Return only the templates with names matching specified string. The matching is case-insensitive.

  • limit (int) – The number of records to return. The server will use a (possibly finite) default if not specified.

  • offset (int) – The number of records to skip.

  • project_type (ComplianceDocTemplateProjectType) – The project type of the template.

Returns:

templates – The list of template objects.

Return type:

list of ComplianceDocTemplate

sections_to_json_file(path, indent=2)

Save sections of the template to a json file at the specified path

Parameters:
  • path (str) – the path to save the file to

  • indent (int) – indentation to use in the json file.

Return type:

None

update(name=None, sections=None, project_type=None)

Update the name or sections of an existing doc template.

Note that default or non-existent templates can not be updated.

Parameters:
  • name (Optional[str]) – the new name for the template

  • sections (list of dicts) – The list of sections within the template.

  • project_type (ComplianceDocTemplateProjectType) – The project type of the template

Return type:

None

delete()

Delete the compliance documentation template.

Return type:

None

class datarobot.enums.ComplianceDocTemplateProjectType

The project type supported by the template.

class datarobot.enums.ComplianceDocTemplateType

The type of default template and sections to create a template.

classmethod to_project_type(template_type)

Map from template type to project type supported by the template.

Return type:

Optional[ComplianceDocTemplateProjectType]