File size: 2,864 Bytes
41fae03
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bbbfba8
41fae03
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""Domain enums — single source of truth for all status and classification values.

These enums are used across the canonical document, provenance, readiness,
and viewer projection models. They carry no logic — only values.
"""

from __future__ import annotations

from enum import StrEnum

# -- Geometry ----------------------------------------------------------------


class GeometryStatus(StrEnum):
    """How a piece of geometry was obtained."""

    EXACT = "exact"
    INFERRED = "inferred"
    REPAIRED = "repaired"
    UNKNOWN = "unknown"


class CoordinateOrigin(StrEnum):
    """Origin of the coordinate system.  Always top_left in canonical model."""

    TOP_LEFT = "top_left"


class Unit(StrEnum):
    """Measurement unit.  Always px in canonical model."""

    PX = "px"


# -- Provenance --------------------------------------------------------------


class EvidenceType(StrEnum):
    """How a piece of data was produced."""

    PROVIDER_NATIVE = "provider_native"
    DERIVED = "derived"
    REPAIRED = "repaired"
    MANUAL = "manual"


# -- Document structure ------------------------------------------------------


class BlockRole(StrEnum):
    """Semantic role of a text block within the page."""

    BODY = "body"
    HEADING = "heading"
    FOOTNOTE = "footnote"
    CAPTION = "caption"
    MARGIN = "margin"
    PAGE_NUMBER = "page_number"
    HEADER = "header"
    FOOTER = "footer"
    OTHER = "other"


class NonTextKind(StrEnum):
    """Type of non-textual region."""

    ILLUSTRATION = "illustration"
    TABLE = "table"
    SEPARATOR = "separator"
    ORNAMENT = "ornament"
    GRAPHIC = "graphic"
    OTHER = "other"


# -- Source ------------------------------------------------------------------


class InputType(StrEnum):
    """Type of the original input document."""

    IMAGE = "image"
    PDF = "pdf"
    OCR_JSON = "ocr_json"
    MARKDOWN = "markdown"
    HTML = "html"
    XML = "xml"
    TEXT = "text"
    OTHER = "other"


# -- Readiness ---------------------------------------------------------------


class ReadinessLevel(StrEnum):
    """How ready a document / page / element is for export."""

    FULL = "full"
    PARTIAL = "partial"
    DEGRADED = "degraded"
    NONE = "none"


class MissingCapability(StrEnum):
    """Specific capabilities that may be missing for export readiness."""

    PAGE_DIMENSIONS = "page_dimensions"
    BLOCK_GEOMETRY = "block_geometry"
    LINE_GEOMETRY = "line_geometry"
    WORD_GEOMETRY = "word_geometry"
    WORD_TEXT = "word_text"
    READING_ORDER = "reading_order"
    LANGUAGE = "language"
    CONFIDENCE = "confidence"


# -- Overlay (viewer) --------------------------------------------------------


class OverlayLevel(StrEnum):
    """Granularity level for viewer overlays."""

    BLOCK = "block"
    LINE = "line"
    WORD = "word"
    NON_TEXT = "non_text"