I’m trying to submit results using the api, using the methods I found here:
Here’s my test code:
ws_obj = api.get_object_by_uid(worksheet)
layout = ws_obj.Layout
result = 1.69
for position in layout:
sample = api.get_object_by_uid(position['container_uid'])
sample_id = api.get_id(sample)
analysis = api.get_object_by_uid(position['analysis_uid'])
result = result + 0.23
print(sample_id + " " + analysis.Title() + " = " + str(result))
The output I get from my last line always matches the result I submit, but when I navigate to the AnalysisRequest or Worksheet the results are still blank. What do?
Any help would be greatly appreciated, thanks
I may be wrong, but I think senaite.api was deprecated and therefore archived.
You can either use the (new?) SENAITE API (you will find examples in its doctests) or you can use SENAITE JSON API (documentation here), depending on what you want to achieve.
Hi @alexanderstrand , you have to reindex the object after you set the result, like follows:
The reason is that we always try to use brains instead of objects in listings, cause waking-up objects is an expensive task.
@alexanderstrand, if you are using the core’s api from
senaite.core add-on you are ok. This api is not deprecated at all.
Thanks so much! I’ll give that a go. Appreciate the help!