7
7
8
8
from .annotation import is_local_path , Point3D
9
9
from .constants import (
10
- DATASET_ITEM_ID_KEY ,
11
10
IMAGE_URL_KEY ,
12
11
METADATA_KEY ,
13
12
ORIGINAL_IMAGE_URL_KEY ,
@@ -92,12 +91,12 @@ class DatasetItemType(Enum):
92
91
class DatasetItem : # pylint: disable=R0902
93
92
image_location : Optional [str ] = None
94
93
reference_id : Optional [str ] = None
95
- item_id : Optional [str ] = None
96
94
metadata : Optional [dict ] = None
97
95
pointcloud_location : Optional [str ] = None
98
96
upload_to_scale : Optional [bool ] = True
99
97
100
98
def __post_init__ (self ):
99
+ assert self .reference_id is not None , "reference_id is required."
101
100
assert bool (self .image_location ) != bool (
102
101
self .pointcloud_location
103
102
), "Must specify exactly one of the image_location, pointcloud_location parameters"
@@ -133,14 +132,12 @@ def from_json(cls, payload: dict, is_scene=False):
133
132
image_location = image_url ,
134
133
pointcloud_location = payload .get (POINTCLOUD_URL_KEY , None ),
135
134
reference_id = payload .get (REFERENCE_ID_KEY , None ),
136
- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
137
135
metadata = payload .get (METADATA_KEY , {}),
138
136
)
139
137
140
138
return cls (
141
139
image_location = image_url ,
142
140
reference_id = payload .get (REFERENCE_ID_KEY , None ),
143
- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
144
141
metadata = payload .get (METADATA_KEY , {}),
145
142
upload_to_scale = payload .get (UPLOAD_TO_SCALE_KEY , None ),
146
143
)
@@ -152,10 +149,8 @@ def to_payload(self, is_scene=False) -> dict:
152
149
payload : Dict [str , Any ] = {
153
150
METADATA_KEY : self .metadata or {},
154
151
}
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
159
154
160
155
if is_scene :
161
156
if self .image_location :
0 commit comments