Skip to content

Commit

Permalink
Merge branch 'pre-release/2024-R5.3' into improvement/LIMS-1458/fix-g…
Browse files Browse the repository at this point in the history
…ithub-warnings
  • Loading branch information
ndg63276 authored Dec 3, 2024
2 parents f7ae077 + 6e51851 commit 0219093
Show file tree
Hide file tree
Showing 44 changed files with 589 additions and 386 deletions.
5 changes: 3 additions & 2 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"mpdf/mpdf": "8.1.2",
"ralouphie/getallheaders": "2.0.5",
"slim/slim": "2.6.2",
"stomp-php/stomp-php": "3.0.6",
"php-amqplib/php-amqplib": "^2.0",
"symfony/http-foundation": "^5.4",
"symfony/filesystem": "^5.4",
"mpdf/qrcode": "^1.2",
"mtcmedia/dhl-api": "dev-master#9b4b6315",
"maennchen/zipstream-php": "2.1.0"
"maennchen/zipstream-php": "2.1.0",
"phpseclib/bcmath_compat": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
16 changes: 8 additions & 8 deletions api/scripts/mtz2map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ else
fi
fi

#export CCP4_MASTER=/dls_sw/apps/ccp4/<ccp4 version>
export CCP4_MASTER=$5
export CINCL=$CCP4_MASTER/include
export CLIBD=$CCP4_MASTER/lib/data

export CCP4_SCR=/tmp
export root=$CCP4_MASTER/bin

if [ $3 == 'dimple' -o $3 == 'mrbump' ]; then

if [ -f $4 ]; then
Expand All @@ -28,14 +36,6 @@ else
fi
fi

#export CCP4_MASTER=/dls_sw/apps/ccp4/<ccp4 version>
export CCP4_MASTER=$5
export CINCL=$CCP4_MASTER/include
export CLIBD=$CCP4_MASTER/lib/data

export CCP4_SCR=/tmp
export root=$CCP4_MASTER/bin

if [ $3 == 'dimple' ]; then

if $root/mtzinfo $mtz | grep -q PH2FOFCWT; then
Expand Down
16 changes: 9 additions & 7 deletions api/src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,14 +1109,16 @@ function _submit_zocalo_recipe($recipe, $parameters, $error_code = 500)
}


