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

DPL 950 - NT barcodes import #1453

Merged
merged 20 commits into from
Jan 10, 2024
Merged

DPL 950 - NT barcodes import #1453

merged 20 commits into from
Jan 10, 2024

Conversation

seenanair
Copy link
Contributor

@seenanair seenanair commented Dec 14, 2023

  • GeneralReception page update

    • New source option "Sequencescape Tubes"
    • Print support
      • Displays only when source selected is "Sequencescape Tubes"
      • Displays human barcodes when user enters a valid barcode
      • Printer option selection
      • Support priniting on 'Print' button click
    • Fetching labware data from Sequencescape on entering/scanning barcodes
    • Import functaionlity modification
  • SequencescapeTubes added in receptions

  • sequencescapeUils.js added - all generic functions used between receptions/Sequencescape and receptions/SequenscapeTubes

  • Unit and e2e test case updates

  • Resolving import paths

Copy link
Collaborator

@stevieing stevieing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things to look at but looking good.

*
* @returns {Array} Array of attribute keys
*/
const getAttributeKeys = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can turn this into a 1 liner
return Object.keys(labwareTypes).flatMap((type) => labwareTypes[type].attributes)

...buildRequestAndSample({ aliquot, study, sample, sample_metadata, requestOptions }),
}
}
const labwareTypes = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

labwareTypes seem to be the same in both receptions. Maybe we can move it to the utils?

Copy link
Contributor Author

@seenanair seenanair Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually they are different in both -
For Sequencescape it contains both plates and tubes,
const labwareTypes = { plates: { type: 'plates', attributes: 'plates_attributes', transformFunction: transformPlate, }, tubes: { type: 'tubes', attributes: 'tubes_attributes', transformFunction: transformTube, }, }

For SequenceTubes , it contains only tubes
const labwareTypes = { tubes: { type: 'tubes', attributes: 'tubes_attributes', transformFunction: transformTube, }, }

Probably , we can have the default in utils as only having tubes
const labwareTypes = { tubes: { type: 'tubes', attributes: 'tubes_attributes', transformFunction: transformTube, }, }
and in Sequencescape , we can modify this generic type to append the 'plates' as well. But , I am not sure whether it improves much as there are only two of them. Please comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the default have both plates and tubes and then each reception uses the appropriate one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good. I will make the changes 👍

name: 'sequencescape-tubes',
text: 'Sequencescape Tubes',
value: 'SequencescapeTubes',
},
}

// TO MODIFY - remove versions once dpl_877_reception_request is enabled by default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this comment now you have removed the flag?

}
}

const labwareTypes = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my previous comment I think we could put this back to remove duplication in the receptions.

// labwareData is used to store the input barcodes as well as the data fetched from sequencescape which is then imported into traction
labwareData: {
inputBarcodes: [], // inputBarcodes is used to store the barcodes that the user has inputted
foundBarcodes: new Set(), // foundBarcodes is used to store the barcodes that have been found in sequencescape
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Using sets is a great way to prevent duplicates.

showModal(message) {
this.modalState = { visible: true, message }
},
importFailed({ message }) {
//Handler for deleting barcodes from the input field
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirey sure what is going on here but you may be able to turn it into a map.

Copy link
Contributor Author

@seenanair seenanair Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler is designed for an edge case that addresses inconsistencies arising when the user enters barcodes and subsequently deletes them using the backspace or delete key. When the user inputs data, we fetch that information upon pressing the enter key, and our labwareData object keeps the necessary details from sequencescape fetch (used for printing or importing).
However, if the user removes the barcode by pressing delete or backspace, the data stored in our state may become inconsistent with what is present in the input barcode field. Therefore, it is essential to delete all information corresponding to the deleted input barcode. Failing to do so could result in printing or importing information related to barcodes that are no longer in the input barcode field.
Hope it make sense.

As we are keeping three different array fields in labwareData for inputBarcodes, foundBarcdes(from SS) and attributes (again from SS for import) I thought forEach is better to make changes for each of them.

Please let me know your thoughts on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative solution to completely eliminate this issue and this handler is to inform the user that, after making any changes in input barcode field( whether it is delete or any edit), they should press 'Enter'. This action will ensure that the labwareData state aligns consistently with the barcodes in the input field.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth a call about this? Function seems to work fine but looks like there could be room for simplifying.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure. Do you have some time tomorrow after 10.30 , for a quick call?

- Removed feature flag comment
- Code enhancements
Copy link
Collaborator

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, couple comments.

.env.production Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can unstage this if its not intentional.

include: 'receptacles.aliquots.sample.sample_metadata,receptacles.aliquots.study',
fields: {
tubes: 'labware_barcode,receptacles',
wells: 'position,aliquots',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont think we need to fetch wells as this is only for tubes.

showModal(message) {
this.modalState = { visible: true, message }
},
importFailed({ message }) {
//Handler for deleting barcodes from the input field
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth a call about this? Function seems to work fine but looks like there could be room for simplifying.

- labwareTypes, transformTube, transformPlate moved to utils
BenTopping
BenTopping previously approved these changes Jan 5, 2024
@@ -272,6 +272,7 @@ export default {
attributes: [], // attributes is used to store the attributes that have been found in sequencescape
},
printerName: '',
debounceTimer: 1000, // debounce timer for barcode deletion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be set to null by default since its not the time its the timer itself. I think thats my mistake when we went over it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenTopping
No, you helped a lot. It's bit stupid of me that I didn't realise that it's a timerId returned by setTimeout and not a timer value.
Updated to null now 👍

- debounceTimer set to null
- Fixed console warning for TractionBadge.spec.js
@stevieing stevieing merged commit f52a71d into develop Jan 10, 2024
5 checks passed
@stevieing stevieing deleted the dpl-950-import-NT-barcodes branch January 10, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants