Requirements & Systems Portal のドキュメントエクスポートウィザードは、要件および V&V 作業から直接、編集可能な Microsoft Word ファイルを作成できます。 *.docxファイルを作成できます。定義済みのテンプレートを使用することも、独自のテンプレートをアップロードすることもできます。このウィザードは、Python-Docx-Templateライブラリによって駆動され、Jinja Templating Engineを活用しています。このダイナミックなコンビにより、カスタムテンプレートを作成することができます。
Python-Docx-Template ライブラリ
Python-Docx-Template ライブラリは Python-Docx ライブラリの機能を拡張する強力なツールです。Jinja Templating Engine を組み込み、Word ファイル内で動的なコンテンツ生成を可能にします。つまり、変数、ループ、条件式を使用して、文書にその場でデータを入力することができます。本質的には、Word文書にエスプレッソを注入するようなものです。
リッチテキストであるフィールドには r接頭辞はエクスポートテンプレートで使用する必要があります。たとえば、要件テキストフィールドは、テンプレートに r requirement.text.
エクスポート テンプレートの管理
要件とシステム ポータルのインスタンスで利用可能なテンプレートは Export templatesページ (
» Settings » Export templates).
-
デフォルトでは、要件ドキュメント エクスポート用に 3 つ、V&V アクティビティ ドキュメント エクスポート用に 3 つの合計 6 つのテンプレートが用意されています。
-
新しいユーザー定義テンプレートを追加するには、ページの右上にある
ボタンをクリックします。表示されるウィンドウで Add template表示されるウィンドウで、新しいテンプレートを以下に適用するかどうかを選択します。 Requirementsまたは V&V Activitiesを選択します。 Applicable objectsドロップダウンを使用して、新しいテンプレートを適用する必要があるかどうかを選択します。 Select template領域でテンプレート・ファイルを選択する。
ダイアログの
ボタンをクリックして、テンプレートを追加します。テンプレートは Export templatesページのリストに表示され、ドキュメントのエクスポートで使用できます。
-
テンプレートのファイルはダウンロードできます。これを行うには、 必要なテンプレートの欄の
ボタンをクリックし、必要なテンプレートを選択します。 Nameボタンをクリックし Downloadコマンドを選択します。ブラウザの設定により、あらかじめ定義された場所に自動的にダウンロードされるか、ハードドライブ上の保存場所を尋ねられます。
-
ユーザー定義のテンプレートは、新しいテンプレート・ファイルで上書きすることができます。これを行うには、必要なテンプレートの欄の
。 Nameボタンをクリックし、表示されるメニューから Overwrite Templateコマンドを選択します。表示されるメニューからコマンドを選択します。 Overwrite templateウィンドウを使用して、テンプレートの適用を定義し、新しいファイルを選択します。オプションを有効にして I confirm I want to overwriteオプションを有効にし、
ボタンをクリックして処理を完了します。
付録 - 要件エクスポート テンプレートのデータ オブジェクト構造
要件 & システム ポータルのインスタンスでは、デフォルトの要件エクスポート テンプレートが 3 つ利用可能で、各テンプ レートは前のテンプレートよりも徐々に複雑になっています。こ れ ら のテ ン プ レー ト を利用す る には、 順番に取 り 組む こ と が賢明です。以下はそのラインアップです:
-
spec_doc.docx- このテンプレートは、要件ドキュメントビューと同じ出力を生成するための、ありふれたテンプレートです。初心者に最適で、簡単なループと変数を扱います。
-
spec_table.docx- このテンプレートでは、条件式とフィルタを紹介します。ここからが本番です。これは、スクリプトベースのWordテンプレートのJinjaバージョンで、マージフィールドがあります。
-
req_verification.docx- テンプレートのグランドマスターです。ネストされたループや条件式が豊富で、テーブルまで組み込まれています。これをマスターすれば、基本的に文書テンプレートのジェダイだ。
あなたのドキュメントのニーズに合うように、自由にセクションを追加したり、削除したり、修正したりしてください。上記の順序でデフォルトのテンプレート・ファイルを一通り見た後、自分のレポートに含めることができるものの限界を試す冒険心が湧いてくるかもしれません。
以下は、 要件エ ク ス ポー ト テ キ ス ト テ ン プ レー ト が情報を取得す る オブジ ェ ク ト の基本構造です。
Requirement Export Templates – Data Object Structure
{
"specifications":[
{
"id":"number": "番号"、
"name":"string": "文字列"、
"description":string": "文字列"、
"requirements":[
{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"タイトル":"文字列"、
"rationale":"RichText"、
"images":image": ["画像"]、
"type":「文字列
"verification_methods":[{
"name":"string": "文字列"、
"text":"string": "文字列"、
"component_vms":[{
"name":"string": "文字列"、
"closeout_reference":"文字列"
}]
}],
"specification_id":number": "番号"、
group_id": "数値":「番号」、
"applicability_conditions":[文字列"]、
"content_type":{
"id":"string": "文字列"、
"name":"文字列"
},
"state":「文字列
「コンプライアンス「文字列
compliance_comment": "文字列":string": "文字列"、
「タグ":タグ": ["文字列"]、
"parents":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"children":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"owner":{
"user":{
"ユーザー名":「文字列
"first_name":string": "文字列"、
last_name": "文字列":string": "文字列"、
「グループ":[文字列]
},
"group":{
"name":"string": "文字列"、
"ユーザー":[文字列]
}
},
"files":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}],
"custom_fields":[{
"field":"string": "文字列"、
値": ["文字列"].
}],
"position":"番号"、
"verification_items_verified":「数」、
「verification_items_total": "数値"、
"verification_items":[{
"status":「文字列
"component": "コンポーネント":"string": "文字列"、
"tags":タグ": ["文字列"]、
「アクティビティ":{
"name":"string": "文字列"、
"verification_methods":[文字列]
},
"last_item_run":{
"status":"文字列"、
「コメント":"文字列"
}
}],
"linked_components":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"description":string": "文字列"、
"valis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"textvalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"text":"文字列"
}],
"matrices":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"datevalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"date":「文字列
}],
"creator":「文字列
"添付ファイル":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}]
}]
}
],
"content_type":{
"id":"number": "番号"、
"name":"文字列"
}
}
],
"requirements":[
{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"タイトル":"文字列"、
"rationale":"RichText"、
"images":image": ["画像"]、
"type":「文字列
"verification_methods":[{
"name":"string": "文字列"、
"text":"string": "文字列"、
"component_vms":[{
"name":"string": "文字列"、
"closeout_reference":"文字列"
}]
}],
"specification_id":"number": "番号"、
group_id": "数値":「番号」、
"applicability_conditions":[文字列"]、
"content_type":{
"id":"string": "文字列"、
"name":"文字列"
},
"state":「文字列
「コンプライアンス「文字列
compliance_comment": "文字列":string": "文字列"、
「タグ":タグ": ["文字列"]、
"parents":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"children":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"owner":{
"user":{
"ユーザー名":「文字列
"first_name":string": "文字列"、
last_name": "文字列":string": "文字列"、
「グループ":[文字列]
},
"group":{
"name":"string": "文字列"、
"ユーザー":[文字列]
}
},
"files":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}],
"custom_fields":[{
"field":"string": "文字列"、
値": ["文字列"].
}],
"position":"番号"、
"verification_items_verified":「数」、
「verification_items_total": "数値"、
"verification_items":[{
"status":「文字列
"component": "コンポーネント":"string": "文字列"、
"tags":タグ": ["文字列"]、
「アクティビティ":{
"name":"string": "文字列"、
"verification_methods":[文字列]
},
"last_item_run":{
"status":"文字列"、
「コメント":"文字列"
}
}],
"linked_components":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"valis":[{
"id":"number": "数字"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"textvalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"text":"文字列"
}],
"matrices":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"datevalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"date":「文字列
}],
"creator":「文字列
"添付ファイル":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}]
}]
}
],
"requirements_groups":[
{
"id":"number": "番号"、
"name":"string": "文字列"、
"description":string": "文字列"、
"specification_id":"number": "番号"、
"requirements":[
{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"タイトル":"文字列"、
"rationale":"RichText"、
"images":image": ["画像"]、
"type":「文字列
"verification_methods":[{
"name":"string": "文字列"、
"text":"string": "文字列"、
"component_vms":[{
"name":"string": "文字列"、
"closeout_reference":"文字列"
}]
}],
"specification_id":number": "番号"、
group_id": "数値":「番号」、
"applicability_conditions":[文字列"]、
"content_type":{
"id":"string": "文字列"、
"name":"文字列"
},
"state":「文字列
「コンプライアンス「文字列
compliance_comment": "文字列":string": "文字列"、
「タグ":タグ": ["文字列"]、
"parents":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"children":[{
"id":"string": "文字列"、
"identifier":"string": "文字列"、
"text":「リッチテキスト
"title":"文字列"
}],
"owner":{
"user":{
"ユーザー名":「文字列
"first_name":string": "文字列"、
last_name": "文字列":string": "文字列"、
「グループ":[文字列]
},
"group":{
"name":"string": "文字列"、
"ユーザー":[文字列]
}
},
"files":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}],
"custom_fields":[{
"field":"string": "文字列"、
値": ["文字列"].
}],
"position":"番号"、
"verification_items_verified":「数」、
「verification_items_total": "数値"、
"verification_items":[{
"status":「文字列
"component": "コンポーネント":"string": "文字列"、
"tags":タグ": ["文字列"]、
「アクティビティ":{
"name":"string": "文字列"、
"verification_methods":[文字列]
},
"last_item_run":{
"status":"文字列"、
「コメント":"文字列"
}
}],
"linked_components":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"valis":[{
"id":"number": "数字"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"textvalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"text":"文字列"
}],
"matrices":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"value":string": "文字列"、
"formula":「文字列
}],
"datevalis":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"date":「文字列
}],
"creator":「文字列
"添付ファイル":[{
"name":"string": "文字列"、
"description":"string": "文字列"、
「バージョン":「文字列"、
"is_reference":"boolean": "ブール値"、
"tags":[タグ": "string]
}]
}]
}
],
"content_type":{
"id":"number": "番号"、
"name":"文字列"
}
}
],
"timestamp":"datetime"、
「テンプレート名":「文字列
"verification_and_validation_methods":[{
"id":"number": "番号"、
"name":"string": "文字列"、
"description":"文字列"
}]
}
フィールドの並べ替え
Jinjaテンプレート・ドキュメントの Sort関数を使用して、要件を並べ替えることができます。たとえば |sort(attribute='identifier')ここで、要件は識別子列で英数字順にソートされます。
例
{% for requirement in requirements|selectattr("specification_id", "equalto", specification.id)|selectattr("group_id", "none") |sort(attribute='identifier') -%}
カスタム列
現在のドキュメントエクスポーターでは、カスタム列の値を簡単にエクスポートできます。単純なテキストベースのカスタムカラムの場合、以下のような一般的な構造を使用できます:
{% for custom_field in requirement.custom_fields|selectattr(“field”, “equalto”, “Name of Custom Column”) %}{% for value in custom_field.value %}{{ value }}{% endfor %}{% endfor %}
必ず Name of Custom Columnテキストは必ずカラムヘッダに記載されている実際のカラム名に置き換えてください。
カスタムカラムがテキストではなく、複数選択可能なオプションである場合、ユーザーは次のコードを使用し、ユースケースに合わせて更新することができます。
{%- if requirement.custom_fields -%} とします。
{追加_info_values = [] を設定します。}
{category_values = [] を設定します。}
{%- set additional_info_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', '追加情報') -%} {%- set additional_info_custom_fields = requirement.custom_fields | selectattr('field', 'equalto', '追加情報') -%}
{% 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 -%}
付録 - V&Vアクティビティ・エクスポート・テンプレートのデータ・オブジェクト構造
以下は、V&V アクティビティ・エクスポート・テンプレートが情報を取得するオブジェクトの基本構造です。
V&V Activity Export Templates – Data Object Structure
# トップレベル
{
アクティビティ[{}] # すべてのアクティビティのリスト
フォルダ[{
名前: 文字列
アクティビティ{}] # アクティビティのリスト
}]
timestamp: datetime
テンプレート名: 文字列
}
# アクティビティ
{
id: 数字
名前: 文字列
説明: 文字列
期待される結果: string
タグ:[文字列]
verification_methods: [{」で始まる。
名前: 文字列
説明: 文字列
}]
所有者:ユーザーまたはグループ
custom_fields:[] # CustomFieldsのリスト
承認: boolean
items:[VVItems のリスト
step_definitions:[ステップ定義のリスト
runs:[{}] # ActivityRunのリスト
}
# VVItem
{
id: 数字
要件識別子: 文字列
コンポーネント:{# reqs ドキュメント内のリンクコンポーネントと同じ。
id: 数字
名前: 文字列
valis:[{
id: 数字
name: 文字列
値: 文字列
式:文字列
}]
textvalis:[{
id: 数字
name: 文字列
テキスト:文字列
}]
マトリックス:[{
id: 数
name: 文字列
値: 文字列
式: 文字列
}]
datevalis:[{
id: 数字
name: 文字列
日付:文字列
}]
creator: string
添付ファイル:[{
name: 文字列
説明: 文字列
バージョン: string
is_reference: boolean
タグ:[文字列]
}]
}
コンプライアンス: 文字列
コンプライアンスコメント: 文字列
last_item_run:{}# VVItemRun
last_item_run_status: str
item_runs:{}] # VVItemRun のリスト
}
# ステップ定義
{
id: int
アクティビティID: int
ステップ番号: int
位置: float
フルステップナンバー: str
full_step_path: str
親ステップ ID: int
名前: string
説明: 文字列
期待される結果: string
タグ:[文字列]
item_ids: [] # VVItemsのidのリスト
}
# アクティビティ実行
{
id: int
name: string
説明: 文字列
タイムスタンプ: string
start_date: string # 書式は reqs ドキュメントのエクスポートと同じ。
終了日: string
完了状態: int
completed_on: string
completed_by:ユーザー
activity_id: int
default_run: bool
位置: float
steps_synced:ブール
期待される結果: string
evidence: string # ファイル/ドキュメント名
custom_fields:[] # CustomFieldsのリスト
タグのリスト[文字列]
run_executor:{}# ユーザーまたはグループ
承認者{}# ユーザーまたはグループ
approved: boolean
approved_by:ユーザー
approved_at: 文字列
item_runs:[] # VVItemRuns のリスト
step_runs:[{}] # VVStepRunsのリスト
}
# VVItemRun
{
id: int
status: string
verified_by:ユーザー
activity_run_id: int
ステータス"status-display-name"
コメント: 文字列
シリアル番号: string
step_run_id: int # ステップラン
verification_item:{} # 検証項目# 検証項目
verification_item_requirement_identifier: 文字列
verification_item_component_name: 文字列
}
# ステップ実行
{
id: int
name: string
コメント: 文字列
ステータス: string
説明: 文字列
activity_run_id: int
フルステップナンバー: str
ステップ番号: int
位置: float
full_step_run_path: str
parent_step_run_id: int
期待される結果: string
タグ[文字列]
item_run_ids: [] # VVItemRun の ID のリスト
item_requirement_identifiers: str
}