File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,41 @@ def review_metrics(self, net_score):
422
422
res = self .client .execute (query_str , {id_param : self .uid })
423
423
return res ["project" ]["reviewMetrics" ]["labelAggregate" ]["count" ]
424
424
425
+ def setup_editor (self , ontology ):
426
+ """
427
+ Sets up the project using the Pictor editor.
428
+
429
+ Args:
430
+ ontology (Ontology): The ontology to attach to the project
431
+ """
432
+ labeling_frontend = next (
433
+ self .client .get_labeling_frontends (
434
+ where = Entity .LabelingFrontend .name == "Editor" ))
435
+ self .labeling_frontend .connect (labeling_frontend )
436
+
437
+ LFO = Entity .LabelingFrontendOptions
438
+ self .client ._create (
439
+ LFO , {
440
+ LFO .project :
441
+ self ,
442
+ LFO .labeling_frontend :
443
+ labeling_frontend ,
444
+ LFO .customization_options :
445
+ json .dumps ({
446
+ "tools" : [],
447
+ "classifications" : []
448
+ })
449
+ })
450
+
451
+ query_str = """mutation ConnectOntologyPyApi($projectId: ID!, $ontologyId: ID!){
452
+ project(where: {id: $projectId}) {connectOntology(ontologyId: $ontologyId) {id}}}"""
453
+ self .client .execute (query_str , {
454
+ 'ontologyId' : ontology .uid ,
455
+ 'projectId' : self .uid
456
+ })
457
+ timestamp = datetime .now (timezone .utc ).strftime ("%Y-%m-%dT%H:%M:%SZ" )
458
+ self .update (setup_complete = timestamp )
459
+
425
460
def setup (self , labeling_frontend , labeling_frontend_options ):
426
461
""" Finalizes the Project setup.
427
462
You can’t perform that action at this time.
0 commit comments