Requirements & Systems Portal's Document Export wizard is your go-to for whipping up editable Microsoft Word *.docx files straight from your requirements and V&V activities. You can use predefined templates or upload your own templates. The wizard is fueled by the Python-Docx-Template library, which, in turn, leverages the Jinja Templating Engine. This dynamic duo allows you to craft custom templates.
*.docx
The Python-Docx-Template library is a powerful tool that extends the functionality of the Python-Docx library. It incorporates the Jinja Templating Engine, enabling dynamic content generation within your Word files. This means you can use variables, loops, and conditionals to populate your document with data on the fly. Essentially, it's like giving your Word doc a shot of espresso.
Templates available to your Requirements & Systems Portal instance are listed on the Export templates page ( » Settings » Export templates).
By default, six templates are provided – three for the requirement document export and three for the V&V activity document export.
For more information about requirements export templates, refer to the Document Export page.
For more information about V&V activities export templates, refer to the Document Export page.
To add a new user-defined template, click the button at the top right of the page. In the Add template window that appears, choose if the new template needs to be applied to Requirements or V&V Activities using the Applicable objects drop-down and then use the Select template region to select the template file.
Click the button in the dialog to add the template. It will be shown in the list on the Export templates page and can then be used in document export.
The file of any template can be downloaded. To do this, click the button in the Name column of the required template and select the Download command. According to your personal browser settings, your browser will either automatically download the file to a predefined location or ask you where to store it on your hard drive.
A user-defined template can be overwritten with a new template file. To do this, click the button in the Name column of the required template and select the Overwrite Template command from the menu that appears. Use the Overwrite template window that opens to define the template applicability and select the new file. Enable the I confirm I want to overwrite option and click the button to complete the process.
Three default requirement export templates are available in a Requirements & Systems Portal instance, each progressively more complex than the last. So, if you're looking to up your template game, tackling them in sequence is a smart move. Here's the lineup:
spec_doc.docx – this one is your straightforward, run-of-the-mill template meant to produce an identical output to the requirements Document View. It's excellent for beginners and covers simple loops and variables.
spec_table.docx – stepping it up a notch, this template introduces conditionals and filters. It's where things start to get spicy. It’s the Jinja version of our script-based Word template with merge fields.
req_verification.docx – the grandmaster of our templates. This one's rich in nested loops and conditionals, and it even incorporates tables. If you can master this, you're basically a Jedi of document templating.
Feel free to add, remove, or modify sections to fit your documentation needs better. After going through the default template files in the order given above, you might feel adventurous enough to test the limits of what you can include in your reports.
Here’s the basic structure of the object from which your requirement export templates will pull information from.
{ "specifications": [ { "id": "number", "name": "string", "description": "string", "requirements": [ { "id": "string", "identifier": "string", "text": "RichText", "title": "string", "rationale": "RichText", "images": ["image"], "type": "string", "verification_methods": [{ "name": "string", "text": "string", "component_vms": [{ "name": "string", "closeout_reference": "string" }] }], "specification_id": "number", "group_id": "number", "applicability_conditions": ["string"], "content_type": { "id": "string", "name": "string" }, "state": "string", "compliance": "string", "compliance_comment": "string", "tags": ["string"], "parents": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "children": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "owner": { "user": { "username": "string", "first_name": "string", "last_name": "string", "groups": ["string"] }, "group": { "name": "string", "users": ["string"] } }, "files": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }], "custom_fields": [{ "field": "string", "value": ["string"] }], "position": "number", "verification_items_verified": "number", "verification_items_total": "number", "verification_items": [{ "status": "string", "component": "string", "tags": ["string"], "activity": { "name": "string", "verification_methods": ["string"] }, "last_item_run": { "status": "string", "comment": "string" } }], "linked_components": [{ "id": "number", "name": "string", "description": "string", "valis": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "textvalis": [{ "id": "number", "name": "string", "text": "string" }], "matrices": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "datevalis": [{ "id": "number", "name": "string", "date": "string" }], "creator": "string", "attachments": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }] }] } ], "content_type": { "id": "number", "name": "string" } } ], "requirements": [ { "id": "string", "identifier": "string", "text": "RichText", "title": "string", "rationale": "RichText", "images": ["image"], "type": "string", "verification_methods": [{ "name": "string", "text": "string", "component_vms": [{ "name": "string", "closeout_reference": "string" }] }], "specification_id": "number", "group_id": "number", "applicability_conditions": ["string"], "content_type": { "id": "string", "name": "string" }, "state": "string", "compliance": "string", "compliance_comment": "string", "tags": ["string"], "parents": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "children": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "owner": { "user": { "username": "string", "first_name": "string", "last_name": "string", "groups": ["string"] }, "group": { "name": "string", "users": ["string"] } }, "files": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }], "custom_fields": [{ "field": "string", "value": ["string"] }], "position": "number", "verification_items_verified": "number", "verification_items_total": "number", "verification_items": [{ "status": "string", "component": "string", "tags": ["string"], "activity": { "name": "string", "verification_methods": ["string"] }, "last_item_run": { "status": "string", "comment": "string" } }], "linked_components": [{ "id": "number", "name": "string", "valis": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "textvalis": [{ "id": "number", "name": "string", "text": "string" }], "matrices": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "datevalis": [{ "id": "number", "name": "string", "date": "string" }], "creator": "string", "attachments": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }] }] } ], "requirements_groups": [ { "id": "number", "name": "string", "description": "string", "specification_id": "number", "requirements": [ { "id": "string", "identifier": "string", "text": "RichText", "title": "string", "rationale": "RichText", "images": ["image"], "type": "string", "verification_methods": [{ "name": "string", "text": "string", "component_vms": [{ "name": "string", "closeout_reference": "string" }] }], "specification_id": "number", "group_id": "number", "applicability_conditions": ["string"], "content_type": { "id": "string", "name": "string" }, "state": "string", "compliance": "string", "compliance_comment": "string", "tags": ["string"], "parents": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "children": [{ "id": "string", "identifier": "string", "text": "RichText", "title": "string" }], "owner": { "user": { "username": "string", "first_name": "string", "last_name": "string", "groups": ["string"] }, "group": { "name": "string", "users": ["string"] } }, "files": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }], "custom_fields": [{ "field": "string", "value": ["string"] }], "position": "number", "verification_items_verified": "number", "verification_items_total": "number", "verification_items": [{ "status": "string", "component": "string", "tags": ["string"], "activity": { "name": "string", "verification_methods": ["string"] }, "last_item_run": { "status": "string", "comment": "string" } }], "linked_components": [{ "id": "number", "name": "string", "valis": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "textvalis": [{ "id": "number", "name": "string", "text": "string" }], "matrices": [{ "id": "number", "name": "string", "value": "string", "formula": "string" }], "datevalis": [{ "id": "number", "name": "string", "date": "string" }], "creator": "string", "attachments": [{ "name": "string", "description": "string", "version": "string", "is_reference": "boolean", "tags": ["string"] }] }] } ], "content_type": { "id": "number", "name": "string" } } ], "timestamp": "datetime", "template_name": "string" }
You can sort the requirements using the Sort function on the Jinja template document. For example, you can add |sort(attribute='identifier') where the requirements are sorted alphanumerically on the identifier column.
|sort(attribute='identifier')
Example:
{% for requirement in requirements|selectattr("specification_id", "equalto", specification.id)|selectattr("group_id", "none") |sort(attribute='identifier') -%}
With the current document exporter, you can export the custom column values easily. For a simple text based custom column, you can use the following generic structure:
{% for custom_field in requirement.custom_fields|selectattr(“field”, “equalto”, “Name of Custom Column”) %}{% for value in custom_field.value %}{{ value }}{% endfor %}{% endfor %}
Be sure to substitute the Name of Custom Column text with the actual name of the column indicated on the column header.
Name of Custom Column
If the custom column is not a text and is a multi-selection option, the user can use the following code and update it for their use case.
{%- if requirement.custom_fields -%} {%- set additional_info_values = [] -%} {%- set category_values = [] -%} {%- set additional_info_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', 'Additional Information') -%} {% for custom_field in additional_info_custom_fields -%} {%- set additional_info_values = additional_info_values + custom_field.value -%} {% endfor -%} {%- set category_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', 'Category') -%} {% for custom_field in category_custom_fields -%} {%- set category_values = category_values + custom_field.value -%} {% endfor -%} {%- set additional_info_string = additional_info_values | join(';') -%} {%- set category_string = category_info_values | join(';') -%} {%- endif -%}
Here’s the basic structure of the object from which your V&V activities export templates will pull information from.
# TOP LEVEL { activities: [{}] # List of all Activities folders: [{ name: string activities: [{}] # List of Activities }] timestamp: datetime template_name: string } # Activity { id: number name: string description: string expected_results: string tags: [string] verification_methods: [{ name: string description: string }] owner: User or Group custom_fields: [] # List of CustomFields approvals: boolean items: [{}] # List of VVItems step_definitions: [{}] # List of StepDefinitions runs: [{}] # List of ActivityRuns } # VVItem { id: number requirement_identifier: string component: { # Same as linked components in the reqs doc export id: number name: string valis: [{ id: number name: string value: string formula: string }] textvalis: [{ id: number name: string text: string }] matrices: [{ id: number name: string value: string formula: string }] datevalis: [{ id: number name: string date: string }] creator: string attachments: [{ name: string description: string version: string is_reference: boolean tags: [string] }] } compliance: string compliance_comment: string last_item_run: {} # VVItemRun last_item_run_status: str item_runs: [{}] # List of VVItemRuns } # StepDefinition { id: int activity_id: int step_number: int position: float full_step_number: str full_step_path: str parent_step_id: int name: string description: string expected_results: string tags: [string] item_ids: [] # List of VVItems ids } # ActivityRun { id: int name: string description: string timestamp: string start_date: string # Format use same as in reqs doc export finish_date: string completion_state: int completed_on: string completed_by: User activity_id: int default_run: bool position: float steps_synced: bool expected_results: string evidence: string # File/Doc name custom_fields: [] # List of CustomFields tags: [string] run_executor: {} # User or Group approver: {} # User or Group approved: boolean approved_by: User approved_at: string item_runs: [] # List of VVItemRuns step_runs: [{}] # List of VVStepRuns } # VVItemRun { id: int status: string verified_by: User activity_run_id: int status: "status-display-name" comment: string serial_number: string step_run_id: int # StepRun verification_item:{} # VVItem verification_item_requirement_identifier: string verification_item_component_name: string } # StepRun { id: int name: string comment: string status: string description: string activity_run_id: int full_step_number: str step_number: int position: float full_step_run_path: str parent_step_run_id: int expected_results: string tags: [string] item_run_ids: [] # List of VVItemRun ids item_requirement_identifiers: str }