File Record Validators
This page contains the reference API for the FileRecord pydantic validation model, its variants and dependencies.
dorsal.file.validators.file_record.FileRecord
pydantic-model
Bases: BaseModel
File annotation record.
Optionally includes validation hash.
Fields:
-
hash(SHA256Hash) -
validation_hash(Blake3Hash | None) -
quick_hash(QuickHash | None) -
similarity_hash(TLSHash | None) -
annotations(Annotations | None) -
tags(list[FileTag])
Validators:
-
_populate_and_validate_hashes_from_base -
_identical_hash_check
dorsal.file.validators.file_record.FileRecordDateTime
pydantic-model
Bases: FileRecord
A FileRecord with dates in the root level.
- This format is returned by the DorsalHub API
Fields:
-
hash(SHA256Hash) -
validation_hash(Blake3Hash | None) -
quick_hash(QuickHash | None) -
similarity_hash(TLSHash | None) -
annotations(Annotations | None) -
tags(list[FileTag]) -
all_hashes(None) -
all_hash_ids(None) -
date_created(AwareDatetime) -
date_modified(AwareDatetime)
Validators:
-
_populate_and_validate_hashes_from_base -
_identical_hash_check
dorsal.file.validators.file_record.FileRecordStrict
pydantic-model
Bases: FileRecord
File annotation record, including validation hash.
- Used for indexing new files and their metadata (including structured records and/or tags)
- This format is generated locally by a ModelRunner instance, it is not provided by the DorsalHub API.
Used in:
POST /file/public|private
Fields:
-
hash(SHA256Hash) -
quick_hash(QuickHash | None) -
similarity_hash(TLSHash | None) -
tags(list[FileTag]) -
validation_hash(Blake3Hash) -
annotations(Annotations) -
source(Literal['disk', 'cache', 'dorsalhub'])
Validators:
-
_populate_and_validate_hashes_from_base -
_identical_hash_check
dorsal.file.validators.file_record.Annotation
pydantic-model
Bases: BaseModel
Container for a single annotation record (e.g. file/pdf)
Attributes:
- record - e.g. PDFValidationModel - a single file annotation record
- source - has attributes (e.g. version) relevant to production of record
Fields:
-
record(GenericFileAnnotation | None) -
private(bool) -
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.Annotations
pydantic-model
Bases: BaseModel
File annotation container.
Config:
extra:allowpopulate_by_name:True
Fields:
-
file_base(Annotation_Base) -
file_ebook(Annotation_Ebook | None) -
file_mediainfo(Annotation_MediaInfo | None) -
file_office(Annotation_OfficeDocument | None) -
file_pdf(Annotation_PDF | None)
Validators:
-
_validate_and_type_extras
dorsal.file.validators.file_record.AnnotationSource
module-attribute
AnnotationSource = Annotated[
Union[
AnnotationModelSource,
AnnotationManualSource,
AnnotationUserUnknownSource,
AnnotationUserRecordSource,
],
Field(discriminator="type"),
]
dorsal.file.validators.file_record.Annotation_Base
pydantic-model
Bases: Annotation
Fields:
-
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None) -
record(FileCoreValidationModel) -
private(None)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.Annotation_Ebook
pydantic-model
Bases: Annotation
Fields:
-
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None) -
record(EbookValidationModel | None) -
private(bool)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.Annotation_MediaInfo
pydantic-model
Bases: Annotation
Fields:
-
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None) -
record(MediaInfoValidationModel | None) -
private(bool)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.Annotation_OfficeDocument
pydantic-model
Bases: Annotation
Fields:
-
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None) -
record(OfficeDocumentValidationModel | None) -
private(bool)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.Annotation_PDF
pydantic-model
Bases: Annotation
Fields:
-
source(AnnotationSource) -
schema_version(str | None) -
group(AnnotationGroupInfo | None) -
record(PDFValidationModel | None) -
private(bool)
Validators:
-
_validate_record_size→record
dorsal.file.validators.file_record.GenericFileAnnotation
pydantic-model
Bases: BaseModel
A container for arbitrary annotation record data, allowing any fields.
Used in LocalFile._add_annotation when the annotation being added is a dictionary.
Config:
extra:allow