Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ownership of resource unclear #58

Open
pral2a opened this issue Sep 7, 2021 · 9 comments
Open

Ownership of resource unclear #58

pral2a opened this issue Sep 7, 2021 · 9 comments

Comments

@pral2a
Copy link

pral2a commented Sep 7, 2021

After transferring an economicResource to a new agent using an economicEvent a new economicResource is created. However, the former agent still has editing capabilities over the new economicResource.

Could you confirm that the behaviour is correct?

@sbocconi
Copy link

sbocconi commented Sep 8, 2021

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.

@pral2a
Copy link
Author

pral2a commented Sep 8, 2021

To add clarity. Those are two separate issues:

  1. Ownership or editing capabilities on newly created resources not owned by the agent. That is a backend related issue. Ownership of resource unclear  #58 (comment)
  2. Duplication of resources after an event (i.e. transfer). That is a front-end implementation issue we are tackling here Inventory page showing resources multiple times? reflow-project/weloop#107 (comment)

@ocataco
Copy link

ocataco commented Sep 9, 2021

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.

@vcuculo
Copy link

vcuculo commented Sep 16, 2021

Interested on this issue.
From API Tour documentation, there are 3 different cases for createEconomicEvent:

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).

@fosterlynn
Copy link

@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.)

@sbocconi
Copy link

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?

@jaromil
Copy link
Member

jaromil commented Sep 23, 2021

@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.

@sbocconi
Copy link

Hi @jaromil, and is this UID is different from the one reported by ResourceInventoriedAs (which stays constant, as seen e.g. in dyne/reflow-os#3 (comment) )?

Is this UID more "internal" with respect to the id of ResourceInventoriedAs?

@jaromil
Copy link
Member

jaromil commented Sep 23, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants