Skip to main content

StorAI

storai is a reusable Python library that generates business insights from:

  • summary-level data (monthly/periodic KPIs), and
  • optional source-level data (row-level transactions/events).

It returns display-ready output, human-readable insights, reasons, and optional ML findings.

Install

pip install storai

Postgres support (driver):

pip install "storai[postgres]"

For development:

pip install -e ".[dev,test,postgres]"

Quick Start

DataFrame input

import pandas as pd
from storai import analyze

summary_df = pd.DataFrame(
    {
        "year": [2025, 2025, 2025, 2025],
        "month": [7, 8, 9, 10],
        "payment": [391585.01, 342235.81, 402424.61, 434446.20],
        "visit_count": [1474, 1309, 1428, 1433],
    }
)

source_df = summary_df.copy()

result = analyze(summary_df=summary_df, source_df=source_df)
print(result["insights"])

SQL input

from sqlalchemy import create_engine
from storai import analyze

engine = create_engine("postgresql+psycopg2://user:pass@host:5432/db")

summary_sql = """
select year, month, sum(payment_amount) as payment, sum(visit_count) as visit_count
from semantic.tbl_executive_summary
where year = 2025 and month in (7,8,9,10)
group by 1,2
"""

source_sql = """
select *
from semantic.tbl_executive_summary
where year = 2025 and month in (7,8,9,10)
"""

result = analyze(summary_sql=summary_sql, source_sql=source_sql, db_engine=engine)
print(result["insights"])

Output Contract

{
  "display_df": pandas.DataFrame,
  "display_rows": list[dict],
  "source_sql": str | None,
  "insights": list[{"insight": str, "reason": str}],
  "ml_findings": {"outliers": list, "patterns": list},
}

Public API

  • storai.analyze(...)
  • storai.story(...) (alias of analyze)
  • storai.detect_insights(...)
  • storai.compute_metrics(...)
  • storai.detect_ml_findings(...)
  • storai.infer_schema(...)

Project Layout

The package uses src layout for clean packaging boundaries:

src/storai/
  api/
  application/
  analysis/
  core/
  data/
  domain/
  insights/
  metrics/
  ml/
  narrative/
  schema/
  utils/

Build And Publish

Build distributions:

python -m build

Validate artifacts:

python -m twine check dist/*

Upload:

python -m twine upload dist/*

License

MIT

Metadata

Release files for storai 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for storai 0.1.2
File Size Uploaded Provenance Actions
storai-0.1.2.tar.gz 25.7 kB Without provenance Details for storai-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for storai 0.1.2
File Interpreter ABI Platform Actions
storai-0.1.2-py3-none-any.whl Python 3 none any Details for storai-0.1.2-py3-none-any.whl

Total release size: 54.0 kB

Release files / storai-0.1.2.tar.gz

Download URL storai-0.1.2.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ce6678d360d3053f4af32ca8ffe9a31a89049b2b2714be80338755de5f15a9d1
BLAKE2b-256 checksum
How to use checksums
b5e52d478367fcb7c8176f4fde88370c24b375a675462df8f14104dc187cb62e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / storai-0.1.2-py3-none-any.whl

Download URL storai-0.1.2-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bda28393be437d18d44cee85397e440972a1456df70d790f6f1a79898011741b
BLAKE2b-256 checksum
How to use checksums
602bbacbe02f52e81fe5010b85f301c158a1ee57515e0c66a9a49565d824ae64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for storai 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page