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

Integrate/imca shipments #239

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2080109
allow container assigment by staff from prop + beamline as well as visit
stufisher Aug 22, 2020
970b402
allow filtering containers by shipment, and by registry
stufisher Aug 22, 2020
f58e11e
add diffractionplan columns to sample, get samples by shipment
stufisher Aug 22, 2020
f9f8b40
add new diffraction plan columns and container view toggle
stufisher Aug 22, 2020
80e18cb
add csv importer
stufisher Aug 22, 2020
80708bd
add barcode scan container assign page
stufisher Aug 22, 2020
3d64911
add new config.json option
stufisher Aug 23, 2020
f123ba1
count distinct rather than groupby
stufisher Aug 23, 2020
9a44717
dont fetch if val empty, debounce right function
stufisher Aug 29, 2020
387f20d
update breadcrumbs
stufisher Aug 31, 2020
4c6c614
punctuation
stufisher Aug 31, 2020
c0acf24
use concat_ws incase some values are null
stufisher Sep 1, 2020
3bfa5a4
add collectionmode and priority
stufisher Sep 14, 2020
f4d07e5
add other csv mime types
stufisher Sep 16, 2020
2f4e62b
mime type is not sent on windows :|
stufisher Sep 17, 2020
c534cf4
increase page size for sample
stufisher Sep 22, 2020
9cc0d66
validate barcode on scan assign page
stufisher Dec 23, 2020
6936828
wip: mailin enhancements
stufisher Apr 10, 2021
aca1db8
make possible to disable diff plan columns for containers
stufisher Apr 26, 2021
35f1d48
rename csv button
stufisher Apr 26, 2021
5554832
add mark shipment returned button and api, add mark queue completed a…
stufisher Apr 30, 2021
7544d8a
document disabling exp_plan fields
stufisher Apr 30, 2021
2a14dcd
add initial queued containers view
stufisher Apr 30, 2021
548c8f8
update container review page, link from container
stufisher Apr 30, 2021
94c266f
separate spacegroups
stufisher Apr 30, 2021
86fb5c6
add additional filters to queue view
stufisher May 22, 2021
3fe0a46
add queue button to admin menu
stufisher May 22, 2021
0263e95
allow customising auto collect label
stufisher May 22, 2021
6fd7c79
remove debug
stufisher May 22, 2021
b5b5ba7
add link back to container
stufisher May 22, 2021
60b03e4
allow staff to queue entire shipment
stufisher May 22, 2021
a4393c0
remove debug
stufisher May 22, 2021
5ad92d8
stop shipment return if there are still outstanding queued containers
stufisher May 24, 2021
2796146
allow anyone to use queue shipment button if enabled
stufisher May 29, 2021
27112d6
add samples to containerqueue for pucks and allow editing their statu…
stufisher May 29, 2021
2fdd64b
correct where option comes from...
stufisher May 31, 2021
edf5155
increase number of containers when queuing a shipment
stufisher Jun 5, 2021
168330a
Enable UAS API to set delivered time on close
Jul 26, 2021
38d4361
Add hooks for determining delivered time on session close api call
Jul 26, 2021
f1d61b9
Add missing import in shipment routes file
Jul 29, 2021
5d868a1
Update comments to describe custom site logo
Jul 29, 2021
3c09b29
Added missing route for import csv
Jul 29, 2021
252811f
Make clear csv_profile in config.json does not need file extension
Jul 29, 2021
bf67b48
Prevent sample patch failing because no container id
Jul 29, 2021
35dfcb9
Revert "Enable UAS API to set delivered time on close"
Jul 26, 2021
d6be16e
Revert "Add hooks for determining delivered time on session close api…
Jul 26, 2021
d20a907
add missing routes
stufisher Sep 13, 2021
5e48332
fix no images in review page
stufisher Jan 7, 2022
9dea442
correct permission for queued containers
stufisher Jan 7, 2022
55cc148
allow searching containers by owner(person).login
stufisher Jan 7, 2022
c2438fd
preserve search term in url (ty always first on queued containers)
stufisher Jan 7, 2022
a487761
apply search params to count query
stufisher Jan 7, 2022
4904a8c
make sure currentPage is int
stufisher Jan 7, 2022
4927bbb
add staffcomments to swagger api
stufisher Jan 7, 2022
94a2e08
received typo
stufisher Jan 7, 2022
24c5e79
prevent container / sample duplication for csv import
stufisher Jan 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add csv importer
  • Loading branch information
