Skip to content

Commit

Permalink
LIMS-395: Use new XRC tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Williams committed Jul 10, 2023
1 parent ccaebd1 commit 47b908a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion api/src/Database/Type/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class MySQL extends DatabaseParent {

// Xray Centring
'XrayCentringResult',
'XrayCentring',

'BeamCalendar',
'SpaceGroup',
Expand Down Expand Up @@ -551,4 +552,4 @@ function close()
if ($this->conn)
$this->conn->close();
}
}
}
6 changes: 4 additions & 2 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -1441,17 +1441,19 @@ function _null_or($field, $conversion)
# Grid Scan Info
function _grid_info()
{
$info = $this->db->pq("SELECT dc.datacollectiongroupid, dc.datacollectionid, dc.axisstart, p.posx as x, p.posy as y, p.posz as z, g.dx_mm, g.dy_mm, g.steps_x, g.steps_y, IFNULL(g.micronsperpixelx,g.pixelspermicronx) as micronsperpixelx, IFNULL(g.micronsperpixely,g.pixelspermicrony) as micronsperpixely, g.snapshot_offsetxpixel, g.snapshot_offsetypixel, g.orientation, g.snaked, DATE_FORMAT(dc.starttime, '%Y%m%d') as startdate
$info = $this->db->pq("SELECT dc.datacollectiongroupid, dc.datacollectionid, dc.axisstart, p.posx as x, p.posy as y, p.posz as z, g.dx_mm, g.dy_mm, g.steps_x, g.steps_y, IFNULL(g.micronsperpixelx,g.pixelspermicronx) as micronsperpixelx, IFNULL(g.micronsperpixely,g.pixelspermicrony) as micronsperpixely, g.snapshot_offsetxpixel, g.snapshot_offsetypixel, g.orientation, g.snaked, DATE_FORMAT(dc.starttime, '%Y%m%d') as startdate, xrc.status as xrcstatus, xrcr.xraycentringresultid
FROM gridinfo g
INNER JOIN datacollection dc on (dc.datacollectionid = g.datacollectionid) or (dc.datacollectiongroupid = g.datacollectiongroupid)
LEFT OUTER JOIN position p ON dc.positionid = p.positionid
LEFT OUTER JOIN xraycentring xrc ON dc.datacollectiongroupid = xrc.datacollectiongroupid
LEFT OUTER JOIN xraycentringresult xrcr ON xrc.xraycentringid = xrcr.xraycentringid
WHERE dc.datacollectionid = :1 ", array($this->arg('id')));

if (!sizeof($info))
$this->_output(array());
else {
foreach ($info[0] as $k => &$v) {
if ($k == 'ORIENTATION')
if ($k == 'ORIENTATION' || $k == 'XRCSTATUS')
continue;
$v = floatval($v);
}
Expand Down
17 changes: 9 additions & 8 deletions client/src/js/modules/dc/views/gridplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ define(['jquery', 'marionette',
populatePIA: function() {
var d = this.distl.get('data')
var defaultPIA = 'pia_total_intensity'
var numberOfImages = this.grid.get('STEPS_X') * this.grid.get('STEPS_Y')
var dcAgeMinutes = this.getOption('parent').get('AGE')
if (d[0].length < 1) {
this.ui.ty.hide()
if (this.attachments.length) {
Expand All @@ -224,12 +222,15 @@ define(['jquery', 'marionette',
if (a) this.ui.ty2.val(a.get('DATACOLLECTIONFILEATTACHMENTID'))
this.loadAttachment()
}
} else if (d[0].length != numberOfImages && dcAgeMinutes < 5) {
this.trigger('warning', 'Per image analysis still ongoing');
} else if (d[0].length != numberOfImages) {
this.trigger('warning', 'Missing per image analysis');
} else if (Math.max(...d[0].map(o => o[1])) == 0) {
this.trigger('warning', 'Zero spots found');
}
var xrcstatus = this.grid.get('XRCSTATUS')
var result = this.grid.get('XRAYCENTRINGRESULTID')
if (xrcstatus == 'success' && result == 0) {
this.trigger('warning', 'No diffraction found');
} else if (xrcstatus == 'failed') {
this.trigger('warning', 'Xray Centring has failed');
} else if (xrcstatus == 'pending') {
this.trigger('warning', 'Xray Centring analysis pending');
}
},

Expand Down

0 comments on commit 47b908a

Please sign in to comment.