You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(validation): add context-aware postal code validators for UK, Canada, and Germany #512
As outlined in the Contributor Roadmap (Level 2: Component Improvements), international tabular datasets frequently contain regional postal and zip codes. Adding dedicated validation support for common international formats helps users validate addresses and geographic fields safely without custom regex scripts.
Task
Implement context-aware postal code regex patterns in src/freshdata/fieldcheck.py for:
United Kingdom (UK): e.g. SW1A 1AA, EC1A 1BB, W1A 0AX
Canada: e.g. K1A 0B1, M5V 2T6
Germany (PLZ): e.g. 10115, 80331 (5-digit numeric strings)
Add corresponding unit test cases in tests/test_fieldcheck.py to ensure valid codes pass, invalid patterns fail cleanly, and edge cases (lowercase, varying whitespace) are properly handled or normalized.
Acceptance Criteria
Add compiled regex patterns or helper functions in src/freshdata/fieldcheck.py supporting UK, Canadian, and German postal codes.
Integrate into validate_fields pattern matching or field specification lookup.
Add unit tests in tests/test_fieldcheck.py covering positive matches, negative matches, and edge cases.
Tests execute fast and pass cleanly with pytest tests/test_fieldcheck.py --no-cov.
Code adheres to style and type standards (ruff check . and mypy src/freshdata/fieldcheck.py).
Activity