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.
Python-Docx-Template Library
Copy Link
Copied
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.
Managing Export Templates
Copy Link
Copied
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.
Appendix – Data Object Structure of Requirement Export Templates
Copy Link
Copied
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.
Requirement Export Templates – Data Object Structure
Copy Link
Copied
006
"description": "string",
010
"identifier": "string",
013
"rationale": "RichText",
016
"verification_methods": [{
021
"closeout_reference": "string"
024
"specification_id": "number",
025
"group_id": "number",
026
"applicability_conditions": ["string"],
032
"compliance": "string",
033
"compliance_comment": "string",
037
"identifier": "string",
043
"identifier": "string",
049
"username": "string",
050
"first_name": "string",
051
"last_name": "string",
061
"description": "string",
063
"is_reference": "boolean",
070
"position": "number",
071
"verification_items_verified": "number",
072
"verification_items_total": "number",
073
"verification_items": [{
075
"component": "string",
079
"verification_methods": ["string"]
086
"linked_components": [{
089
"description": "string",
115
"description": "string",
117
"is_reference": "boolean",
132
"identifier": "string",
135
"rationale": "RichText",
138
"verification_methods": [{
143
"closeout_reference": "string"
146
"specification_id": "number",
147
"group_id": "number",
148
"applicability_conditions": ["string"],
154
"compliance": "string",
155
"compliance_comment": "string",
159
"identifier": "string",
165
"identifier": "string",
171
"username": "string",
172
"first_name": "string",
173
"last_name": "string",
183
"description": "string",
185
"is_reference": "boolean",
192
"position": "number",
193
"verification_items_verified": "number",
194
"verification_items_total": "number",
195
"verification_items": [{
197
"component": "string",
201
"verification_methods": ["string"]
208
"linked_components": [{
236
"description": "string",
238
"is_reference": "boolean",
244
"requirements_groups": [
248
"description": "string",
249
"specification_id": "number",
253
"identifier": "string",
256
"rationale": "RichText",
259
"verification_methods": [{
264
"closeout_reference": "string"
267
"specification_id": "number",
268
"group_id": "number",
269
"applicability_conditions": ["string"],
275
"compliance": "string",
276
"compliance_comment": "string",
280
"identifier": "string",
286
"identifier": "string",
292
"username": "string",
293
"first_name": "string",
294
"last_name": "string",
304
"description": "string",
306
"is_reference": "boolean",
313
"position": "number",
314
"verification_items_verified": "number",
315
"verification_items_total": "number",
316
"verification_items": [{
318
"component": "string",
322
"verification_methods": ["string"]
329
"linked_components": [{
357
"description": "string",
359
"is_reference": "boolean",
371
"timestamp": "datetime",
372
"template_name": "string"
Sorting of the Fields
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.
Example:
{% for requirement in requirements|selectattr("specification_id", "equalto", specification.id)|selectattr("group_id", "none") |sort(attribute='identifier') -%}
Custom Columns
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.
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.
01
{%- if requirement.custom_fields -%}
02
{%- set additional_info_values = [] -%}
03
{%- set category_values = [] -%}
04
{%- set additional_info_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', 'Additional Information') -%}
05
{% for custom_field in additional_info_custom_fields -%}
06
{%- set additional_info_values = additional_info_values + custom_field.value -%}
08
{%- set category_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', 'Category') -%}
09
{% for custom_field in category_custom_fields -%}
10
{%- set category_values = category_values + custom_field.value -%}
12
{%- set additional_info_string = additional_info_values | join(';') -%}
13
{%- set category_string = category_info_values | join(';') -%}
Appendix – Data Object Structure of V&V Activity Export Templates
Copy Link
Copied
Here’s the basic structure of the object from which your V&V activities export templates will pull information from.
V&V Activity Export Templates – Data Object Structure
Copy Link
Copied
003
activities: [{}] # List of all Activities
006
activities: [{}] # List of Activities
009
template_name: string
016
expected_results: string
018
verification_methods: [{
023
custom_fields: [] # List of CustomFields
025
items: [{}] # List of VVItems
026
step_definitions: [{}] # List of StepDefinitions
027
runs: [{}] # List of ActivityRuns
032
requirement_identifier: string
033
component: { # Same as linked components in the reqs doc export
063
is_reference: boolean
068
compliance_comment: string
069
last_item_run: {} # VVItemRun
070
last_item_run_status: str
071
item_runs: [{}] # List of VVItemRuns
079
full_step_number: str
084
expected_results: string
086
item_ids: [] # List of VVItems ids
094
start_date: string # Format use same as in reqs doc export
096
completion_state: int
103
expected_results: string
104
evidence: string # File/Doc name
105
custom_fields: [] # List of CustomFields
107
run_executor: {} # User or Group
108
approver: {} # User or Group
112
item_runs: [] # List of VVItemRuns
113
step_runs: [{}] # List of VVStepRuns
121
status: "status-display-name"
123
serial_number: string
124
step_run_id: int # StepRun
125
verification_item:{} # VVItem
126
verification_item_requirement_identifier: string
127
verification_item_component_name: string
137
full_step_number: str
140
full_step_run_path: str
141
parent_step_run_id: int
142
expected_results: string
144
item_run_ids: [] # List of VVItemRun ids
145
item_requirement_identifiers: str