# Transformation Configuration Setup

## Overview

The Cordial data share provides data on email and SMS subscribe / unsubscribe, regular and triggered campaigns, contacts and sends / bounces / opens / clicks. The Daasity transformation code maps data from the Cordial data share into a Cordial schema and then finally into the Unified Notifications Schema (UNS)

## Feature Dependencies

You must have enabled our [Code Repository](https://help.daasity.com/technical-docs/transform-code/code-repository) feature in order to both access the Daasity transformation code as well as modify a Script Manifest File enabling this code to execute

We recommend you review the [Transformation Configuration](https://help.daasity.com/technical-docs/workflows-and-scheduling/script-manifest-yaml-files) section of our Help documentation to familiarize yourself with our workflow engine and script manifest files.

## Script Manifest File (YML)

### Upstream Transformation Dependencies

{% hint style="danger" %}
This code is dependent on the following data share being setup:

* Cordial

This code block is dependent on the following upstream code blocks being implemented:

* [Initialization](https://help.daasity.com/technical-docs/transform-code/transform-code/initialization-code)
  {% endhint %}

### Transformation Code Requirements

{% hint style="info" %}
This Transformation Code is for the Cordial Snowflake Data Share
{% endhint %}

To enable the data transformation from the Cordial data share into the Cordial schema and UNS, the following code must be run in a workflow:

```
  cordial:
    scripts:
      # The following scripts need to be modified with the name of the Snowflake Share from Cordial
      - "github://platform-sql-shared/scripts/templates/cordial_ext/100_EXT_cordial_contacts_template.sql"
      - "github://platform-sql-shared/scripts/templates/cordial_ext/101_EXT_cordial_contact_lists_template.sql"
      - "github://platform-sql-shared/scripts/templates/cordial_ext/102_EXT_cordial_events_template.sql"
      - "github://platform-sql-shared/scripts/templates/cordial_ext/103_EXT_cordial_event_properties_template.sql"
      - "github://platform-sql-shared/scripts/templates/cordial_ext/104_EXT_cordial_message_sends_template.sql"
      - "github://platform-sql-shared/scripts/templates/cordial_ext/105_EXT_cordial_message_send_tags_template.sql"
      # End of scripts that need to be modified

      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1101_UNS_BAS_CORDIAL_automations.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1102_UNS_BAS_CORDIAL_campaigns.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1103_UNS_BAS_CORDIAL_contacts.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1105_UNS_BAS_CORDIAL_lists.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1106_UNS_BAS_CORDIAL_contact_lists.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1107_UNS_BAS_CORDIAL_sends.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1108_UNS_BAS_CORDIAL_opens.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1109_UNS_BAS_CORDIAL_clicks.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1110_UNS_BAS_CORDIAL_unsubscribes.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1111_UNS_BAS_CORDIAL_bounces.sql"
      - "github://platform-sql-shared/scripts/base/1000_uns/cordial/1112_UNS_BAS_CORDIAL_spams.sql"
```

### Cordial Schema

The data from the Cordial Snowflake share includes JSON that must be de-nested in order to populate the UNS tables.  The following code must be copied into your own [Code Repository](https://help.daasity.com/technical-docs/transform-code/code-repository) and modified to have the name of the data share updated.  This code must be run to de-nest the data and populate the Cordial schema which is used as the source for UNS:

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/100_EXT_cordial_contacts_template.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/101_EXT_cordial_contact_lists_template.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/102_EXT_cordial_events_template.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/103_EXT_cordial_event_properties_template.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/104_EXT_cordial_message_sends_template.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/templates/cordial_ext/105_EXT_cordial_message_send_tags_template.sql>

{% hint style="warning" %}
The Cordial Schema scripts must be modified to use the name of the Snowflake share that Cordial has created.  Look for this block `<'database_share_name'>` within the SQL code and replace this with the name of the database share
{% endhint %}

### Unified Notification Schema

Code to populate the UNS tables:

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1101_UNS_BAS_CORDIAL_automations.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1102_UNS_BAS_CORDIAL_campaigns.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1103_UNS_BAS_CORDIAL_contacts.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1105_UNS_BAS_CORDIAL_lists.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1106_UNS_BAS_CORDIAL_contact_lists.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1107_UNS_BAS_CORDIAL_sends.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1108_UNS_BAS_CORDIAL_opens.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1109_UNS_BAS_CORDIAL_clicks.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1110_UNS_BAS_CORDIAL_unsubscribes.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1111_UNS_BAS_CORDIAL_bounces.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/1000_uns/cordial/1112_UNS_BAS_CORDIAL_spams.sql>
