Source code for paperap.models.document.suggestions.model

"""
Document suggestions module for Paperless-NgX.

This module provides the DocumentSuggestions model which represents AI-generated
suggestions for document metadata based on document content analysis.
"""

from __future__ import annotations

from datetime import date
from typing import List

from paperap.models.abstract import StandardModel


[docs] class DocumentSuggestions(StandardModel): """ Represents AI-generated suggestions for a Paperless-NgX document. The DocumentSuggestions model contains lists of suggested metadata IDs that Paperless-NgX's AI has determined might be appropriate for a document based on its content analysis. These suggestions can be used to quickly apply metadata to documents during processing. All fields in this model are read-only as they are generated by the Paperless-NgX server and cannot be modified by clients. Attributes: correspondents (list[int]): List of suggested correspondent IDs that might be associated with this document. tags (list[int]): List of suggested tag IDs that might be relevant to this document's content. document_types (list[int]): List of suggested document type IDs that might categorize this document. storage_paths (list[int]): List of suggested storage path IDs where this document might be stored. dates (list[date]): List of suggested relevant dates extracted from the document content. Examples: >>> # Get suggestions for a document >>> doc = client.documents.get(123) >>> suggestions = client.document_suggestions.get(doc.id) >>> >>> # Apply suggested tags to the document >>> if suggestions.tags: ... doc.tags.extend(suggestions.tags) ... doc.save() """ correspondents: list[int] = [] tags: list[int] = [] document_types: list[int] = [] storage_paths: list[int] = [] dates: list[date] = []
[docs] class Meta(StandardModel.Meta): """ Metadata for the DocumentSuggestions model. This class defines metadata for the DocumentSuggestions model, including which fields are read-only. """ read_only_fields = {"correspondents", "tags", "document_types", "storage_paths", "dates"}