@@ -25,6 +25,8 @@ class DocItemLabel(str, Enum):
2525 CHECKBOX_UNSELECTED = "checkbox_unselected"
2626 FORM = "form"
2727 KEY_VALUE_REGION = "key_value_region"
28+ GRADING_SCALE = "grading_scale" # for elements in forms, questionaires representing a grading scale
29+ # e.g. [strongly disagree | ... | ... | strongly agree]
2830
2931 # Additional labels for markup-based formats (e.g. HTML, Word)
3032 PARAGRAPH = "paragraph"
@@ -144,17 +146,43 @@ def __str__(self):
144146 """Get string value."""
145147 return str (self .value )
146148
149+ @staticmethod
150+ def get_color (label : "TableCellLabel" ) -> Tuple [int , int , int ]:
151+ """Return the RGB color associated with a given label."""
152+ color_map = {
153+ TableCellLabel .COLUMN_HEADER : (255 , 0 , 0 ),
154+ TableCellLabel .ROW_HEADER : (0 , 255 , 0 ),
155+ TableCellLabel .ROW_SECTION : (0 , 0 , 255 ),
156+ TableCellLabel .BODY : (0 , 255 , 255 ),
157+ }
158+ return color_map .get (label , (0 , 0 , 0 ))
159+
147160
148161class GraphCellLabel (str , Enum ):
149162 """GraphCellLabel."""
150163
151164 UNSPECIFIED = "unspecified"
152165
153- KEY = "key"
154- VALUE = "value"
155-
166+ KEY = "key" # used to designate a key (label) of a key-value element
167+ VALUE = "value" # Data value with or without explicit Key, but filled in,
168+ # e.g. telephone number, address, quantity, name, date
169+ EMPTY_VALUE = "empty_value" # used for empty value fields in fillable forms
156170 CHECKBOX = "checkbox"
157171
172+ def __str__ (self ):
173+ """Get string value."""
174+ return str (self .value )
175+
176+ @staticmethod
177+ def get_color (label : "GraphCellLabel" ) -> Tuple [int , int , int ]:
178+ """Return the RGB color associated with a given label."""
179+ color_map = {
180+ GraphCellLabel .KEY : (255 , 0 , 0 ),
181+ GraphCellLabel .VALUE : (0 , 255 , 0 ),
182+ GraphCellLabel .EMPTY_VALUE : (0 , 0 , 255 ),
183+ }
184+ return color_map .get (label , (0 , 0 , 0 ))
185+
158186
159187class GraphLinkLabel (str , Enum ):
160188 """GraphLinkLabel."""
0 commit comments