# Quick Start Guide

Welcome to the documentation for the Transforms SDK. The goal is get you setup and running as quick as possible.  Let's jump right in!

The <mark style="color:purple;">**`Transformer`**</mark> is the primary class responsible for every single major operation that occurs in a transformation process. Let's review the steps and how these events occur.

{% hint style="info" %}
Want to read a bit more about how the transforms system works?

[terminology](https://docs.perigee.software/transforms/terminology "mention")

[the-mapping-document](https://docs.perigee.software/transforms/the-mapping-document "mention")
{% endhint %}

## Steps

### Retrieving the data

To transform data, we need data. Getting that data into the system is extremely easy using Transforms. Simply ask the <mark style="color:purple;">**`Transformer`**</mark> to read a <mark style="color:purple;">**`DataTable`**</mark> from the file. You can do this either by path, or by bytes.&#x20;

```csharp
//Direct read
DataTable file = Transformer.TableFromFile("Properties.csv");

//From a byte array and mime type
file = Transformer.TableFromFile(
    File.ReadAllBytes("Properties.csv"), 
    TransformUtil.ToMimeType("csv"), 
    "Properties.csv");
```

### Retrieving associated files (maps, lookups, segments)

Before transforming the data, we need a map to process it through. We can simply ask the system the load this data in as well.&#x20;

```csharp
var maps = Transformer.GetMapFromFile("CommProperties.map.xlsx", out var rpt);
```

You can request lookups exactly the same way :thumbsup:

```csharp
var lookups = Transformer.GetLookupFromFile("Lookups.lvm.xlsx", out var rpt);
```

### Transforming

All transforming is done through the Transformer **`MapTo`** methods. They allow you take a <mark style="color:purple;">**`DataTable`**</mark> , run it through a Map, and produce a target file.

```csharp
TransformationResult Result = file.MapTo(maps.First());
```

Could it really be that easy? <mark style="color:green;">**YES!**</mark>.

This result object contains everything you need to produce reports and export data. Let's look at that next

### Produce Data

Most of the time you'll be producing a data file to be inspected or loaded. There's an incredibly easy way to produce these results with an appropriately named file (using the mapping specification's export name)

```csharp
File.WriteAllBytes(Result.GetCSVNameOfExportFile(), Result.WriteCSV());
```

If you're trying to write Excel, JSON or inspect the <mark style="color:purple;">**`DataTable`**</mark> for the target result you can do so as well:

```csharp
File.WriteAllBytes(Result.GetXLSXNameOfExportFile(), Result.WriteXLSX());
File.WriteAllBytes(Result.GetJSONNameOfExportFile(), Result.WriteJSON());
DataTable Target = Result.TargetTable;
```

### Reporting

All reporting data is stored in structured classes. You may inspect, use or modify these however you see fit.

```csharp
var transform_report = Result.Report;
var dq_report = Result.DataQualityResults
```

If you would like to generate <mark style="color:purple;">**`DataTables`**</mark> from these reports, there are built in commands to do so:

```csharp
var DT_TransformReport = Result.GenerateTransformationReport();
var DT_DQ = Result.GenerateDataQualityReport();
```

To produce XLSX reports from the reporting data, use the <mark style="color:purple;">**`ExcelWriter`**</mark> by supplying the data, and optional header rows / images.

```csharp
ExcelWriter.WriteWorkbook();
ExcelWriter.WriteWorkbookWithImageBytes();
```

## Summary

This quick reference guide covers the entire process of importing data, mapping it, inspecting the results, and exporting data, including reports, out of the system. The following sections will provide more detailed instructions on how to customize and utilize other aspects of the transformation SDK.
