You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Funded feature code is #12543 [DFC] Anonymized orders endpoint
Description
- As a: enterprise user - On page: on the DFC API - I want to be able to do: see an order endpoint with fewer data than the regular DFC order endpoint.
Create a new controller engines/dfc_provider, maybe called AnonymousOrdersController.
We can re-use some of the DFC authentification but instead of looking up a user, we will trust the given email address.
The email address can be authorized against our feature toggles. For example Flipper.enable(:inrae, "[email protected]"). Then we can create a model class to work with Flipper: InraeUser = Struct.new(:flipper_id) and pass that on to check if the email is allowed to access this endpoint.
RachL
changed the title
A dedicated orders endpoint is needed as we want an orders endpoint but with fewer data than the regular one
As an enterprise user, I can access an API endpoint with fewer data
Jun 3, 2024
RachL
changed the title
As an enterprise user, I can access an API endpoint with fewer data
As a dedicated user, I can access a DFC API endpoint with fewer data and all enterpises
Jun 3, 2024
RachL
changed the title
As a dedicated user, I can access a DFC API endpoint with fewer data and all enterpises
As a dedicated user, I can access a DFC API endpoint with fewer data and all enterprises
Jun 3, 2024
Ok. I think I see the issue... this isn't an Orders endpoint... you aren't sharing data from individual Orders, you're aggregating Orders, from multiple Enterprises, for a given reporting period (to/from date).
I'm on my phone atm, but can look when I'm back on the laptop & provide dfc mappings for the ofn fields you've mentioned.
I would suggest a name like AggregatedSalesData
You probably want to feed in the date range as parameters (either in path or in query).
Wondering how efficient OFN is at builsing this resultset on the fly... do we need to consider indexing/performance? 🤔
dfc-b:PostCode is accesible through Enterprise:hasAddress (inherited from Agent, so you might need to look there)
Product/Variant Units are parsed via the measures.rdf SKOS vocabulary. Not sure how that was mapped, but you should be able to yoink the same code as for the Product endpoints.
Price should be passed as a dfc-bPrice object, which is attached to an Offer, which is linked to a CatalogItem (hence why we tend to serve SuppliedProduct with CatalogItem). You'll need to embed the links in the graph, but not the entire object, just @id will do.
Offer also links to SaleSession which will be where you can get the Orders link & determine the quantity sold. I think you'll need to pass all the OrderLines to the object, any aggregation would need to happen after the DFC objects are parsed.
@anansilva - Hope that all makes sense, I'll give you a buzz on Slack.
To make the graph hang together, I think we need to start from a User (the INRAE user), affilitate them to all the Enterprises that are willing to share data & walk the graph to OrderLines from there.
Funded feature code is #12543 [DFC] Anonymized orders endpoint
Description
- As a: enterprise user
- On page: on the DFC API
- I want to be able to do: see an order endpoint with fewer data than the regular DFC order endpoint.
This endpoint needs to reveal only
And ideally only for a given period and a list of product names:
Technical tasks
engines/dfc_provider
, maybe called AnonymousOrdersController.The email address can be authorized against our feature toggles. For example
Flipper.enable(:inrae, "[email protected]")
. Then we can create a model class to work withFlipper: InraeUser = Struct.new(:flipper_id)
and pass that on to check if the email is allowed to access this endpoint.OrderBuilder
similar to https://github.com/mkllnk/openfoodnetwork/blob/b11221a235e419f1438e5c1045044cb1c8330428/engines/dfc_provider/app/services/order_builder.rb.Acceptance Criteria & Tests
The text was updated successfully, but these errors were encountered: