FastPII Docs
Detectors

Date of Birth

Detect Czech date-of-birth patterns with birth-context gating and normalized date metadata.

Purpose

Use the date_of_birth detector for Czech date-of-birth mentions in text.

This detector reports accuracy above 90% and favors dates that appear near birth-related context words.

It also extracts normalized date metadata and age-related information.

Detector Name

date_of_birth

Supported Formats

  • DD.MM.YYYY
  • DD. M. YYYY

Examples:

  • 15.03.1990
  • 15. 3. 1990
  • Narozen 15. 3. 1990

Validation Logic

The detector first validates the date itself, then checks whether birth-related context appears nearby.

Date Rules

  • Month must be 1-12
  • Day must fit the selected month
  • Leap years are handled for February
  • Year must be between 1900 and current year + 2

Context Gating

Birth context is checked in the text window before the matched date.

FastPII looks for words such as:

  • narozen
  • narozena
  • narození
  • datum narození

If birth context is present, the finding is emitted as date_of_birth.

If context is missing, the internal finding type can fall back to date even though the detector is the date-of-birth detector.

There is no checksum algorithm for this detector.

Python Examples

Detect a date of birth

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["cz"])
result = guard.detect("Narozen 15. 3. 1990", detector_names=["date_of_birth"])

for finding in result.findings:
    print(finding.type, finding.value, finding.metadata)

Validate a numeric date directly

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["cz"])
result = guard.validate("15. 3. 1990", "date_of_birth")

print(result.is_valid)
print(result.metadata)

Expected Metadata

This detector can return:

  • day
  • month
  • year
  • iso_date
  • age
  • zodiac_sign

Example Output

{
    "day": 15,
    "month": 3,
    "year": 1990,
    "iso_date": "1990-03-15",
    "age": 35,
    "zodiac_sign": "pisces",
}

Limitations

  • Validation only accepts numeric DD.MM.YYYY style input.
  • Context affects whether the finding type is date_of_birth or generic date.
  • Age is computed at runtime, so it changes over time.

Notes

Verified detection example from the codebase:

guard.detect("Narozen 15. 3. 1990")

On this page