Importing ReqIF file via xlsx2reqif python code conversion

Hello,

I have an issue with converting a .xlsx file to .reqif.

I would like to import requirements into Capella using the Requirements VP (I have installed what I believe are the necessary add-ons and checked the required settings to display requirements on my screen). Skipping details, I believe I have identified everything needed to make it work. The requirements come from a basic Excel file, an example of which I have attached, that I convert to .reqif using a Python script found on the following GitLab repository “xlsx2reqif” : ebroecker/pyreqif: should be a python implementation of reqif-format (import/export) (github.com).

Once converted, despite the messages appearing on the console (see image below), I obtain my .reqif file (also attached) which includes an XML structure that seems correct.

I then import this file into one of my Capella architectures, the “Model Update” window opens, my file appears in bold red, but I do not see my textual requirements (screenshot below).

It should be noted that the number of “R” entries without text corresponds to the number of requirements in my Excel table, so the ReqIF conversion partly worked.

I have gone through all the exchanges and forums I could find, with little improvement, and I am now wondering if this is related to the add-ons downloaded on Capella, the Python conversion code (which formats into XML but perhaps not in the expected Capella format), or my original Excel file: does the Excel file need a specific format? Should certain characters be avoided?

I am particularly stuck, and any help would be appreciated. The next step is to explore what can be done with Python4Capella, but I still want to succeed in maintaining the initial method.

Thank you in advance.

AP
reqif_testfile.xlsx (11.5 KB)
reqif_testfile.reqif (34.5 KB)
pyreqif_test.zip (366.2 KB)

1 Like

Hi,
import of requirements needs to stick to some guidelines.

It is better to comply with standard ReqIF naming convention.

I recommend to use at least the following columns in the excel file:

  • reqIfId: a UUID field providing a fixed reference to the requirement. It allows to manage import of an updated reqif avoiding duplication of requirements. Instead Capella diff/merge capability will allow to update modified fields only
  • IE PUID: the human readable unique identifier
  • ReqIf.Description: requirement title
  • ReqIf.Text: requirement text

If you need additional custom fields, then you have to define them in the types folder in your Capella system engineering perspective, (e.g. Operational Analysis or System Analysis), like

image

Last but not least, you must tell Capella requirement importer to manage custom attributes. You need to create a text named, e.g. CustomAttributes.properties, similar to the following:

ReqType:true
Verification\ Method:true
Remark:true
Assignment:true
Mission\ Assignment:true
Verification\ Stage: true
GS\ Verification\ Level: true
SS\ Verification\ Level: true
Parent: true
Family: true
Risk\ ID: true
SO: true
Type: true

setting true for the custom attribute you want to import.
Finally, you need to enable the customized import file in the preferences.

Finally, let me recommend you a good practice for requirement management. You should put requirement pertaining to different levels of the system decomposition in distinct requirement modules and properly trace requirements from one level to the upper one (both tracing directions would be optimal, though).

Hope that it helps

2 Likes

Hi pge62,

Thank you so much for your response; it has been incredibly helpful.

I can now see my requirements displayed, but they are shown as “values” rather than as the requirement types and my requirements are still displaying “…”.
image

I have another question regarding good practices. I agree that it is crucial to properly trace requirements. Is there a way to organize requirements, sub-requirements, and sub-sub-requirements hierarchically, such as by using folders or another method, instead of displaying them as “Levels” as shown in the screenshot?

Here is an example of what I mean. (I dit it on PowerPoint).

image

Thank you very much,
AP

Hi @anto761,

When you refer to organise requirements, I will assume you are referring to the same level, for example Operational Analysis.

You can use requirements pkg (aka package) to organise requirements.

On the other hand, if you are importing requirements in ReqIF format the levelling should match the same headings in the source ReqIF file. If after the import you don’t have levels, I assume you don’t have them in the source file (before ReqIF import), hence, you need to consider what is the source for your textual requirements: external to Capella, or defined in the model? I would go for the first, if you are importing ReqIF to your model.

I will leave you with two references, if you wish to read more about:

I hope that helps,
HĂ©lder Castro

Hi,
if you want to correctly view requirements you have to follow the recommendations related to the naming conventions for column headers
The text of the requirement will be shown in the Text property tab if the ReqIf.Text name shall be used for the the header corresponding columnt in the Excel file

  • ReqIf.Description: requirement title
  • ReqIf.Text: requirement text

Please find attached a template to clarify this point.

REQ-Sample.xlsx (8.5 KB)

Hi @anto761,
another recommendation. pyreqif maps every string to xhtml, therefore you need to define IE PUID as xhtml, otherwise you would see the div tag.

Type folder
image

IE PUID definition
image

Let me suggest another approach that gives you better control of attribute data types and what goes into the resulting ReqIF file. I’ve used ReqView, which has excellent Excel import and ReqIF export capabilities suited for Capella:

  1. Create a project in ReqView.
  2. Add custom attributes of appropriate types for everything in your Excel files. I’ve only added origID as a string based on your example Excel file.
  3. To import the Excel file, we need to modify it first:
    1. Rename column ID to origID
    2. Fill in the level column based on the hierarchy
    3. Create heading and text columns and fill one of them with contents of Lvl X Req – e.g. use heading if it has descendants and text otherwise
    4. Delete the Lvl X Req columns
    5. Save it as CSV UTF-8 file and then import into the ReqView document
  4. You should get something like this in ReqView:
  5. Export ReqIF to Capella, ensure Export for Capella MBSE is checked so that ForeignIDs are numeric and that a .properties file with all custom attribute names is generated
  6. You should get something like this in Capella:
    image

It might seem a bit complicated, but using this approach will allow iterative updates from CSV to ReqView as well as from ReqView to Capella using ReqIF – the internal identifiers of all objects are persisted. Once you import the stuff into ReqView, there’s not much point in using Excel anymore though.

Hope this helps, I’m attaching all the files involved.

Richard

reqif_testfile.reqif (32.1 KB)
reqif_testfile-reqview.csv (1.1 KB)
reqif_testfile-reqview.xlsx (10.1 KB)
reqview_prj.reqw (24.6 KB)