# Maps Review Rating Change Dashboard (`practical_ai_lab_jp/pal-maps-ratings-change-dashboard`) Actor

Per-business rating shifts with confidence intervals and small-sample warnings from review exports you supply.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-maps-ratings-change-dashboard.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** Lead generation, SEO tools
- **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 business analyzeds

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

## Maps Review Rating Change Dashboard

Turn review exports you already hold into a per-business answer to one question: **did the average rating really move, or is it noise?**

For each business the Actor compares a recent window with a baseline window, reports the average change with a 95% confidence interval, shows the share of 1–2 star reviews, and attaches sample-size warnings. Businesses without enough data get an explicit `insufficient_data` status instead of a misleading number.

### What it does not do

- It does **not** scrape Google Maps or any other site and makes no network requests. You supply the data.
- It does not collect reviewer names or any personal data; only business, date and rating are read.

### Input

| Field | Meaning | Default |
|---|---|---|
| `reviews` | JSON array of rows with a business (`placeId`, `businessId` or `name`), `date` (YYYY-MM-DD) and `rating` (1–5). Optional `reviewId` removes duplicates. | – |
| `csvText` | Same data as CSV text with a header row. Combined with `reviews`. | – |
| `asOfDate` | End of the recent window. | newest review date |
| `recentDays` | Recent window length. | 90 |
| `baselineDays` | Baseline window, directly before the recent one. | 365 |
| `minReviewsPerWindow` | Minimum reviews in each window for a verdict. | 10 |
| `minMeaningfulShift` | Smallest shift (stars) reported as improved/declined. | 0.2 |
| `maxReviews` | Row cap to keep memory low. | 50000 |

Copyable example:

```json
{
  "csvText": "placeId,name,date,rating\ncafe-001,Harbor Cafe,2026-01-10,5\ncafe-001,Harbor Cafe,2026-09-05,2",
  "recentDays": 90,
  "baselineDays": 365,
  "minReviewsPerWindow": 10
}
```

That tiny example will return `insufficient_data` by design; provide at least `minReviewsPerWindow` reviews per window for a verdict.

### Output

One dataset row per business: `status` (`improved`, `declined`, `no_clear_change`, `insufficient_data`), `baselineMean`, `recentMean`, `ratingChange`, `changeCI95Low`, `changeCI95High`, counts per window, `lowStarShareRecent`/`lowStarShareBaseline`, `sampleConfidence` (`insufficient`, `low`, `adequate`) and a `warnings` list. A run summary is stored in the key-value store as `OUTPUT_SUMMARY`, including counts of invalid and duplicate rows.

### Method and limitations

- Welch's interval for the difference of means, using Student t critical values. Ratings are discrete 1–5 values and often skewed, so the interval is approximate, especially below about 30 reviews per window.
- A variance floor is applied so identical ratings do not give a falsely exact interval.
- `sampleConfidence` is `low` when the smaller window has fewer than 3× the minimum reviews.
- Results describe your export only. Exports may be incomplete, sampled or biased (for example by review filtering or deletion), and the Actor cannot detect that.
- Statistical significance is not a cause. A drop can come from a changed mix of reviewers, seasonality or a single event.
- Many businesses tested at once will show some chance "significant" results; no multiple-comparison correction is applied.
- Dates are compared as calendar days with no time-zone handling. Rows with unparseable dates or ratings outside 1–5 are skipped and counted.

### Pricing

The code emits a `business-analyzed` event for each business with a verdict. Rows with `insufficient_data` and failed runs are not charged. Pricing is not set in this repository.

### Local tests

`python -m unittest discover -s tests -t .` (offline, standard library only for the analysis modules).

# Actor input Schema

## `reviews` (type: `array`):

Array of objects. Recognised keys: businessId / placeId / name (business), date (YYYY-MM-DD), rating (1-5), optional reviewId.

## `csvText` (type: `string`):

Optional CSV text with a header row, e.g. placeId,name,date,rating. Combined with the JSON rows above.

## `asOfDate` (type: `string`):

YYYY-MM-DD end of the recent window. Defaults to the newest review date in your data.

## `recentDays` (type: `integer`):

Length of the recent window.

## `baselineDays` (type: `integer`):

Length of the baseline window that ends where the recent window starts.

## `minReviewsPerWindow` (type: `integer`):

Below this count in either window, no change verdict is given and the business is not charged.

## `minMeaningfulShift` (type: `number`):

A statistically clear shift smaller than this is reported as stable.

## `maxReviews` (type: `integer`):

Safety cap on accepted rows to keep memory low.

## Actor input object example

```json
{
  "reviews": [
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-01-10",
      "rating": 5
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-02-02",
      "rating": 4
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-09-05",
      "rating": 2
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-09-20",
      "rating": 3
    }
  ],
  "recentDays": 90,
  "baselineDays": 365,
  "minReviewsPerWindow": 10,
  "minMeaningfulShift": 0.2,
  "maxReviews": 50000
}
```

# 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 = {
    "reviews": [
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-01-10",
            "rating": 5
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-02-02",
            "rating": 4
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-09-05",
            "rating": 2
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-09-20",
            "rating": 3
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-maps-ratings-change-dashboard").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 = { "reviews": [
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-01-10",
            "rating": 5,
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-02-02",
            "rating": 4,
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-09-05",
            "rating": 2,
        },
        {
            "placeId": "cafe-001",
            "name": "Harbor Cafe",
            "date": "2026-09-20",
            "rating": 3,
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-maps-ratings-change-dashboard").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 '{
  "reviews": [
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-01-10",
      "rating": 5
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-02-02",
      "rating": 4
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-09-05",
      "rating": 2
    },
    {
      "placeId": "cafe-001",
      "name": "Harbor Cafe",
      "date": "2026-09-20",
      "rating": 3
    }
  ]
}' |
apify call practical_ai_lab_jp/pal-maps-ratings-change-dashboard --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-maps-ratings-change-dashboard"
        }
    }
}
```

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/Jzk3lWNlFpI5rUmUf/builds/Gcs4cSZdNOafLzid0/openapi.json
