Open pral2a opened 3 years ago
I am not clear why a new economicResource
is created after a transfer?
This does not sound in line with tracking a resources across a flow, I would think that a new resource is created only when particular events are performed, such as produce if I remember correctly.
To add clarity. Those are two separate issues:
I am experiencing a similar issue.
When I perform a transfer from provider to receiver, the corresponding economic resource is not updated to have the receiver as the accountable agent.
In a simulation I’ve created a transfer event of a lot that contains a couple of medical gowns (tracking id’s are in the manifest in the note). See here the ouput of a recorded transfer event:
{ "data": { "economicEvent": { "id": "01FDV09AQ8MSPGSTJK9BC0PDY0", "provider": { "id": "01FDSF07W22B3TMYF9HB2RG0QR", "name": "clean lease a_tsc" }, "receiver": { "id": "01FDSEWBCPJ7H8NWHMGK531NAD", "name": "olvg a_hospital" }, "resourceInventoriedAs": { "id": "01FDV09AEM1QTFQ8EYBBPT67NP", "name": "Gown Lot", "note": "Manifest: http://cleanlease.nl/zs/0471b80b-0301-4aa5-92d0-6a1de73239be,http://cleanlease.nl/zs/3845418d-cdf2-4cd1-81b9-90c783d0fdd1,http://cleanlease.nl/zs/3b6c95f9-3ec3-40e3-888a-f254865ef2a9,http://cleanlease.nl/zs/c6a354ca-dc2e-48ae-9975-a59c190b507b" } } } }
Now when I lookup the resource identified under “resourceInventoriedAs” (01FDV09AEM1QTFQ8EYBBPT67NP):
{ "data": { "economicResource": { "containedIn": null, "currentLocation": { "id": "01FDSM9TTCHXM5AEDBX0AX327Y" }, "id": "01FDV09AEM1QTFQ8EYBBPT67NP", "name": "Gown Lot", "note": "Manifest: http://cleanlease.nl/zs/0471b80b-0301-4aa5-92d0-6a1de73239be,http://cleanlease.nl/zs/3845418d-cdf2-4cd1-81b9-90c783d0fdd1,http://cleanlease.nl/zs/3b6c95f9-3ec3-40e3-888a-f254865ef2a9,http://cleanlease.nl/zs/c6a354ca-dc2e-48ae-9975-a59c190b507b", "onhandQuantity": { "hasNumericalValue": 0 }, "primaryAccountable": { "id": "01FDSF07W22B3TMYF9HB2RG0QR", "name": "clean lease a_tsc" } } } }
I would expect that the primaryAccountable is the hospital (OLVG) after the transfer, not clean lease a_tsc (the provider)… Which is a problem because when I try to consume this lot resource as the hospital, I get the error:
“You cannot do this since the provider is not accountable for the resource.”
It seems to me that the agent is not updated to be the receiver after a transfer.
Interested on this issue.
From API Tour documentation, there are 3 different cases for createEconomicEvent
:
consume
-like (https://reflowos.dyne.org/docs/api_tour#conduct-an-economic-event-on-an-existing-resource)produce
-like (https://reflowos.dyne.org/docs/api_tour#conduct-an-economic-event-that-results-in-a-completely-new-resource)transfer
(https://reflowos.dyne.org/docs/api_tour#conduct-an-economic-event-between-an-existing-resource-and-a-new-resource)The first one, does not create new EconomicResources and should not change the ownership, but just decrease the available quantity. The second one, creates a new EconomicResource from scratch. The third one, creates a new EconomicResource (held by the receiver) by decreasing the quantity of an already existing resource (held by the provider).
@vcuculo (and @sbocconi this helps answer your question above too about transfers creating a new resource)
creates a new EconomicResource from scratch
There is an additional part of this definition. produce
and transfer
might create a new EconomicResource from scratch. Or they might increment an existing EconomicResource on the receiver side. The latter happens when the resource is a "stock" resource that already exists, where each thing is "substitutable" for any other thing in the resource, like "3-1/4 in. 16-Penny Smooth Vinyl-Coated Steel Sinker Nails". In this case, the EconomicResource is not about which exact nails are in it, nails will come and nails will go, but it is considered the same resource.
More info here https://valueflo.ws/introduction/resources.html#identification-and-behaviors-of-resources.
(I know this wanders off topic of this specific issue, please ignore if not relevant to you.)
Hello @fosterlynn, so in case a EconomicResource is of type serialized
(like a particular guitar) and I tranfer
it from me (the owner) to you, is it correct that a new resource is created?
This does not sound logical to me if we want to perform track and trace, because it looks as it is more difficult to connect different resources to the same object, but there might be reasons that escape me. Could you elaborate on it please?
@sbocconi for authenticated track and trace the Reflow the UID is changing at every interaction, aggregating each agent and event and resource connected. The change of state however should not invalidate previous connections, its just that a new resource is created connected to its previous state.
Hi @jaromil, and is this UID is different from the one reported by ResourceInventoriedAs
(which stays constant, as seen e.g. in https://github.com/dyne/reflow-os/issues/3#issuecomment-923876363 )?
Is this UID more "internal" with respect to the id of ResourceInventoriedAs
?
@sbocconi yes and is not yet fully implemented yet, its the cryptography validator for track and trace once reflow is fully implemented and hopefully aligns with the logic of valueflows
After transferring an
economicResource
to a newagent
using aneconomicEvent
a neweconomicResource
is created. However, the formeragent
still has editing capabilities over the neweconomicResource
.Could you confirm that the behaviour is correct?