procurelytics-ai 0.1.0
AI-powered procurement analytics: predictive sourcing, spend optimization, process mining, ESG scoring, and responsible AI governance.
License: MIT
Requires Python: >=3.9
Keywords: ai, esg, governance, ml, process-mining, procurement, sourcing, spend-analytics

# procurelytics-ai

**procurelytics-ai** is an open-source Python library that delivers **AI-powered procurement analytics** for modern procurement and ERP environments.

It is designed to help teams transform raw procurement data into:
- **Predictive sourcing signals** (ML-based supplier health / risk scoring)
- **Spend optimization intelligence** (category/supplier consolidation hooks)
- **Process mining foundations** (variants, lead-time patterns; extensible)
- **ESG & sustainability scoring** (supplier responsibility insights)
- **Responsible AI governance checks** (data quality and representation proxy checks)
- **GenAI-ready prompts** (provider-agnostic prompts for copilots and LLMs)

The library is vendor-neutral and works with exports from **SAP/ERP systems**, procurement platforms, and analytics warehouses.

---

## Why procurelytics-ai?

Procurement teams often face these challenges:
- Lack of visibility into supplier performance risks
- Difficulty detecting where procurement cycles slow down
- ESG and compliance pressures with inconsistent data
- A need for executive-friendly insights, not just raw reports

**procurelytics-ai** provides explainable analytics primitives plus AI-ready outputs so you can:
- prioritize supplier strategies,
- reduce risk,
- improve resilience, and
- accelerate decision-making.

---

## Installation

Install from PyPI:

```bash
pip install procurelytics-ai
```
## Requirements
- Python 3.9+

## Quick Start (CLI)
### 1) Prepare a supplier dataset

#### Supported formats:

- .csv
 
- .json

- .jsonl

#### Recommended columns:

- supplier_id (required)

- esg_score (0..100)

- on_time_rate (0..1)

- defect_rate (0..1)

- country (optional)

- category (optional)

## Example CSV:

```
supplier_id,country,category,esg_score,on_time_rate,defect_rate
SUP-1,US,IT,88,0.93,0.01
SUP-2,IN,Hardware,72,0.84,0.03
SUP-3,US,IT,55,0.78,0.05
```

## 2) Run supplier scoring
```
procurelytics score-suppliers suppliers.csv
```

### You will get:

- top supplier ranking (health score)

- governance findings (data quality + representation proxy checks)

- a provider-agnostic GenAI prompt you can paste into any LLM/copilot

## Programmatic Usage
### Supplier feature engineering + ML scoring

```
import pandas as pd
from procurelytics_ai.ml.features import build_supplier_features
from procurelytics_ai.ml.predict import train_and_score_suppliers

df = pd.read_csv("suppliers.csv")
X = build_supplier_features(df)
ranked = train_and_score_suppliers(X)

print(ranked.head(10))
```

### ESG scoring (optional)

```
from procurelytics_ai.esg.scoring import weighted_esg_score

score = weighted_esg_score(
    supplier_id="SUP-1",
    factors={"co2_intensity": 0.7, "compliance": 0.9, "labor_risk": 0.8}
)

print(score.score, score.rationale)
```

### Responsible AI / Governance

- procurelytics-ai includes lightweight governance checks to support safer analytics:

#### Data quality report

- warns on high missingness

- flags invalid ESG score ranges

#### Representation proxy check

- warns when one group dominates the dataset (e.g., one country is 80%+)

- These checks are intentionally lightweight and transparent—useful for production workflows without heavy dependencies.

### GenAI Support

- procurelytics-ai generates a provider-agnostic GenAI prompt, so you can feed results into:

- internal copilots

- chatbots

- LLM tools (OpenAI / Vertex / Azure / local models)

- This package does not force any vendor lock-in.

### Testing
```
pytest
```

## Roadmap

#### Planned enhancements:

- CSV/BigQuery ingestion utilities

- Spend optimization modules (leakage detection, consolidation suggestions)

- Process mining expansion (rework loops, conformance scoring)

- Optional LLM adapters (kept modular)

#### Contributing

##### Contributions are welcome:

- new analytics modules

- data adapters for ERP platforms

- examples and notebooks

- documentation improvements


## MIT License

```
MIT License

Copyright (c) 2026 Jagadeesh Vasanthada

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```