stufisher authored and Neil A Smith committed Aug 16, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 80e18cb634ff8eca43cb6df84e2aac4ff9e29b0c
92 changes: 92 additions & 0 deletions client/src/js/csv/imca.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
define([], function() {

return {
// The csv column names
headers: ['Puck', 'Pin', 'Project', 'Priority', 'Mode', 'Notes to Staff', 'Collection strategy', 'Contact person', 'Expected space group', 'Expected Cell Dimensions', 'Expected Resolution', 'Minimum Resolution Required to Collect', 'Recipe', 'Exposure time', 'Image Width', 'Phi', 'Attenuation', 'Aperture', 'Detector Distance', 'Prefix for frames', 'Observed Resolution', 'Comments From Staff', 'Status'],

// ... and their ISPyB table mapping
mapping: ['CONTAINER', 'LOCATION', 'ACRONYM', 'PRIORITY', 'COLLECTIONMODE', 'COMMENTS', 'COMMENTS', 'OWNER', 'SPACEGROUP', 'CELL', 'AIMEDRESOLUTION', 'REQUIREDRESOLUTION', 'RECIPE', 'EXPOSURETIME', 'AXISRANGE', 'AXISROTATION', 'TRANSMISSION', 'PREFERREDBEAMSIZEX', 'DETECTORDISTANCE', 'PREFIX', 'DCRESOLUTION', 'DCCOMMENTS', 'STATUS'],

// Columns to show on the import page
columns: {
LOCATION: 'Location',
PROTEINID: 'Protein',
NAME: 'Sample',
PRIORITY: 'Priority',
COLLECTIONMODE: 'Mode',
COMMENTS: 'Comments',
SPACEGROUP: 'Spacegroup',
CELL: 'Cell',
AIMEDRESOLUTION: 'Aimed Res',
REQUIREDRESOLUTION: 'Required Res',
EXPOSURETIME: 'Exposure (s)',
AXISRANGE: 'Axis Osc',
NUMBEROFIMAGES: 'No. Images',
TRANSMISSION: 'Transmission',
PREFERREDBEAMSIZEX: 'Beamsize',
},

// Import transforms
transforms: {
CELL: function(v, m) {
var comps = v.split(/\s+/)
_.each(['CELL_A', 'CELL_B', 'CELL_C', 'CELL_ALPHA', 'CELL_BETA', 'CELL_GAMMA'], function(ax, i) {
if (comps.length > i) m[ax] = comps[i].replace(',', '')
})
},
AXISROTATION: function(v, m) {
if (m.AXISRANGE) m.NUMBEROFIMAGES = m.AXISROTATION / m.AXISRANGE
},
SPACEGROUP: function(v, m) {
m.SPACEGROUP = v.replace(/[\(\)]/g, '')
},
LOCATION: function(v, m) {
if (!this.xcount) this.xcount = 1
m.NAME = 'x'+(this.xcount++)
},
COLLECTIONMODE: function(v, m) {
m.COLLECTIONMODE = v.toLowerCase()
}
},

// Export transforms
export: {
CELL: function(m) {
return `${m.CELL_A}, ${m.CELL_B}, ${m.CELL_C}, ${m.CELL_ALPHA}, ${m.CELL_BETA}, ${m.CELL_GAMMA}`.trim()
},

STATUS: function(m) {
var status = 'skipped'
if (m.QUEUEDTIMESTAMP) status = 'queued';
if (m.R > 0) status = 'recieved'
if (m.DC > 0) status = 'collected'

return status
},

AXISROTATION: function(m) {
return m.AXISRANGE * m.NUMBEROFIMAGES
},

COMMENTS: function(m, h) {
var comments = m.COMMENTS.split(' | ')
return comments.length > 1 && h == 'Collection strategy' ? comments[1] : comments[0]
}
},

exampleCSV: `Puck,Pin,Project,Priority,Mode,Notes to Staff,Collection strategy,Contact person,Expected space group,Expected Cell Dimensions,Expected Resolution,Minimum Resolution Required to Collect,Recipe,Exposure time,Image Width,Phi,Attenuation,Aperture,Detector Distance,Prefix for frames,Observed Resolution,Comments From Staff,Status
Blue53,1,a,1,Manual,Tricky,Do best you can,Luke,C2,"143.734, 67.095, 76.899, 90, 110.45, 90",1.9-3.5,4,luke-360.rcp,,,,,,,,,,
Blue53,2,a,1,Manual,Very tricky,New crystals,Luke,C2,140 65 75 90 110 90,1.8-2.4,3.5,,0.1,0.25,,95,5,250,image_,,,
Blue53,2,a,1,Manual,Very tricky,New crystals,Luke,C2,140 65 75 90 110 90,1.8-2.4,3.5,,0.1,0.25,,95,5,250,image_,,,
Blue53,3,b,3,Auto,Routine,SeMet,Luke,P2,52.4 39.8 65.0 108.5,1.5,1.7,,0.04,0.25,360,,10,300,,,,
Blue53,4,c,3,Auto,Rods,Native,Luke,P21,39 69.2 60 90 105.3,1.5,1.7,,0.04,0.25,360,95,20,,image_,,,
Blue53,5,d,8,,Plates,,Luke,C222,280 45 112 102 90,1.5,1.7,,0.04,0.25,360,95,50,300,image_,,,
Blue54,1,e,,Auto,,,,P212121,67 82 276,2.1,2.5,,,0.25,180,,10,350,image_,,,
Blue54,2,e,4,,,,Luke,P2(1)2(1)2(1),67 82 276,,1.7,luke-180.rcp,,,,,,,,,,
Blue54,3,f,,Auto,,,,P222,,2.1,,,0.04,,180,95,,350,image_,,,
Blue54,4,g,4,Auto,,,Luke,,,2.1,2.5,,0.04,0.25,180,75,,350,image_,,,
Blue54,5,h,99,Auto,,,Luke,P222,,2.2,2.5,,0.04,0.25,180,95,,400,image_,,,
`
}

})
38 changes: 35 additions & 3 deletions client/src/js/modules/shipment/controller.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ define(['backbone',
'modules/shipment/views/shipments',
'modules/shipment/views/shipment',
'modules/shipment/views/shipmentadd',

'modules/shipment/views/fromcsv',

'models/container',
'collections/containers',
'modules/shipment/views/container',
@@ -46,8 +47,8 @@ define(['backbone',

], function(Backbone,
GetView,
Dewar, Shipment, Shipments,
ShipmentsView, ShipmentView, ShipmentAddView,
Dewar, Shipment, Shipments,
ShipmentsView, ShipmentView, ShipmentAddView, ImportFromCSV,
Container, Containers, ContainerView, ContainerPlateView, /*ContainerAddView,*/ ContainersView, QueueContainerView,
ContainerRegistry, ContainersRegistry, ContainerRegistryView, RegisteredContainer,
RegisteredDewar, DewarRegistry, DewarRegView, RegDewarView, RegDewarAddView, DewarRegistryView,
@@ -116,6 +117,37 @@ define(['backbone',
}
},

// Import csv based on selected profile
import_csv: function(sid) {
if (!app.config.csv_profile) {
app.message({ title: 'CSV Import Not Enabled', message: 'Shipment CSV import is not currently enabled'})
return
}

var lookup = new ProposalLookup({ field: 'SHIPPINGID', value: sid })
lookup.find({
success: function() {
var shipment = new Shipment({ SHIPPINGID: sid })
shipment.fetch({
success: function() {
app.bc.reset([bc, { title: shipment.get('SHIPPINGNAME') }, { title: 'Import from CSV' }])
app.content.show(new ImportFromCSV({ model: shipment, format: 'imca' }))
},
error: function() {
app.bc.reset([bc])
app.message({ title: 'No such shipment', message: 'The specified shipment could not be found'})
},
})
},

error: function() {
app.bc.reset([bc, { title: 'No such shipment' }])
app.message({ title: 'No such shipment', message: 'The specified shipment could not be found'})
}
})
},


create_awb: function(sid) {
var shipment = new Shipment({ SHIPPINGID: sid })
shipment.fetch({
2 changes: 2 additions & 0 deletions client/src/js/modules/shipment/router.js
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ define(['utils/lazyrouter'], function(LazyRouter) {
'shipments/awb/sid/:sid': 'create_awb',
'shipments/pickup/sid/:sid': 'rebook_pickup',

'shipments/csv/:sid': 'import_csv',

'containers/cid/:cid(/iid/:iid)(/sid/:sid)': 'view_container',
'containers/queue/:cid': 'queue_container',
'containers/add/did/:did': 'add_container',
Loading