Compliance Documentation Templates
- class datarobot.models.compliance_doc_template.ComplianceDocTemplate(id, creator_id, creator_username, name, org_id=None, sections=None)
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 sectiontype
: 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 withget_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.- Attributes:
- idstr
the id of the template
- namestr
the name of the template.
- creator_idstr
the id of the user who created the template
- creator_usernamestr
username of the user who created the template
- org_idstr
the id of the organization the template belongs to
- sectionslist of dicts
the sections of the template describing the structure of the document. Section schema is described in Notes section above.
- 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_typestr or None
Type of the template. Currently supported values are “normal” and “time_series”
- Returns:
- templateComplianceDocTemplate
the default template object with
sections
attribute populated with default sections.
- Return type:
- classmethod create_from_json_file(name, path)
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:
- namestr
the name of the template. Must be unique for your user.
- pathstr
the path to find the JSON file at
- Returns:
- templateComplianceDocTemplate
the created template
- Return type:
- classmethod create(name, sections)
Create a template with the specified name and sections.
- Parameters:
- namestr
the name of the template. Must be unique for your user.
- sectionslist
list of section objects
- Returns:
- templateComplianceDocTemplate
the created template
- Return type:
- classmethod get(template_id)
Retrieve a specific template.
- Parameters:
- template_idstr
the id of the template to retrieve
- Returns:
- templateComplianceDocTemplate
the retrieved template
- Return type:
- classmethod list(name_part=None, limit=None, offset=None)
Get a paginated list of compliance documentation template objects.
- Parameters:
- name_partstr or None
Return only the templates with names matching specified string. The matching is case-insensitive.
- limitint
The number of records to return. The server will use a (possibly finite) default if not specified.
- offsetint
The number of records to skip.
- Returns:
- templateslist of ComplianceDocTemplate
the list of template objects
- Return type:
List
[ComplianceDocTemplate
]
- sections_to_json_file(path, indent=2)
Save sections of the template to a json file at the specified path
- Parameters:
- pathstr
the path to save the file to
- indentint
indentation to use in the json file.
- Return type:
None
- update(name=None, sections=None)
Update the name or sections of an existing doc template.
Note that default or non-existent templates can not be updated.
- Parameters:
- namestr, optional
the new name for the template
- sectionslist of dicts
list of sections
- Return type:
None
- delete()
Delete the compliance documentation template.
- Return type:
None