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 ,
@@ -91,11 +90,11 @@ class DatasetItemType(Enum):
91
90
class DatasetItem : # pylint: disable=R0902
92
91
image_location : Optional [str ] = None
93
92
reference_id : Optional [str ] = None
94
- item_id : Optional [str ] = None
95
93
metadata : Optional [dict ] = None
96
94
pointcloud_location : Optional [str ] = None
97
95
98
96
def __post_init__ (self ):
97
+ assert self .reference_id is not None , "reference_id is required."
99
98
assert bool (self .image_location ) != bool (
100
99
self .pointcloud_location
101
100
), "Must specify exactly one of the image_location, pointcloud_location parameters"
@@ -127,14 +126,12 @@ def from_json(cls, payload: dict, is_scene=False):
127
126
image_location = image_url ,
128
127
pointcloud_location = payload .get (POINTCLOUD_URL_KEY , None ),
129
128
reference_id = payload .get (REFERENCE_ID_KEY , None ),
130
- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
131
129
metadata = payload .get (METADATA_KEY , {}),
132
130
)
133
131
134
132
return cls (
135
133
image_location = image_url ,
136
134
reference_id = payload .get (REFERENCE_ID_KEY , None ),
137
- item_id = payload .get (DATASET_ITEM_ID_KEY , None ),
138
135
metadata = payload .get (METADATA_KEY , {}),
139
136
)
140
137
@@ -145,10 +142,8 @@ def to_payload(self, is_scene=False) -> dict:
145
142
payload : Dict [str , Any ] = {
146
143
METADATA_KEY : self .metadata or {},
147
144
}
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
152
147
153
148
if is_scene :
154
149
if self .image_location :
0 commit comments