77
88from .annotation import is_local_path , Point3D
99from .constants import (
10- DATASET_ITEM_ID_KEY ,
1110 IMAGE_URL_KEY ,
1211 METADATA_KEY ,
1312 ORIGINAL_IMAGE_URL_KEY ,
@@ -91,11 +90,11 @@ class DatasetItemType(Enum):
9190class DatasetItem : # pylint: disable=R0902
9291 image_location : Optional [str ] = None
9392 reference_id : Optional [str ] = None
94- item_id : Optional [str ] = None
9593 metadata : Optional [dict ] = None
9694 pointcloud_location : Optional [str ] = None
9795
9896 def __post_init__ (self ):
97+ assert self .reference_id is not None , "reference_id is required."
9998 assert bool (self .image_location ) != bool (
10099 self .pointcloud_location
101100 ), "Must specify exactly one of the image_location, pointcloud_location parameters"
@@ -127,14 +126,12 @@ def from_json(cls, payload: dict, is_scene=False):
127126 image_location = image_url ,
128127 pointcloud_location = payload .get (POINTCLOUD_URL_KEY , None ),
129128 reference_id = payload .get (REFERENCE_ID_KEY , None ),
130- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
131129 metadata = payload .get (METADATA_KEY , {}),
132130 )
133131
134132 return cls (
135133 image_location = image_url ,
136134 reference_id = payload .get (REFERENCE_ID_KEY , None ),
137- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
138135 metadata = payload .get (METADATA_KEY , {}),
139136 )
140137
@@ -145,10 +142,8 @@ def to_payload(self, is_scene=False) -> dict:
145142 payload : Dict [str , Any ] = {
146143 METADATA_KEY : self .metadata or {},
147144 }
148- if self .reference_id :
149- payload [REFERENCE_ID_KEY ] = self .reference_id
150- if self .item_id :
151- payload [DATASET_ITEM_ID_KEY ] = self .item_id
145+
146+ payload [REFERENCE_ID_KEY ] = self .reference_id
152147
153148 if is_scene :
154149 if self .image_location :
0 commit comments