Skip to content

feat: add first-class DateTime support#66

Merged
maskedsyntax merged 2 commits intomainfrom
feat/datetime-support
Mar 2, 2026
Merged

feat: add first-class DateTime support#66
maskedsyntax merged 2 commits intomainfrom
feat/datetime-support

Conversation

@maskedsyntax
Copy link
Member

Summary

  • Type inference: type_inference.py now detects datetime64 native dtypes and auto-parses object columns (>80% parseable → "DateTime"). Detection runs before cardinality-based categorical classification, so date columns with few unique values are no longer misclassified.
  • Config: New DateTimeThresholds dataclass in config.py with tunable parse threshold, future-date ratio, gap multipliers, and minimum row count.
  • 3 new checks in checks/datetime_checks.py:
    • datetime_future_dates — flags values timestamped in the future (data entry errors, clock skew)
    • datetime_gaps — detects anomalously large gaps vs. the median gap in a time series
    • datetime_monotonicity — warns when a high-uniqueness date column is out of temporal order
  • Richer summaries: _summarize_datetime now includes weekday distribution, hour distribution (sub-day precision), gap statistics (median/mean/min/max gap), monotonicity, future value count, and a has_time_component flag.
  • Removed deprecated infer_datetime_format argument from all pd.to_datetime calls.
  • 31 new tests in tests/test_datetime.py covering type inference, each check unit, summary fields, and end-to-end DatasetAnalyzer integration. All 150 tests pass (119 existing + 31 new).

Test plan

  • uv run pytest tests/test_datetime.py -v → 31/31 pass
  • uv run pytest tests/ --ignore=tests/test_datetime.py → 119/119 pass (no regressions)

… summaries

- type_inference.py: detect datetime64 dtypes and parse object columns
  (>80% parseable via pd.to_datetime → classified as "DateTime"); datetime
  detection runs before cardinality-based categorical check so date columns
  with few unique values are not misclassified
- config.py: add DateTimeThresholds (parse threshold, future-date ratio,
  gap multipliers, min rows) wired into HashPrepConfig
- checks/datetime_checks.py: three new checks —
    - datetime_future_dates: flags values timestamped in the future
    - datetime_gaps: detects anomalously large gaps vs. median gap
    - datetime_monotonicity: warns when a high-uniqueness date column is
      out of temporal order
- summaries/variables.py: enhance _summarize_datetime with weekday
  distribution, hour distribution (sub-day precision), gap statistics,
  monotonicity, future_count, and has_time_component flag; removed
  deprecated infer_datetime_format argument across all callers
- checks/__init__.py + core/analyzer.py: register three new checks in
  CHECKS registry and ALL_CHECKS list
- tests/test_datetime.py: 31 tests covering type inference, each check
  unit, summary fields, and end-to-end DatasetAnalyzer integration
@vercel
Copy link

vercel bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hashprep Ready Ready Preview, Comment Mar 2, 2026 5:15pm

@maskedsyntax maskedsyntax merged commit 8e97549 into main Mar 2, 2026
6 checks passed
@maskedsyntax maskedsyntax deleted the feat/datetime-support branch March 2, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant