Metadata-Version: 2.5
Name: rovidence-eval
Version: 0.1.0
Summary: Vendor-neutral robot pilot acceptance checks: availability, MTBF, MTTR, mission success, interventions, cost per task and payback, scored against your Go/No-Go gates.
Project-URL: Homepage, https://rovidence.com/tools/robot-pilot-evaluator
Project-URL: Methodology, https://rovidence.com/methodology
Project-URL: Sample report, https://rovidence.com/sample-report
Author-email: Rovidence <hello@rovidence.com>
License-Expression: MIT
License-File: LICENSE
Keywords: acceptance-testing,amr,availability,kpi,mtbf,pilot,procurement,robotics,warehouse
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Manufacturing
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Requires-Dist: pydantic<3,>=2.0
Requires-Dist: pyyaml>=6
Requires-Dist: rich>=13
Requires-Dist: typer>=0.9
Provides-Extra: test
Requires-Dist: packaging>=24; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# rovidence-eval

**Score a robot pilot against its Go/No-Go acceptance gates, using the same formulas as [rovidence.com](https://rovidence.com/methodology).**

> Not a terminal person? Use the browser version: **[rovidence.com/tools/robot-pilot-evaluator](https://rovidence.com/tools/robot-pilot-evaluator)**. Upload the same CSV, set the same gates, get the same verdict. No sign-up, and the file never leaves your browser.

`rovidence-eval` takes a pilot log (one row per shift or day, exported from a fleet manager, WMS or spreadsheet) and the buyer's acceptance gates, and returns:

- **Availability, MTBF, MTTR, mission success, interventions per 1,000 tasks, cost per task and payback**, overall and week by week
- a **pass/miss for every gate** and a **GO / CONDITIONAL GO / NO-GO** verdict, with the conditions a vendor has to close
- what's behind the numbers: the top failure and intervention causes, temperature context, and operator time spent on interventions
- a **JSON report with SHA-256 hashes** that anyone can check with `rovidence-eval verify`
- **exit codes** you can use to gate a pipeline

It's vendor-neutral and deterministic, and it runs offline. Every formula is a line-for-line port of the Rovidence app's metric engine. The test suite checks the results against vectors produced by the app's own TypeScript code, and the floats have to match exactly.

## Quick start

```sh
pip install rovidence-eval          # or: uv tool install rovidence-eval / pipx install rovidence-eval
rovidence-eval init                 # writes sample_pilot_log.csv + acceptance_gates.yaml
rovidence-eval run sample_pilot_log.csv --gates acceptance_gates.yaml
```

```text
ROVIDENCE PILOT EVALUATION   rovidence-eval 0.1.0
AMR each-picking pilot (illustrative sample) · Vendor A
12 weeks · 84 days · 216 rows · 2026-06-08 → 2026-08-29

Gate                          Target             Measured   Result
──────────────────────────────────────────────────────────────────
Availability                   ≥ 92%                91.2%    MISS
MTBF                         ≥ 200 h                212 h    PASS
MTTR                        ≤ 60 min               47 min    PASS
Mission success                ≥ 95%                96.8%    PASS
Interventions     ≤ 10 / 1,000 tasks   14.3 / 1,000 tasks    MISS
Cost per task                ≤ £0.15                £0.14    PASS
Payback                  ≤ 24 months            22 months    PASS
Availability 91.2%   Mission success 96.8%   MTBF 212 h   MTTR 47 min
╭──────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│   CONDITIONAL GO   5 of 7 acceptance gates met                                       │
│                                                                                      │
│  Proceed to a phased rollout, conditional on the vendor closing the gaps on          │
│  availability and interventions. Re-measure all acceptance gates at 90 days.         │
│                                                                                      │
│  Conditions                                                                          │
│  • Vendor to demonstrate availability ≥ 92% (measured 91.2%) at re-measurement.      │
│  • Vendor to demonstrate interventions ≤ 10 / 1,000 tasks (measured 14.3 / 1,000     │
│  tasks) at re-measurement.                                                           │
│                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────╯

What the numbers show
• #1 failure cause: Thermal faults, 38% of 98 failure events (site averaged 31.0°C).
• #1 intervention cause: Exception handling (damaged / unreadable items), 61% of 9,152
interventions.
• At ~2 minutes per intervention, that's ~305 hours of operator time over 12 weeks —
roughly 68% of a full-time role shifted onto your floor team.
• 3 safety events logged; safety checks took 1,160 minutes of scheduled time.

Computed locally with rovidence-eval from the supplied log. Not reviewed by Rovidence:
treat every figure as self-reported (Tier 3) until the underlying export is verified.
Formulas: https://rovidence.com/methodology
```

The sample is generated demo data for a 12-week, 12-AMR each-picking pilot. It reproduces the [Rovidence sample report](https://rovidence.com/sample-report) exactly.

## Exit codes

| Code | Meaning |
|---:|---|
| 0 | **GO**: every gate passed |
| 2 | **CONDITIONAL GO**: at least two-thirds of gates passed |
| 1 | **NO-GO**: fewer than two-thirds passed |
| 3 | The log or config failed validation (row-numbered errors on stderr) |
| 4 | No gates configured, so there's no verdict |
| 64 | Command-line usage error |

```sh
rovidence-eval run weekly_export.csv -g acceptance_gates.yaml -o report.json || echo "pilot not accepted ($?)"
```

## The pilot log (CSV)

This is the same format the Rovidence scorecard imports. Each row is one shift or one day, and every hour and minute figure is a fleet total.

```
date,shift,operating_hours,assigned_tasks,completed_tasks,failures,failure_causes,downtime_minutes,repair_minutes,interventions,intervention_causes,charging_events,charging_minutes_lost,safety_events,safety_check_downtime,support_labor_hours,ambient_temp_c
2026-06-08,Early,96,2568,2446,0,,30,0,39,exception_handling:22;rescue:12;restock_support:5,14,296,0,200,5.2,28.1
```

| Column | Rules |
|---|---|
| `date` | `YYYY-MM-DD`. Slash dates are rejected because `08/06/2026` means different days in the UK and the US |
| `shift` | Any label (`Early`, `Late`, `Night`). Leave it blank for a daily row |
| `operating_hours` | Required (scheduled) robot-hours, fleet total, > 0 |
| `assigned_tasks`, `completed_tasks` | Whole numbers; completed ≤ assigned |
| `failures`, `failure_causes` | `cause:count;…` using `mechanical`, `software`, `connectivity`, `thermal`, `charging`, `operator_override`. The counts must add up to `failures` |
| `downtime_minutes`, `repair_minutes` | Stoppage and repair minutes |
| `interventions`, `intervention_causes` | `rescue`, `exception_handling`, `restock_support`, `other`. The counts must add up to `interventions` |
| `charging_events`, `charging_minutes_lost` | Count only charging that takes up scheduled time |
| `safety_events`, `safety_check_downtime` | Safety events, and scheduled minutes lost to safety checks |
| `support_labor_hours` | Staff hours spent supporting the robots |
| `ambient_temp_c` | Optional. Used for thermal context |

Rows are grouped into pilot weeks counted from `pilot_start`, or from the earliest row if it isn't set. The whole file is validated before anything is calculated, and every error is reported with its row number. Run `rovidence-eval schema columns` for the JSON Schema.

**Your export uses different column names?** Rename the headers. Or, in the browser tool or the Rovidence scorecard, map your columns to these fields once.

## The pilot config (`acceptance_gates.yaml`)

```yaml
pilot_name: "AMR each-picking pilot"
vendor_name: "Vendor A"
pilot_start: 2026-06-08
currency: GBP

gates:                                # the buyer's thresholds, set before the pilot; omit any you don't use
  availability_min_pct: 92
  mtbf_min_hours: 200
  mttr_max_minutes: 60
  mission_success_min_pct: 95
  interventions_max_per_1000_tasks: 10
  cost_per_task_max: 0.15             # needs costs
  payback_max_months: 24              # needs costs + baseline

baseline:
  manual_throughput_per_hour: 92      # tasks per labour hour before the robots; needed for payback
  minutes_per_intervention: 2
  fte_hours_per_week: 37.5

costs:
  robot_monthly_cost: 20400           # fleet lease / RaaS / capex amortisation
  integration_cost: 84000
  integration_amort_months: 36
  maintenance_monthly: 1950
  labor_rate: 17.8                    # fully loaded, per hour
  total_investment: 273000
```

Unknown keys are errors, so a typo like `min_mmbi:` can't silently turn a gate off. The camelCase keys used by the web tool's JSON export (`availabilityMin`, `robotMonthlyCost`, …) are accepted too. Run `rovidence-eval schema config` for the full schema.

## How the numbers are calculated

| Metric | Formula |
|---|---|
| Availability | (operating hours − downtime − charging lost − safety-check downtime) ÷ operating hours. Nothing is excluded: the robot can't work while it charges or is being checked |
| MTBF | operating hours ÷ failures. With no failures, it's reported as *at least* the failure-free hours |
| MTTR | repair minutes ÷ failures |
| Mission success | completed ÷ assigned tasks |
| Interventions | interventions ÷ (completed tasks ÷ 1,000) |
| Cost per task | (robot cost + integration amortisation + maintenance + support labour) ÷ completed tasks, over the measured period |
| Payback | total investment ÷ (baseline labour cost for the same tasks − current monthly cost) |

Gates are compared at the precision they're reported at, so a displayed 91.2% never "passes" a 91.2% gate by a hidden decimal. Halves round up, as on rovidence.com.

**Verdict:** GO if every gate passes. CONDITIONAL GO if at least two-thirds pass; each miss becomes a condition. NO-GO otherwise. Full methodology: [rovidence.com/methodology](https://rovidence.com/methodology).

## Python API

```python
from rovidence_eval import evaluate_pilot_csv

report = evaluate_pilot_csv("sample_pilot_log.csv", "acceptance_gates.yaml")
print(report.verdict)                    # "GO" | "CONDITIONAL_GO" | "NO_GO" | None (no gates)
for gate in report.gates:
    print(gate.label, gate.value_text, gate.threshold_text, "PASS" if gate.pass_ else "MISS")
print(report.model_dump_json(by_alias=True, indent=2))
```

Lower-level functions are also exported: `parse_pilot_csv`, `aggregate_weeks`, `compute_metrics`, `evaluate_gates`, `verdict_for`, `PilotConfig` and `PilotDataError` (its `.errors` holds the row-numbered messages).

## Other commands

| Command | What it does |
|---|---|
| `rovidence-eval run LOG [-g gates.yaml] [-f table\|json\|markdown] [-o report.json\|report.md] [--weeks]` | Evaluate. `LOG` can be `-` for stdin |
| `rovidence-eval init [DIR] [--blank]` | Write the sample pilot, or an empty template with `--blank` |
| `rovidence-eval verify report.json [--log LOG]` | Check that the report hasn't been edited. With `--log`, also check that it reproduces from that exact file. This works on reports downloaded from the browser tool too |
| `rovidence-eval push LOG --api-key KEY` | Send rows to **your private** Rovidence evaluation through the upload API (in batches of 250, safe to resend). Nothing is published |
| `rovidence-eval schema columns\|config\|report` | Print a JSON Schema |

## What the report is and isn't

The JSON report records SHA-256 hashes of the input file, the config and the report itself. That proves the report hasn't been changed and makes it reproducible. It isn't a signature, and it doesn't prove the log is genuine. Results computed with this tool are **self-reported (Tier 3)** in Rovidence's [evidence tiers](https://rovidence.com/methodology) until the underlying export has been verified. Short pilots can miss rare failures and seasonal effects, so record the period, fleet size and workload alongside the verdict.

## Development

```sh
pip install -e ".[test]" && pytest
```

`tests/fixtures/ts_vectors.json` is generated by running the Rovidence app's TypeScript engine (`tools/gen_vectors.mts`). If you change a formula in the app, regenerate the vectors and the tests will show any drift:

```sh
cd ../rovidence-web && node --import tsx ../rovidence-eval/tools/gen_vectors.mts ../rovidence-eval/tests/fixtures/ts_vectors.json
```
### Each release: bump the version and push

1. Increase `__version__` in `src/rovidence_eval/__init__.py`, for example from `0.1.0` to `0.1.1`.
2. Commit and push to the repository's **default branch**, or merge a pull request containing the version bump.
3. **Publish to PyPI** detects the changed version, runs the full CI and package checks, creates tag `v0.1.1` and publishes a GitHub release with generated release notes, then uploads the exact tested distributions to PyPI. No manual tag or release is needed. Approve the `pypi` environment only if you configured a reviewer.
4. Confirm installation: `pip install rovidence-eval==0.1.1`, then `rovidence-eval --version`.

Unchanged versions and pushes to other branches do not release. Version decreases fail. Prerelease versions such as `0.2.0rc1` create GitHub prereleases. On an initial push with no previous version file, the current version is treated as the first release.

The workflow uses GitHub's built-in token to create the release and publishes to PyPI in the same run. No personal access token is needed. Keep the Trusted Publisher workflow filename as **`release.yml`**. If your `pypi` environment previously allowed only tags, also allow the default branch: automatic releases run from that branch.

Publishing a release manually remains supported. Its tag must match the package version, and the full checks still run. If automatic publishing fails after the GitHub release is created, rerun the failed workflow jobs; do not move an existing tag to another commit. PyPI does not allow replacing an uploaded version, so fixes to a published package require a new version. Duplicate uploads fail visibly.

### Check a release locally without uploading

From the CLI repository root, in a fresh virtual environment:

```sh
python -m pip install build twine
python -m build
python -m twine check --strict dist/*
python scripts/check_release.py
python -m pip install "dist/rovidence_eval-0.1.0-py3-none-any.whl[test]"
python scripts/smoke_test.py
python -m pytest -q
python -m pip check
```

Replace the wheel version when releasing a later version. Start with an empty `dist/` directory so old releases cannot be included accidentally. Set `RELEASE_TAG=v0.1.0` when running `check_release.py` to test the tag guard too. The smoke test runs `init`, evaluation, JSON export, verification and schema output from a temporary directory, so missing wheel resources are caught before publication.
