@@ -98,7 +98,7 @@ class Classification:
98
98
removed in a future release. Dropdown will also
99
99
no longer be able to be created in the Editor on 3/31/2022.
100
100
101
- A classfication to be added to a Project's ontology. The
101
+ A classification to be added to a Project's ontology. The
102
102
classification is dependent on the Classification Type.
103
103
104
104
To instantiate, the "class_type" and "name" parameters must
@@ -125,8 +125,10 @@ class Classification:
125
125
instructions: (str)
126
126
required: (bool)
127
127
options: (list)
128
+ ui_mode: (str)
128
129
schema_id: (str)
129
130
feature_schema_id: (str)
131
+ scope: (str)
130
132
"""
131
133
132
134
class Type (Enum ):
@@ -138,6 +140,10 @@ class Type(Enum):
138
140
class Scope (Enum ):
139
141
GLOBAL = "global"
140
142
INDEX = "index"
143
+
144
+ class UIMode (Enum ):
145
+ HOTKEY = "hotkey"
146
+ SEARCHABLE = "searchable"
141
147
142
148
_REQUIRES_OPTIONS = {Type .CHECKLIST , Type .RADIO , Type .DROPDOWN }
143
149
@@ -149,6 +155,7 @@ class Scope(Enum):
149
155
schema_id : Optional [str ] = None
150
156
feature_schema_id : Optional [str ] = None
151
157
scope : Scope = None
158
+ ui_mode : Optional [UIMode ] = None # How this classification should be answered (e.g. hotkeys / autocomplete, etc)
152
159
153
160
def __post_init__ (self ):
154
161
if self .class_type == Classification .Type .DROPDOWN :
@@ -180,6 +187,7 @@ def from_dict(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
180
187
instructions = dictionary ["instructions" ],
181
188
required = dictionary .get ("required" , False ),
182
189
options = [Option .from_dict (o ) for o in dictionary ["options" ]],
190
+ ui_mode = cls .UIMode (dictionary ["uiMode" ]) if "uiMode" in dictionary else None ,
183
191
schema_id = dictionary .get ("schemaNodeId" , None ),
184
192
feature_schema_id = dictionary .get ("featureSchemaId" , None ),
185
193
scope = cls .Scope (dictionary .get ("scope" , cls .Scope .GLOBAL )))
@@ -198,6 +206,9 @@ def asdict(self, is_subclass: bool = False) -> Dict[str, Any]:
198
206
"schemaNodeId" : self .schema_id ,
199
207
"featureSchemaId" : self .feature_schema_id
200
208
}
209
+ if (self .class_type == self .Type .RADIO or self .class_type == self .Type .CHECKLIST ) and self .ui_mode :
210
+ # added because this key does nothing for text so no point of including
211
+ classification ["uiMode" ] = self .ui_mode .value
201
212
if is_subclass :
202
213
return classification
203
214
classification [
0 commit comments