From fd55df185a5ffd04ffe7427d6930f8c3e216e3f8 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Mon, 26 Jul 2021 11:44:52 +0100 Subject: [PATCH 1/2] New versions of upsert sprocs for particle picker and particle classifiation + grants --- grants/ispyb_processing.sql | 3 + .../sp_upsert_particle_classification_v2.sql | 64 +++++++++++++++++++ .../sp_upsert_particle_picker_v2.sql | 46 +++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 schemas/ispyb/stored_programs/sp_upsert_particle_classification_v2.sql create mode 100644 schemas/ispyb/stored_programs/sp_upsert_particle_picker_v2.sql diff --git a/grants/ispyb_processing.sql b/grants/ispyb_processing.sql index c50ae7da..7eaaeb93 100644 --- a/grants/ispyb_processing.sql +++ b/grants/ispyb_processing.sql @@ -136,5 +136,8 @@ GRANT EXECUTE ON PROCEDURE insert_phasing_analysis_results TO 'ispyb_processing' GRANT EXECUTE ON PROCEDURE insert_cryoem_initial_model TO 'ispyb_processing'; GRANT EXECUTE ON PROCEDURE upsert_particle_classification TO 'ispyb_processing'; +GRANT EXECUTE ON PROCEDURE upsert_particle_classification_v2 TO 'ispyb_processing'; GRANT EXECUTE ON PROCEDURE upsert_particle_classification_group TO 'ispyb_processing'; GRANT EXECUTE ON PROCEDURE upsert_particle_picker TO 'ispyb_processing'; +GRANT EXECUTE ON PROCEDURE upsert_particle_picker_v2 TO 'ispyb_processing'; + diff --git a/schemas/ispyb/stored_programs/sp_upsert_particle_classification_v2.sql b/schemas/ispyb/stored_programs/sp_upsert_particle_classification_v2.sql new file mode 100644 index 00000000..067a4ee4 --- /dev/null +++ b/schemas/ispyb/stored_programs/sp_upsert_particle_classification_v2.sql @@ -0,0 +1,64 @@ +-- Example calls: +-- +-- First create a Movie, a MotionCorrection, a ParticlePicker and a ParticleClassificationGroup: + +/* +SET @mid := NULL; +SET @mcid := NULL; +CALL upsert_movie(@mid, 6017405, NULL, NULL, NULL, NULL, NULL, NULL); +CALL upsert_motion_correction(@mcid, @mid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +SET @ppid := NULL; +CALL upsert_particle_picker_v2(@ppid, @mcid, NULL, 'pp template 1', 8.1, 151, '/xyzls/bl101/data/2021/bi23456-1/processed/kl_1_summary.jpg'); +SET @pcgid := NULL; +CALL upsert_particle_classification_group(@pcgid, @ppid, NULL, '2D', 1, 1300, 2, 'P222'); + +-- Then call this procedure: +SET @pcid := NULL; +CALL upsert_particle_classification_v2(@pcid, @pcgid, 1, '/absolute/path/to/image/file', 1200, 0.91, 2, 3.5, 2.8, 92); +*/ + +DELIMITER ;; +CREATE OR REPLACE DEFINER=`ispyb_root`@`%` PROCEDURE `upsert_particle_classification_v2`( + INOUT p_id int unsigned, + p_particleClassificationGroupId int unsigned, + p_classNumber int unsigned, + p_classImageFullPath varchar(255), + p_particlesPerClass int unsigned, + p_classDistribution float, + p_rotationAccuracy float, + p_translationAccuracy float, + p_estimatedResolution float, + p_overallFourierCompleteness float + ) + MODIFIES SQL DATA + COMMENT 'Inserts or updates info about a particle classification (p_id).\nMandatory columns:\nFor insert: p_particleClassificationGroupId\nFor update: p_id \nReturns: Record ID in p_id.' +BEGIN + IF p_id IS NOT NULL OR p_particleClassificationGroupId IS NOT NULL THEN + INSERT INTO ParticleClassification (particleClassificationId, + particleClassificationGroupId, classNumber, classImageFullPath, + particlesPerClass, classDistribution, rotationAccuracy, + translationAccuracy, estimatedResolution, overallFourierCompleteness) + VALUES (p_id, p_particleClassificationGroupId, p_classNumber, + p_classImageFullPath, + p_particlesPerClass, p_classDistribution, p_rotationAccuracy, + p_translationAccuracy, p_estimatedResolution, + p_overallFourierCompleteness) + ON DUPLICATE KEY UPDATE + particleClassificationGroupId = IFNULL(p_particleClassificationGroupId, particleClassificationGroupId), + classNumber = IFNULL(p_classNumber, classNumber), + classImageFullPath = IFNULL(p_classImageFullPath, classImageFullPath), + particlesPerClass = IFNULL(p_particlesPerClass, particlesPerClass), + classDistribution = IFNULL(p_classDistribution, classDistribution), + rotationAccuracy = IFNULL(p_rotationAccuracy, rotationAccuracy), + translationAccuracy = IFNULL(p_translationAccuracy, translationAccuracy), + estimatedResolution = IFNULL(p_estimatedResolution, estimatedResolution), + overallFourierCompleteness = IFNULL(p_overallFourierCompleteness, overallFourierCompleteness); + + IF p_id IS NULL THEN + SET p_id = LAST_INSERT_ID(); + END IF; + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument(s) are NULL: p_id OR p_particleClassificationGroupId must be non-NULL.'; + END IF; +END;; +DELIMITER ; diff --git a/schemas/ispyb/stored_programs/sp_upsert_particle_picker_v2.sql b/schemas/ispyb/stored_programs/sp_upsert_particle_picker_v2.sql new file mode 100644 index 00000000..aa869f81 --- /dev/null +++ b/schemas/ispyb/stored_programs/sp_upsert_particle_picker_v2.sql @@ -0,0 +1,46 @@ +-- Example calls: +-- First create a Movie and a MotionCorrection: +-- +/* +SET @mid := NULL; +SET @mcid := NULL; +CALL upsert_movie(@mid, 6017405, NULL, NULL, NULL, NULL, NULL, NULL); +CALL upsert_motion_correction(@mcid, @mid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- Then call this procedure: +SET @ppid := NULL; +CALL upsert_particle_picker_v2(@ppid, @mcid, NULL, 'pp template 1', 8.1, 151, '/xyzls/bl101/data/2021/bi23456-1/processed/kl_1_summary.jpg'); +*/ + +DELIMITER ;; +CREATE OR REPLACE DEFINER=`ispyb_root`@`%` PROCEDURE `upsert_particle_picker_v2`( + INOUT p_id int(11) unsigned, + p_firstMotionCorrectionId int(11) unsigned, + p_programId int(11) unsigned, + p_particlePickingTemplate varchar(255), + p_particleDiameter float, + p_numberOfParticles int unsigned, + p_summaryImageFullPath varchar(255) + ) + MODIFIES SQL DATA + COMMENT 'Inserts or updates info about a particle picker (p_id).\nMandatory columns:\nFor insert: p_firstMotionCorrectionId\nFor update: p_id \nReturns: Record ID in p_id.' +BEGIN + IF p_id IS NOT NULL OR p_firstMotionCorrectionId IS NOT NULL THEN + INSERT INTO ParticlePicker (particlePickerId, firstMotionCorrectionId, programId, particlePickingTemplate, particleDiameter, numberOfParticles, summaryImageFullPath) + VALUES (p_id, p_firstMotionCorrectionId, p_programId, p_particlePickingTemplate, p_particleDiameter, p_numberOfParticles, p_summaryImageFullPath) + ON DUPLICATE KEY UPDATE + firstMotionCorrectionId = IFNULL(p_firstMotionCorrectionId, firstMotionCorrectionId), + programId = IFNULL(p_programId, programId), + particlePickingTemplate = IFNULL(p_particlePickingTemplate, particlePickingTemplate), + particleDiameter = IFNULL(p_particleDiameter, particleDiameter), + numberOfParticles = IFNULL(p_numberOfParticles, numberOfParticles), + summaryImageFullPath = IFNULL(p_summaryImageFullPath, summaryImageFullPath); + + IF p_id IS NULL THEN + SET p_id = LAST_INSERT_ID(); + END IF; + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument(s) are NULL: p_id OR p_firstMotionCorrectionId must be non-NULL.'; + END IF; +END;; +DELIMITER ; From e9a49f6b19a7a28138cd01bebee958fa97cd0beb Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Mon, 26 Jul 2021 11:45:56 +0100 Subject: [PATCH 2/2] Bump version + refresh schema files + doc --- HISTORY.rst | 10 ++ schemas/ispyb/lookups.sql | 6 +- schemas/ispyb/routines.sql | 107 +++++++++++++++++- .../2021_07_26_AdminVar_bump_version.sql | 5 + 4 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 schemas/ispyb/updates/2021_07_26_AdminVar_bump_version.sql diff --git a/HISTORY.rst b/HISTORY.rst index 5694f1eb..5daa5298 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,16 @@ History Unreleased / master ------------------- +1.25.0 (2021-07-26) +------------------- + +New versions of stored procedures: + +* ``upsert_particle_picker_v2`` - new parameter ``p_summaryImageFullPath`` +* ``upsert_particle_classification_v2`` - new parameter ``p_classDistribution`` + + + 1.24.0 (2021-07-23) ------------------- diff --git a/schemas/ispyb/lookups.sql b/schemas/ispyb/lookups.sql index a9ff5f02..ada53bed 100644 --- a/schemas/ispyb/lookups.sql +++ b/schemas/ispyb/lookups.sql @@ -19,7 +19,7 @@ -- /*!40000 ALTER TABLE `AdminVar` DISABLE KEYS */; -INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.24.0'); +INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.25.0'); /*!40000 ALTER TABLE `AdminVar` ENABLE KEYS */; -- @@ -27,7 +27,7 @@ INSERT INTO `AdminVar` (`varId`, `name`, `value`) VALUES (4,'schemaVersion','1.2 -- /*!40000 ALTER TABLE `SchemaStatus` DISABLE KEYS */; -INSERT INTO `SchemaStatus` (`schemaStatusId`, `scriptName`, `schemaStatus`, `recordTimeStamp`) VALUES (6,'20180213_BLSample_subLocation.sql','DONE','2018-02-13 13:27:19'),(12,'20180213_DataCollectionFileAttachment_fileType.sql','DONE','2018-02-13 15:12:54'),(16,'20180303_v_run_to_table.sql','DONE','2018-07-25 15:11:18'),(19,'20180328_ImageQualityIndicators_alter_table.sql','DONE','2018-07-25 15:11:18'),(22,'20180410_BeamLineSetup_alter.sql','DONE','2018-07-25 15:11:18'),(25,'20180413_BeamLineSetup_and_Detector_alter.sql','DONE','2018-07-25 15:11:18'),(28,'20180501_DataCollectionGroup_experimentType_enum.sql','DONE','2018-07-25 15:11:18'),(31,'20180531_ScreeningOutput_alignmentSuccess.sql','DONE','2018-07-25 15:11:18'),(34,'20180629_DataCollection_imageContainerSubPath.sql','DONE','2018-07-25 15:11:18'),(35,'20180913_BeamCalendar.sql','DONE','2018-09-19 09:52:45'),(36,'2018_09_19_DataCollection_imageDirectory_comment.sql','DONE','2018-09-19 12:38:01'),(37,'2018_09_27_increase_schema_version.sql','DONE','2018-09-27 13:17:15'),(38,'2018_11_01_XrayCenteringResult.sql','DONE','2018-11-01 13:36:53'),(39,'2018_11_01_AutoProcProgram_dataCollectionId.sql','DONE','2018-11-01 15:10:38'),(40,'2018_11_01_AutoProcProgramMessage.sql','DONE','2018-11-01 15:28:17'),(44,'2018_11_01_DiffractionPlan_centeringMethod.sql','DONE','2018-11-01 22:51:36'),(45,'2018_11_02_DataCollectionGroup_experimentType_enum.sql','DONE','2018-11-02 11:54:15'),(47,'2018_11_05_spelling_of_centring.sql','DONE','2018-11-05 15:31:38'),(48,'2018_11_09_AutoProcProgram_update_processing_program.sql','DONE','2018-11-09 16:38:34'),(49,'2018_11_14_AutoProcProgramMessage_autoinc.sql','DONE','2018-11-14 10:15:27'),(50,'2018_11_22_AutoProcProgram_processingStatus_update.sql','DONE','2018-11-22 16:11:15'),(51,'2018_12_04_EnergyScan_and_XFEFluorescenceSpectrum_add_axisPosition.sql','DONE','2018-12-04 14:13:23'),(52,'2018_12_20_DataCollectionGroup_scanParameters.sql','DONE','2018-12-20 17:30:04'),(53,'2019_01_14_Proposal_state.sql','DONE','2019-01-14 12:13:31'),(54,'2019_01_14_ProcessingJobParameter_parameterValue.sql','DONE','2019-01-14 14:00:02'),(57,'2019_01_15_Detector_localName.sql','DONE','2019-01-15 23:01:15'),(58,'2019_02_04_BLSession_unique_index.sql','DONE','2019-02-04 13:52:19'),(59,'2019_03_29_BLSession_archived.sql','DONE','2019-04-03 14:43:08'),(60,'2019_04_03_UserGroup_and_Permission.sql','DONE','2019-04-03 14:51:04'),(61,'2019_04_07_AdminVar_bump_version.sql','DONE','2019-04-07 11:35:06'),(62,'2019_04_08_AdminVar_bump_version.sql','DONE','2019-04-08 15:38:01'),(63,'2019_04_23_AdminVar_bump_version.sql','DONE','2019-04-23 11:13:27'),(64,'2019_04_23_drop_v_run_view.sql','DONE','2019-04-23 11:13:35'),(67,'2019_04_23_v_run_additional_runs.sql','DONE','2019-04-23 12:39:47'),(68,'2019_05_28_AdminVar_bump_version.sql','DONE','2019-05-28 13:29:27'),(72,'2019_07_17_BLSample_crystalId_default.sql','DONE','2019-07-17 15:21:59'),(73,'2019_08_15_Sleeve.sql','DONE','2019-08-15 08:34:34'),(74,'2019_08_15_AdminVar_bump_version.sql','DONE','2019-08-15 08:57:37'),(75,'2019_08_28_AdminVar_bump_version.sql','DONE','2019-08-28 13:30:13'),(76,'2019_08_30_AdminVar_bump_version.sql','DONE','2019-08-30 11:58:16'),(77,'2019_10_06_BLSampleImage_fk3.sql','DONE','2019-10-06 16:55:44'),(78,'2019_10_08_DiffractionPlan_experimentKind.sql','DONE','2019-10-08 12:47:10'),(79,'2019_11_07_AutoProcProgramAttachment_importanceRank.sql','DONE','2019-11-07 16:35:25'),(80,'2019_11_07_AdminVar_bump_version.sql','DONE','2019-11-07 16:45:44'),(81,'2019_11_08_AdminVar_bump_version.sql','DONE','2019-11-08 16:09:52'),(82,'2019_11_26_v_run_idx1.sql','DONE','2019-11-26 15:00:21'),(83,'2019_12_02_AdminVar_bump_version.sql','DONE','2019-12-02 11:29:05'),(84,'2019_12_02_AdminVar_bump_version_v2.sql','DONE','2019-12-02 18:14:11'),(85,'2020_01_03_BLSampleImage_tables.sql','DONE','2020-01-03 16:05:45'),(86,'2020_01_06_AdminVar_bump_version.sql','DONE','2020-01-06 11:45:02'),(87,'2020_01_07_AdminVar_bump_version.sql','DONE','2020-01-07 09:45:25'),(88,'2020_01_07_AdminVar_bump_version_v2.sql','DONE','2020-01-07 10:24:54'),(89,'2020_01_07_AdminVar_bump_version_v3.sql','DONE','2020-01-07 11:16:09'),(90,'2020_01_20_AdminVar_bump_version.sql','DONE','2020-01-20 13:40:52'),(91,'2020_01_20_AdminVar_bump_version_v2.sql','DONE','2020-01-20 16:27:37'),(92,'2020_02_13_SpaceGroup_data.sql','DONE','2020-02-13 16:52:53'),(93,'2020_01_21_DiffractionPlan_experimentKind.sql','DONE','2020-02-13 17:13:17'),(94,'2020_02_21_ProposalHasPerson_role_enum.sql','DONE','2020-02-21 14:36:10'),(95,'2020_02_21_Session_has_Person_role_enum.sql','DONE','2020-02-21 14:36:17'),(96,'2020_02_27_Container_scLocationUpdated.sql','DONE','2020-02-27 13:43:51'),(97,'2020_03_09_Reprocessing_drop_tables.sql','DONE','2020-03-09 11:05:09'),(98,'2020_03_24_ProcessingPipeline_tables.sql','DONE','2020-03-26 16:37:29'),(99,'2020_03_25_ProcessingPipeline_ren_col.sql','DONE','2020-03-26 16:37:34'),(100,'2020_03_27_AdminVar_bump_version.sql','DONE','2020-03-27 08:51:52'),(101,'2020_03_27_AdminVar_bump_version_v2.sql','DONE','2020-03-27 15:07:56'),(102,'2020_04_06_alterProtein.sql','DONE','2020-04-06 13:40:18'),(103,'2020_04_27_BLSampleImageAutoScoreSchema_insert_CHIMP.sql','DONE','2020-04-27 14:37:41'),(104,'2020_05_21_BLSampleImageAutoScoreClass_insert_CHIMP.sql','DONE','2020-05-21 17:52:54'),(105,'2020_06_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-06-01 10:29:19'),(106,'2020_06_01_Protein_new_columns.sql','DONE','2020-06-01 10:29:32'),(107,'2020_06_01_AdminVar_bump_version.sql','DONE','2020-06-01 10:46:11'),(108,'2020_06_08_Shipping_comments.sql','DONE','2020-06-08 16:44:26'),(109,'2020_06_10_DiffractionPlan_experimentKind.sql','DONE','2020-06-10 14:35:18'),(110,'2020_06_15_Shipping_comments.sql','DONE','2020-06-15 14:01:25'),(111,'2020_06_24_BLSampleGroup_name.sql','DONE','2020-06-24 10:56:25'),(112,'2020_06_24_DiffractionPlan_userPath.sql','DONE','2020-06-24 10:56:30'),(113,'2020_07_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-07-01 13:51:49'),(114,'2020_07_06_DewarRegistry_to_DewarRegistry_has_Proposal_data.sql','DONE','2020-07-06 10:59:22'),(115,'2020_07_13_AdminVar_bump_version.sql','DONE','2020-07-13 18:14:39'),(116,'2020_08_03_AdminVar_bump_version.sql','DONE','2020-08-03 15:19:36'),(117,'2020_09_02_AutoProcScalingStatistics_new_index.sql','DONE','2020-09-02 17:02:33'),(118,'2020_09_08_DewarRegistry_modify_fks.sql','DONE','2020-09-08 15:26:14'),(119,'2020_08_28_ComponentSubType_changes.sql','DONE','2020-10-14 18:15:55'),(120,'2020_08_28_ConcentrationType_changes.sql','DONE','2020-10-14 18:15:55'),(121,'2020_08_28_Dewar_type.sql','DONE','2020-10-14 18:15:55'),(122,'2020_08_28_DiffractionPlan_new_temperature_cols.sql','DONE','2020-10-14 18:15:55'),(123,'2020_08_28_ExperimentType.sql','DONE','2020-10-14 18:15:55'),(124,'2020_08_28_PurificationColumn.sql','DONE','2020-10-14 18:15:55'),(125,'2020_08_29_BLSampleType.sql','DONE','2020-10-14 18:15:55'),(126,'2020_08_29_Protein_isotropy.sql','DONE','2020-10-14 18:15:55'),(127,'2020_10_16_AdminVar_bump_version.sql','DONE','2020-10-16 22:05:36'),(128,'2020_10_19_AdminVar_bump_version.sql','DONE','2020-10-20 04:21:23'),(129,'2020_10_22_GridInfo_dcId.sql','DONE','2020-11-09 13:57:27'),(130,'2020_11_09_Phasing_method_enum.sql','DONE','2020-11-09 13:57:27'),(133,'2020_11_09_AdminVar_bump_version.sql','DONE','2020-11-09 22:26:13'),(134,'2020_11_10_SpaceGroup_update.sql','DONE','2020-11-20 17:49:46'),(135,'2020_11_13_Dewar_facilityCode.sql','DONE','2020-11-20 17:49:46'),(136,'2020_11_20_AdminVar_bump_version.sql','DONE','2020-11-20 17:49:46'),(137,'2020_12_01_AdminVar_bump_version.sql','DONE','2020-12-01 12:21:43'),(138,'2020_12_04_Container_experimentTypeId_FK.sql','DONE','2020-12-04 16:34:05'),(139,'2020_12_04_AdminVar_bump_version.sql','DONE','2020-12-04 16:40:14'),(140,'2020_11_22_diffractionplan_priority_and_mode.sql','DONE','2020-12-29 18:29:08'),(141,'2020_12_07_AutoProc_index_unit_cell.sql','DONE','2020-12-29 18:29:08'),(142,'2020_12_07_DataCollection_index_startTime.sql','DONE','2020-12-29 18:29:08'),(143,'2020_12_10_BLSubSample_source.sql','DONE','2020-12-29 18:29:08'),(144,'2020_12_30_AdminVar_bump_version.sql','DONE','2020-12-30 14:36:17'),(145,'2021_01_13_AdminVar_bump_version.sql','DONE','2021-01-13 12:12:57'),(146,'2021_01_14_AdminVar_bump_version.sql','DONE','2021-01-14 11:04:57'),(147,'2020_07_31_add_offset_blsampleimage.sql','DONE','2021-02-22 12:28:16'),(148,'2020_07_31_add_type_blsubsample.sql','DONE','2021-02-22 12:28:16'),(149,'2020_07_31_extend_dcattachment_enum.sql','DONE','2021-02-22 12:28:16'),(150,'2020_07_31_extend_dcg_type_enum.sql','DONE','2021-02-22 12:28:16'),(151,'2020_07_31_extend_robotaction_enum.sql','DONE','2021-02-22 12:28:16'),(152,'2020_07_31_refactor_xrfmapping.sql','DONE','2021-02-22 12:28:16'),(153,'2020_11_22_blsample_staff_comments.sql','DONE','2021-02-22 12:28:16'),(154,'2021_01_28_beamlinesetup_add_datacentre.sql','DONE','2021-02-22 12:28:16'),(155,'2021_02_04_DiffractionPlan_strategyOption.sql','DONE','2021-02-22 12:28:16'),(156,'2021_02_22_AdminVar_bump_version.sql','DONE','2021-02-22 13:06:57'),(157,'2021_02_22_AdminVar_bump_version_v2.sql','DONE','2021-02-22 15:37:45'),(158,'2020_08_28_ContainerType.sql','DONE','2021-03-05 16:09:40'),(159,'2021_03_03_BF_automationError.sql','DONE','2021-03-05 16:09:41'),(160,'2021_03_03_BF_automationFault.sql','DONE','2021-03-05 16:09:41'),(161,'2021_03_03_cryoEMv2_0_tables.sql','DONE','2021-03-05 16:09:41'),(162,'2021_03_05_AdminVar_bump_version.sql','DONE','2021-03-05 16:09:41'),(163,'2021_03_05_ContainerType_update.sql','DONE','2021-04-13 15:50:39'),(164,'2021_03_08_ContainerType_update.sql','DONE','2021-04-13 15:50:39'),(165,'2021_03_09_SpaceGroup_update.sql','DONE','2021-04-13 15:50:39'),(166,'2021_03_19_add_drop_indices.sql','DONE','2021-04-13 15:50:39'),(167,'2021_03_19_ExperimentType_update.sql','DONE','2021-04-13 15:50:39'),(168,'2021_04_01_BLSampleGroup_has_BLSample_modify_type.sql','DONE','2021-04-13 15:50:39'),(169,'2021_04_01_ContainerType_insert.sql','DONE','2021-04-13 15:50:39'),(170,'2021_04_12_cryoEMv2_1.sql','DONE','2021-04-13 15:50:39'),(171,'2021_04_13_AdminVar_bump_version.sql','DONE','2021-04-13 16:17:12'),(173,'2021_04_13_ContainerType_update.sql','DONE','2021-04-13 16:42:57'),(174,'2021_04_20_AdminVar_bump_version.sql','DONE','2021-04-20 17:05:50'),(175,'2020_11_19_ContainerQueueSample.sql','DONE','2021-05-14 16:07:45'),(176,'2020_11_19_DataCollection.sql','DONE','2021-05-14 16:07:45'),(177,'2021_04_23_Dewar_fk_constraint.sql','DONE','2021-05-14 16:07:46'),(178,'2021_05_12_ParticleClassification_rotationAccuracy.sql','DONE','2021-05-14 16:07:46'),(179,'2021_05_14_AdminVar_bump_version.sql','DONE','2021-05-14 16:21:50'),(180,'2021_05_19_AdminVar_bump_version.sql','DONE','2021-05-19 16:01:54'),(181,'2021_05_20_AdminVar_bump_version.sql','DONE','2021-05-20 10:30:35'),(182,'2021_05_28_AdminVar_bump_version.sql','DONE','2021-05-28 15:46:50'),(183,'2020_08_28_DiffractionPlan_new_cols.sql','DONE','2021-07-07 09:32:34'),(184,'2021_06_01_BLSampleGroup_fk_proposalId.sql','DONE','2021-07-07 09:32:34'),(185,'2021_06_09_DataCollectionGroup_experimentType_enum.sql','DONE','2021-07-07 09:32:34'),(186,'2021_06_11_DataCollectionGroup_experimentType_enum.sql','DONE','2021-07-07 09:32:34'),(187,'2021_06_17_SpaceGroup_update.sql','DONE','2021-07-07 09:32:34'),(188,'2021_06_30_zc_ZocaloBuffer.sql','DONE','2021-07-07 09:32:34'),(189,'2021_07_01_ParticleClassification_classDistribution.sql','DONE','2021-07-07 09:32:34'),(190,'2021_07_01_ParticlePicker_summaryImageFullPath.sql','DONE','2021-07-07 09:32:34'),(191,'2021_07_02_UserGroup_insert.sql','DONE','2021-07-07 09:32:34'),(192,'2021_07_07_AdminVar_bump_version.sql','DONE','2021-07-07 10:35:39'),(193,'2021_07_07_AdminVar_bump_version_v2.sql','DONE','2021-07-07 11:37:27'),(194,'2021_07_08_AutoProcScalingStatistics_resIOverSigI2.sql','DONE','2021-07-23 17:36:44'),(195,'2021_07_08_Screening_autoProcProgramId.sql','DONE','2021-07-23 17:36:45'),(196,'2021_07_09_ProposalHasPerson_role_enum.sql','DONE','2021-07-23 17:36:45'),(197,'2021_07_09_Session_has_Person_role_enum.sql','DONE','2021-07-23 17:36:45'),(198,'2021_07_21_Positioner_tables.sql','DONE','2021-07-23 17:36:45'),(199,'2021_07_23_AdminVar_bump_version.sql','DONE','2021-07-23 17:36:45'),(200,'2021_07_23_AutoProcProgram_drop_dataCollectionId.sql','DONE','2021-07-23 17:36:45'); +INSERT INTO `SchemaStatus` (`schemaStatusId`, `scriptName`, `schemaStatus`, `recordTimeStamp`) VALUES (6,'20180213_BLSample_subLocation.sql','DONE','2018-02-13 13:27:19'),(12,'20180213_DataCollectionFileAttachment_fileType.sql','DONE','2018-02-13 15:12:54'),(16,'20180303_v_run_to_table.sql','DONE','2018-07-25 15:11:18'),(19,'20180328_ImageQualityIndicators_alter_table.sql','DONE','2018-07-25 15:11:18'),(22,'20180410_BeamLineSetup_alter.sql','DONE','2018-07-25 15:11:18'),(25,'20180413_BeamLineSetup_and_Detector_alter.sql','DONE','2018-07-25 15:11:18'),(28,'20180501_DataCollectionGroup_experimentType_enum.sql','DONE','2018-07-25 15:11:18'),(31,'20180531_ScreeningOutput_alignmentSuccess.sql','DONE','2018-07-25 15:11:18'),(34,'20180629_DataCollection_imageContainerSubPath.sql','DONE','2018-07-25 15:11:18'),(35,'20180913_BeamCalendar.sql','DONE','2018-09-19 09:52:45'),(36,'2018_09_19_DataCollection_imageDirectory_comment.sql','DONE','2018-09-19 12:38:01'),(37,'2018_09_27_increase_schema_version.sql','DONE','2018-09-27 13:17:15'),(38,'2018_11_01_XrayCenteringResult.sql','DONE','2018-11-01 13:36:53'),(39,'2018_11_01_AutoProcProgram_dataCollectionId.sql','DONE','2018-11-01 15:10:38'),(40,'2018_11_01_AutoProcProgramMessage.sql','DONE','2018-11-01 15:28:17'),(44,'2018_11_01_DiffractionPlan_centeringMethod.sql','DONE','2018-11-01 22:51:36'),(45,'2018_11_02_DataCollectionGroup_experimentType_enum.sql','DONE','2018-11-02 11:54:15'),(47,'2018_11_05_spelling_of_centring.sql','DONE','2018-11-05 15:31:38'),(48,'2018_11_09_AutoProcProgram_update_processing_program.sql','DONE','2018-11-09 16:38:34'),(49,'2018_11_14_AutoProcProgramMessage_autoinc.sql','DONE','2018-11-14 10:15:27'),(50,'2018_11_22_AutoProcProgram_processingStatus_update.sql','DONE','2018-11-22 16:11:15'),(51,'2018_12_04_EnergyScan_and_XFEFluorescenceSpectrum_add_axisPosition.sql','DONE','2018-12-04 14:13:23'),(52,'2018_12_20_DataCollectionGroup_scanParameters.sql','DONE','2018-12-20 17:30:04'),(53,'2019_01_14_Proposal_state.sql','DONE','2019-01-14 12:13:31'),(54,'2019_01_14_ProcessingJobParameter_parameterValue.sql','DONE','2019-01-14 14:00:02'),(57,'2019_01_15_Detector_localName.sql','DONE','2019-01-15 23:01:15'),(58,'2019_02_04_BLSession_unique_index.sql','DONE','2019-02-04 13:52:19'),(59,'2019_03_29_BLSession_archived.sql','DONE','2019-04-03 14:43:08'),(60,'2019_04_03_UserGroup_and_Permission.sql','DONE','2019-04-03 14:51:04'),(61,'2019_04_07_AdminVar_bump_version.sql','DONE','2019-04-07 11:35:06'),(62,'2019_04_08_AdminVar_bump_version.sql','DONE','2019-04-08 15:38:01'),(63,'2019_04_23_AdminVar_bump_version.sql','DONE','2019-04-23 11:13:27'),(64,'2019_04_23_drop_v_run_view.sql','DONE','2019-04-23 11:13:35'),(67,'2019_04_23_v_run_additional_runs.sql','DONE','2019-04-23 12:39:47'),(68,'2019_05_28_AdminVar_bump_version.sql','DONE','2019-05-28 13:29:27'),(72,'2019_07_17_BLSample_crystalId_default.sql','DONE','2019-07-17 15:21:59'),(73,'2019_08_15_Sleeve.sql','DONE','2019-08-15 08:34:34'),(74,'2019_08_15_AdminVar_bump_version.sql','DONE','2019-08-15 08:57:37'),(75,'2019_08_28_AdminVar_bump_version.sql','DONE','2019-08-28 13:30:13'),(76,'2019_08_30_AdminVar_bump_version.sql','DONE','2019-08-30 11:58:16'),(77,'2019_10_06_BLSampleImage_fk3.sql','DONE','2019-10-06 16:55:44'),(78,'2019_10_08_DiffractionPlan_experimentKind.sql','DONE','2019-10-08 12:47:10'),(79,'2019_11_07_AutoProcProgramAttachment_importanceRank.sql','DONE','2019-11-07 16:35:25'),(80,'2019_11_07_AdminVar_bump_version.sql','DONE','2019-11-07 16:45:44'),(81,'2019_11_08_AdminVar_bump_version.sql','DONE','2019-11-08 16:09:52'),(82,'2019_11_26_v_run_idx1.sql','DONE','2019-11-26 15:00:21'),(83,'2019_12_02_AdminVar_bump_version.sql','DONE','2019-12-02 11:29:05'),(84,'2019_12_02_AdminVar_bump_version_v2.sql','DONE','2019-12-02 18:14:11'),(85,'2020_01_03_BLSampleImage_tables.sql','DONE','2020-01-03 16:05:45'),(86,'2020_01_06_AdminVar_bump_version.sql','DONE','2020-01-06 11:45:02'),(87,'2020_01_07_AdminVar_bump_version.sql','DONE','2020-01-07 09:45:25'),(88,'2020_01_07_AdminVar_bump_version_v2.sql','DONE','2020-01-07 10:24:54'),(89,'2020_01_07_AdminVar_bump_version_v3.sql','DONE','2020-01-07 11:16:09'),(90,'2020_01_20_AdminVar_bump_version.sql','DONE','2020-01-20 13:40:52'),(91,'2020_01_20_AdminVar_bump_version_v2.sql','DONE','2020-01-20 16:27:37'),(92,'2020_02_13_SpaceGroup_data.sql','DONE','2020-02-13 16:52:53'),(93,'2020_01_21_DiffractionPlan_experimentKind.sql','DONE','2020-02-13 17:13:17'),(94,'2020_02_21_ProposalHasPerson_role_enum.sql','DONE','2020-02-21 14:36:10'),(95,'2020_02_21_Session_has_Person_role_enum.sql','DONE','2020-02-21 14:36:17'),(96,'2020_02_27_Container_scLocationUpdated.sql','DONE','2020-02-27 13:43:51'),(97,'2020_03_09_Reprocessing_drop_tables.sql','DONE','2020-03-09 11:05:09'),(98,'2020_03_24_ProcessingPipeline_tables.sql','DONE','2020-03-26 16:37:29'),(99,'2020_03_25_ProcessingPipeline_ren_col.sql','DONE','2020-03-26 16:37:34'),(100,'2020_03_27_AdminVar_bump_version.sql','DONE','2020-03-27 08:51:52'),(101,'2020_03_27_AdminVar_bump_version_v2.sql','DONE','2020-03-27 15:07:56'),(102,'2020_04_06_alterProtein.sql','DONE','2020-04-06 13:40:18'),(103,'2020_04_27_BLSampleImageAutoScoreSchema_insert_CHIMP.sql','DONE','2020-04-27 14:37:41'),(104,'2020_05_21_BLSampleImageAutoScoreClass_insert_CHIMP.sql','DONE','2020-05-21 17:52:54'),(105,'2020_06_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-06-01 10:29:19'),(106,'2020_06_01_Protein_new_columns.sql','DONE','2020-06-01 10:29:32'),(107,'2020_06_01_AdminVar_bump_version.sql','DONE','2020-06-01 10:46:11'),(108,'2020_06_08_Shipping_comments.sql','DONE','2020-06-08 16:44:26'),(109,'2020_06_10_DiffractionPlan_experimentKind.sql','DONE','2020-06-10 14:35:18'),(110,'2020_06_15_Shipping_comments.sql','DONE','2020-06-15 14:01:25'),(111,'2020_06_24_BLSampleGroup_name.sql','DONE','2020-06-24 10:56:25'),(112,'2020_06_24_DiffractionPlan_userPath.sql','DONE','2020-06-24 10:56:30'),(113,'2020_07_01_DewarRegistry_and_DewarRegistry_has_Proposal.sql','DONE','2020-07-01 13:51:49'),(114,'2020_07_06_DewarRegistry_to_DewarRegistry_has_Proposal_data.sql','DONE','2020-07-06 10:59:22'),(115,'2020_07_13_AdminVar_bump_version.sql','DONE','2020-07-13 18:14:39'),(116,'2020_08_03_AdminVar_bump_version.sql','DONE','2020-08-03 15:19:36'),(117,'2020_09_02_AutoProcScalingStatistics_new_index.sql','DONE','2020-09-02 17:02:33'),(118,'2020_09_08_DewarRegistry_modify_fks.sql','DONE','2020-09-08 15:26:14'),(119,'2020_08_28_ComponentSubType_changes.sql','DONE','2020-10-14 18:15:55'),(120,'2020_08_28_ConcentrationType_changes.sql','DONE','2020-10-14 18:15:55'),(121,'2020_08_28_Dewar_type.sql','DONE','2020-10-14 18:15:55'),(122,'2020_08_28_DiffractionPlan_new_temperature_cols.sql','DONE','2020-10-14 18:15:55'),(123,'2020_08_28_ExperimentType.sql','DONE','2020-10-14 18:15:55'),(124,'2020_08_28_PurificationColumn.sql','DONE','2020-10-14 18:15:55'),(125,'2020_08_29_BLSampleType.sql','DONE','2020-10-14 18:15:55'),(126,'2020_08_29_Protein_isotropy.sql','DONE','2020-10-14 18:15:55'),(127,'2020_10_16_AdminVar_bump_version.sql','DONE','2020-10-16 22:05:36'),(128,'2020_10_19_AdminVar_bump_version.sql','DONE','2020-10-20 04:21:23'),(129,'2020_10_22_GridInfo_dcId.sql','DONE','2020-11-09 13:57:27'),(130,'2020_11_09_Phasing_method_enum.sql','DONE','2020-11-09 13:57:27'),(133,'2020_11_09_AdminVar_bump_version.sql','DONE','2020-11-09 22:26:13'),(134,'2020_11_10_SpaceGroup_update.sql','DONE','2020-11-20 17:49:46'),(135,'2020_11_13_Dewar_facilityCode.sql','DONE','2020-11-20 17:49:46'),(136,'2020_11_20_AdminVar_bump_version.sql','DONE','2020-11-20 17:49:46'),(137,'2020_12_01_AdminVar_bump_version.sql','DONE','2020-12-01 12:21:43'),(138,'2020_12_04_Container_experimentTypeId_FK.sql','DONE','2020-12-04 16:34:05'),(139,'2020_12_04_AdminVar_bump_version.sql','DONE','2020-12-04 16:40:14'),(140,'2020_11_22_diffractionplan_priority_and_mode.sql','DONE','2020-12-29 18:29:08'),(141,'2020_12_07_AutoProc_index_unit_cell.sql','DONE','2020-12-29 18:29:08'),(142,'2020_12_07_DataCollection_index_startTime.sql','DONE','2020-12-29 18:29:08'),(143,'2020_12_10_BLSubSample_source.sql','DONE','2020-12-29 18:29:08'),(144,'2020_12_30_AdminVar_bump_version.sql','DONE','2020-12-30 14:36:17'),(145,'2021_01_13_AdminVar_bump_version.sql','DONE','2021-01-13 12:12:57'),(146,'2021_01_14_AdminVar_bump_version.sql','DONE','2021-01-14 11:04:57'),(147,'2020_07_31_add_offset_blsampleimage.sql','DONE','2021-02-22 12:28:16'),(148,'2020_07_31_add_type_blsubsample.sql','DONE','2021-02-22 12:28:16'),(149,'2020_07_31_extend_dcattachment_enum.sql','DONE','2021-02-22 12:28:16'),(150,'2020_07_31_extend_dcg_type_enum.sql','DONE','2021-02-22 12:28:16'),(151,'2020_07_31_extend_robotaction_enum.sql','DONE','2021-02-22 12:28:16'),(152,'2020_07_31_refactor_xrfmapping.sql','DONE','2021-02-22 12:28:16'),(153,'2020_11_22_blsample_staff_comments.sql','DONE','2021-02-22 12:28:16'),(154,'2021_01_28_beamlinesetup_add_datacentre.sql','DONE','2021-02-22 12:28:16'),(155,'2021_02_04_DiffractionPlan_strategyOption.sql','DONE','2021-02-22 12:28:16'),(156,'2021_02_22_AdminVar_bump_version.sql','DONE','2021-02-22 13:06:57'),(157,'2021_02_22_AdminVar_bump_version_v2.sql','DONE','2021-02-22 15:37:45'),(158,'2020_08_28_ContainerType.sql','DONE','2021-03-05 16:09:40'),(159,'2021_03_03_BF_automationError.sql','DONE','2021-03-05 16:09:41'),(160,'2021_03_03_BF_automationFault.sql','DONE','2021-03-05 16:09:41'),(161,'2021_03_03_cryoEMv2_0_tables.sql','DONE','2021-03-05 16:09:41'),(162,'2021_03_05_AdminVar_bump_version.sql','DONE','2021-03-05 16:09:41'),(163,'2021_03_05_ContainerType_update.sql','DONE','2021-04-13 15:50:39'),(164,'2021_03_08_ContainerType_update.sql','DONE','2021-04-13 15:50:39'),(165,'2021_03_09_SpaceGroup_update.sql','DONE','2021-04-13 15:50:39'),(166,'2021_03_19_add_drop_indices.sql','DONE','2021-04-13 15:50:39'),(167,'2021_03_19_ExperimentType_update.sql','DONE','2021-04-13 15:50:39'),(168,'2021_04_01_BLSampleGroup_has_BLSample_modify_type.sql','DONE','2021-04-13 15:50:39'),(169,'2021_04_01_ContainerType_insert.sql','DONE','2021-04-13 15:50:39'),(170,'2021_04_12_cryoEMv2_1.sql','DONE','2021-04-13 15:50:39'),(171,'2021_04_13_AdminVar_bump_version.sql','DONE','2021-04-13 16:17:12'),(173,'2021_04_13_ContainerType_update.sql','DONE','2021-04-13 16:42:57'),(174,'2021_04_20_AdminVar_bump_version.sql','DONE','2021-04-20 17:05:50'),(175,'2020_11_19_ContainerQueueSample.sql','DONE','2021-05-14 16:07:45'),(176,'2020_11_19_DataCollection.sql','DONE','2021-05-14 16:07:45'),(177,'2021_04_23_Dewar_fk_constraint.sql','DONE','2021-05-14 16:07:46'),(178,'2021_05_12_ParticleClassification_rotationAccuracy.sql','DONE','2021-05-14 16:07:46'),(179,'2021_05_14_AdminVar_bump_version.sql','DONE','2021-05-14 16:21:50'),(180,'2021_05_19_AdminVar_bump_version.sql','DONE','2021-05-19 16:01:54'),(181,'2021_05_20_AdminVar_bump_version.sql','DONE','2021-05-20 10:30:35'),(182,'2021_05_28_AdminVar_bump_version.sql','DONE','2021-05-28 15:46:50'),(183,'2020_08_28_DiffractionPlan_new_cols.sql','DONE','2021-07-07 09:32:34'),(184,'2021_06_01_BLSampleGroup_fk_proposalId.sql','DONE','2021-07-07 09:32:34'),(185,'2021_06_09_DataCollectionGroup_experimentType_enum.sql','DONE','2021-07-07 09:32:34'),(186,'2021_06_11_DataCollectionGroup_experimentType_enum.sql','DONE','2021-07-07 09:32:34'),(187,'2021_06_17_SpaceGroup_update.sql','DONE','2021-07-07 09:32:34'),(188,'2021_06_30_zc_ZocaloBuffer.sql','DONE','2021-07-07 09:32:34'),(189,'2021_07_01_ParticleClassification_classDistribution.sql','DONE','2021-07-07 09:32:34'),(190,'2021_07_01_ParticlePicker_summaryImageFullPath.sql','DONE','2021-07-07 09:32:34'),(191,'2021_07_02_UserGroup_insert.sql','DONE','2021-07-07 09:32:34'),(192,'2021_07_07_AdminVar_bump_version.sql','DONE','2021-07-07 10:35:39'),(193,'2021_07_07_AdminVar_bump_version_v2.sql','DONE','2021-07-07 11:37:27'),(194,'2021_07_08_AutoProcScalingStatistics_resIOverSigI2.sql','DONE','2021-07-23 17:36:44'),(195,'2021_07_08_Screening_autoProcProgramId.sql','DONE','2021-07-23 17:36:45'),(196,'2021_07_09_ProposalHasPerson_role_enum.sql','DONE','2021-07-23 17:36:45'),(197,'2021_07_09_Session_has_Person_role_enum.sql','DONE','2021-07-23 17:36:45'),(198,'2021_07_21_Positioner_tables.sql','DONE','2021-07-23 17:36:45'),(199,'2021_07_23_AdminVar_bump_version.sql','DONE','2021-07-23 17:36:45'),(200,'2021_07_23_AutoProcProgram_drop_dataCollectionId.sql','DONE','2021-07-23 17:36:45'),(201,'2021_07_26_AdminVar_bump_version.sql','DONE','2021-07-26 10:41:54'); /*!40000 ALTER TABLE `SchemaStatus` ENABLE KEYS */; -- @@ -248,4 +248,4 @@ INSERT INTO `ScanParametersService` (`scanParametersServiceId`, `name`, `descrip /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-07-23 18:38:11 +-- Dump completed on 2021-07-26 11:42:03 diff --git a/schemas/ispyb/routines.sql b/schemas/ispyb/routines.sql index 538cbac8..e67c76d7 100644 --- a/schemas/ispyb/routines.sql +++ b/schemas/ispyb/routines.sql @@ -9657,6 +9657,64 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `upsert_particle_classification_v2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `upsert_particle_classification_v2`( + INOUT p_id int unsigned, + p_particleClassificationGroupId int unsigned, + p_classNumber int unsigned, + p_classImageFullPath varchar(255), + p_particlesPerClass int unsigned, + p_classDistribution float, + p_rotationAccuracy float, + p_translationAccuracy float, + p_estimatedResolution float, + p_overallFourierCompleteness float + ) + MODIFIES SQL DATA + COMMENT 'Inserts or updates info about a particle classification (p_id).\nMandatory columns:\nFor insert: p_particleClassificationGroupId\nFor update: p_id \nReturns: Record ID in p_id.' +BEGIN + IF p_id IS NOT NULL OR p_particleClassificationGroupId IS NOT NULL THEN + INSERT INTO ParticleClassification (particleClassificationId, + particleClassificationGroupId, classNumber, classImageFullPath, + particlesPerClass, classDistribution, rotationAccuracy, + translationAccuracy, estimatedResolution, overallFourierCompleteness) + VALUES (p_id, p_particleClassificationGroupId, p_classNumber, + p_classImageFullPath, + p_particlesPerClass, p_classDistribution, p_rotationAccuracy, + p_translationAccuracy, p_estimatedResolution, + p_overallFourierCompleteness) + ON DUPLICATE KEY UPDATE + particleClassificationGroupId = IFNULL(p_particleClassificationGroupId, particleClassificationGroupId), + classNumber = IFNULL(p_classNumber, classNumber), + classImageFullPath = IFNULL(p_classImageFullPath, classImageFullPath), + particlesPerClass = IFNULL(p_particlesPerClass, particlesPerClass), + classDistribution = IFNULL(p_classDistribution, classDistribution), + rotationAccuracy = IFNULL(p_rotationAccuracy, rotationAccuracy), + translationAccuracy = IFNULL(p_translationAccuracy, translationAccuracy), + estimatedResolution = IFNULL(p_estimatedResolution, estimatedResolution), + overallFourierCompleteness = IFNULL(p_overallFourierCompleteness, overallFourierCompleteness); + + IF p_id IS NULL THEN + SET p_id = LAST_INSERT_ID(); + END IF; + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument(s) are NULL: p_id OR p_particleClassificationGroupId must be non-NULL.'; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `upsert_particle_picker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9700,6 +9758,51 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `upsert_particle_picker_v2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE PROCEDURE `upsert_particle_picker_v2`( + INOUT p_id int(11) unsigned, + p_firstMotionCorrectionId int(11) unsigned, + p_programId int(11) unsigned, + p_particlePickingTemplate varchar(255), + p_particleDiameter float, + p_numberOfParticles int unsigned, + p_summaryImageFullPath varchar(255) + ) + MODIFIES SQL DATA + COMMENT 'Inserts or updates info about a particle picker (p_id).\nMandatory columns:\nFor insert: p_firstMotionCorrectionId\nFor update: p_id \nReturns: Record ID in p_id.' +BEGIN + IF p_id IS NOT NULL OR p_firstMotionCorrectionId IS NOT NULL THEN + INSERT INTO ParticlePicker (particlePickerId, firstMotionCorrectionId, programId, particlePickingTemplate, particleDiameter, numberOfParticles, summaryImageFullPath) + VALUES (p_id, p_firstMotionCorrectionId, p_programId, p_particlePickingTemplate, p_particleDiameter, p_numberOfParticles, p_summaryImageFullPath) + ON DUPLICATE KEY UPDATE + firstMotionCorrectionId = IFNULL(p_firstMotionCorrectionId, firstMotionCorrectionId), + programId = IFNULL(p_programId, programId), + particlePickingTemplate = IFNULL(p_particlePickingTemplate, particlePickingTemplate), + particleDiameter = IFNULL(p_particleDiameter, particleDiameter), + numberOfParticles = IFNULL(p_numberOfParticles, numberOfParticles), + summaryImageFullPath = IFNULL(p_summaryImageFullPath, summaryImageFullPath); + + IF p_id IS NULL THEN + SET p_id = LAST_INSERT_ID(); + END IF; + ELSE + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument(s) are NULL: p_id OR p_firstMotionCorrectionId must be non-NULL.'; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `upsert_person` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11027,7 +11130,7 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-07-23 18:38:10 +-- Dump completed on 2021-07-26 11:38:57 -- MariaDB dump 10.19 Distrib 10.5.10-MariaDB, for Linux (x86_64) -- -- Host: 10.88.0.5 Database: ispyb_build @@ -11074,4 +11177,4 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-07-23 18:38:11 +-- Dump completed on 2021-07-26 11:38:57 diff --git a/schemas/ispyb/updates/2021_07_26_AdminVar_bump_version.sql b/schemas/ispyb/updates/2021_07_26_AdminVar_bump_version.sql new file mode 100644 index 00000000..f707c31c --- /dev/null +++ b/schemas/ispyb/updates/2021_07_26_AdminVar_bump_version.sql @@ -0,0 +1,5 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2021_07_26_AdminVar_bump_version.sql', 'ONGOING'); + +UPDATE AdminVar SET `value` = '1.25.0' WHERE `name` = 'schemaVersion'; + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2021_07_26_AdminVar_bump_version.sql';