Repository navigation
fieldcheck: add uk/ca/de postal_code semantic type - #516
wufangyong973 wants to merge 2 commits into
Conversation
Signed-off-by: wufangyong973 <wufangyong973@users.noreply.github.com>
Signed-off-by: wufangyong973 <wufangyong973@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for working on this, @wufangyong973! The helper functions, normalization, and integration into However, there is a functional bug in the UK postcode regex that causes valid two-digit districts to fail: Issue: Two-digit UK districts fail validationIn _UK_POSTAL_RE = re.compile(r"^[A-Z]{1,2}[0-9][A-Z]{0,1}[0-9][A-Z]{2}$")Notice that
Interestingly, your docstring on line 91 explicitly lists Fix:Update _UK_POSTAL_RE = re.compile(r"^[A-Z]{1,2}[0-9][0-9A-Z]?[0-9][A-Z]{2}$")
_POSTAL_COMPACT_RE = re.compile(
r"^([A-Z]{1,2}[0-9][0-9A-Z]?[0-9][A-Z]{2}|[A-Z][0-9][A-Z][0-9][A-Z][0-9]|[0-9]{5})$"
)Please also add test cases in |
closes #512
each country gets its own compact regex: UK is 1-2 letters plus a district plus the inward, Canada alternates letter/digit, and the German PLZ is five digits. normalisation (uppercase + strip) happens in the per-cell step, the vectorised pre-screen only matches the space-free canonical form, so spaced or lowercase values fall through to the per-cell check and get re-decided there, same rhythm as email/url.