{"version":"1.2.1","nb3-doctrine":"Bare 'Capitalised Capitalised' bigrams are intentionally NOT included in this pattern set. Scrubbing them would falsely match German medical terminology such as 'Diabetes Mellitus', 'Akute Otitis', 'Bilaterale Pneumonie', 'Morbus Crohn', and 'Ductus Arteriosus Botalli'. All name-matching patterns require an explicit honorific prefix (Dr., Hr., Fr.) to avoid this class of false positives.","patterns":[{"name":"kim-mail","regex":"(?:(?<![a-zA-Z0-9._%+\\-])|(?<=\\.kim\\.telematik))[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.kim\\.telematik","replacement":"[KIM-MAIL]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Domain-anchored to *.kim.telematik — negligible false-positive risk as this TLD is exclusive to the German Telematikinfrastruktur.","flags":"g"},{"name":"email","regex":"(?<![a-zA-Z0-9._%+\\-])[a-zA-Z0-9._%+\\-]{1,64}@[a-zA-Z0-9\\-]{1,63}(?:\\.[a-zA-Z0-9\\-]{1,63}){1,8}","replacement":"[EMAIL]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Requires a local part, '@' and a dotted domain, so a bare '@' or 'Dosis @ 8 Uhr' does not match. Runs after kim-mail, which keeps its own [KIM-MAIL] token for KIM addresses.","flags":"g"},{"name":"de-street-address","regex":"(?<![A-Za-zÄÖÜäöüß\\-])[A-ZÄÖÜ][a-zäöüß]{1,30}(?:-[A-ZÄÖÜ][a-zäöüß]{1,30}){0,3}(?:straße|strasse|str\\.?|weg|allee|platz|gasse|damm|ufer|chaussee|(?:\\s{1,3}|-)(?:Straße|Strasse|Str\\.?|Weg|Allee|Platz|Gasse|Damm|Ufer|Chaussee))\\s{0,3}\\d{1,4}(?!\\d)(?!\\s{0,3}(?:m|km|min|Min|Minuten|Meter|Std|h)(?![A-Za-zÄÖÜäöüß]))(?:\\s?[a-zA-Z](?![A-Za-zÄÖÜäöüß\\d]))?(?:-\\d{1,4}(?!\\d))?(?:,?\\s{1,3}(?:in\\s{1,3})?(?:D-)?\\d{5}(?!\\d)\\s{1,3}[A-ZÄÖÜ][a-zäöüß]{1,30}(?:-[A-ZÄÖÜ][a-zäöüß]{1,30}){0,3}(?:\\s{1,3}[A-ZÄÖÜ][a-zäöüß]{1,30}(?:-[A-ZÄÖÜ][a-zäöüß]{1,30}){0,3}){0,2}(?:\\s{1,3}(?:am|an\\s{1,3}der|im|in\\s{1,3}der|ob\\s{1,3}der|vor\\s{1,3}der|bei)\\s{1,3}[A-ZÄÖÜ][a-zäöüß]{1,30}(?:-[A-ZÄÖÜ][a-zäöüß]{1,30}){0,3})?)?","replacement":"[ADDRESS]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Requires a capitalised street name ending in a German street suffix (straße, strasse, str., str, weg, allee, platz, gasse, damm, ufer, chaussee) and a house number that is not followed by a unit word (m, km, min, Minuten, Meter, Std, h), so 'Gehweg 50 m' is not an address. The postal code and city are matched only after such a street, so a bare five-digit number before a capitalised noun ('10000 Einheiten') is not an address. The suffix 'ring' is excluded because it collides with medication forms ('Vaginalring 1 Stück'). Addresses without a street suffix ('Am Markt 3') are not covered (NB-3). Ordered before titled-name so a titled name directly before a street does not leave the house number, postal code or city behind.","flags":"g"},{"name":"titled-name","regex":"(Dr\\.|Hr\\.|Fr\\.)(\\s(?:med\\.|phil\\.|rer\\.|nat\\.|jur\\.))? [A-ZÄÖÜ][a-zäöüß]+(?:-[A-ZÄÖÜ][a-zäöüß]+)*(?:\\s[A-ZÄÖÜ][a-zäöüß]+(?:-[A-ZÄÖÜ][a-zäöüß]+)*)*","replacement":"[NAME]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Requires honorific prefix to avoid matching medical term bigrams (NB-3). Handles hyphenated surnames (Dr. Müller-Schmidt) and title modifiers (Dr. med.). Bare 'Capitalised Capitalised' patterns (e.g. 'Diabetes Mellitus', 'Morbus Crohn') are intentionally excluded.","flags":"g"},{"name":"date-de","regex":"\\b(0[1-9]|[12]\\d|3[01])\\.(0[1-9]|1[0-2])\\.(19|20)\\d{2}\\b","replacement":"[DATE]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Strict 4-digit year constraint (19xx/20xx) prevents matching version numbers or other numeric patterns.","flags":"g"},{"name":"phone-de","regex":"(?<![\\d\\-/])(?<!\\d[\\s/\\-])(?<!\\d\\s\\s)(?<!\\d\\s\\s\\s)(?:\\+49[\\s\\-/]{0,3}(?:\\(0\\)[\\s\\-/]{0,3})?\\d{1,4}[\\s\\-/]{0,3}\\d{5,9}|(?<!EBM\\s)(?<!EBM:\\s)(?<!EBM:)(?<!GOZ\\s)(?<!GOZ:\\s)(?<!GOZ:)(?<!GOÄ\\s)(?<!GOÄ:\\s)(?<!GOÄ:)(?<!GOA\\s)(?<!GOA:\\s)(?<!GOA:)(?<!BEMA\\s)(?<!BEMA:\\s)(?<!BEMA:)(?<!PZN\\s)(?<!PZN:\\s)(?<!PZN:)(?<!Pos\\s)(?<!Pos:\\s)(?<!Pos:)(?<!Position\\s)(?<!Position:\\s)(?<!Position:)(?<!Ziffer\\s)(?<!Ziffer:\\s)(?<!Ziffer:)(?<!Ziff\\s)(?<!Ziff:\\s)(?<!Ziff:)(?<!GNR\\s)(?<!GNR:\\s)(?<!GNR:)(?<!Leistung\\s)(?<!Leistung:\\s)(?<!Leistung:)(?<!OPS\\s)(?<!OPS:\\s)(?<!OPS:)(?<!ICD\\s)(?<!ICD:\\s)(?<!ICD:)\\(?0[1-9]\\d{0,2}\\)?(?:[\\s\\-]{1,3}|\\s/\\s)[1-9]\\d{6,8})(?!\\d)","replacement":"[PHONE]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Scrubs ONLY unambiguous phone numbers (product decision 2026-10-09 'in dubio pro text', cognovis/fhir-deidentification-de#20, bounded acceptance correction): medical correctness outranks silent PII over-redaction and an unimplemented physician-review fallback cannot authorise silently masking possible clinical content, so every genuinely ambiguous or labelled-clinical form is PRESERVED for the reviewed consumer path. Branch 1 -- a '+49' international number -- is ALWAYS scrubbed, even directly behind a clinical label ('Pos +49 40 1234567', 'Leistung: +49 171 5550123'): the country code is itself unambiguous, so the clinical-label guards do not apply to it, its separators are permissive (a bare slash is fine) and its subscriber block may lead with 0 ('+49 40/1234567', '+49 (0)30/12345678', '+49 171/5550123', '+49 40 0123456' all scrub). Branch 2 -- a national number with a trunk '0' plus an area code whose FIRST digit is NON-ZERO ('0[1-9]\\d{0,2}', a 2-4-digit area, optionally parenthesised) -- scrubs only when a separator is followed by a subscriber block of AT LEAST SEVEN digits starting with a NON-ZERO digit, and the area/subscriber slash must be space-padded (' / '); a bare slash is not a separator. The area shape is grounded in the German numbering plan, where every area code after the trunk 0 starts with a non-zero digit (030, 040, 0211, 0171) and '00' is the international access prefix, never a national area code. Two consequences keep clinical codes intact: a token whose FIRST group is FIVE digits ('03000') is not a 2-4-digit area and is PRESERVED as a possible EBM code, bare or under ANY label ('03000 1234567', 'Xyz 03000 1234567'); and a token whose area would be '00...' ('0010 1234567', 'GOZ 0010 1234567', '0030 1234567') is NOT a valid national phone and can only be a code (a GOZ number with leading zeros), so it too is PRESERVED. The '>=7'-digit subscriber rule additionally resolves the six-digit collision zone (EBM/GOZ composites collide at six digits -- '03000 123456', '03220 456789' -- while real phones carry a >=7-digit subscriber). Case-insensitive clinical/billing-label lookbehinds (the 'gi' flag), one per label in {EBM, GOZ, GOÄ, GOA, BEMA, PZN, Pos, Position, Ziffer, Ziff, GNR, Leistung, OPS, ICD} as '(?<!L )(?<!L: )(?<!L:)' placed ONLY before the national alternative, PRESERVE a NATIONAL phone-shaped token directly behind such a label ('Pos 03000 1234567', 'GNR 03000 1234567', 'Ziffer 03000 1234567', 'Pos: 03000 1234567', 'EBM 03000 1234567'), because its first group is a clinical code that must not be masked; they are not word-anchored, so a compound label ('Gebuehrenziffer 03000 1234567') stays preserved too, and a generic label such as bare 'Nr' is deliberately excluded so real phones after it still scrub. Also PRESERVED: bare or labelled slash-joined and six-digit composites regardless of label, case or punctuation ('03220/032210', '030/1234567', 'EBM: 03000/123456', 'Pos 03220 456789', bare '03000 123456'), 0-leading billing runs ('EBM 03000 03040', 'GOZ 0010 / 0030 / 0050', '(03000 03040)', 'EBM 03000 03040 123456', 'EBM 03000  03040 123456'), bare contiguous and six-digit clinical tokens ('PZN 01234567', '123456', '0123456'), fragmented/ambiguous numbers with no non-zero-leading >=7-digit subscriber block ('0221 4710', '040 123 4567', '0171 / 555 01 23', '(03491) / 123456'), and dosage or clinical-code forms ('0-0-1', '5-812.0'). Real phones still scrub, including the bare and phone-labelled '040 1234567', 'Tel. 040 1234567', 'Fax 030 1234567', '030 / 1234567' and '(040) / 1234567'. RESIDUAL (narrow): a phone-shaped token under a clinical label OUTSIDE the enumerated set is not guarded and is scrubbed; the label set must be extended when a new label is observed.","flags":"gi"},{"name":"kvnr-kvid10","regex":"\\b[A-Z][0-9]{9}\\b","replacement":"[KVNR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Single uppercase letter followed by exactly 9 digits. Combined entry for KVNR and KVID-10 for traceability in audit logs. May false-positive on certain medication batch codes, but KVNR leakage risk outweighs this.","flags":"g"},{"name":"lanr-bsnr","regex":"(?<!SNOMED\\s)(?<!SNOMED\\s\\s)(?<!SNOMED\\s\\s\\s)(?<!SNOMED:)(?<!SNOMED:\\s)(?<!SNOMED CT\\s)(?<!SNOMED CT\\s\\s)(?<!SNOMED CT:\\s)(?<!SNOMED-CT\\s)(?<!SNOMED-CT:\\s)(?<!SCTID\\s)(?<!SCTID:\\s)(?<!SNOMED CT:)(?<!SNOMED-CT:)(?<!SCTID:)\\b\\d{9}\\b","replacement":"[LANR-BSNR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"9-digit sequences match both LANR (Lebenslange Arztnummer) and BSNR (Betriebsstättennummer); unified pattern reduces implementation complexity. May match year+month+day combos, but acceptable given identifier sensitivity. Fixed-width negative lookbehinds exclude a nine-digit SNOMED CT concept identifier in SNOMED context -- the 'SNOMED' label with one to three trailing whitespace (so 'SNOMED\\r\\n' and 'SNOMED   ' with three spaces), the 'SNOMED:'/'SNOMED: ' colon forms, the spelled-out 'SNOMED CT '/'SNOMED CT: ', the hyphenated 'SNOMED-CT '/'SNOMED-CT: ', and the 'SCTID '/'SCTID: ' label, all case-insensitive via the 'gi' flag -- which is a clinical concept id, not a provider or practice identifier; bare and labelled LANR/BSNR values still match.","flags":"gi"},{"name":"de-lanr","regex":"\\bLANR[\\s:]*[1-9]\\d{8}\\b","flags":"gi","replacement":"[LANR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Label-anchored (LANR prefix required, case-insensitive). Avoids false positives on bare 9-digit billing numbers. Note: the generic lanr-bsnr pattern already covers bare 9-digit sequences; this pattern provides labeled-variant detection with higher specificity. The `flags: \"gi\"` field signals case-insensitive matching for consumers (JS RegExp does not support inline `(?i)`)."},{"name":"de-bsnr","regex":"\\bBSNR[\\s:]*\\d{9}\\b","flags":"gi","replacement":"[BSNR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Label-anchored (BSNR prefix required, case-insensitive). Same rationale as de-lanr. The `flags: \"gi\"` field signals case-insensitive matching for consumers (JS RegExp does not support inline `(?i)`)."},{"name":"de-age-adjective","regex":"\\b\\d{1,3}-j[aä]hrig[e]?[rnsm]?\\b","replacement":"[AGE]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Matches German age adjective forms: 82-jährige (nom.), 82-jährigen (gen/dat/acc pl.), 82-jähriger (gen./dat. masc.), 82-jährigem (dat. masc./neut.), 82-jähriges (gen. neut.). Does NOT match non-standard 82-jährigens. Digit prefix (1-3 digits) prevents false matches on standalone '-jährig' suffixes.","flags":"g"},{"name":"de-age-predicative","regex":"\\b\\d{1,3}\\s+Jahre?\\s+alt\\b","replacement":"[AGE]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Matches predicative age forms: '82 Jahre alt', '1 Jahr alt'. Requires 'alt' suffix to avoid matching clinical durations like '3 Jahre Verlauf'.","flags":"g"},{"name":"de-versnr","regex":"\\b\\d{3}-\\d{6}-\\d{5}-\\d{2}\\b","replacement":"[VERSNR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"German DRV pension/social insurance number format: 3-6-5-2 digit groups. Highly specific format; negligible false-positive risk.","flags":"g"},{"name":"de-kvnr-labeled","regex":"\\bKVNR[\\s:]*[A-Z]\\d{9}\\b","flags":"gi","replacement":"[KV-NR]","appliesTo":["note.text","free-text"],"falsePositiveRationale":"Higher-confidence labeled variant alongside existing bare kvnr-kvid10 pattern. KVNR prefix (case-insensitive) + standard KVID-10 format. The `flags: \"gi\"` field signals case-insensitive matching for consumers (JS RegExp does not support inline `(?i)`)."}]}