# Order Risk Radar - Find Costly Order & Stock Issues (`northpeak_data/order-risk-radar`) Actor

Stop costly order mistakes before customers complain. Detect overdue orders, inventory shortages, supplier delays and stalled fulfillment. Get prioritized risk alerts, clear evidence and recommended next actions from your operations data. No ERP integration required.

- **URL**: https://apify.com/northpeak_data/order-risk-radar.md
- **Developed by:** [Northpeak Data](https://apify.com/northpeak_data) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 operational risk detecteds

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

## Order Risk Radar - Catch Costly Order, Stock & Supplier Issues Early

**Find the orders, stock shortages, and supplier delays that could cost you money, before they turn into customer problems.**

### Stop searching spreadsheets. Start fixing the right problems.

**Pricing clarity:** Results are individual risk findings written to the default dataset, not unique orders. One order can generate several findings, so the number of billed results may exceed the number of input orders. Check the current Store pricing before running large batches.

Order Risk Radar turns exported operational data into a ranked action list. It detects overdue orders, upcoming deadlines, orders with no recent progress, stock shortages, reorder alerts, and late linked suppliers. Every finding explains the evidence and recommends a concrete next step.

#### Quick start

1. Open **Input**. Paste your own operational data into at least one JSON array. Empty arrays produce no dataset results. To see a demonstration without billable dataset items, enable **Run a free-of-result-charges demo**. This option overrides even prefilled records; sample findings will be saved to the **SAMPLE_RESULTS** key-value record instead of the default dataset. The Actor-start fee may still apply.
2. Paste `orders`, `inventory`, or `suppliers` JSON arrays using the field names below.
3. Run the Actor. Review **Output** for ranked risks and **SUMMARY** for counts.
4. Export the dataset as JSON/CSV or use Apify's API and integrations.

Example input:

```json
{"orders":[{"orderId":"ORD-1001","status":"processing","promisedDate":"2026-10-10","lastUpdatedAt":"2026-10-08","sku":"SKU-A","quantity":10,"orderValue":800,"supplierId":"SUP-1"}],"inventory":[{"sku":"SKU-A","availableQuantity":3,"reorderPoint":5}],"suppliers":[{"supplierId":"SUP-1","status":"pending","expectedDeliveryDate":"2026-10-09"}]}
```

#### What you get

- **Priority and score:** critical/high/medium/low, sorted by urgency.
- **Evidence:** the dates, quantities, or supplier state behind each alert.
- **Recommended next action:** a clear operational task, not a generic dashboard.
- **Affected order value:** shown only when supplied; **not a prediction of financial loss**. An order may be included in multiple alerts.
- **API-friendly issue IDs:** deterministic identifiers suitable for downstream deduplication.

#### Scope and limitations

Version 0.1 analyzes supplied JSON records. It never silently substitutes billable demo records for empty input. Demo findings are available only when explicitly requested, and are stored outside the billable dataset. It does not connect to ERP systems, send alerts, autonomously repair orders, guarantee losses prevented, or deduplicate across runs. Date calculations use UTC-compatible JavaScript dates. Input data quality determines output quality. No claim of market exclusivity is made.

#### Prefilled input versus explicit demo mode

The Input form and generated API examples may contain a prefilled `DEMO-1001` order with related inventory and supplier records. **Running these prefilled records in normal mode is a real run**: any risk findings written to the default dataset may incur the published per-result charge, plus the Actor-start fee. The word `DEMO` in an order ID does **not** activate free demo mode.

To preview sample findings **without per-result dataset charges**, explicitly enable **Run a free-of-result-charges demo** in Input. This checkbox takes precedence over prefilled `DEMO-1001` and any other input arrays; no risk findings are written to the billable dataset. In that mode, inspect the `SAMPLE_RESULTS` key-value record rather than expecting billable findings in the default dataset. An Actor-start fee may still apply.

**Billing unit:** One detected risk finding, not one order or one input row. A single order can produce several risk findings. Review the current Store pricing before a large run.

#### Getting useful results

Supply real `orders`, `inventory`, or `suppliers` records to identify actionable issues. If you are evaluating the Actor for the first time, enable the explicit demo option and inspect the `SAMPLE_RESULTS` key-value record before preparing your own data. The demo does not create billable dataset findings, although an Actor-start fee may apply.

For recurring operational checks, run the Actor on updated data through an Apify Task or API integration. This version analyzes the data supplied in each run and does not automatically connect to your ERP or send notifications.

#### API contract and date handling

POST Input JSON to the Apify Actor run endpoint; retrieve the run's default dataset for normal findings. With `runSample: true`, supplied arrays are ignored and only `SAMPLE_RESULTS` contains fictional findings. Empty arrays return no findings. Date-independent stock-shortage example: `{ "orders": [{ "orderId": "DEMO-1001", "sku": "DEMO-SKU", "quantity": 10 }], "inventory": [{ "sku": "DEMO-SKU", "availableQuantity": 3, "reorderPoint": 5 }] }`. This normal-mode fictional example can produce billable findings.

Deadlines use UTC calendar days: `dueSoonDays: 0` means today, never tomorrow. Tests exercise actual Store schema prefill, empty data, sample override, dataset routing and deadline boundaries. Local tests do not certify the deployed version or daily Store health check.

#### Verified fictional example files

See `examples/fictional-input.json` and `examples/fictional-output.json`, captured from a local Apify SDK execution on 2026-11-04. These are fictional demonstration records, not live business results or proof of a deployed cloud run.

#### Copyable API request

Use the JSON from the example input file as `input.json`. Keep the token in an environment secret. This normal cloud request can incur published charges; review pricing first.

```bash
curl -X POST 'https://api.apify.com/v2/acts/northpeak_data~order-risk-radar/run-sync-get-dataset-items' \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @input.json
```

With `runSample: true`, the synchronous dataset endpoint returns an empty array by design. Start with `/runs`, read `defaultKeyValueStoreId` from the run response and retrieve `/v2/key-value-stores/{id}/records/SAMPLE_RESULTS` for that mode. Normal input writes to the dataset.

#### Connect an exported customer dataset

Provide `ordersDatasetId`, `inventoryDatasetId` and/or `suppliersDatasetId` from your existing Apify datasets. Each ID replaces its matching JSON array, including the Store prefill. Example: `{ "ordersDatasetId": "YOUR_ORDERS_DATASET_ID", "inventoryDatasetId": "YOUR_STOCK_DATASET_ID", "suppliers": [] }`. Rows use the same documented fields as pasted JSON. Existing datasets are read using your account's access; no scraper or ERP login is started. Source exports above `maxRecordsPerDataset` (default 10,000; maximum 50,000 per dataset) fail explicitly instead of silently omitting records. Sample mode ignores source IDs and uses only fictional records.

# Actor input Schema

## `orders` (type: `array`):

Fields: orderId, status, promisedDate, lastUpdatedAt, sku, quantity, orderValue, supplierId. Prefilled records are fictional demo data for the Store health check. Replace with your own records before production use.

## `inventory` (type: `array`):

Fields: sku, availableQuantity, reorderPoint. Prefilled records are fictional demo data for the Store health check. Replace with your own records before production use.

## `suppliers` (type: `array`):

Fields: supplierId, expectedDeliveryDate, status. Prefilled records are fictional demo data for the Store health check. Replace with your own records before production use.

## `staleOrderDays` (type: `integer`):

Flag active orders with no recorded update for this many days.

## `dueSoonDays` (type: `integer`):

Flag unshipped orders with promised delivery dates within this many days.

## `runSample` (type: `boolean`):

When enabled, ignore any prefilled or supplied operational records and write fictional sample findings to SAMPLE_RESULTS instead of the billable default dataset. The Actor-start charge may still apply.

## `ordersDatasetId` (type: `string`):

Optional existing Apify dataset ID. Replaces the orders array, including prefilled demo rows. No upstream Actor is started. Ignored in runSample mode.

## `inventoryDatasetId` (type: `string`):

Optional existing Apify dataset ID. Replaces the inventory array, including prefilled demo rows. No upstream Actor is started. Ignored in runSample mode.

## `suppliersDatasetId` (type: `string`):

Optional existing Apify dataset ID. Replaces the suppliers array, including prefilled demo rows. No upstream Actor is started. Ignored in runSample mode.

## `maxRecordsPerDataset` (type: `integer`):

Fail explicitly if a source export exceeds this cap; never silently truncate operational records.

## Actor input object example

```json
{
  "orders": [
    {
      "orderId": "DEMO-1001",
      "status": "processing",
      "promisedDate": "2025-01-08",
      "lastUpdatedAt": "2025-01-07",
      "sku": "DEMO-SKU",
      "quantity": 10,
      "orderValue": 800,
      "supplierId": "DEMO-SUP"
    }
  ],
  "inventory": [
    {
      "sku": "DEMO-SKU",
      "availableQuantity": 3,
      "reorderPoint": 5
    }
  ],
  "suppliers": [
    {
      "supplierId": "DEMO-SUP",
      "status": "pending",
      "expectedDeliveryDate": "2025-01-09"
    }
  ],
  "staleOrderDays": 3,
  "dueSoonDays": 2,
  "runSample": false,
  "maxRecordsPerDataset": 10000
}
```

# Actor output Schema

## `risks` (type: `string`):

Actionable order, inventory and supplier risk findings in the default dataset.

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

Run summary, data presence and demo mode details.

## `sampleResults` (type: `string`):

Demo-only findings stored outside the billed default dataset when runSample is enabled.

# 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 = {
    "orders": [
        {
            "orderId": "DEMO-1001",
            "status": "processing",
            "promisedDate": "2025-01-08",
            "lastUpdatedAt": "2025-01-07",
            "sku": "DEMO-SKU",
            "quantity": 10,
            "orderValue": 800,
            "supplierId": "DEMO-SUP"
        }
    ],
    "inventory": [
        {
            "sku": "DEMO-SKU",
            "availableQuantity": 3,
            "reorderPoint": 5
        }
    ],
    "suppliers": [
        {
            "supplierId": "DEMO-SUP",
            "status": "pending",
            "expectedDeliveryDate": "2025-01-09"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("northpeak_data/order-risk-radar").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 = {
    "orders": [{
            "orderId": "DEMO-1001",
            "status": "processing",
            "promisedDate": "2025-01-08",
            "lastUpdatedAt": "2025-01-07",
            "sku": "DEMO-SKU",
            "quantity": 10,
            "orderValue": 800,
            "supplierId": "DEMO-SUP",
        }],
    "inventory": [{
            "sku": "DEMO-SKU",
            "availableQuantity": 3,
            "reorderPoint": 5,
        }],
    "suppliers": [{
            "supplierId": "DEMO-SUP",
            "status": "pending",
            "expectedDeliveryDate": "2025-01-09",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("northpeak_data/order-risk-radar").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 '{
  "orders": [
    {
      "orderId": "DEMO-1001",
      "status": "processing",
      "promisedDate": "2025-01-08",
      "lastUpdatedAt": "2025-01-07",
      "sku": "DEMO-SKU",
      "quantity": 10,
      "orderValue": 800,
      "supplierId": "DEMO-SUP"
    }
  ],
  "inventory": [
    {
      "sku": "DEMO-SKU",
      "availableQuantity": 3,
      "reorderPoint": 5
    }
  ],
  "suppliers": [
    {
      "supplierId": "DEMO-SUP",
      "status": "pending",
      "expectedDeliveryDate": "2025-01-09"
    }
  ]
}' |
apify call northpeak_data/order-risk-radar --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,northpeak_data/order-risk-radar"
        }
    }
}
```

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/mGrsevmnoRl1M9SwI/builds/T51d5sLhzEPaPdvKj/openapi.json
