Opened 4 years ago

Last modified 19 months ago

#2716 assigned enhancement

Genesys orders need to go directly to GG

Reported by: Martin Reisinger Owned by: dbmubrett
Priority: major Milestone:
Component: Other Version: N/A
Severity: Keywords: efficiency, usability
Cc: Database Engine: N/A
Operating System: N/A

Description (last modified by Martin Reisinger)

The current process is extremely inefficient:

  • Users on the Genesys portal request USDA germplasm – often, they will send multiple requests
  • Genesys sends an email to USDA’s GrinGlobal.Orders@…, per each Genesys request
  • Someone from NPGS opens/reviews the email and

o Confirms with Genesys that we received the email (“confirm” involves clicking a link and then going thru two sets of captcha images to confirm)
o Determines which NPGS site(s) are involved in the request, based on the requested taxa
o Copies boilerplate text/directions from a Word doc into an email reply to the requestor that indicates they need to order again, using GG
o Cc’s the site(s) involved with the requested taxa

  • Per the bullet above, the user proceeds by making a new request for the same material in GG

GG currently accepts incoming Web Order Requests from the GG public website. Could the incoming message being sent by a GG API be configured so that the incoming order from Genesys is similar to a incoming GG Web Order Request (WOR).

An enhancement to all incoming requests would be a new field to store the source of the request, such as GGPW, GEN, …

Attachments (6)

genesys_2023-03-17_17-37-38.jpg​ (116.9 KB ) - added by Martin Reisinger 4 years ago.
Genebank Request protocol.pdf​ (135.0 KB ) - added by dbmubrett 2 years ago.
External gene bank request protocol, provided by Matija from Genesys
external-request.yaml​ (5.1 KB ) - added by dbmubrett 2 years ago.
External endpoint swagger yaml file
Screenshot 2024-07-30 at 15-47-58 Cart GRIN-Global.png​ (55.3 KB ) - added by dbmubrett 2 years ago.
Screenshot of blurb added to checkout process
Screenshot 2024-07-31 at 11-57-37 Request Detail GRIN-Global.png​ (63.2 KB ) - added by dbmubrett 2 years ago.
Screenshot of automatic special instructions
trac2716_addendum_to_text.jpg​ (60.4 KB ) - added by Martin Reisinger 2 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Martin Reisinger, 4 years ago

Description: modified (diff)

by Martin Reisinger, 4 years ago

comment:2 by dbmubrett, 3 years ago

Owner: set to dbmubrett
Status: new → assigned

by dbmubrett, 2 years ago

External gene bank request protocol, provided by Matija from Genesys

comment:3 by dbmubrett, 2 years ago

Matija from Crop Trust / Genesys provided the attached external genebank request protocol document, which describes notionally how an external entity could programmatically place a web request with a grin instance.

It essentially describes this workflow:

  1. A Genesys user submits a web request for some NPGS accessions.
  1. Genesys POSTs a JSON request to a particular endpoint that we implement (e.g., /api/external-request?authKey=abc...123) with a request body including all order information.
  1. The POST endpoint validates the request items and returns a guid representing the persisted external request.
  1. Genesys persists the external request guid and generates a re-usable GET link (e.g., /api/external-request?id=abcd-....-1234) for the user to follow.
  1. The GET endpoint looks up the external request and redirects to the shopping cart with the associated request items pre-populated for the user to complete the request (e.g., /cartview?action=add&id=123456&id=7654321) or, if an associated web request is found, it redirects to profile web order history.

This seems like a well reasoned flow and one that we probably can and should support. I think it would satisfy the requirements of this ticket (including tracking external request source information), and probably set us up to easily handle external requests from other entities (assuming they would follow the same protocol).

A few concerns:

  1. This implementation implies persistence on our side of the external request information and an authentication key to permit the associated POST. This probably means adding one or two tables, one of which would relate to web_order_request. I'll need to learn how we typically integrate db migrations into a release.
  1. I haven't yet spoken with Matija and I don't know if this protocol is aspirational or is already implemented on their end.
  1. The document implies that a doi is included with the request (along with accession identifier). Since we haven't implemented doi (as far as I know), I'm not sure if the plant accession identifier is enough info to ensure we can programmatically find the correct accession id. In other words, I'm not sure how robust/reliable it would be to search our db for SELECT accession_id FROM accession WHERE accession_number_part1 = 'PI' AND accession_number_part2 = 12345 and expect no more than one result. I need to determine if I need to require our own numerical ids as part of the request, or find some other means to make this request reliable.
  1. The document also implies that it would include pii of the requesting user, but since we'd be redirecting the user into our own checkout process, I'm not sure we'd need or want that information.
