# EU Safety Gate & RappelConso Scraper — GPSR Recall Matcher (`vesper_studio/eu-gpsr-product-recall-matcher`) Actor

Scrape official EU Safety Gate & RappelConso product recalls and screen e-commerce catalogs (Shopify, WooCommerce, Google Shopping XML, CSV, JSON) by exact GTIN/EAN and fuzzy brand/model matching. Technical compliance monitoring for EU GPSR (not a legal certification).

- **URL**: https://apify.com/vesper_studio/eu-gpsr-product-recall-matcher.md
- **Developed by:** [Xavier Richard](https://apify.com/vesper_studio) (community)
- **Categories:** E-commerce, Automation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $25.00 / 1,000 product recall match delivereds

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

## EU GPSR Product Recall Matcher (Safety Gate & RappelConso)

Automatically screen e-commerce product catalogs (**Shopify, WooCommerce, PrestaShop, Google Shopping XML, CSV, JSON**) against official European product recall databases (**EU Safety Gate** and **French RappelConso**) to support **EU General Product Safety Regulation (GPSR)** supply-chain monitoring.

> **IMPORTANT LEGAL NOTICE / AVERTISSEMENT JURIDIQUE**\
> This Actor provides an **informative technical matching score only** (`is_informative_only: true`). It **does not constitute legal certification**, regulatory advice, or formal compliance verification under EU Regulation (EU) 2023/988 (GPSR). Merchants and compliance teams must always manually verify any flagged match against the official EU Safety Gate or RappelConso recall notice before taking corrective or legal action.

***

### Key Features

- **100% Public Official APIs (Zero Proxies, 256–512 MB RAM)**
  - **EU Safety Gate**: Official custom XML export API (`ec.europa.eu/safety-gate-alerts/api/download/weeklyReport/custom/xml/en`), automatically chunked into <= 28-day windows and parsed securely via `defusedxml`.
  - **RappelConso (France)**: Official OpenDataSoft v2.1 API (`data.economie.gouv.fr/api/explore/v2.1/catalog/datasets/rappelconso-v2-gtin-trie/records`), aggregating multi-GTIN rows by `numero_fiche`.
- **Multi-Format Catalog Ingestion**
  - Direct JSON list (`catalogItems`: `[{ sku, gtin, brand, title, model }]`)
  - **Shopify** storefront URL or `/products.json` (auto-paginated up to 250 items/page across variants)
  - **Google Shopping XML** feeds (RSS 2.0 `g:gtin`, `g:brand`, `g:mpn` & Atom)
  - **CSV** exports (WooCommerce, PrestaShop, ERP exports with `,`, `;`, `\t`, and UTF-8 BOM auto-detection)
  - **JSON** feed URLs
- **Two-Tier Matching Engine (`src/matcher.py`)**
  1. **Tier 1 — `exact_gtin` (100% confidence)**: Normalizes EAN-8, UPC-A (12-digit), EAN-13, GTIN-14, and Safety Gate concatenated barcodes / RappelConso integer GTINs for `O(1)` exact matching.
  2. **Tier 2 — `fuzzy_brand_model` (RapidFuzz, configurable threshold ≥ 85%)**: Accent-folded brand + model/reference matching with token-level explanation (`matched_tokens`, `match_explanation`) and guards against brand mismatches or differing model numbers.
- **Delta Mode (`onlyNew`) & Graceful Abort**
  - Tracks processed recall IDs in the Apify Key-Value Store (`seen_recalls`) so scheduled runs only evaluate and emit newly published recalls.
  - Listens for Apify `ABORTING` events to flush buffered dataset matches and persist delta state cleanly.
- **Pay-Per-Event (PPE) Ready**
  - Enforces pre-flight and per-batch budget checks for `recall-fetched` and `catalog-match` events.

***

### Input Example

```json
{
  "sources": ["safety_gate", "rappelconso"],
  "publishedAfter": "2026-10-15",
  "excludeFood": false,
  "fuzzyThreshold": 85,
  "onlyNew": true,
  "catalogItems": [
    {
      "sku": "NAJ-SC-V2",
      "gtin": "7350080242795",
      "brand": "Najell",
      "title": "Najell SleepCarrier Volume 2",
      "model": "SleepCarrier Volume 2"
    },
    {
      "sku": "BCK-DSW-22",
      "gtin": "",
      "brand": "Backen",
      "title": "Autocuiseur Inox Design DSW 22-7L",
      "model": "DSW 22-7L"
    }
  ]
}
```

***

### Output Dataset Record

Each match (or `recall_only` record when no catalog is provided) includes:

- `disclaimer`: Explicit legal notice stating the score is technical & informative only
- `is_informative_only`: Always `true`
- `match_level`: `"exact_gtin"` | `"fuzzy_brand_model"` | `"recall_only"`
- `confidence_score`: `100.0` for exact GTIN, `85.0–99.9` for fuzzy brand/model
- `matched_gtin`, `matched_tokens`, `match_explanation`
- Catalog metadata: `sku`, `catalog_gtin`, `catalog_brand`, `catalog_title`, `catalog_model`, `catalog_url`
- Official recall metadata: `recall_source`, `recall_id`, `recall_title`, `recall_brand`, `recall_model`, `recall_gtins`, `recall_category`, `notifying_country`, `risk_level`, `risk_types`, `danger_description`, `measures`, `published_date`, `recall_url`, `image_urls`

A run summary is also written to the Key-Value Store under `MATCH_SUMMARY`.

***

### Local Testing

```bash
pytest
```

# Actor input Schema

## `sources` (type: `array`):

Official European product recall databases to fetch and index in memory.

## `catalogItems` (type: `array`):

Direct JSON array of merchant products: \[{ "sku": "...", "gtin": "...", "brand": "...", "title": "...", "model": "..." }]. Can be combined with catalogUrl.

## `catalogUrl` (type: `string`):

Public URL to your catalog feed: Shopify store or /products.json URL, Google Shopping XML feed, CSV export (PrestaShop/WooCommerce), or JSON array URL.

## `catalogFormat` (type: `string`):

Format of catalogUrl. Use 'auto' to detect Shopify /products.json, Google Shopping XML, CSV, or JSON automatically.

## `publishedAfter` (type: `string`):

Fetch recalls published on or after this ISO date (YYYY-MM-DD). If omitted, defaults to the last lookbackDays (30 days by default).

## `lookbackDays` (type: `integer`):

Number of days to look back when publishedAfter is not specified.

## `categories` (type: `array`):

Optional case-insensitive substrings to filter recall categories/subcategories (e.g. 'Childcare', 'Electrical', 'bébés-enfants', 'jouets'). Leave empty for all categories.

## `notifyingCountries` (type: `array`):

Optional ISO-2 codes (e.g. FR, DE, SE, NL) or country names (e.g. France, Germany) to filter notifying authorities. Leave empty for all EU/EEA countries.

## `riskLevels` (type: `array`):

Optional case-insensitive filters matched against risk level or risk types (e.g. 'Serious risk', 'Chemical', 'Electric shock', 'Injuries'). Leave empty for all risks.

## `excludeFood` (type: `boolean`):

When enabled, excludes RappelConso 'alimentation' records to focus strictly on non-food GPSR consumer goods.

## `fuzzyThreshold` (type: `number`):

Minimum RapidFuzz composite score (0-100) required to emit a Tier 2 'fuzzy_brand_model' match. Recommended: 85.

## `onlyNew` (type: `boolean`):

Skip official recalls already processed in previous runs using Apify Key-Value Store ('seen_recalls'). State is checkpointed on completion and on graceful abort.

## `maxRecalls` (type: `integer`):

Maximum number of recall records to fetch and index across selected sources. Each fetched recall bills one 'recall-fetched' PPE event.

## `maxMatches` (type: `integer`):

Maximum number of dataset items to deliver. Each delivered match bills one 'catalog-match' PPE event.

## Actor input object example

```json
{
  "sources": [
    "safety_gate",
    "rappelconso"
  ],
  "catalogItems": [],
  "catalogUrl": "https://example-shop.com/products.json",
  "catalogFormat": "auto",
  "publishedAfter": "2026-10-01",
  "lookbackDays": 30,
  "categories": [],
  "notifyingCountries": [],
  "riskLevels": [],
  "excludeFood": false,
  "fuzzyThreshold": 85,
  "onlyNew": false,
  "maxRecalls": 500,
  "maxMatches": 1000
}
```

# Actor output Schema

## `matches` (type: `string`):

Two-tier exact GTIN and fuzzy brand/model matches between merchant catalog items and EU Safety Gate / RappelConso recalls. Technical informative matching score only — not a legal certification.

## `summary` (type: `string`):

Summary statistics including recalls fetched, catalog products evaluated, exact GTIN matches, fuzzy matches, delta skipped recalls, and legal disclaimer.

# 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 = {
    "sources": [
        "safety_gate",
        "rappelconso"
    ],
    "catalogItems": [],
    "catalogFormat": "auto",
    "lookbackDays": 30,
    "categories": [],
    "notifyingCountries": [],
    "riskLevels": [],
    "excludeFood": false,
    "fuzzyThreshold": 85,
    "onlyNew": false,
    "maxRecalls": 500,
    "maxMatches": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("vesper_studio/eu-gpsr-product-recall-matcher").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 = {
    "sources": [
        "safety_gate",
        "rappelconso",
    ],
    "catalogItems": [],
    "catalogFormat": "auto",
    "lookbackDays": 30,
    "categories": [],
    "notifyingCountries": [],
    "riskLevels": [],
    "excludeFood": False,
    "fuzzyThreshold": 85,
    "onlyNew": False,
    "maxRecalls": 500,
    "maxMatches": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("vesper_studio/eu-gpsr-product-recall-matcher").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 '{
  "sources": [
    "safety_gate",
    "rappelconso"
  ],
  "catalogItems": [],
  "catalogFormat": "auto",
  "lookbackDays": 30,
  "categories": [],
  "notifyingCountries": [],
  "riskLevels": [],
  "excludeFood": false,
  "fuzzyThreshold": 85,
  "onlyNew": false,
  "maxRecalls": 500,
  "maxMatches": 1000
}' |
apify call vesper_studio/eu-gpsr-product-recall-matcher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vesper_studio/eu-gpsr-product-recall-matcher"
        }
    }
}
```

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/3OigYda3t3Lmdj3Af/builds/VYl8aumOCeCxffAyW/openapi.json