function _send_zocalo_message($zocalo_queue, $zocalo_message, $error_code = 500)
function _send_zocalo_message($rabbitmq_zocalo_vhost, $zocalo_message, $error_code = 500)
{
global
$zocalo_server,
$zocalo_username,
$zocalo_password;
$rabbitmq_zocalo_host,
$rabbitmq_zocalo_port,
$rabbitmq_zocalo_username,
$rabbitmq_zocalo_password,
$rabbitmq_zocalo_routing_key;

if (empty($zocalo_server) || empty($zocalo_queue))
if (empty($rabbitmq_zocalo_host) || empty($rabbitmq_zocalo_vhost))
{
$message = 'Zocalo server or queue not specified.';
error_log($message);
Expand All @@ -1129,8 +1131,8 @@ function _send_zocalo_message($zocalo_queue, $zocalo_message, $error_code = 500)
try
{
error_log("Sending message" . var_export($zocalo_message, true));
$queue = new Queue($zocalo_server, $zocalo_username, $zocalo_password);
$queue->send($zocalo_queue, $zocalo_message, true, $this->user->loginId);
$queue = new Queue($rabbitmq_zocalo_host, $rabbitmq_zocalo_port, $rabbitmq_zocalo_username, $rabbitmq_zocalo_password, $rabbitmq_zocalo_vhost);
$queue->send($zocalo_message, $rabbitmq_zocalo_routing_key);
}
catch (Exception $e)
{
Expand Down
4 changes: 2 additions & 2 deletions api/src/Page/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Contact extends Page
{

public static $arg_list = array('CARDNAME' => '([\w\s\-])+',
'FAMILYNAME' => '([\w\-])+',
'GIVENNAME' => '([\w\-])+',
'FAMILYNAME' => '([\w\s\-])+',
'GIVENNAME' => '([\w\s\-])+',
'PHONENUMBER' => '.*',
'EMAILADDRESS' => '.*',
'LABNAME' => '([\w\s\-])+',
Expand Down
66 changes: 44 additions & 22 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DC extends Page
array('/dat/:id', 'get', '_plot'),
);

const EVTOA = 12398.4198;

# ------------------------------------------------------------------------
# Data Collection AJAX Requests
# This is pretty crazy, it will return unioned data collections, energy
Expand Down Expand Up @@ -121,11 +123,11 @@ function _data_collections($single = null)

$where = '';
if ($this->arg('t') == 'sc')
$where = ' AND (dc.overlap != 0 OR ifnull(et.name, dcg.experimenttype) = "Screening")';
$where = ' AND (dc.overlap != 0 OR ifnull(et.name, dcg.experimenttype) in ("Screening", "Characterization"))';
else if ($this->arg('t') == 'gr')
$where = ' AND dc.axisrange = 0';
else if ($this->arg('t') == 'fc')
$where = ' AND dc.overlap = 0 AND dc.axisrange > 0 AND dc.numberOfImages > 1 AND ifnull(et.name, dcg.experimenttype) != "Screening"';
$where = ' AND dc.overlap = 0 AND dc.axisrange > 0 AND dc.numberOfImages > 1 AND ifnull(et.name, dcg.experimenttype) not in ("Screening", "Characterization")';
} else if ($this->arg('t') == 'edge') {
$where2 = '';
} else if ($this->arg('t') == 'mca') {
Expand All @@ -139,11 +141,11 @@ function _data_collections($single = null)
$where2 = " AND es.comments LIKE '%_FLAG_%'";
$where4 = " AND xrf.comments LIKE '%_FLAG_%'";
} else if ($this->arg('t') == 'ap') {
$where = ' AND app.processingstatus = 1';
$where = " AND ifnull(et.name, dcg.experimenttype) not in ('Screening', 'Characterization') AND app.processingstatus = 1";
$extj[0] .= "INNER JOIN autoprocintegration ap ON dc.datacollectionid = ap.datacollectionid
INNER JOIN autoprocprogram app ON app.autoprocprogramid = ap.autoprocprogramid";
} else if ($this->arg('t') == 'ph') {
$where = " AND app.processingstatus = 1 AND app.processingprograms in ('big_ep', 'fast_ep')";
$where = " AND ifnull(et.name, dcg.experimenttype) not in ('Screening', 'Characterization') AND app.processingstatus = 1 AND app.processingprograms in ('big_ep', 'fast_ep')";
$extj[0] .= "INNER JOIN processingjob pj ON dc.datacollectionid = pj.datacollectionid
INNER JOIN autoprocprogram app ON app.processingjobid = pj.processingjobid";
} else if ($this->arg('t') == 'err') {
Expand Down Expand Up @@ -368,13 +370,14 @@ function _data_collections($single = null)
$s = str_replace('_', '$_', $this->arg('s'));

$st = sizeof($args) + 1;
$where .= " AND (lower(dc.filetemplate) LIKE lower(CONCAT(CONCAT('%',:$st),'%')) ESCAPE '$' OR lower(dc.imagedirectory) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 1) . "), '%')) ESCAPE '$' OR lower(smp.name) LIKE lower(CONCAT(CONCAT('%', :" . ($st + 2) . "), '%')) ESCAPE '$')";
$where2 .= " AND (lower(es.comments) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 3) . "), '%')) ESCAPE '$' OR lower(es.element) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 4) . "), '%')) ESCAPE '$' OR lower(smp.name) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 5) . "), '%')) ESCAPE '$')";
$where .= " AND (dc.filetemplate LIKE CONCAT('%',:$st,'%') ESCAPE '$' OR dc.imagedirectory LIKE CONCAT('%',:" . ($st + 1) . ",'%') ESCAPE '$' OR smp.name LIKE CONCAT('%', :" . ($st + 2) . ",'%') ESCAPE '$')";
$where2 .= " AND (es.comments LIKE CONCAT('%',:" . ($st + 3) . ",'%') ESCAPE '$' OR es.element LIKE CONCAT('%',:" . ($st + 4) . ",'%') ESCAPE '$' OR smp.name LIKE CONCAT('%',:" . ($st + 5) . ",'%') ESCAPE '$')";
$where3 .= ' AND r.robotactionid < 0';
$where4 .= " AND (lower(xrf.filename) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 6) . "), '%')) ESCAPE '$' OR lower(smp.name) LIKE lower(CONCAT(CONCAT('%',:" . ($st + 7) . "), '%')) ESCAPE '$')";
$where4 .= " AND (xrf.filename LIKE CONCAT('%',:" . ($st + 6) . ",'%') ESCAPE '$' OR smp.name LIKE CONCAT('%',:" . ($st + 7) . ",'%') ESCAPE '$')";

for ($i = 0; $i < 8; $i++)
array_push($args, $s);

}

# Set Count field
Expand Down Expand Up @@ -421,9 +424,12 @@ function _data_collections($single = null)
dc.transmission,
dc.axisrange,
dc.wavelength,
".self::EVTOA."/dc.wavelength as energy,
dc.comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
dc.xtalsnapshotfullpath1 as x1,
dc.xtalsnapshotfullpath2 as x2,
dc.xtalsnapshotfullpath3 as x3,
Expand All @@ -440,7 +446,7 @@ function _data_collections($single = null)
dc.c2lens,
dc.objaperture,
dc.magnification,
dc.totalexposeddose as totaldose,
dose.total as totaldose,
CAST(dc.totalabsorbeddose AS DECIMAL(5, 2)) as totalabsdose,
d.detectorpixelsizehorizontal,
d.detectorpixelsizevertical,
Expand Down Expand Up @@ -511,9 +517,9 @@ function _data_collections($single = null)
// $this->db->set_debug(True);

