forked from fli-iam/shanoir-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
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 fli-iam#2206 from youennmerel/fli-iam#2194
[fli-iam#2194] Generate Tags from "organ" dataset properties
- Loading branch information
Showing
60 changed files
with
1,021 additions
and
298 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
docker-compose/database/db-changes/datasets/0049_create_tables_tags.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,17 @@ | ||
CREATE TABLE `study_tag` ( | ||
`id` bigint(20) NOT NULL, | ||
`color` varchar(255) DEFAULT NULL, | ||
`name` varchar(255) DEFAULT NULL, | ||
`study_id` bigint(20) DEFAULT NULL, | ||
PRIMARY KEY (`id`), | ||
KEY `FKboew1v3lqqa0afxnigq4fxhf3` (`study_id`), | ||
CONSTRAINT `FKboew1v3lqqa0afxnigq4fxhf3` FOREIGN KEY (`study_id`) REFERENCES `study` (`id`) | ||
); | ||
CREATE TABLE `dataset_tag` ( | ||
`dataset_id` bigint(20) NOT NULL, | ||
`study_tag_id` bigint(20) NOT NULL, | ||
KEY `FKkh92b0ddi9nxrevqkdmvqpcm3` (`study_tag_id`), | ||
KEY `FKd0dkfmqchgw18bxirml5an8ex` (`dataset_id`), | ||
CONSTRAINT `FKd0dkfmqchgw18bxirml5an8ex` FOREIGN KEY (`dataset_id`) REFERENCES `dataset` (`id`), | ||
CONSTRAINT `FKkh92b0ddi9nxrevqkdmvqpcm3` FOREIGN KEY (`study_tag_id`) REFERENCES `study_tag` (`id`) | ||
); |
48 changes: 48 additions & 0 deletions
48
docker-compose/database/oneshot-updates/tag_ofsep_organs.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,48 @@ | ||
-- Create study_tags in studies for all relevant studies | ||
|
||
INSERT INTO studies.study_tag (color, name, study_id) | ||
SELECT DISTINCT '#e74c3c', 'volume.organ:brain', proc.study_id | ||
FROM datasets.dataset_property prop | ||
INNER JOIN datasets.dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'brain'; | ||
|
||
INSERT INTO studies.study_tag (color, name, study_id) | ||
SELECT DISTINCT '#27ae60', 'volume.organ:spine', proc.study_id | ||
FROM datasets.dataset_property prop | ||
INNER JOIN datasets.dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'spine'; | ||
|
||
INSERT INTO studies.study_tag (color, name, study_id) | ||
SELECT DISTINCT '#198bda', 'volume.organ:null', proc.study_id | ||
FROM datasets.dataset_property prop | ||
INNER JOIN datasets.dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'null'; | ||
|
||
-- Copy studies study_tags to datasets study_tags | ||
|
||
INSERT INTO datasets.study_tag (id, color, name, study_id) | ||
SELECT id, color, name, study_id | ||
FROM studies.study_tag; | ||
|
||
-- Create dataset_tag for all relevant dataset | ||
|
||
INSERT INTO dataset_tag (dataset_id, study_tag_id) | ||
SELECT DISTINCT prop.dataset_id, tag.id | ||
FROM dataset_property prop | ||
INNER JOIN dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
INNER JOIN study_tag tag ON tag.study_id = proc.study_id AND tag.name = 'volume.organ:brain' | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'brain'; | ||
|
||
INSERT INTO dataset_tag (dataset_id, study_tag_id) | ||
SELECT DISTINCT prop.dataset_id, tag.id | ||
FROM dataset_property prop | ||
INNER JOIN dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
INNER JOIN study_tag tag ON tag.study_id = proc.study_id AND tag.name = 'volume.organ:spine' | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'spine'; | ||
|
||
INSERT INTO dataset_tag (dataset_id, study_tag_id) | ||
SELECT DISTINCT prop.dataset_id, tag.id | ||
FROM dataset_property prop | ||
INNER JOIN dataset_processing proc ON proc.id = prop.dataset_processing_id | ||
INNER JOIN study_tag tag ON tag.study_id = proc.study_id AND tag.name = 'volume.organ:null' | ||
WHERE prop.name = 'volume.organ' AND prop.value = 'null'; |
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
Oops, something went wrong.