# Shopify Product Data Quality Command Center (`practical_ai_lab_jp/pal-shopify-product-data-quality-command-center`) Actor

Enter one public Shopify store URL. Get severity-ranked, source-linked product and variant QA tables, a dated baseline and repeat-run regression checks.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-shopify-product-data-quality-command-center.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** E-commerce, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 product quality reports

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Shopify Product Data Quality Command Center

Paste **one public Shopify store URL** and get a complete product and variant QA workflow for a catalog operations team:

- severity-ranked, source-linked **remediation tables** (grouped by issue, and record by record),
- scores for four buyer outcomes (identifiers, pricing, media, structure/schema),
- a **dated baseline** stored per store domain,
- **repeat-run regression checks** that show what got worse, what was fixed and what changed since the last run.

No CSV upload, no second snapshot and no login. The only required input is `storeUrl`.

> This Actor reads only what a store already publishes to the public. It cannot see private admin data (see [Limitations](#limitations-and-sample-size-caveats)).

### Who it is for

Ecommerce catalog operations, agencies that onboard or migrate Shopify stores, marketplace and ad-feed managers, and data teams that need a repeatable pre-flight check before pushing a catalog to channels. Use it on stores you own or are authorized to review.

### Quick start (one URL)

1. Open the Actor and set **Store URL**, for example `https://your-store.myshopify.com` or your custom domain (replace the placeholder with your own store).
2. Leave everything else at its default and run it.
3. Open the dataset:
   - the first row (`RUN_SUMMARY`) has `runStatus: "BASELINE_CREATED"`, the scores and the limitations,
   - `REMEDIATION_GROUP` rows list issues from most to least severe,
   - `FINDING` rows list each affected product or variant with a link to the storefront page and to the feed page it was read from.

Copyable input:

```json
{
    "storeUrl": "https://your-store.myshopify.com",
    "maxProducts": 500,
    "maxCollectionsToCheck": 10
}
```

### Track a store over time (schedule later runs)

The first run creates the baseline. To compare later, create an **Apify Schedule** for this Actor with the same input (for example weekly). Each scheduled run:

1. loads the stored baseline for that domain,
2. runs the same audit,
3. emits `runStatus: "REPEAT_RUN_COMPARED"`, regression check results, and only the **changed** records (new findings, resolved findings, product/price/SKU/handle changes) plus a small sample of unchanged findings,
4. replaces the stored baseline with the new run (the original baseline date and a short run history are kept).

This Actor does **not** send alerts by itself and does not schedule itself. If you want notifications, attach Apify run integrations or webhooks to your schedule and use `regression.status` in the summary.

Where the baseline lives: a named key-value store (default `pal-shopify-product-qa-state`, change it with `stateStoreName`) in your own Apify account. It holds one compact record per store domain (key `STATE_<hash of host>`): product ids, handles, variant prices and SKUs (bounded to 2,000 products, 20 variants per product, 5,000 findings, under about 3 MB) and a hash index of findings. It contains no personal data. Set `resetBaseline` to `true` to start over. If you clear `stateStoreName`, the baseline is kept only in that run's own store and **will not** be available to the next cloud run.

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `storeUrl` (required) | – | One HTTPS storefront URL. Only scheme and host are used. |
| `maxProducts` | 500 | Upper bound (1–2,000) on products read, 250 per request. |
| `maxCollectionsToCheck` | 10 | Largest listed collections whose feed is read for stale-link checks (0–25; 0 disables). |
| `requestDelaySeconds` | 1 | Minimum pause between storefront requests (0.25–10). |
| `maxDiscountPercent` | 90 | Compare-at prices implying a bigger discount are flagged. |
| `priceChangeAlertPercent` | 50 | Repeat runs: price moves at/above this fail the price regression check. |
| `regressionScoreDrop` | 2 | Repeat runs: overall score drops larger than this fail the score check. |
| `sampleOutputSize` | 10 | Repeat runs: unchanged findings added as a sample. |
| `stateStoreName` | `pal-shopify-product-qa-state` | Named key-value store for baselines. |
| `resetBaseline` | false | Ignore the stored baseline and create a new one. |

### Output

All rows go to the default dataset and carry a `recordType`. Dataset views are provided for each type.

| `recordType` | When | Content |
| --- | --- | --- |
| `RUN_SUMMARY` | every run (first row) | status, dates, coverage, scores, per-outcome scorecards, regression result, limitations, sample-size caveat |
| `REMEDIATION_GROUP` | every run | one row per rule, severity-ranked, with counts, affected share of products, fix guidance and example links; on repeat runs also new/unchanged/resolved counts |
| `FINDING` | first run: all (up to 3,000); repeat runs: new ones plus a sample | record-level finding with product handle, variant id, SKU, field, observed vs expected value, `sourceUrl`, `feedUrl`, `priorityRank` |
| `REGRESSION_CHANGE` | repeat runs | `PRODUCT_ADDED`, `PRODUCT_REMOVED`, `HANDLE_CHANGED`, `PRICE_CHANGED`, `SKU_CHANGED`, `VARIANT_COUNT_CHANGED` |
| `RESOLVED_FINDING` | repeat runs | findings present in the baseline that no longer occur on entities that were checked again |
| `RUN_ERROR` | failed runs | error code and message |

The summary is also saved under the key `OUTPUT` of the run's default key-value store.

Illustrative shape of a group row (example values, not a real store):

```json
{
    "recordType": "REMEDIATION_GROUP",
    "groupRank": 1,
    "severity": "critical",
    "buyerOutcome": "identifier_readiness",
    "ruleId": "ID002",
    "title": "Duplicate SKU across variants",
    "findingCount": 4,
    "affectedProducts": 3,
    "exampleSourceUrls": ["https://your-store.example/products/some-handle?variant=123"]
}
```

### Four buyer outcomes

Each finding belongs to one outcome; the summary gives every outcome its own score and top rule.

1. **Identifier readiness** (`identifier_readiness`) – missing SKU, duplicate SKU (exact and case-only), SKU whitespace, duplicate/missing handle, duplicate product id, missing vendor and product type.
2. **Price and compare-at integrity** (`pricing_integrity`) – missing/unparseable, negative or zero price; compare-at not above price; unparseable compare-at; extreme discounts; 10x price spread inside a product; more than two decimals.
3. **Image and variant media integrity** (`media_integrity`) – no images; variant featured image not among the product's images; images linked to variants that do not exist; images owned by another product id; invalid image URLs; missing alt text; gaps/duplicates in image positions; repeated image URLs.
4. **Collection links and public schema stability** (`structure_and_schema`) – expected product, variant and image fields missing or mistyped; variant options that do not match the product's option list; variant `product_id` mismatches; timestamp problems; empty listed collections; collections whose feed returns 404; collections that list products absent from the catalog feed; collection count mismatches.

Severity levels are `critical`, `high`, `medium`, `low`, `info`. Findings are sorted by severity, then rule, handle and variant.

#### Scores

Per outcome and overall: `100 − share of entities affected`, where each entity is weighted by its worst finding (critical 1.0, high 0.6, medium 0.3, low 0.1). It is a relative indicator for comparing runs of the same store, not an industry benchmark.

#### Regression checks (repeat runs)

| Check | Fails when |
| --- | --- |
| RC01 / RC02 | new critical / new high findings appear |
| RC03 | overall score drops by more than `regressionScoreDrop` |
| RC04 | more than 20% of baseline products vanished (skipped if this run read only part of the catalog) |
| RC05 | a variant price moved by at least `priceChangeAlertPercent` |
| RC06 | fields disappeared from the public feed (new fields only warn) |
| RC07 | product handles changed (warns; old URLs may need redirects) |

`regression.status` is `PASSED`, `PASSED_WITH_WARNINGS` or `FAILED`.

### Safety and fair use

- Only public HTTPS feeds of the store you enter: `/products.json`, `/collections.json`, `/collections/<handle>/products.json`.
- `robots.txt` is read and honored (user-agent token `PALShopifyProductQA`, `*` and `$` patterns, longest match) **before every storefront request**. If it disallows a path, the run refuses that request. If `robots.txt` cannot be read (5xx, 429, network error), the request is refused. A missing `robots.txt` (404/410) is treated as "no rules"; 401/403 is treated as "blocked".
- URLs must be HTTPS on the default port, without credentials; IP literals and internal host names are rejected. DNS answers must all be public addresses, and the connection goes to the validated address. Redirects (max 3) are re-validated, including robots, on every hop.
- Bounded work: at most 60 requests, 20 s per request, 12 MB per response, a 5-minute run budget and at least 0.25 s between requests. No proxies, no logins, no contact or personal data collection.
- Failed runs (robots denial, private host, disabled feed, no products, rate limiting) write a `RUN_ERROR` row, and end as failed. A run is only counted as a delivered report after the dataset was written and the baseline was stored.

### Limitations and sample-size caveats

- **Public data only.** Barcodes/GTINs, cost, inventory quantities, metafields, draft/unpublished products and anything behind a login are not in the public feed, so identifier checks cover SKU, handle, vendor and product type.
- **"Schema mismatch" is relative to the feed shape commonly seen publicly,** not an official Shopify contract. Themes, apps or Shopify may change it; a mismatch means "review", not "broken".
- **Price checks compare feed strings.** Currency, tax and market-specific prices are not verified; a zero price or deep discount can be intentional.
- **Sampling.** Catalogs above `maxProducts` are reported as a partial sample (the summary says so). Collection checks read only the largest listed collections and the first 250 products of each. Stale links outside that sample are not found.
- **Small catalogs give volatile scores.** With fewer than about 30 products a single product moves percentages a lot; the summary adds a caveat.
- **Repeat-run comparisons assume similar coverage.** Removed products are only reported when the current run read the whole catalog. If the baseline stored more than 5,000 findings, only the most severe were kept and `baselineFindingsTruncated` is set.
- Stores that password-protect the storefront, disable the feeds, rate-limit the request or block automated access cannot be audited; the run fails with a clear error instead of a partial report.
- The baseline is compared with the **previous** run (rolling), not with a fixed historical run; `baselineDate` is the date the baseline was first created.

### Local development

The unit tests are fully offline (a fake storefront replaces the network):

```bash
python -m unittest discover -s tests -t .
```

The code is in `src/`: `safety.py` (URL/SSRF), `robots.py`, `http_client.py` (bounded polite client), `collector.py` (feeds), `rules.py` (findings), `scoring.py`, `state.py` and `compare.py` (baseline and regression), `report.py` (dataset rows), `pipeline.py` (pure audit) and `main.py` (Apify I/O).

# Actor input Schema

## `storeUrl` (type: `string`):

The prefilled example URL produces a clearly labeled, free synthetic demo (no real store or persistent baseline). Replace with a real public HTTPS Shopify storefront URL to run a live audit.

## `maxProducts` (type: `integer`):

Upper bound on products read from the public products feed (250 per request). Larger catalogs are reported as a partial sample.

## `maxCollectionsToCheck` (type: `integer`):

How many of the largest listed collections get their product feed fetched to look for stale links (first 250 products each). Use 0 to skip all collection checks.

## `requestDelaySeconds` (type: `number`):

Minimum pause between requests to the storefront. Lower bound 0.25 seconds.

## `maxDiscountPercent` (type: `number`):

A compare-at price that implies a discount larger than this is flagged for review.

## `priceChangeAlertPercent` (type: `number`):

On repeat runs, a variant price change at or above this percentage fails the price regression check.

## `regressionScoreDrop` (type: `number`):

On repeat runs, the overall quality score falling by more than this many points fails the score regression check.

## `sampleOutputSize` (type: `integer`):

On repeat runs, only changed records are emitted in full. This many of the highest-ranked unchanged findings are added as a sample.

## `stateStoreName` (type: `string`):

Named key-value store that keeps one compact baseline per store domain so scheduled runs can be compared. Lowercase letters, digits and hyphens, 3-63 characters. Leave empty to use this run's own default store (the baseline then does NOT survive to the next cloud run).

## `resetBaseline` (type: `boolean`):

Ignore any stored baseline for this domain and create a new one from this run.

## Actor input object example

```json
{
  "storeUrl": "https://store.example.com",
  "maxProducts": 500,
  "maxCollectionsToCheck": 10,
  "requestDelaySeconds": 1,
  "maxDiscountPercent": 90,
  "priceChangeAlertPercent": 50,
  "regressionScoreDrop": 2,
  "sampleOutputSize": 10,
  "stateStoreName": "pal-shopify-product-qa-state",
  "resetBaseline": false
}
```

# Actor output Schema

## `results` (type: `string`):

Download rows from the latest run in JSON/CSV.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "storeUrl": "https://store.example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-shopify-product-data-quality-command-center").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "storeUrl": "https://store.example.com" }

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-shopify-product-data-quality-command-center").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "storeUrl": "https://store.example.com"
}' |
apify call practical_ai_lab_jp/pal-shopify-product-data-quality-command-center --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-shopify-product-data-quality-command-center"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/z5aVldHvoKAK6bx4Q/builds/vB6zZBOsWNaAkTlLv/openapi.json
