Metadata-Version: 2.5
Name: rovidence-eval
Version: 0.1.1
Summary: Evaluate warehouse robot pilot logs against acceptance thresholds (availability, MTBF, MTTR, mission success, interventions, cost, payback) with GO/NO-GO verdicts.
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 acceptance criteria from the command line or Python.

`rovidence-eval` reads a pilot log CSV (one row per shift or day, from a fleet manager, WMS or spreadsheet) and a YAML file of acceptance gates. It calculates availability, MTBF, MTTR, mission success, interventions per 1,000 tasks, cost per task and payback, then returns a **GO**, **CONDITIONAL GO** or **NO-GO** verdict.

It is deterministic and runs offline. It implements the published [Rovidence methodology](https://rovidence.com/methodology), and its results match the Rovidence app and the browser-based [pilot evaluator](https://rovidence.com/tools/robot-pilot-evaluator) exactly.

## Install

```sh
pip install rovidence-eval
```

Python 3.9 or later.

## Quick start
Prefer a browser version or need to share a visual summary with non-technical stakeholders? Use the web version at https://rovidence.com/tools/robot-pilot-evaluator.

```sh
rovidence-eval init        # writes sample_pilot_log.csv and acceptance_gates.yaml
rovidence-eval run sample_pilot_log.csv --gates acceptance_gates.yaml
```

```text
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

 CONDITIONAL GO   5 of 7 acceptance gates met
```

The sample is generated demo data for a 12-week AMR pilot.

## Inputs

**Pilot log (CSV):** one row per shift or day, with fleet totals:

```csv
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
```

The whole file is validated before anything is calculated. Errors are reported with their row numbers. See the [column reference](docs/reference.md#pilot-log-csv).

**Gates (YAML):** your thresholds. Leave out any gate you don't need:

```yaml
gates:
  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 and payback gates also need a `costs` and `baseline` section. See the [config reference](docs/reference.md#config-acceptance_gatesyaml).

## Verdict and exit codes

The CLI, public browser evaluator and main Rovidence app use the same convention:

- **Machine-readable `verdict`** (Python API and JSON): `GO`, `CONDITIONAL_GO`, `NO_GO`, or `null` (`None` in Python) when no gates are configured.
- **Display label** (`verdict_label` in Python/JSON; `verdictLabel` inside the web app): `GO`, `CONDITIONAL GO`, `NO-GO`, or `NO VERDICT`. Terminal, Markdown and web reports show these readable labels.

Use `verdict` in code and automation; do not parse the terminal label.

| `verdict` | Display label | Rule | Exit code |
|---|---|---|---:|
| `GO` | GO | Every gate passes | 0 |
| `CONDITIONAL_GO` | CONDITIONAL GO | At least two-thirds of gates pass | 2 |
| `NO_GO` | NO-GO | Fewer than two-thirds pass | 1 |
| `null` | NO VERDICT | No gates configured | 4 |

For example, `--format json` includes both:

```json
{
  "verdict": "CONDITIONAL_GO",
  "verdict_label": "CONDITIONAL GO"
}
```

Other exit codes: `3` invalid input, `4` no gates configured, `64` usage error. A scheduled job can therefore act on the result directly:

```sh
rovidence-eval run weekly_export.csv -g acceptance_gates.yaml -o report.json || notify-team "$?"
```

## Commands

| Command | Description |
|---|---|
| `run LOG [-g GATES] [-f table\|json\|markdown] [-o FILE] [--weeks]` | Evaluate a log. `LOG` can be `-` for stdin. `-o` writes JSON, or Markdown for `.md` |
| `init [DIR] [--blank]` | Write the sample files, or empty templates |
| `verify REPORT [--log LOG]` | Check that a JSON report hasn't been edited and, with `--log`, that it reproduces from that file |
| `push LOG --api-key KEY` | Upload rows to a private evaluation on rovidence.com (optional) |
| `schema columns\|config\|report` | Print a JSON Schema |

## Python API

```python
from rovidence_eval import evaluate_pilot_csv

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

Invalid input raises `PilotDataError`; its `.errors` list holds the row-numbered messages. Lower-level functions are also exported: `parse_pilot_csv`, `aggregate_weeks`, `compute_metrics`, `evaluate_gates` and `verdict_for`.

## Development

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

The tests compare results against vectors generated from the Rovidence app's TypeScript engine (`tests/fixtures/ts_vectors.json`). Regenerate them with `tools/gen_vectors.mts` after any change to the methodology.

To release, bump `__version__` in `src/rovidence_eval/__init__.py` and merge to the default branch. CI runs the tests, creates the GitHub release and publishes to PyPI.

## License

MIT
