> For the complete documentation index, see [llms.txt](https://intuitem.gitbook.io/ciso-assistant/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://intuitem.gitbook.io/ciso-assistant/configuration/libraries/create-mapping.md).

# Create a Mapping

Create a Mapping between two frameworks

A Mapping links requirements from two Frameworks. Start with the YAML file version of each Framework, generate an Excel workbook with [`prepare_mapping_v2.py`](https://github.com/intuitem/ciso-assistant-community/blob/main/tools/prepare_mapping_v2.py), then complete and import it. You do not need to copy the Framework sheets into the Mapping workbook for that.

## 1. Get the two Framework YAML files

Choose which Framework is the **source** and which is the **target**. The preparation script needs a YAML library containing each Framework and its requirement nodes. If you only have Excel files, convert them to YAML first as explained in [the optional conversion step](https://intuitem.gitbook.io/ciso-assistant/configuration/libraries/pages/C3bJVhV2eXdqfpERgkwz#id-5.-optional-convert-the-workbook-to-yaml). These YAML files are inputs to the preparation script. Nonetheless, you can still import the finished Mapping as Excel.

## 2. Generate the Mapping workbook

You can download and run `prepare_mapping_v2.py` without downloading the whole repository. If you already set up Python while creating your Framework libraries, you can reuse that virtual environment.

1. Install [Python](https://www.python.org/) 3.14 or later if needed, then check its version:

   ```shell
   python --version
   ```
2. Click [here](https://raw.githubusercontent.com/intuitem/ciso-assistant-community/refs/heads/main/tools/prepare_mapping_v2.py) to download the [`prepare_mapping_v2.py`](https://raw.githubusercontent.com/intuitem/ciso-assistant-community/refs/heads/main/tools/prepare_mapping_v2.py) script. Place it in a working folder with both Framework YAML files.
3. Open a terminal in that folder and create a virtual environment if you do not already have one:

   ```shell
   python -m venv .venv
   ```
4. Activate the virtual environment. On Windows, use PowerShell:

   ```powershell
   .\.venv\Scripts\Activate.ps1
   ```

   On macOS or Linux, use:

   ```shell
   source .venv/bin/activate
   ```
5. Install the packages used by the script in the active virtual environment:

   ```shell
   python -m pip install openpyxl PyYAML
   ```
6. Run the downloaded script with the source YAML first and the target YAML second. Replace the example filenames with your own:

   ```shell
   python prepare_mapping_v2.py source.yaml target.yaml
   ```

{% hint style="info" %}
If the `python` command is not recognized, use `python3` instead in the commands above. If the `.py` link opens as text in your browser, right-click and save the page as `prepare_mapping_v2.py`.
{% endhint %}

The script creates a `mapping-<source>-and-<target>.xlsx` file in the current directory. It fills the library and Mapping metadata, lists the source requirements in `mappings_content`, and adds `source` and `target` sheets for reference.

## 3. Link the requirements

Open the generated workbook and work in the `mappings_content` sheet. The `source` and `target` sheets are there to help you find the requirements you want to link: compare their names and descriptions, then use their `node_id` values.

The script has already filled the `source_node_id` column in `mappings_content` with assessable source requirements. You can complete those rows or clear the pre-filled values and build your own list, without removing the header row.

To create a link, fill one row in `mappings_content` as follows:

1. In `source_node_id`, enter the requirement's `node_id` from the `source` sheet.
2. In `target_node_id`, enter the requirement's `node_id` from the `target` sheet.
3. In `relationship`, choose the type of link. The `guidelines` sheet lists the available values, such as `intersect`.

For a typical Mapping, entering `intersect` in the `relationship` column will suffice. You can put another valid value only if you need to describe a more specific relationship between the requirements.

For example, an illustrative Mapping from a sample Framework to ISO/IEC 27001:2022 could look like this:

| source\_node\_id | target\_node\_id | relationship |
| ---------------- | ---------------- | ------------ |
| `access.1`       | `a.5.18`         | `intersect`  |
| `access.1`       | `a.5.16`         | `intersect`  |
| `identity.1`     | `a.5.16`         | `intersect`  |

Here, `access.1` links to two target requirements, and `a.5.16` links to two source requirements. Each link has its own row. Remove any unused rows. Every row with content must have all three fields.

See [Mappings](/ciso-assistant/configuration/libraries/library-objects/mappings.md) for the meaning and accepted values of each field, including the optional `rationale` and `strength_of_relationship`.

## 4. Keep the generated metadata

The script fills `library_meta` and `mappings_meta` for you, including the Framework URNs, requirement URN prefixes, and library dependencies. You do not need to change these sheets for a standard Mapping.

{% hint style="info" %}
The script uses `intuitem` by default for `provider`, `packager`, `copyright`, and the library and Mapping URNs. You can replace it with your organization's name, but make sure you update the related URNs consistently.
{% endhint %}

## 5. Import the Mapping library

Save the completed workbook, make sure both referenced Framework libraries are available in CISO Assistant, then [import the Excel file](/ciso-assistant/configuration/libraries/import-library.md). You do not need to convert the Mapping workbook to YAML first.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://intuitem.gitbook.io/ciso-assistant/configuration/libraries/create-mapping.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
