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 ,
@@ -92,12 +91,12 @@ class DatasetItemType(Enum):
9291class DatasetItem : # pylint: disable=R0902
9392 image_location : Optional [str ] = None
9493 reference_id : Optional [str ] = None
95- item_id : Optional [str ] = None
9694 metadata : Optional [dict ] = None
9795 pointcloud_location : Optional [str ] = None
9896 upload_to_scale : Optional [bool ] = True
9997
10098 def __post_init__ (self ):
99+ assert self .reference_id is not None , "reference_id is required."
101100 assert bool (self .image_location ) != bool (
102101 self .pointcloud_location
103102 ), "Must specify exactly one of the image_location, pointcloud_location parameters"
@@ -133,14 +132,12 @@ def from_json(cls, payload: dict, is_scene=False):
133132 image_location = image_url ,
134133 pointcloud_location = payload .get (POINTCLOUD_URL_KEY , None ),
135134 reference_id = payload .get (REFERENCE_ID_KEY , None ),
136- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
137135 metadata = payload .get (METADATA_KEY , {}),
138136 )
139137
140138 return cls (
141139 image_location = image_url ,
142140 reference_id = payload .get (REFERENCE_ID_KEY , None ),
143- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
144141 metadata = payload .get (METADATA_KEY , {}),
145142 upload_to_scale = payload .get (UPLOAD_TO_SCALE_KEY , None ),
146143 )
@@ -152,10 +149,8 @@ def to_payload(self, is_scene=False) -> dict:
152149 payload : Dict [str , Any ] = {
153150 METADATA_KEY : self .metadata or {},
154151 }
155- if self .reference_id :
156- payload [REFERENCE_ID_KEY ] = self .reference_id
157- if self .item_id :
158- payload [DATASET_ITEM_ID_KEY ] = self .item_id
152+
153+ payload [REFERENCE_ID_KEY ] = self .reference_id
159154
160155 if is_scene :
161156 if self .image_location :
0 commit comments