@@ -23,6 +23,7 @@ class Image(BaseModel):
23
23
sizes : dict [str , ImageSize ] | None = None
24
24
uploaded_t : int | None = None
25
25
imgid : int | None = None
26
+ rev : int | None = None
26
27
uploader : str | None = None
27
28
28
29
@model_validator (mode = "after" )
@@ -242,13 +243,13 @@ def parse_language_fields(cls, data: dict) -> dict:
242
243
@classmethod
243
244
def parse_images (cls , data : dict ) -> dict :
244
245
"""Parse images field into a list of dictionaries with `key`, `imgid`,
245
- `sizes`, `uploaded_t`, and `uploader` keys.
246
+ `rev`, ` sizes`, `uploaded_t`, and `uploader` keys.
246
247
247
248
In Open Food Facts, images are stored as a dictionary with the image
248
249
key as the key and the image data as the value.
249
250
250
251
To make the schema compatible with Parquet, we convert these fields
251
- into a list of dictionaries with `key`, `imgid`, `sizes`, `uploaded_t`,
252
+ into a list of dictionaries with `key`, `imgid`, `rev`, ` sizes`, `uploaded_t`,
252
253
and `uploader` keys. We copy the image key (ex: `3`, `nutrition_fr`,...)
253
254
from the original dictionary and add it as a field under the `key` key.
254
255
"""
@@ -283,6 +284,7 @@ def parse_owner_fields(cls, data: dict):
283
284
[
284
285
pa .field ("key" , pa .string (), nullable = True ),
285
286
pa .field ("imgid" , pa .int32 (), nullable = True ),
287
+ pa .field ("rev" , pa .int32 (), nullable = True ),
286
288
pa .field (
287
289
"sizes" ,
288
290
pa .struct (
0 commit comments