Skip to main content
This guide covers how to create and manage mappings between your dataset columns and Rosetta Stone attributes. Mappings are the translation layer that enables your data to be queried through the normalized narrative.rosetta_stone table.
For background on how mappings work, see How Rosetta Stone Works.

Prerequisites

  • A dataset uploaded to Narrative
  • Understanding of your dataset’s column semantics
  • Familiarity with basic NQL syntax (for transformation expressions)

Map to the source of a derivation

Some attributes can be computed from others through derivation rules. A dataset mapped to the source attribute of a rule gets a derived mapping to the rule’s target automatically, so one mapping to normalized_email can also answer queries for sha256_hashed_email. A mapping made directly to the derived attribute covers only that attribute. Before you choose a target attribute, check what it is derived from. Open the attribute under Rosetta Stone → Attributes: the Derivable From card lists the active rules that can produce it, and the Can Derive card lists the rules that take it as their source. See Attributes Interface for what each row shows. The API answers the same question:
Each node with "relationship": "ancestor" is an attribute the target can be derived from. If your column holds one of those forms, map to it instead. Rules are followed one step at a time: a mapping covers the attributes derived directly from it, not the attributes derived from those in turn. Map directly to a derived attribute only when the dataset holds nothing but the derived form, such as hashed emails with no plain addresses.

Using the UI

View suggested mappings

  1. Navigate to Datasets and select your dataset
  2. Click the Rosetta Stone tab
  3. Review the auto-generated mapping suggestions
The UI displays your columns alongside suggested attributes. Each suggestion includes:
  • The target attribute name and description
  • A confidence score
  • A preview of sample data after transformation

Accept a suggested mapping

For high-confidence suggestions:
  1. Review the suggested attribute and sample output
  2. Click Accept to create the mapping
The mapping becomes active immediately.

Modify a suggested mapping

If a suggestion is close but not quite right:
  1. Click Edit on the suggestion
  2. Modify the target attribute or transformation expression
  3. Click Save

Create a manual mapping

For columns without suggestions or when you need a custom mapping:
  1. Click Add Mapping
  2. Select the source column
  3. Search for and select the target attribute
  4. Write a transformation expression if needed
  5. Click Create

Reject a suggestion

If a suggestion is incorrect:
  1. Click the X or Reject button
  2. The suggestion is removed and won’t reappear

Review derived mappings

The Rosetta Stone Mappings section on a dataset lists the derived mappings your stored mappings imply alongside the stored ones. A derived row is tagged Derived, and carries a Lossy or Imprecise tag when the rule behind it loses or approximates information. Derived mappings are computed when a query runs and never stored, so they cannot be tested, edited, or deleted. Their row menu offers a single action:
  1. Open the row menu on a derived mapping and choose View Provenance
  2. Read the chain in the drawer: the stored mapping it started from, each derivation rule applied in order, and the attribute it produces
  3. Click View source mapping to open the stored mapping it came from, read-only
To change a derived mapping, change the stored mapping it came from or the rule that produced it.

Using the API

List available attributes

Before creating mappings, browse available attributes:
Response:

Get mapping suggestions for a dataset

Request auto-generated mapping suggestions:
Response:

Create a mapping

Create a new mapping for a dataset column:
Response:

Accept a system-proposed mapping

Accept a suggestion from the auto-generated mappings:

Update an existing mapping

Modify a mapping’s transformation:

Delete a mapping

Remove a mapping:

Mapping types

The Mappings API accepts three mapping types:
  • value_mapping — a single SQL expression producing a primitive value.
  • object_mapping — one expression per property of an object attribute.
  • cached_mapping — joins the source dataset against a precomputed cache dataset at query time. Use this when the transformation is expensive or comes from an external workflow.
For the full schema, validation rules, and constraints (including the company-scope and opt-out restrictions on cached mappings), see Mapping types.

Writing transformation expressions

Transformation expressions are NQL expressions that convert source values to the target attribute format.

Simple column reference

When no transformation is needed:

Type conversion

Convert a string to an integer:
Convert to timestamp:

Conditional logic

Map discrete values:
Map ranges:

Null handling

Provide a default for nulls:
Replace specific values with null:

String manipulation

Normalize case:
Trim whitespace:
Extract a substring:

Combining multiple columns

Concatenate values:
Build a struct:

Complete worked example

Scenario

You have a customer dataset with these columns:

Step 1: Review suggestions

The system suggests:
  • sex → hl7_gender (medium confidence)
  • signup_date → event_timestamp (high confidence)
  • email_hash → email_sha256 (high confidence)

Step 2: Accept high-confidence mappings

Accept the signup_date and email_hash mappings.

Step 3: Customize the gender mapping

The suggested transformation doesn’t handle "X" correctly. Create a custom mapping:

Step 4: Create a manual mapping for customer ID

Map cust_id to the unique_identifier attribute:

Step 5: Test and activate

Test all mappings, then activate.

Troubleshooting

How Rosetta Stone Works

Understand the mechanics of attributes and mappings

Validating Mappings

Test and verify your mappings

Edge Cases

Handle complex mapping scenarios

Transformation Functions

Complete function reference

Mapping Types

API reference for value_mapping, object_mapping, and cached_mapping