Skip to main content

datascope

PyPI version CI Python 3.10+ License: MIT

PyPI: pip install datascope-dq

Data created upstream — by manufacturing teams entering UPCs, inventory staff assigning product codes, offshore developers choosing column types — silently breaks systems downstream. A product code with letters where EDI expects numbers. Fifteen "N/A" strings buried in 500 numeric rows that pandas silently drops, skewing every calculation by 3%.

datascope finds these problems, explains what's wrong in plain English, and tells you what to fix. It reads each cell's actual type (not what pandas infers), detects hidden quality issues, classifies their severity by downstream impact, and generates a professional diagnostic report.


What It Finds

Detection Example Severity
Mixed types 485 numbers + 15 strings in a "numeric" column Critical
Sentinel values "N/A", "TBD", "pending" hiding in numeric data Critical
Missing values 50%+ of a column is blank — aggregations silently exclude those rows (below 50% is flagged Info) Warning
Leading-zero inconsistency "00123" alongside "456" — keys that won't match Warning
Mixed date formats "01/15/2026" and "2026-01-15" in the same column Warning
Suspected duplicate IDs 98% unique in an ID column — the other 2% will fan out joins Warning
Near-constant columns 1 distinct value across 10,000 rows Info

Each finding is expressed as assumption vs. reality: what the data appears to be vs. what it actually contains. Every finding includes a downstream impact explanation, a fix recommendation, and a prevention rule.

Note on CSV input: date strings written in formats the CSV loader recognizes (e.g. 2026-01-15 and 01/15/2026) are parsed to real dates at load time, so a CSV column mixing those two formats is normalized before analysis and does not raise a Mixed date formats finding. To surface mixed date formats, supply the column as text — for example in an .xlsx file with text-formatted cells, where the values stay strings and the check fires as expected.


Installation

pip install datascope-dq

For Parquet file support:

pip install datascope-dq[parquet]

Or install from source:

git clone https://github.com/MsShawnP/datascope.git
cd datascope
pip install -e .

Usage

# Analyze an Excel file
datascope data.xlsx

# Analyze a CSV
datascope sales_export.csv

# Analyze a Parquet file (requires pyarrow)
datascope data.parquet

# Specify a sheet and output directory
datascope data.xlsx --sheet Revenue --output-dir ./client_reports

Output Formats

# PDF report (default)
datascope data.xlsx

# Structured JSON for pipeline integration
datascope data.xlsx --format json

# Self-contained HTML report
datascope data.xlsx --format html

# Annotated Excel with highlighted problem cells
datascope data.xlsx --format annotated-excel

# PDF + JSON together
datascope data.xlsx --format both

CLI Flags

# Quiet mode — exit code only (0 = no critical, 1 = critical findings)
datascope data.xlsx --quiet

# Verbose mode — full tracebacks on analyzer failures
datascope data.xlsx --verbose

# Limit row count (default: warn at 500K cells, abort at 5M)
datascope huge_file.csv --max-rows 100000

Example Output

datascope: Analyzing sample_mixed_types.xlsx...
  200 rows x 4 columns

Found 2 findings:
  2 Critical  ########

Top critical findings:
  * revenue_mixed: However, 15 str values were found among 200 non-null values (the majority type covers 92.5%). Examples of unexpected values: 'N/A', 'N/A', 'N/A', and 2 more.
  * revenue_mixed: However, 7.5% of values (1 distinct sentinel string) are placeholder text rather than real data: 'N/A' (15 times).

Report saved: reports/sample_mixed_types_diagnostic.pdf

The Report

Reports are structured for non-technical readers — no jargon, no composite scores, no unexplained metrics.

Executive Summary — overall health assessment, finding counts by severity, top critical issues highlighted.

Findings by Severity — each finding presented as a card:

  • Assumption: what the data appears to be
  • Reality: what it actually contains
  • Impact: what breaks downstream
  • Recommended Fix: what to do now
  • Prevention Rule: what right looks like going forward

Field Inventory — summary table of all columns with their detected issue types and severity.

Findings are color-coded (red/amber/blue) and grouped by severity so readers know what to fix first.


How It Works

Most tools let pandas (or the SQL driver, or Excel) decide column types. A column with 485 numbers and 15 strings becomes float64 — the strings become NaN, the type problem disappears, and every downstream calculation is quietly wrong.

