Repository navigation
v2.1.0
Pre-defined Specs and Contextual Normalizers
Added
- Add pre-defined Specs for common field types:
KeywordSpecfor identifiers, codes, and enums with exact matching, optional whitespace stripping, and int-to-string conversionTextSpecfor free-form text with fuzzy matching and comprehensive normalization (lowercase, strip, collapse spaces, remove accents)NumericSpecfor numeric fields with intelligent type coercion (JSON Number → Python int/float) and optional tolerance-based similarityBooleanSpecfor boolean fields with exact matching and value conversionDatetimeSpecfor 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
FieldContextdataclass 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
FieldSpecto support both simple and contextual normalizers - Update
BaseModel._build_combined_normalizer()to handle contextual normalizers and passFieldContextwhen needed - Update field processing to preserve all
FieldSpecattributes when creating combined normalizers
Full Changelog: v2.0.0...v2.1.0