Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generation status query errors when source is deleted. #2361

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public void cancelPathwaysGeneration(
@Path("/{id}/generation")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Transactional
public List<CommonGenerationDTO> getPathwayGenerations(
@PathParam("id") final Integer pathwayAnalysisId
) {
Expand Down
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;
Loading