-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from DiamondLightSource/sample_image_auto_score
SP: insert sample image auto score + bump version
- Loading branch information
Showing
5 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
schema/stored_programs/sp_insert_sample_image_auto_score.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
DELIMITER ;; | ||
CREATE OR REPLACE PROCEDURE `insert_sample_image_auto_score`( | ||
OUT p_id int(11) unsigned, | ||
p_imageFullPath varchar(255), | ||
p_schemaName varchar(25), | ||
p_scoreClass varchar(15), | ||
p_probability float | ||
) | ||
MODIFIES SQL DATA | ||
COMMENT 'Insert a row with the auto scored probability for a given sample image using a certain class and schema. Returns the ID in p_id.' | ||
BEGIN | ||
DECLARE l_blSampleImageId int(11) unsigned; | ||
DECLARE l_blSampleImageAutoScoreClassId tinyint(3) unsigned; | ||
|
||
IF p_imageFullPath IS NOT NULL AND p_schemaName IS NOT NULL AND p_scoreClass IS NOT NULL THEN | ||
|
||
SELECT max(blSampleImageId) INTO l_blSampleImageId FROM BLSampleImage WHERE imageFullPath = p_imageFullPath; | ||
|
||
SELECT blSampleImageAutoScoreClassId INTO l_blSampleImageAutoScoreClassId FROM BLSampleImageAutoScoreClass bsiasc INNER JOIN BLSampleImageAutoScoreSchema bsiass USING(blSampleImageAutoScoreSchemaId) | ||
WHERE bsiasc.scoreClass = p_scoreClass AND bsiass.schemaName = p_schemaName AND bsiass.enabled > 0; | ||
|
||
INSERT INTO BLSampleImage_has_AutoScoreClass (blSampleImageId, blSampleImageAutoScoreClassId, probability) | ||
VALUES (l_blSampleImageId, l_blSampleImageAutoScoreClassId, p_probability); | ||
|
||
SET p_id = LAST_INSERT_ID(); | ||
|
||
END IF; | ||
END;; | ||
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_01_06_AdminVar_bump_version.sql', 'ONGOING'); | ||
|
||
UPDATE AdminVar SET `value` = '1.10.0' WHERE `name` = 'schemaVersion'; | ||
|
||
UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_01_06_AdminVar_bump_version.sql'; |