Last edited 2 years ago by dbmubrett (previous) (diff)

comment:4 by dbmubrett, 2 years ago

After a group chat with Matija today, it looks like we will pretty much implement this updated flow as documented on the PDF. I will make a local implementation and share the details with Matija to hammer out the details of the POST API request.

We were able to resolve some of the concerns I posted above.

Regarding concern (2) above: This flow is not implemented on the Genesys website. MAtija will be implementing this flow in parallel with our own implementation.

Regarding concern (3) above: Matija noted that the POST request can include a dataProviderId corresponding to our own numerical accession keys.

Regarding concern (4) above: I am thinking that this information should facilitate a convenience feature where the user can have some of their profile/account forms automatically filled out for them as they go through the web request process on our site.

by dbmubrett, 2 years ago

Attachment: external-request.yaml​ added

External endpoint swagger yaml file

by dbmubrett, 2 years ago

Screenshot of blurb added to checkout process

comment:5 by dbmubrett, 2 years ago

I've pushed the implementation for this onto a branch in gitlab: ​http://10.19.50.70:8080/Brett.Hunter/server/-/commit/d9b074d178bae767136f7c51127b87c8b87f833a

Cart Checkout Changes

In addition to the POST endpoint, I've made some small changes to the checkout process for users that come from genesys via the external-request query param link:

Before placing the order, I'm automatically prepending a special instruction note (also screenshot attached) so staff can have some contextual awareness in the CT that the order was placed via Genesys:

* Originated as an external request from Genesys *

Marty pointed out that the accessions requested via genesys will sometimes have multiple associated inventory options. To account for this, I added a brief blurb in the shopping cart during the checkout process for these external orders (see attached screenshot also):

Ensure each item reflects the correct form (seed, cutting, etc.) and inventory prior to check out. Visit the item details page to view alternatives.

I could use some feedback on the specific verbiage here. There's a relatively small number of accessions with multiple inventory available (~4% of accessions if I queried correctly) so I'm not inclined to add too much effort in this edge case unless someone thinks we need a more robust solution here (i.e., add an interface to the cart page to allow directly selecting inventory alternatives for each cart item).

Schema Change

This implementation includes a new table web_order_request_external that associates with web_order_request_id FK. This will allow us to persist the external request data and track which orders originate from genesys or any other external entity we ultimately enable. This uses a guid pk and I'd appreciate any feedback on the details here (via SSMS table designer, not sure if all the constraints make sense):

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[web_order_request_external](
	[web_order_request_external_id] [uniqueidentifier] NOT NULL,
	[web_order_request_id] [int] NULL,
	[auth_key] [uniqueidentifier] NOT NULL,
	[schemaless_request_items] [nvarchar](max) NOT NULL,
	[schemaless_requestor_data] [nvarchar](max) NOT NULL,
	[created_date] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_web_order_request_external] PRIMARY KEY NONCLUSTERED 
(
	[web_order_request_external_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[web_order_request_external] ADD  CONSTRAINT [DF_web_order_request_external_web_order_request_external_id]  DEFAULT (newid()) FOR [web_order_request_external_id]
GO

ALTER TABLE [dbo].[web_order_request_external]  WITH CHECK ADD  CONSTRAINT [FK_web_order_request_external_web_order_request_external] FOREIGN KEY([web_order_request_external_id])
REFERENCES [dbo].[web_order_request_external] ([web_order_request_external_id])
GO

ALTER TABLE [dbo].[web_order_request_external] CHECK CONSTRAINT [FK_web_order_request_external_web_order_request_external]
GO

Still TODO:

  • Share the swagger yaml (attached) with Matija for feedback.
  • Deploy this feature on an external instance for Matija to develop/test against.
  • Code review. I'm new to the codebase and C# so I'd like to get some code review (the diff is linked above on gitlab).
Last edited 19 months ago by dbmubrett (previous) (diff)

by dbmubrett, 2 years ago

Screenshot of automatic special instructions

by Martin Reisinger, 2 years ago

comment:6 by Martin Reisinger, 2 years ago

added image with suggested verbiage to warn requesters of possible alternative forms;

unrelated -- NPGS will be moving to incorporating DOIs soon (possibly autumn, 2024?)- this needs to be discussed & approved across NPGS, but any prior resistance to this idea has essentially dissipated.

Note: See TracTickets for help on using tickets.