@@ -27,11 +27,9 @@ def audio_data_row(rand_gen):
2727def conversation_data_row (rand_gen ):
2828 return {
2929 "row_data" :
30- "https://storage.googleapis.com/labelbox-datasets/conversational-sample-data/sample- conversation-1.json" ,
30+ "https://storage.googleapis.com/labelbox-developer-testing-assets/conversational_text/1000-conversations/ conversation-1.json" ,
3131 "global_key" :
32- f"https://storage.googleapis.com/labelbox-datasets/conversational-sample-data/sample-conversation-1.json-{ rand_gen (str )} " ,
33- "media_type" :
34- "CONVERSATIONAL" ,
32+ f"https://storage.googleapis.com/labelbox-developer-testing-assets/conversational_text/1000-conversations/conversation-1.json-{ rand_gen (str )} " ,
3533 }
3634
3735
@@ -138,15 +136,21 @@ def data_row_json_by_data_type(audio_data_row, conversation_data_row,
138136
139137
140138@pytest .fixture
141- def v2_exports_by_data_type (expected_export_v2_image , expected_export_v2_audio ,
139+ def exports_v2_by_data_type (expected_export_v2_image , expected_export_v2_audio ,
142140 expected_export_v2_html , expected_export_v2_text ,
143- expected_export_v2_video ):
141+ expected_export_v2_video ,
142+ expected_export_v2_conversation ,
143+ expected_export_v2_dicom ,
144+ expected_export_v2_document ):
144145 return {
145146 'image' : expected_export_v2_image ,
146147 'audio' : expected_export_v2_audio ,
147148 'html' : expected_export_v2_html ,
148149 'text' : expected_export_v2_text ,
149150 'video' : expected_export_v2_video ,
151+ 'conversation' : expected_export_v2_conversation ,
152+ 'dicom' : expected_export_v2_dicom ,
153+ 'document' : expected_export_v2_document ,
150154 }
151155
152156
@@ -173,6 +177,34 @@ def annotations_by_data_type(polygon_inference, rectangle_inference,
173177 }
174178
175179
180+ @pytest .fixture
181+ def annotations_by_data_type_v2 (
182+ polygon_inference , rectangle_inference , rectangle_inference_document ,
183+ line_inference_v2 , line_inference , entity_inference ,
184+ entity_inference_index , entity_inference_document ,
185+ checklist_inference_index , text_inference_index , checklist_inference ,
186+ text_inference , video_checklist_inference ):
187+ return {
188+ 'audio' : [checklist_inference , text_inference ],
189+ 'conversation' : [
190+ checklist_inference_index , text_inference_index ,
191+ entity_inference_index
192+ ],
193+ 'dicom' : [line_inference_v2 ],
194+ 'document' : [
195+ entity_inference_document , checklist_inference , text_inference ,
196+ rectangle_inference_document
197+ ],
198+ 'html' : [text_inference , checklist_inference ],
199+ 'image' : [
200+ polygon_inference , rectangle_inference , line_inference ,
201+ checklist_inference , text_inference
202+ ],
203+ 'text' : [entity_inference , checklist_inference , text_inference ],
204+ 'video' : [video_checklist_inference ]
205+ }
206+
207+
176208@pytest .fixture
177209def ontology ():
178210 bbox_tool = {
@@ -281,13 +313,43 @@ def ontology():
281313 'value' : 'optionn'
282314 }]
283315 }
316+ checklist_index = {
317+ 'required' :
318+ False ,
319+ 'instructions' :
320+ 'checklist_index' ,
321+ 'name' :
322+ 'checklist_index' ,
323+ 'type' :
324+ 'checklist' ,
325+ 'scope' :
326+ 'index' ,
327+ 'options' : [{
328+ 'label' : 'option1_index' ,
329+ 'value' : 'option1_index'
330+ }, {
331+ 'label' : 'option2_index' ,
332+ 'value' : 'option2_index'
333+ }, {
334+ 'label' : 'optionN_index' ,
335+ 'value' : 'optionn_index'
336+ }]
337+ }
284338 free_form_text = {
285339 'required' : False ,
286340 'instructions' : 'text' ,
287341 'name' : 'text' ,
288342 'type' : 'text' ,
289343 'options' : []
290344 }
345+ free_form_text_index = {
346+ 'required' : False ,
347+ 'instructions' : 'text_index' ,
348+ 'name' : 'text_index' ,
349+ 'type' : 'text' ,
350+ 'scope' : 'index' ,
351+ 'options' : []
352+ }
291353 radio = {
292354 'required' :
293355 False ,
@@ -316,10 +378,18 @@ def ontology():
316378 }
317379
318380 tools = [
319- bbox_tool , polygon_tool , polyline_tool , point_tool , entity_tool ,
320- segmentation_tool , raster_segmentation_tool , named_entity
381+ bbox_tool ,
382+ polygon_tool ,
383+ polyline_tool ,
384+ point_tool ,
385+ entity_tool ,
386+ segmentation_tool ,
387+ raster_segmentation_tool ,
388+ named_entity ,
389+ ]
390+ classifications = [
391+ checklist , checklist_index , free_form_text , free_form_text_index , radio
321392 ]
322- classifications = [checklist , free_form_text , radio ]
323393 return {"tools" : tools , "classifications" : classifications }
324394
325395
@@ -431,7 +501,8 @@ def prediction_id_mapping(configured_project):
431501 if 'tool' in tool :
432502 tool_type = tool ['tool' ]
433503 else :
434- tool_type = tool ['type' ]
504+ tool_type = tool [
505+ 'type' ] if 'scope' not in tool else f"{ tool ['type' ]} _{ tool ['scope' ]} " # so 'checklist' of 'checklist_index'
435506 result [tool_type ] = {
436507 "uuid" : str (uuid .uuid4 ()),
437508 "schemaId" : tool ['featureSchemaId' ],
@@ -495,6 +566,13 @@ def rectangle_inference(prediction_id_mapping):
495566 return rectangle
496567
497568
569+ @pytest .fixture
570+ def rectangle_inference_document (rectangle_inference ):
571+ rectangle = rectangle_inference .copy ()
572+ rectangle .update ({"page" : 1 , "unit" : "POINTS" })
573+ return rectangle
574+
575+
498576@pytest .fixture
499577def line_inference (prediction_id_mapping ):
500578 line = prediction_id_mapping ['line' ].copy ()
@@ -510,6 +588,31 @@ def line_inference(prediction_id_mapping):
510588 return line
511589
512590
591+ @pytest .fixture
592+ def line_inference_v2 (prediction_id_mapping ):
593+ line = prediction_id_mapping ['line' ].copy ()
594+ line_data = {
595+ "groupKey" :
596+ "axial" ,
597+ "segments" : [{
598+ "keyframes" : [{
599+ "frame" :
600+ 1 ,
601+ "line" : [{
602+ "x" : 147.692 ,
603+ "y" : 118.154
604+ }, {
605+ "x" : 150.692 ,
606+ "y" : 160.154
607+ }]
608+ }]
609+ },]
610+ }
611+ line .update (line_data )
612+ del line ['tool' ]
613+ return line
614+
615+
513616@pytest .fixture
514617def point_inference (prediction_id_mapping ):
515618 point = prediction_id_mapping ['point' ].copy ()
@@ -526,6 +629,45 @@ def entity_inference(prediction_id_mapping):
526629 return entity
527630
528631
632+ @pytest .fixture
633+ def entity_inference_index (prediction_id_mapping ):
634+ entity = prediction_id_mapping ['named-entity' ].copy ()
635+ entity .update ({
636+ "location" : {
637+ "start" : 0 ,
638+ "end" : 8
639+ },
640+ "messageId" : "0" ,
641+ })
642+
643+ del entity ['tool' ]
644+ return entity
645+
646+
647+ @pytest .fixture
648+ def entity_inference_document (prediction_id_mapping ):
649+ entity = prediction_id_mapping ['named-entity' ].copy ()
650+ document_selections = {
651+ "textSelections" : [{
652+ "tokenIds" : [
653+ "3f984bf3-1d61-44f5-b59a-9658a2e3440f" ,
654+ "3bf00b56-ff12-4e52-8cc1-08dbddb3c3b8" ,
655+ "6e1c3420-d4b7-4c5a-8fd6-ead43bf73d80" ,
656+ "87a43d32-af76-4a1d-b262-5c5f4d5ace3a" ,
657+ "e8606e8a-dfd9-4c49-a635-ad5c879c75d0" ,
658+ "67c7c19e-4654-425d-bf17-2adb8cf02c30" ,
659+ "149c5e80-3e07-49a7-ab2d-29ddfe6a38fa" ,
660+ "b0e94071-2187-461e-8e76-96c58738a52c"
661+ ],
662+ "groupId" : "2f4336f4-a07e-4e0a-a9e1-5629b03b719b" ,
663+ "page" : 1 ,
664+ }]
665+ }
666+ entity .update (document_selections )
667+ del entity ['tool' ]
668+ return entity
669+
670+
529671@pytest .fixture
530672def segmentation_inference (prediction_id_mapping ):
531673 segmentation = prediction_id_mapping ['superpixel' ].copy ()
@@ -579,6 +721,19 @@ def checklist_inference(prediction_id_mapping):
579721 return checklist
580722
581723
724+ @pytest .fixture
725+ def checklist_inference_index (prediction_id_mapping ):
726+ checklist = prediction_id_mapping ['checklist_index' ].copy ()
727+ checklist .update ({
728+ 'answers' : [{
729+ 'schemaId' : checklist ['tool' ]['options' ][0 ]['featureSchemaId' ]
730+ }],
731+ "messageId" : "0" ,
732+ })
733+ del checklist ['tool' ]
734+ return checklist
735+
736+
582737@pytest .fixture
583738def text_inference (prediction_id_mapping ):
584739 text = prediction_id_mapping ['text' ].copy ()
@@ -587,6 +742,14 @@ def text_inference(prediction_id_mapping):
587742 return text
588743
589744
745+ @pytest .fixture
746+ def text_inference_index (prediction_id_mapping ):
747+ text = prediction_id_mapping ['text_index' ].copy ()
748+ text .update ({'answer' : "free form text..." , "messageId" : "0" })
749+ del text ['tool' ]
750+ return text
751+
752+
590753@pytest .fixture
591754def video_checklist_inference (prediction_id_mapping ):
592755 checklist = prediction_id_mapping ['checklist' ].copy ()
0 commit comments