Skip to content

Commit

Permalink
add filenames to req elements in reqrepo. generate the 2nd direction …
Browse files Browse the repository at this point in the history
…for the bi-directional traceability into the reqrepo for each req.
  • Loading branch information
DrMarkusVoss committed Feb 21, 2025
1 parent 4004416 commit 1a990dd
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/pumla/control/reqparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,24 @@ def updatePUMLAReqRepo(path, mrefilename):
# get put into dict.
pumlareqslist = []

derived_table = []

# sum up information from all files in common list
for f in pumlareqfiles:
reqs = parsePUMLAReqFile(f)
for r in reqs:
r.update({"derived to": "not yet derived"})
r.update({"in file": f})
if not r.get("derived from")==None:
derived_table.append({"from": r["derived from"], "to": r.get("alias")})
pumlareqslist.append(r)

# update the "derived to" attribute corresponding to the "derived from"
for e in derived_table:
for r in pumlareqslist:
if r.get("alias") == e.get("from"):
r.update({"derived to": e.get("to")})


# make it accessible from within PlantUML.
# $allreqs is the preprocessor variable that
Expand Down
4 changes: 2 additions & 2 deletions test/examples/WeatherStation/req.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
derived from:
content:
The Weather Station shall display the measured temperature so that it
is conveniently readable by every human.
is conveniently readable by a human looking at it in a distance of up to 3m.

- type: Requirement
alias: REQ_WS4
status: aligned
derived from:
content:
It shall be possible to switch the unit of the displayed temperature
between degree celsius and Fahrenheit.
between degree Celsius and Fahrenheit.

- type: Requirement
alias: REQ_WS5
Expand Down
11 changes: 6 additions & 5 deletions test/examples/WeatherStation/reqs_json_diagram.puml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@startjson
{"reqsrepopath": ".", "reqsrepofile": "./reqsrepo_json.puml", "reqs": [{"type": "Requirement", "alias": "REQ_WS1", "status": "decided", "derived from": null, "taggedvalues": [{"tag": "Vendor", "values": ["A Inc.", "C Ltd."]},
{"tag": "Variant", "values": ["SysA", "SysB"]}], "content": "This is a requirement towards my Weather Station. The Weather Station shall be able to measure the temperature.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS2", "status": "new", "derived from": null, "content": "This is another requirement. The Weather Station housing shall be blue.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS3", "status": "aligned", "derived from": null, "content": "The Weather Station shall display the measured temperature so that it is conveniently readable by every human.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS4", "status": "aligned", "derived from": null, "content": "It shall be possible to switch the unit of the displayed temperature between degree celsius and Fahrenheit.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS5", "status": "aligned", "derived from": null, "content": "The unit in which the temperature is displayed shall stay as it is even after the batteries and/or the power supply has been removed.", "derived to": "not yet derived"}]}
{"tag": "Variant", "values": ["SysA", "SysB"]}], "content": "This is a requirement towards my Weather Station. The Weather Station shall be able to measure the temperature.", "derived to": "REQ_SensorA1", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS2", "status": "new", "derived from": null, "content": "This is another requirement. The Weather Station housing shall be blue.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS3", "status": "aligned", "derived from": null, "content": "The Weather Station shall display the measured temperature so that it is conveniently readable by a human looking at it in a distance of up to 3m.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS4", "status": "aligned", "derived from": null, "content": "It shall be possible to switch the unit of the displayed temperature between degree Celsius and Fahrenheit.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS5", "status": "aligned", "derived from": null, "content": "The unit in which the temperature is displayed shall stay as it is even after the batteries and/or the power supply has been removed.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_SensorA1", "status": "aligned", "derived from": "REQ_WS1", "content": "The sensor shall be able to measure the temperature of the surrounding air in the room.", "derived to": "not yet derived", "in file": "./tempSensorA/req.yaml"}]}
@endjson


11 changes: 6 additions & 5 deletions test/examples/WeatherStation/reqsrepo_json.puml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
!$allreqs = {"reqsrepopath": ".", "reqsrepofile": "./reqsrepo_json.puml", "reqs": [{"type": "Requirement", "alias": "REQ_WS1", "status": "decided", "derived from": null, "taggedvalues": [{"tag": "Vendor", "values": ["A Inc.", "C Ltd."]},
{"tag": "Variant", "values": ["SysA", "SysB"]}], "content": "This is a requirement towards my Weather Station. The Weather Station shall be able to measure the temperature.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS2", "status": "new", "derived from": null, "content": "This is another requirement. The Weather Station housing shall be blue.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS3", "status": "aligned", "derived from": null, "content": "The Weather Station shall display the measured temperature so that it is conveniently readable by every human.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS4", "status": "aligned", "derived from": null, "content": "It shall be possible to switch the unit of the displayed temperature between degree celsius and Fahrenheit.", "derived to": "not yet derived"},
{"type": "Requirement", "alias": "REQ_WS5", "status": "aligned", "derived from": null, "content": "The unit in which the temperature is displayed shall stay as it is even after the batteries and/or the power supply has been removed.", "derived to": "not yet derived"}]}
{"tag": "Variant", "values": ["SysA", "SysB"]}], "content": "This is a requirement towards my Weather Station. The Weather Station shall be able to measure the temperature.", "derived to": "REQ_SensorA1", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS2", "status": "new", "derived from": null, "content": "This is another requirement. The Weather Station housing shall be blue.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS3", "status": "aligned", "derived from": null, "content": "The Weather Station shall display the measured temperature so that it is conveniently readable by a human looking at it in a distance of up to 3m.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS4", "status": "aligned", "derived from": null, "content": "It shall be possible to switch the unit of the displayed temperature between degree Celsius and Fahrenheit.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_WS5", "status": "aligned", "derived from": null, "content": "The unit in which the temperature is displayed shall stay as it is even after the batteries and/or the power supply has been removed.", "derived to": "not yet derived", "in file": "./req.yaml"},
{"type": "Requirement", "alias": "REQ_SensorA1", "status": "aligned", "derived from": "REQ_WS1", "content": "The sensor shall be able to measure the temperature of the surrounding air in the room.", "derived to": "not yet derived", "in file": "./tempSensorA/req.yaml"}]}

8 changes: 8 additions & 0 deletions test/examples/WeatherStation/tempSensorA/req.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#PUMLARR

- type: Requirement
alias: REQ_SensorA1
status: aligned
derived from: REQ_WS1
content:
The sensor shall be able to measure the temperature of the surrounding air in the room.

0 comments on commit 1a990dd

Please sign in to comment.