Omni Data Refinement — Professional API Reference
DatasetThe Dataset class is the main entry point to OMR. It wraps a Pandas DataFrame and attaches intelligent engines to it.
from omr import Dataset import pandas as pd df = pd.read_csv("data.csv") dataset = Dataset(df)
Dataset.summary()Prints a highly optimized, single-line summary of your dataset. Ideal for quick pulse checks.
Dataset (returns self for chaining)dataset.summary()
# > [Dataset] 1000 rows × 5 cols | Missing: 12 (1.2%) | Duplicates: 0 | Health: 98.5/100
Dataset.health()Executes the comprehensive 5-Pillar Data Quality assessment (Completeness, Uniqueness, Consistency, Validity, Conformity).
HealthReport object containing the .score and .issues list.HealthEngine that analyzes null density, duplication rates, and type uniformity.report = dataset.health() print(f"Dataset Health: {report.score}/100")
Dataset.profile()Generates a full statistical profile for every column in the dataset.
Dataset (returns self for chaining).info().dataset.profile()
Dataset.clean()Automatically resolves all data quality issues detected during the health() check.
Dataset (returns self for chaining)dataset.health() # Identifies the issues dataset.clean() # Fixes them automatically
Dataset.explain_changes()Prints a detailed "Transformation Log" showing exactly what clean() (or any other mutation) changed.
Dataset (returns self for chaining)DatasetMetadata.transformations to provide an auditable log of operations.dataset.clean() dataset.explain_changes()
Dataset.analyze()Runs deep statistical analysis to detect complex machine learning hazards.
Dataset (returns self for chaining)StatisticsEngine detects extreme outliers (via IQR/Z-score), highly skewed distributions, multicollinearity between features, and class imbalances.dataset.analyze()
Dataset.compare(other: Dataset)Detects data drift by comparing the statistical distributions of the current dataset against a reference dataset.
other (The reference dataset, e.g., historical data).Dataset (returns self for chaining)prod_data = Dataset(pd.read_csv("prod.csv"))
dataset.compare(prod_data)
Dataset.explain(issue: str)Acts as a built-in AI Data Science tutor.
issue (The name of the statistical issue, e.g., "data_leakage", "class_imbalance").dict containing explanation keys.dataset.explain("class_imbalance")
Dataset.validate(schema: Dict)Enforces strict business rules against the dataset.
schema (A dictionary mapping column names to OMR schema constraints).Dataset (returns self for chaining)from omr import schemas rules = { "age": schemas.PositiveInteger(max=120), "email": schemas.Email() } dataset.validate(rules)
Dataset.snapshot(name: str = "", description: str = "")Saves a checkpoint of your dataset's current state in memory.
int (The unique Version ID).v_id = dataset.snapshot(name="v1", description="Pre-cleaning state")
Dataset.rollback(version_id: int)Reverts the dataset back to a previous snapshot in memory.
Dataset (returns self for chaining)dataset.rollback(1)
Dataset.export()Returns the cleaned, refined underlying Pandas DataFrame.
pd.DataFrameclean_df = dataset.export() model.fit(clean_df)
omr.schemasOMR provides built-in constraint types for strict schema validation. Every schema accepts a not_null boolean argument (default: True), which dictates whether missing values are permitted.
PositiveInteger(min=1, max=None): Validates that values are integers ≥ min and ≤ max.PositiveFloat(min=0.0, max=None): Validates that values are floats > min and ≤ max.NonNegative(): Validates that all numerical values are ≥ 0.OneOf(*values): Validates that values belong to an explicit allowed set (e.g. OneOf("active", "inactive")).Email(): Validates standard email address formats via Regex.Regex(pattern: str): Validates strings against a custom Regular Expression pattern.NotNull(): Ensures the column contains absolutely no missing or null values.MinLength(length: int): Ensures string lengths are at least length characters long.MaxLength(length: int): Ensures string lengths do not exceed length characters.MonitorThe Monitor class is used in production pipelines to track dataset health over time and issue alerts when anomalies occur.
Monitor.watch(dataset: Dataset)Registers a baseline dataset to establish the mathematical "norm" (means, volumes, null frequencies).
from omr import Monitor monitor = Monitor() monitor.watch(historical_dataset)
Monitor.check(new_data: pd.DataFrame)Evaluates incoming data against the registered baseline to detect sudden drops in volume, massive shifts in column means, or spikes in missing values.
list[Alert]alerts = monitor.check(new_daily_batch) for alert in alerts: print(f"[{alert.severity}] {alert.check}: {alert.message}")