> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcemedium.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SM Data Validation

> Check a SourceMedium number against Shopify's own records, order by order, and name the cause of every difference.

When a SourceMedium number and Shopify's disagree, this skill finds out why. Your coding agent pulls both sides for the same days, matches them order by order, and attributes the whole difference to named causes: a different timezone, a different day for a refund, a different rule for which orders count. Most differences are two tools counting different things, not missing data.

## Prerequisites

The install command requires `npx`, which comes with Node.js 18+. Run `node -v` to check. If you see "command not found," install Node.js from [nodejs.org](https://nodejs.org) first.

The skill works on every plan through your [SourceMedium connection](https://docs.sourcemedium.com/docs/ai-analyst/connect-an-ai-assistant.md). It reads the SourceMedium side with custom SQL, so the teammate running it needs data access to all brands; see [member data access](https://docs.sourcemedium.com/docs/ai-analyst/member-data-access.md). It also uses the [SM BigQuery Analyst](https://docs.sourcemedium.com/docs/ai-analyst/agent-skills/sm-bigquery-analyst.md) skill and Python 3.9+.

For Shopify's side, the agent uses the first of these it can:

1. **Your SourceMedium connection's Shopify tools.** `run_shopifyql_report` reads Shopify Analytics, the data behind Shopify's own reports, with nothing to export. It needs Shopify's permission to read reports: a store connected before November 2026 gains it when you [reconnect Shopify](https://docs.sourcemedium.com/docs/data-inputs/platform-integration-instructions/shopify-integration.md).
2. **A raw Shopify table** you selected under [**Warehouse → Raw data**](https://docs.sourcemedium.com/docs/data-activation/managed-data-warehouse/raw-data.md), on any paid plan.
3. **A browser** the agent may drive, signed in to your Shopify admin with permission to view reports.
4. **A CSV** you export from Shopify and hand to the agent.

## Install

```bash theme={null}
npx skills add source-medium/skills --skill sm-bigquery-analyst
npx skills add source-medium/skills --skill sm-data-validation
```

If your agent does not support automatic install through the `skills` CLI, copy the skill folder into that agent's configured skills directory.

## Update

```bash theme={null}
npx skills update sm-bigquery-analyst -y
npx skills update sm-data-validation -y
```

After updating, start a new agent session so it lists your connection's current tools.

***

## Quick start

> [!TIP]
>
> Paste this into your coding agent and replace the number and dates with your own.

```
Use the SourceMedium Data Validation skill.

SourceMedium shows $48,210 net revenue for my store for July 27 to
August 2, and Shopify's sales report shows $49,050. Reconcile them order
by order and tell me what explains the difference.
```

## What it does

**Counts the same thing on both sides.** It reads Shopify's figure the way Shopify reports it, by each row's own day, and re-buckets SourceMedium's days into the store's timezone, padding the window by a day on each side.

**Matches orders, not totals.** Orders are matched by their Shopify ID. Orders only one side has, and orders whose amounts differ, are listed individually.

**Names every difference.** The whole gap is split into named classes that add up to the headline difference: refunds dated differently, refunds across the window edge, orders SourceMedium leaves out as not valid, draft and point-of-sale channels, currency, and anything still unexplained.

**Never calls data wrong from a total.** If something stays unexplained, the report says so and shows the orders behind it.

## What you get

| Output | What it contains |
| - | - |
| The answer | Whether SourceMedium agrees with Shopify for that window, and if not, why |
| The breakdown | Each cause with its dollar and order amounts, adding up to the difference |
| The orders | The orders behind each cause, so you can check them in Shopify |
| Receipts | The SQL and Shopify queries used, with the dates, timezone, and stores |

***

## Related

> [card] [Valid orders](https://docs.sourcemedium.com/docs/help-center/core-concepts/data-definitions/is-order-sm-valid.md)
>
> Which orders SourceMedium counts, and why some Shopify orders are left out.

> [card] [Refund logic](https://docs.sourcemedium.com/docs/help-center/core-concepts/data-definitions/refund-logic.md)
>
> Which date a refund counts on, and how exchanges book.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.