-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/master' into issue-2353-…
…wildcard-perms
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 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
101 changes: 101 additions & 0 deletions
101
...main/resources/db/migration/postgresql/V2.14.1.20240412125600__alter_generation_views.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,101 @@ | ||
DROP VIEW ${ohdsiSchema}.cc_generation; | ||
DROP VIEW ${ohdsiSchema}.estimation_analysis_generation; | ||
DROP VIEW ${ohdsiSchema}.pathway_analysis_generation; | ||
DROP VIEW ${ohdsiSchema}.prediction_analysis_generation; | ||
|
||
CREATE OR REPLACE VIEW ${ohdsiSchema}.cc_generation as ( | ||
SELECT | ||
-- Spring batch based | ||
job.job_execution_id id, | ||
job.create_time start_time, | ||
job.end_time end_time, | ||
job.status status, | ||
job.exit_message exit_message, | ||
CAST(cc_id_param.string_val AS INTEGER) cc_id, | ||
CAST(source_param.string_val AS INTEGER) source_id, | ||
-- Generation info based | ||
gen_info.hash_code hash_code, | ||
gen_info.created_by_id created_by_id | ||
FROM ${ohdsiSchema}.batch_job_execution job | ||
JOIN ${ohdsiSchema}.batch_job_execution_params cc_id_param ON job.job_execution_id = cc_id_param.job_execution_id | ||
AND cc_id_param.key_name = 'cohort_characterization_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id | ||
AND source_param.key_name = 'source_id' | ||
JOIN ${ohdsiSchema}.source s on s.source_id = CAST(source_param.string_val AS INTEGER) | ||
LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info ON job.job_execution_id = gen_info.job_execution_id | ||
ORDER BY start_time DESC | ||
); | ||
|
||
CREATE OR REPLACE VIEW ${ohdsiSchema}.estimation_analysis_generation as | ||
SELECT | ||
job.job_execution_id id, | ||
job.create_time start_time, | ||
job.end_time end_time, | ||
job.status status, | ||
job.exit_message exit_message, | ||
CAST(estimation_id_param.string_val AS INTEGER) estimation_id, | ||
CAST(source_param.string_val AS INTEGER) source_id, | ||
passwd_param.string_val update_password, | ||
-- Generation info based | ||
gen_info.hash_code hash_code, | ||
gen_info.created_by_id created_by_id, | ||
-- Execution info based | ||
exec_info.id analysis_execution_id | ||
FROM ${ohdsiSchema}.batch_job_execution job | ||
JOIN ${ohdsiSchema}.batch_job_execution_params estimation_id_param ON job.job_execution_id = estimation_id_param.job_execution_id | ||
AND estimation_id_param.key_name = 'estimation_analysis_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id | ||
AND source_param.key_name = 'source_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params passwd_param ON job.job_execution_id = passwd_param.job_execution_id | ||
AND passwd_param.key_name = 'update_password' | ||
JOIN ${ohdsiSchema}.source s on s.source_id = CAST(source_param.string_val AS INTEGER) | ||
LEFT JOIN ${ohdsiSchema}.ee_analysis_status exec_info ON job.job_execution_id = exec_info.job_execution_id | ||
LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info ON job.job_execution_id = gen_info.job_execution_id; | ||
|
||
CREATE OR REPLACE VIEW ${ohdsiSchema}.pathway_analysis_generation as | ||
(SELECT | ||
job.job_execution_id id, | ||
job.create_time start_time, | ||
job.end_time end_time, | ||
job.status status, | ||
job.exit_message exit_message, | ||
CAST(pa_id_param.string_val AS INTEGER) pathway_analysis_id, | ||
CAST(source_param.string_val AS INTEGER) source_id, | ||
-- Generation info based | ||
gen_info.hash_code hash_code, | ||
gen_info.created_by_id created_by_id | ||
FROM ${ohdsiSchema}.batch_job_execution job | ||
JOIN ${ohdsiSchema}.batch_job_execution_params pa_id_param ON job.job_execution_id = pa_id_param.job_execution_id | ||
AND pa_id_param.key_name = 'pathway_analysis_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id | ||
AND source_param.key_name = 'source_id' | ||
JOIN ${ohdsiSchema}.source s on s.source_id = CAST(source_param.string_val AS INTEGER) | ||
LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info | ||
ON job.job_execution_id = gen_info.job_execution_id | ||
ORDER BY start_time DESC); | ||
|
||
CREATE OR REPLACE VIEW ${ohdsiSchema}.prediction_analysis_generation as | ||
SELECT | ||
job.job_execution_id id, | ||
job.create_time start_time, | ||
job.end_time end_time, | ||
job.status status, | ||
job.exit_message exit_message, | ||
CAST(plp_id_param.string_val AS INTEGER) prediction_id, | ||
CAST(source_param.string_val AS INTEGER) source_id, | ||
passwd_param.string_val update_password, | ||
-- Generation info based | ||
gen_info.hash_code hash_code, | ||
gen_info.created_by_id created_by_id, | ||
-- Execution info based | ||
exec_info.id analysis_execution_id | ||
FROM ${ohdsiSchema}.batch_job_execution job | ||
JOIN ${ohdsiSchema}.batch_job_execution_params plp_id_param ON job.job_execution_id = plp_id_param.job_execution_id | ||
AND plp_id_param.key_name = 'prediction_analysis_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id | ||
AND source_param.key_name = 'source_id' | ||
JOIN ${ohdsiSchema}.batch_job_execution_params passwd_param ON job.job_execution_id = passwd_param.job_execution_id | ||
AND passwd_param.key_name = 'update_password' | ||
JOIN ${ohdsiSchema}.source s on s.source_id = CAST(source_param.string_val AS INTEGER) | ||
LEFT JOIN ${ohdsiSchema}.ee_analysis_status exec_info ON job.job_execution_id = exec_info.job_execution_id | ||
LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info ON job.job_execution_id = gen_info.job_execution_id; |