Description of the limitation and why it is relevant to address
As a developer I would like that the SDK supplies an entity object instead of an entity ID. This can be implemented on the following places:
- Views
- ParamsFromFile decorater
- Entity fields in the parametrization (ChildEntityOptionField enz.)
Now an Int is supplied and the user needs to import the API and use theAPI().get_entity(id)
function to get the entity object. When the entity object is supplied directly, there is no need to import the API. This results in cleaner code on the app side.
Submitter proposed design (optional)
Old:
@DataView("Data", duration_guess=1)
def calculate_view(self, params, entity_id, **kwargs):
current_entity = API().get_entity(entity_id)
parent = current_entity.parent()
parent_params = parent.last_saved_params
# do something with parent_params
return DataResult(...)
New:
@DataView("Data", duration_guess=1)
def calculate_view(self, params, entity, **kwargs):
parent = entity.parent()
parent_params = parent.last_saved_params
# do something with parent_params
return DataResult(...)
Current workarounds
Use API().get_entity(id)