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

As a dedicated user, I can access a DFC API endpoint with fewer data and all enterprises #12544

Open
Tracked by #12543
RachL opened this issue Jun 3, 2024 · 3 comments · May be fixed by #12573
Open
Tracked by #12543

As a dedicated user, I can access a DFC API endpoint with fewer data and all enterprises #12544

RachL opened this issue Jun 3, 2024 · 3 comments · May be fixed by #12573

Comments

@RachL
Copy link
Contributor

RachL commented Jun 3, 2024

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

  • enterprise (producers) postal code
  • enterprise (distributor) postal code
  • variant unit name
  • unit type
  • units
  • price
  • quantity sold

And ideally only for a given period and a list of product names:

Technical tasks

Acceptance Criteria & Tests

  1. Turn on Flipper toggle
  2. Allow one email address in the toggle
  3. Log in with that email address
  4. See that this endpoint gives you the list of data detailed above, for all enterprises on the database
  5. Enterprise name and full address can't be found
@RachL 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 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 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
@anansilva anansilva linked a pull request Jun 14, 2024 that will close this issue
4 tasks
@RaggedStaff
Copy link
Collaborator

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? 🤔

@RaggedStaff
Copy link
Collaborator

As @mkllnk already mentioned...

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.

@RaggedStaff
Copy link
Collaborator

Further thoughts...

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress ⚙
Development

Successfully merging a pull request may close this issue.

3 participants