sanger / limber

A flexible lims extension of the old app
MIT License
3 stars 8 forks source link

Y24-024 [BUG] Targeted NanoSeq - Errors on metadata save when multiple children of AL Lib plate are created #1620

Closed andrewsparkes closed 4 months ago

andrewsparkes commented 4 months ago

Describe the bug As Targeted NanoSeq users we are getting an error when attempting to create a second or subsequent AL Lib Dil plate in the Targeted NanoSeq pipeline.

RT Ticket Number NA

See errors created in UAT by Maria M on 10th/11th March 24 See also errors in Production created by Lucy S on 12th March 24

To Reproduce Steps to reproduce the behaviour:

  1. Create one AL Lib Dil plate
  2. Attempt to create a second AL Lib Dil plate
  3. Get a 500 server error, in the logs we see: e.g.

    A StandardError occurred in plate_creation#create:
    
    New metadata for request (key: original_plate_barcode, value: SQPU-79408-L) did not save for request at child well location G5
    app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb:60:in `block in create_request_metadata'

NB. despite this error it has still falsely created the child plate as well, when it should not.

Expected behaviour Creation of second or subsequent plates should be possible e.g. if the first needs to be cancelled OR the customer requests they go back to the AL Lib and dilute samples differently.

Screenshots NA

Additional context It seems that the way we are storing the metadata for later use in the Merge file is not coping with the case where you try to create a second or subsequent child plate. The metadata is stored in the submission request, and as that is the same for both children, the 2nd and subsequent attempts to insert the metadata fail because it has already been written to the same requests for the first child (i.e. the code detects duplication).

Code location: app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb method: create_request_metadata

NB. this metadata partially comes from the customer file uploaded in the same labware creator, so it may be the file contents have changed and so metadata values are now different.

Code currently deliberately errors if duplicate keys detected on attempting an insert. Possible solution: check for key exists and update if it does, or insert if it does not. (update 12th Mar 24, this is not suitable, they need to go back to the AL Lib plate and process samples with different dilutions, so need to keep separate metadata for each run of the child plate somehow).

andrewsparkes commented 4 months ago

Duplicate of Y24-028, which is more up to date, so closing this one