Metadata-Version: 2.5
Name: rovidence-eval
Version: 0.1.2
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
```
or 
```sh
python -m pip install rovidence-eval
```

Python 3.9 or later. Check the installation with `rovidence-eval --version`. If your Python installation is managed by your OS, install in a virtual environment or use `pipx install rovidence-eval`.

## Quick start

Prefer a browser version? Use the free [pilot evaluator](https://rovidence.com/tools/robot-pilot-evaluator), with no signup or installation.

Now let's proceed to setup.
Run these commands in an empty working directory:

```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 a generated demo data for a 12-week AMR pilot. It intentionally returns **CONDITIONAL GO** with exit code **2**; this is a pilot result, not a command failure.

## Evaluate your own pilot

1. Create a separate working folder with an empty CSV template and starter gates:

   ```sh
   rovidence-eval init my-pilot --blank
   cd my-pilot
   ```

2. Fill `pilot_log.csv` with your shift or daily data. Keep the template headers and export as **CSV UTF-8**, with dates as `YYYY-MM-DD`. Hours and minutes are **fleet totals**: 12 robots scheduled for 8 hours means `operating_hours=96`. Downtime, charging losses and safety-check downtime must not overlap or exceed the scheduled minutes.
3. Edit `acceptance_gates.yaml` with your agreed thresholds. Delete any gate you don't need. The starter thresholds are examples, not recommendations. If you set `pilot_start`, rows before that date are ignored.
4. Evaluate and save a report:

   ```sh
   rovidence-eval run pilot_log.csv --gates acceptance_gates.yaml --out report.json
   ```

The terminal shows measured values against your targets. `report.json` contains the metrics, gates, verdict, weekly results and config used. Evaluation runs locally; it does not upload or publish your data.

If your export has different headers or units, rename/convert them to the [CSV format](https://github.com/Rovidencehq/rovidence-eval/blob/main/docs/reference.md#pilot-log-csv), or use the browser evaluator to map columns and download the converted CSV and gates for the CLI.

## Save and verify results

```sh
# JSON on stdout, suitable for another program
rovidence-eval run pilot_log.csv -g acceptance_gates.yaml --format json

# A readable Markdown file, including weekly results
rovidence-eval run pilot_log.csv -g acceptance_gates.yaml --out report.md

# Show weekly results in the terminal
rovidence-eval run pilot_log.csv -g acceptance_gates.yaml --weeks

# Check the JSON report and reproduce its results from the exact original CSV
rovidence-eval verify report.json --log pilot_log.csv
```

Keep the original CSV unchanged: even changing its line endings changes its hash. Reports are self-reported results until the underlying evidence is reviewed; a passing verdict or matching hash does not independently verify the source data.

## 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](https://github.com/Rovidencehq/rovidence-eval/blob/main/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 needs `costs.robot_monthly_cost` and `costs.labor_rate`. Payback also needs `baseline.manual_throughput_per_hour` and `costs.total_investment`. A configured gate with missing inputs counts as a miss. See the [config reference](https://github.com/Rovidencehq/rovidence-eval/blob/main/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 and `64` usage error. In scripts or CI, handle codes `1` and `2` as pilot verdicts, separately from validation and usage errors. The report is still written for GO, CONDITIONAL GO, NO-GO and no-gates results.

## 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 |

## Common problems

| Problem | What to check |
|---|---|
| `rovidence-eval` is not found | Activate the environment where you installed it; check with `python -m pip show rovidence-eval` |
| Row validation errors | Keep every required header, use non-negative numbers and whole-number counts, and ensure completed tasks do not exceed assigned tasks |
| Date or encoding errors | Export as CSV UTF-8 and use real `YYYY-MM-DD` dates without timestamps |
| Unexpected cost/payback misses | Enter the required costs and baseline, or remove those gates |
| NO VERDICT | Configure at least one gate; without `--gates`, the CLI uses `./acceptance_gates.yaml` if present |

Run `rovidence-eval --help` or `rovidence-eval run --help` for command options. See the [full reference](https://github.com/Rovidencehq/rovidence-eval/blob/main/docs/reference.md) for all columns, formulas and configuration fields.

## 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`.

Contributing? See the [development guide](https://github.com/Rovidencehq/rovidence-eval/blob/main/CONTRIBUTING.md).

## License

MIT