// will want to support these too at some point
$where2 = ' AND es.energyscanid < 0';
$where3 = ' AND r.robotactionid < 0';
$where4 = ' AND xrf.xfefluorescencespectrumid < 0';
$where2 .= ' AND es.energyscanid < 0';
$where3 .= ' AND r.robotactionid < 0';
$where4 .= ' AND xrf.xfefluorescencespectrumid < 0';

if ($this->has_arg('dcg')) {
$where .= ' AND dc.datacollectiongroupid=:' . (sizeof($args) + 1);
Expand Down Expand Up @@ -555,9 +561,12 @@ function _data_collections($single = null)
min(dc.transmission) as transmission,
min(dc.axisrange) as axisrange,
min(dc.wavelength) as wavelength,
".self::EVTOA."/min(dc.wavelength) as energy,
min(dc.comments) as comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
min(dc.xtalsnapshotfullpath1) as x1,
min(dc.xtalsnapshotfullpath2) as x2,
min(dc.xtalsnapshotfullpath3) as x3,
Expand All @@ -574,7 +583,7 @@ function _data_collections($single = null)
max(dc.c2lens) as c2lens,
max(dc.objaperture) as objaperture,
max(dc.magnification) as magnification,
sum(dc.totalabsorbeddose) as totaldose,
dose.total as totaldose,
CAST(dc.totalabsorbeddose AS DECIMAL(5, 2)) as totalabsdose,
max(d.detectormanufacturer) as detectormanufacturer,
max(d.detectormodel) as detectormodel,
Expand Down Expand Up @@ -660,6 +669,9 @@ function _data_collections($single = null)
SELECT $extcg $fields
FROM datacollection dc
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN (
select datacollectiongroupid, sum(totalabsorbeddose) as total from datacollection group by datacollectiongroupid) dose
ON dc.datacollectiongroupid = dose.datacollectiongroupid
INNER JOIN blsession ses ON ses.sessionid = dcg.sessionid
LEFT OUTER JOIN experimenttype et on dcg.experimenttypeid = et.experimenttypeid
$sample_joins[0]
Expand Down Expand Up @@ -701,17 +713,20 @@ function _data_collections($single = null)
es.energyscanid,
1,
es.element,
es.peakfprime,
es.peakfprime as resolution,
es.exposuretime,
es.axisposition,
es.peakfdoubleprime,
es.peakfdoubleprime as numimg,
es.starttime as st,
es.transmissionfactor,
es.inflectionfprime,
es.inflectionfdoubleprime,
es.inflectionfprime as axisrange,
es.inflectionfdoubleprime as wavelength,
1 as energy,
es.comments,
es.peakenergy,
es.inflectionenergy,
".self::EVTOA."/es.peakenergy as wpk,
".self::EVTOA."/es.inflectionenergy as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -801,10 +816,13 @@ function _data_collections($single = null)
TO_CHAR(xrf.starttime, 'DD-MM-YYYY HH24:MI:SS') as st,
xrf.beamtransmission,
1,
xrf.energy,
".self::EVTOA."/xrf.energy as wavelength,
xrf.energy as energy,
xrf.comments,
1,
1,
1 as wpk,
1 as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -895,9 +913,12 @@ function _data_collections($single = null)
1,
1,
1,
1 as energy,
'A',
1,
1,
1 as wpk,
1 as win,
r.xtalsnapshotbefore,
r.xtalsnapshotafter,
'A',
Expand Down Expand Up @@ -970,7 +991,7 @@ function _data_collections($single = null)

// Data collections
if ($dc['TYPE'] == 'data') {
$nf = array(1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));
$nf = array(0 => array('ENERGY'), 1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));

$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['DIR']);
Expand All @@ -989,9 +1010,10 @@ function _data_collections($single = null)
$dc['DCT'] = 'Data Collection';
}

if ($dc['DCT'] == 'Mesh')
if ($dc['DCT'] == 'Mesh' || $dc['DCT'] == 'Mesh3D' ||
($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1)
) {
$dc['DCT'] = 'Grid Scan';
if ($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1) {
$dc['TYPE'] = 'grid';
}
//$this->profile('dc');
Expand All @@ -1006,12 +1028,12 @@ function _data_collections($single = null)

$dc['FILETEMPLATE'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['FILETEMPLATE']);

$nf = array(2 => array('EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
$nf = array(1 => array('EPK', 'EIN'), 2 => array('AXISRANGE', 'WAVELENGTH', 'EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION', 'NUMIMG'), 5 => array('WPK', 'WIN'));
$this->profile('edge');

// MCA Scans
} else if ($dc['TYPE'] == 'mca') {
$nf = array(2 => array('EXPOSURETIME', 'WAVELENGTH', 'TRANSMISSION'));
$nf = array(0 => array('ENERGY'), 2 => array('EXPOSURETIME', 'TRANSMISSION'), 4 => array('WAVELENGTH'));
$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/\d\d\d\d\/\w\w\d+-\d+\//', '', $dc['DIR']);

Expand Down
Loading

0 comments on commit 0219093

Please sign in to comment.