OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7 / irish_core_generated_scanner_spec.py
temsa's picture
Publish rc7 with spec-driven scanner release
32bcb86 verified
Raw History Blame Contribute Delete
5 kB
# Generated by generate_scanner_spec.py from scanner_spec.yaml
# Do not edit by hand.
SCANNER_SPEC = {
"version": 1,
"description": "Human-readable scanner specification for the Irish core PII repair layer. This is not a pure PEG because several labels require semantic validation after lexical scanning, for example PPSN checksum validation and IBAN mod-97. The scanner therefore uses a two-stage contract: 1. a readable lexical scan spec 2. a deterministic validator per label\n",
"notes": [
"Candidate extraction is generated from this file.",
"Semantic validation stays in code so checksum and plausibility checks remain explicit.",
"The generated Python module is irish_core_generated_scanner_spec.py"
],
"char_classes": {
"PHONE_ALLOWED_CHARS": "+0123456789 -()",
"PASSPORT_ALLOWED_CHARS": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ",
"SORT_ALLOWED_CHARS": "0123456789 -",
"IBAN_ALLOWED_CHARS": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -",
"BIC_ALLOWED_CHARS": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"CARD_ALLOWED_CHARS": "0123456789 -"
},
"start_predicates": {
"plus_or_zero": {
"any_of": [
"+",
"0"
]
},
"ascii_letter": {
"builtin": "ascii_letter"
},
"ascii_digit": {
"builtin": "ascii_digit"
},
"iban_start": {
"any_of": [
"I",
"i"
]
}
},
"scanners": {
"PPSN": {
"kind": "delegate",
"function": "iter_ppsn_candidates",
"shape": "7 digits + check letter + optional suffix letter",
"examples_positive": [
"1234567T",
"1234567TW",
"1234567 T"
],
"examples_negative": [
"123456T",
"12345678T",
"2024T"
]
},
"POSTCODE": {
"kind": "delegate",
"function": "iter_eircode_candidates",
"shape": "routing key + optional space + 4-char unique identifier",
"examples_positive": [
"D02 X285",
"H91 F4A3"
],
"examples_negative": [
"D0X X285",
"ZZZ 1234"
]
},
"PHONE_NUMBER": {
"kind": "scan",
"start_predicate": "plus_or_zero",
"allowed_chars": "PHONE_ALLOWED_CHARS",
"min_len": 9,
"max_len": 24,
"validator": "is_valid_irish_phone",
"shape": "Irish national or +353 phone number, with optional separators",
"examples_positive": [
"0851234567",
"087 123 4567",
"+353 87 123 4567"
],
"examples_negative": [
"2024T",
"123456",
"+353 ABC"
]
},
"PASSPORT_NUMBER": {
"kind": "scan",
"start_predicate": "ascii_letter",
"allowed_chars": "PASSPORT_ALLOWED_CHARS",
"min_len": 9,
"max_len": 10,
"validator": "is_valid_passport",
"shape": "2 letters + 7 digits, optional internal space",
"examples_positive": [
"PA1234567",
"PA 1234567",
"NN5123456"
],
"examples_negative": [
"PA123456",
"123456789",
"PASS12345"
]
},
"BANK_ROUTING_NUMBER": {
"kind": "scan",
"start_predicate": "ascii_digit",
"allowed_chars": "SORT_ALLOWED_CHARS",
"min_len": 6,
"max_len": 8,
"validator": "is_valid_sort_code",
"shape": "6 digits or 3 groups of 2 digits separated by space/hyphen",
"examples_positive": [
"900118",
"90-01-18",
"90 01 18"
],
"examples_negative": [
"90-0018",
"90011",
"AB-01-18"
]
},
"ACCOUNT_NUMBER": {
"kind": "scan",
"start_predicate": "iban_start",
"allowed_chars": "IBAN_ALLOWED_CHARS",
"min_len": 22,
"max_len": 30,
"validator": "is_plausible_ie_iban",
"shape": "Irish IBAN, optional separators",
"examples_positive": [
"IE12 BOFI 9000 1712 3456 78",
"IE12BOFI90001712345678"
],
"examples_negative": [
"IE00TEST12345678901234",
"BOFI90001712345678"
]
},
"CREDIT_DEBIT_CARD": {
"kind": "scan",
"start_predicate": "ascii_digit",
"allowed_chars": "CARD_ALLOWED_CHARS",
"min_len": 13,
"max_len": 24,
"validator": "is_plausible_card",
"shape": "13-19 digits, compact or grouped",
"examples_positive": [
"4111111111111111",
"4111 1111 1111 1111"
],
"examples_negative": [
"0871234567",
"1234 5678 90"
]
},
"SWIFT_BIC": {
"kind": "scan",
"start_predicate": "ascii_letter",
"allowed_chars": "BIC_ALLOWED_CHARS",
"min_len": 8,
"max_len": 11,
"validator": "is_valid_bic",
"shape": "8 or 11 alphanumerics, first 6 letters",
"examples_positive": [
"BOFIIE2D",
"AIBKIE2DXXX"
],
"examples_negative": [
"BOFI1234",
"12345678"
]
}
}
}