FastPII Docs
Reference

Data Models

Detailed reference for Finding, DetectionResult, and ValidationResult.

FastPII exports three public data models from fastpii.

Finding

Finding describes one detected PII span.

FieldTypeDescription
typestrPII type
valuestrMatched value
startintStart offset in the original text
endintEnd offset in the original text
confidencefloatConfidence score
regionstrRegion code
metadatadict[str, Any]Detector-specific metadata

Example JSON:

{
  "type": "rodne_cislo",
  "value": "8001011238",
  "start": 42,
  "end": 52,
  "confidence": 0.95,
  "region": "cz",
  "metadata": {
    "checksum_valid": true,
    "birth_date": "1980-01-01",
    "gender": "male",
    "article_9": true
  }
}

DetectionResult

DetectionResult is returned by PrivacyGuard.detect().

FieldTypeDescription
textstrOriginal input text
findingslist[Finding]Detected findings
detector_nameslist[str]Detector types represented in the final findings
processing_time_msintDetection runtime in milliseconds

Example JSON:

{
  "text": "Jan Novák, email: jan.novak@email.cz, RČ: 8001011238, IČO: 25596641",
  "findings": [
    {
      "type": "name",
      "value": "Jan Novák",
      "start": 0,
      "end": 9,
      "confidence": 0.95,
      "region": "cz",
      "metadata": {
        "firstname": "Jan",
        "surname": "Novák",
        "gender": "m",
        "full_name": "Jan Novák"
      }
    },
    {
      "type": "email",
      "value": "jan.novak@email.cz",
      "start": 18,
      "end": 36,
      "confidence": 0.95,
      "region": "cz",
      "metadata": {
        "local_part": "jan.novak",
        "domain": "email.cz",
        "is_czech_domain": true,
        "provider": "email"
      }
    }
  ],
  "detector_names": ["name", "email", "rodne_cislo", "ico"],
  "processing_time_ms": 0
}

ValidationResult

ValidationResult is returned by PrivacyGuard.validate().

FieldTypeDescription
detectorstrDetector used for validation
valuestrOriginal input value
is_validboolValidation outcome
metadatadict[str, Any]Extracted metadata

Example JSON:

{
  "detector": "rodne_cislo",
  "value": "8001011238",
  "is_valid": true,
  "metadata": {
    "checksum_valid": true,
    "birth_date": "1980-01-01",
    "gender": "male",
    "article_9": true
  }
}

On this page