smart-data-models / data-models

Data Models in common use based on real world use-cases. These definitions underpin a digital market of interoperable and replicable smart solutions.
https://smartdatamodels.org/
115 stars 56 forks source link

Error in "location" when generating a random example #58

Closed silviasdfg closed 6 months ago

silviasdfg commented 9 months ago

When I generate a random example of a WasteContainer entity using ngsi_ld_example_generator from pysmartdatamodels, the type of "location" is set to "Property" instead of "GeoProperty"

albertoabellagarcia commented 9 months ago

That's very good point, let us check it out

albertoabellagarcia commented 9 months ago

did you use it in pysmartdatamodels package or in the online service?

albertoabellagarcia commented 9 months ago

by the comment I guess it is in pysmartdatamodels

silviasdfg commented 9 months ago

yes, I was using the pysmartdatamodels package

albertoabellagarcia commented 6 months ago

Your error could be possible if you are running and old version of the pysmartdatamodels, you have two options: 1) run the function sdm.update_data(). This function retrieves last version of the data about the data models that possibly fixes your need (takes some minutes, be patient, it downloads the full database) 2) update to the last version 0.7.1 of the package

Let me suggest you to make a test with this code before and after updating with 1) or 2) . Possibly the error would appear before updating and will disappear afterwards.

from pysmartdatamodels import pysmartdatamodels as sdm

result = sdm.ngsi_ld_example_generator("https://raw.githubusercontent.com/smart-data-models/dataModel.WasteManagement/master/WasteContainer/schema.json") print(result) with open("payload.json", "w") as file: json.dump(result, file, indent=2)