#2313·presidio

Feature Request: Add French social security number recognizer (FR_NIR)

Author: 32bitsretCreated Sep 29, 2026Updated Sep 29, 2026

Is your feature request related to a problem? Please describe. Presidio has no recognizer for the French NIR (numéro de sécurité sociale, the number on the carte Vitale). It is the primary personal identifier in France, appears on payslips, tax and health documents, and is exactly the kind of value that must never reach a model or a log. Today it is only caught if a generic number pattern happens to match, with no validation.

Describe the solution you'd like A country-specific pattern recognizer, FrNirRecognizer, emitting a new entity FR_NIR, under predefined_recognizers/country_specific/france/.

  • 15 digits: sex, year and month of birth, département, commune, order number, then a 2-digit key computed as 97 - (first 13 digits mod 97) per INSEE (https://www.insee.fr/fr/metadonnees/definition/c1409). Corsican départements 2A/2B are substituted with 19/18 before the checksum.
  • Regex for the structure, validate_result for the checksum, so a 15-digit number with a wrong key is rejected.
  • Accepts compact, space- and dot-separated forms.
  • French and English context words (sécurité sociale, carte vitale, NIR, ameli, social security number).
  • COUNTRY_CODE = "fr", enabled: false by default in default_recognizers.yaml with country_code: fr, following the guidelines for country-specific recognizers.
  • Entry in docs/supported_entities.md under a new France section.

Describe alternatives you've considered Matching the NIR with a generic 15-digit pattern: too many false positives and no way to reject malformed numbers. A custom recognizer configured per deployment: works, but every French user of Presidio would rebuild the same checksum logic.

Additional context No public dataset of real NIRs exists, so validation is checksum-based and tested on synthetic checksum-valid and checksum-invalid numbers, with and without separators, including a Corsican code. I have a branch ready with the recognizer, tests, YAML entry and docs, and will open a PR referencing this issue.

Source: data-privacy-stack/presidio