datascope reads each cell's actual Python type via openpyxl (for Excel) or raw-string inference (for CSV). This cell-level type detection is always on — there's no flag to enable it because skipping it defeats the purpose.

The analysis pipeline:

  1. Load — read with cell-level type preservation (no silent coercion)
  2. Detect — seven analyzers scan for type inconsistencies, sentinels, missing values, format issues, and cardinality anomalies
  3. Classify — severity assigned by downstream impact (critical = silent data loss, warning = likely misinterpretation, info = worth noting)
  4. Compose — plain-English narrative generated for each finding
  5. Report — output as PDF, HTML, JSON, or annotated Excel

Severity Model

Level Meaning Examples
Critical Silent data loss or incorrect calculations will occur Mixed types in numeric columns; sentinel values pandas drops without warning
Warning Key mismatches or misinterpretation likely Leading-zero stripping; ambiguous date formats; duplicate IDs; high null rates
Info Worth noting, no direct downstream breakage Near-constant columns; moderate missing values

Project Structure

datascope/
├── loaders/            # Excel, CSV, and Parquet with cell-level type tracking
│   ├── excel.py        # openpyxl-based, preserves per-cell Python types
│   ├── csv_loader.py   # Raw string inference with regex-accelerated datetime detection
│   ├── parquet.py      # Arrow schema → Python type mapping (optional pyarrow)
│   └── base.py         # Extension-based dispatch
├── analyzers/          # Seven detectors, each returns list[Finding]
│   ├── type_consistency.py
│   ├── sentinel.py
│   ├── format_check.py # Leading zeros + mixed dates
│   ├── cardinality.py  # Near-constant + duplicate IDs
│   └── missing_values.py
├── findings/           # Severity classifier + NL template engine
│   ├── severity.py     # Impact-based classification rules
│   ├── templates.py    # Plain-English templates per finding type
│   ├── composer.py     # Template dispatch
│   └── pipeline.py     # classify → compose → sort
├── reports/
│   ├── pdf.py          # Professional PDF with reportlab
│   ├── html.py         # Self-contained HTML with inline CSS
│   └── annotated_excel.py  # Highlighted cells + findings sheet
└── cli.py              # argparse CLI, pipeline orchestration

Requirements

  • Python 3.10+
  • pandas >= 2.0
  • openpyxl >= 3.1
  • reportlab >= 4.0
  • pyarrow >= 12.0 (optional, for Parquet support)

License

MIT


Built by Lailara LLC — data hygiene and analytics consulting for specialty food brands scaling into national retail.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datascope_dq-2.3.4.tar.gz (240.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datascope_dq-2.3.4-py3-none-any.whl (220.3 kB view details)

Uploaded Python 3

File details

Details for the file datascope_dq-2.3.4.tar.gz.

File metadata

  • Download URL: datascope_dq-2.3.4.tar.gz
  • Upload date:
  • Size: 240.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for datascope_dq-2.3.4.tar.gz
Algorithm Hash digest
SHA256 f074027cc139e7eafcaad465ee9a0012363df061634156b0d9fb9ad646a57841
MD5 6820a8f602ab1c62a29d145a1896487f
BLAKE2b-256 6188972d6ddf44c16231e8f59e66153178a91425b255a3491db443dbd77f2b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for datascope_dq-2.3.4.tar.gz:

Publisher: publish.yml on MsShawnP/datascope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datascope_dq-2.3.4-py3-none-any.whl.

File metadata

  • Download URL: datascope_dq-2.3.4-py3-none-any.whl
  • Upload date:
  • Size: 220.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for datascope_dq-2.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 29ae9e4c7720de43aeb282aa8a83ae459dce842bfa2430be6c60393dc4a06ce1
MD5 d857e9c7ebedb21b515fa4124ea731b4
BLAKE2b-256 e87274eede11ec186baef8a1ce601a3ba5363194bb3d8bd3fa40836e6d922719

See more details on using hashes here.

Provenance

The following attestation bundles were made for datascope_dq-2.3.4-py3-none-any.whl:

Publisher: publish.yml on MsShawnP/datascope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.3.4 This release

2 files

2.3.3

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

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