@@ -98,7 +98,7 @@ class Classification:
9898 removed in a future release. Dropdown will also
9999 no longer be able to be created in the Editor on 3/31/2022.
100100
101- A classfication to be added to a Project's ontology. The
101+ A classification to be added to a Project's ontology. The
102102 classification is dependent on the Classification Type.
103103
104104 To instantiate, the "class_type" and "name" parameters must
@@ -125,8 +125,10 @@ class Classification:
125125 instructions: (str)
126126 required: (bool)
127127 options: (list)
128+ ui_mode: (str)
128129 schema_id: (str)
129130 feature_schema_id: (str)
131+ scope: (str)
130132 """
131133
132134 class Type (Enum ):
@@ -138,6 +140,10 @@ class Type(Enum):
138140 class Scope (Enum ):
139141 GLOBAL = "global"
140142 INDEX = "index"
143+
144+ class UIMode (Enum ):
145+ HOTKEY = "hotkey"
146+ SEARCHABLE = "searchable"
141147
142148 _REQUIRES_OPTIONS = {Type .CHECKLIST , Type .RADIO , Type .DROPDOWN }
143149
@@ -149,6 +155,7 @@ class Scope(Enum):
149155 schema_id : Optional [str ] = None
150156 feature_schema_id : Optional [str ] = None
151157 scope : Scope = None
158+ ui_mode : Optional [UIMode ] = None # How this classification should be answered (e.g. hotkeys / autocomplete, etc)
152159
153160 def __post_init__ (self ):
154161 if self .class_type == Classification .Type .DROPDOWN :
@@ -180,6 +187,7 @@ def from_dict(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
180187 instructions = dictionary ["instructions" ],
181188 required = dictionary .get ("required" , False ),
182189 options = [Option .from_dict (o ) for o in dictionary ["options" ]],
190+ ui_mode = cls .UIMode (dictionary ["uiMode" ]) if "uiMode" in dictionary else None ,
183191 schema_id = dictionary .get ("schemaNodeId" , None ),
184192 feature_schema_id = dictionary .get ("featureSchemaId" , None ),
185193 scope = cls .Scope (dictionary .get ("scope" , cls .Scope .GLOBAL )))
@@ -198,6 +206,9 @@ def asdict(self, is_subclass: bool = False) -> Dict[str, Any]:
198206 "schemaNodeId" : self .schema_id ,
199207 "featureSchemaId" : self .feature_schema_id
200208 }
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
201212 if is_subclass :
202213 return classification
203214 classification [
0 commit comments