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.
| Field | Type | Description |
|---|---|---|
type | str | PII type |
value | str | Matched value |
start | int | Start offset in the original text |
end | int | End offset in the original text |
confidence | float | Confidence score |
region | str | Region code |
metadata | dict[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().
| Field | Type | Description |
|---|---|---|
text | str | Original input text |
findings | list[Finding] | Detected findings |
detector_names | list[str] | Detector types represented in the final findings |
processing_time_ms | int | Detection 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().
| Field | Type | Description |
|---|---|---|
detector | str | Detector used for validation |
value | str | Original input value |
is_valid | bool | Validation outcome |
metadata | dict[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
}
}