Skip to content

v2.1.0

Choose a tag to compare

@github-actions github-actions released this 01 Jan 21:46
· 14 commits to main since this release

Pre-defined Specs and Contextual Normalizers

Added

  • Add pre-defined Specs for common field types:
    • KeywordSpec for identifiers, codes, and enums with exact matching, optional whitespace stripping, and int-to-string conversion
    • TextSpec for free-form text with fuzzy matching and comprehensive normalization (lowercase, strip, collapse spaces, remove accents)
    • NumericSpec for numeric fields with intelligent type coercion (JSON Number → Python int/float) and optional tolerance-based similarity
    • BooleanSpec for boolean fields with exact matching and value conversion
    • DatetimeSpec for datetime strings with ISO format normalization, auto-detection of common formats, and time difference tolerance for similarity
  • Add contextual normalizers that receive FieldContext (field name, type, and spec) for type-aware normalization
  • Add FieldContext dataclass to pass context information to normalizers
  • Add datetime_similarity_factory() for datetime comparison with optional time difference tolerance
  • Add automatic detection of normalizer signature (simple 1-param vs contextual 2-param) in BaseModel

Updated

  • Update FieldSpec to support both simple and contextual normalizers
  • Update BaseModel._build_combined_normalizer() to handle contextual normalizers and pass FieldContext when needed
  • Update field processing to preserve all FieldSpec attributes when creating combined normalizers

Full Changelog: v2.0.0...v2.1.0