From ef8ffcfb64364e6221030f120e7cae21a9f0a52d Mon Sep 17 00:00:00 2001 From: "adel.ka" Date: Fri, 15 Aug 2025 16:41:12 +0300 Subject: [PATCH 1/2] =?UTF-8?q?ERVU-529:=20=D0=BA=D1=80=D0=B0=D1=81=D0=BE?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../punishment/branching_punishment.hpl | 124 -- .../check_if_need_to_repeat_job.hpl} | 68 +- .../change_status_delta_punishment_error.hpl | 110 -- ...change_status_delta_punishment_success.hpl | 110 -- .../change_status_punishment_flow1_error.hpl | 250 --- ...change_status_punishment_flow1_success.hpl | 250 --- .../change_status_punishment_flow2_error.hpl | 254 --- ...change_status_punishment_flow2_success.hpl | 254 --- .../change_status_punishment_flow3_error.hpl | 255 --- ...change_status_punishment_flow3_success.hpl | 255 --- .../change_status_punishment_flow4_error.hpl | 256 --- ...change_status_punishment_flow4_success.hpl | 256 --- .../change_status_punishment_flow5_error.hpl | 256 --- ...change_status_punishment_flow5_success.hpl | 256 --- .../change_status_to_processing.hpl | 142 -- .../change_status_to_processing_delta.hpl | 102 - ...hpl => check_if_punishment_job_exists.hpl} | 67 +- .../checkpoints/checkpoint_job_punishment.hpl | 869 --------- .../checkpoint_punishment_error.hpl | 273 --- .../checkpoints/xxjob_create_files_child.hwf | 235 --- .../punishment/delta_punishment.hpl | 162 -- .../punishment/job_punishment.hwf | 1716 +---------------- .../punishment/parallel/punishment_flow.hpl | 580 ++++++ .../punishment/parallel/punishment_flow1.hpl | 163 -- .../punishment/parallel/punishment_flow2.hpl | 162 -- .../punishment/parallel/punishment_flow3.hpl | 161 -- .../punishment/parallel/punishment_flow4.hpl | 161 -- .../punishment/parallel/punishment_flow5.hpl | 161 -- .../parallel/punishment_flow_delta.hpl | 604 ++++++ .../parallel/punishment_flow_repeat.hpl | 617 ++++++ .../recruitment_five_flow_delta.hpl | 360 ++++ .../recruitment_five_flow_on_error.hpl | 360 ++++ .../recruitment_rows_five_flow_if_error.hpl | 261 --- .../punishment/recruitments_five_flow.hpl | 356 ++++ 34 files changed, 3011 insertions(+), 7455 deletions(-) delete mode 100644 mappings/info_recruits/citizen_tables/punishment/branching_punishment.hpl rename mappings/info_recruits/citizen_tables/{passport/checkpoints/change_status_to_processing_delta.hpl => punishment/check_if_need_to_repeat_job.hpl} (56%) delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing_delta.hpl rename mappings/info_recruits/citizen_tables/punishment/checkpoints/{check_if_job_punishment_exists.hpl => check_if_punishment_job_exists.hpl} (70%) delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_punishment_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/checkpoints/xxjob_create_files_child.hwf delete mode 100644 mappings/info_recruits/citizen_tables/punishment/delta_punishment.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_delta.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_on_error.hpl delete mode 100644 mappings/info_recruits/citizen_tables/punishment/recruitment_rows_five_flow_if_error.hpl create mode 100644 mappings/info_recruits/citizen_tables/punishment/recruitments_five_flow.hpl diff --git a/mappings/info_recruits/citizen_tables/punishment/branching_punishment.hpl b/mappings/info_recruits/citizen_tables/punishment/branching_punishment.hpl deleted file mode 100644 index 74f2576..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/branching_punishment.hpl +++ /dev/null @@ -1,124 +0,0 @@ - - - - branching_punishment - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/09 09:54:43.724 - - - 2025/06/09 09:54:43.724 - - - - - - Set variables 2 - Write to log 2 - N - - - Table input - Set variables 2 - Y - - - - Set variables 2 - SetVariable - - Y - - 1 - - none - - - - - pipeline - PIPE - PARENT_WORKFLOW - - - status - STATUS - PARENT_WORKFLOW - - - Y - - - 1056 - 256 - - - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - select - status as STATUS, - job_name AS PIPELINE -from public.etl_checkpoints -where job_name = 'job_citizen_spouse' - N - - - 816 - 256 - - - - Write to log 2 - WriteToLog - - Y - - 1 - - none - - - Y - - - pipeline - - - status - - - N - 0 - Basic - ${PIPE} -${STATUS} - - - 1280 - 256 - - - - - - diff --git a/mappings/info_recruits/citizen_tables/passport/checkpoints/change_status_to_processing_delta.hpl b/mappings/info_recruits/citizen_tables/punishment/check_if_need_to_repeat_job.hpl similarity index 56% rename from mappings/info_recruits/citizen_tables/passport/checkpoints/change_status_to_processing_delta.hpl rename to mappings/info_recruits/citizen_tables/punishment/check_if_need_to_repeat_job.hpl index 451d2a8..113adcf 100644 --- a/mappings/info_recruits/citizen_tables/passport/checkpoints/change_status_to_processing_delta.hpl +++ b/mappings/info_recruits/citizen_tables/punishment/check_if_need_to_repeat_job.hpl @@ -1,7 +1,7 @@ - change_status_to_processing_delta + check_if_need_to_repeat_job Y @@ -13,22 +13,22 @@ 1000 100 - - 2025/06/16 13:42:26.494 + 2025/08/08 12:27:51.630 - - 2025/06/16 13:42:26.494 + 2025/08/08 12:27:51.630 Table input - Insert / update + Set variables Y - Insert / update - InsertUpdate + Set variables + SetVariable Y @@ -37,37 +37,18 @@ none - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N + + + need_to_repeat_job + NEED_TO_REPEAT_JOB + ROOT_WORKFLOW + + + Y - 1248 - 352 + 624 + 288
@@ -84,16 +65,19 @@ ervu-dashboard N 0 - SELECT - 'PROCESSING' AS status, - 'delta_passport' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints + SELECT EXISTS (SELECT 1 +FROM ervu_dashboard.recruitment r + LEFT JOIN etl.job_execution je + ON r.idm_id = je.recruitment_id + and job_name = 'punishment_job' +where je.status is null or je.status in ('ERROR', 'PROCESSING') +limit 1 +) as need_to_repeat_job; N - 832 - 352 + 336 + 288 diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_error.hpl deleted file mode 100644 index adf6c94..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_error.hpl +++ /dev/null @@ -1,110 +0,0 @@ - - - - change_status_delta_punishment_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 12:20:06.191 - - - 2025/06/16 12:20:06.191 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N - - - 1152 - 304 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - SELECT - 'delta_punishment' as job_name, - 'ERROR' as status, - current_timestamp as record_created - -union all - - SELECT - 'job_punishment' as job_name, - 'ERROR' as status, - current_timestamp as record_created - - - N - - - 784 - 304 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_success.hpl deleted file mode 100644 index 54bcb5c..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_success.hpl +++ /dev/null @@ -1,110 +0,0 @@ - - - - change_status_delta_punishment_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 12:20:06.191 - - - 2025/06/16 12:20:06.191 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N - - - 1152 - 304 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - SELECT - 'delta_punishment' as job_name, - 'SUCCESS' as status, - current_timestamp as record_created - -union all - - SELECT - 'job_punishment' as job_name, - 'SUCCESS' as status, - current_timestamp as record_created - - - N - - - 784 - 304 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl deleted file mode 100644 index 91e4623..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl +++ /dev/null @@ -1,250 +0,0 @@ - - - - change_status_punishment_flow1_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1--, -/* - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, -/* - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( - SELECT - 'punishment_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl deleted file mode 100644 index 0ff574d..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl +++ /dev/null @@ -1,250 +0,0 @@ - - - - change_status_punishment_flow1_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1--, -/* - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, -/* - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( - SELECT - 'punishment_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl deleted file mode 100644 index 5e28ac4..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl +++ /dev/null @@ -1,254 +0,0 @@ - - - - change_status_punishment_flow2_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - --MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - --(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2--, -/* - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, -*/ - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2--, -/* - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl deleted file mode 100644 index 25899f0..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl +++ /dev/null @@ -1,254 +0,0 @@ - - - - change_status_punishment_flow2_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - --MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - --(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2--, -/* - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, -*/ - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2--, -/* - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl deleted file mode 100644 index 3691584..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl +++ /dev/null @@ -1,255 +0,0 @@ - - - - change_status_punishment_flow3_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, -*/ - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3--, -/* - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, -*/ - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3--, -/* - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl deleted file mode 100644 index 74aef8f..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl +++ /dev/null @@ -1,255 +0,0 @@ - - - - change_status_punishment_flow3_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, -*/ - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3--, -/* - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, -*/ - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3--, -/* - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl deleted file mode 100644 index c7f7cf6..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl +++ /dev/null @@ -1,256 +0,0 @@ - - - - change_status_punishment_flow4_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, -*/ - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--, -/* - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, -*/ - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4--, -/* - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl deleted file mode 100644 index 752e93e..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl +++ /dev/null @@ -1,256 +0,0 @@ - - - - change_status_punishment_flow4_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, -*/ - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--, -/* - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 -*/ - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1--, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, -*/ - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4--, -/* - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 -*/ - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -/* - union all - - SELECT - 'job_citizen_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max -*/ -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl deleted file mode 100644 index 86d3ef7..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl +++ /dev/null @@ -1,256 +0,0 @@ - - - - change_status_punishment_flow5_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--, -*/ - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 - - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, -*/ - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 - - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max - -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl deleted file mode 100644 index 7d1092e..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl +++ /dev/null @@ -1,256 +0,0 @@ - - - - change_status_punishment_flow5_success - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 09:14:18.787 - - - 2025/06/16 09:14:18.787 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - last_recruitment_id - last_recruitment_id - Y - - - record_created - record_created - Y - - - recruitment_created_date - recruitment_created_date - Y - - - status - status - Y - -
- N - - - 1056 - 400 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT -/* - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--, -*/ - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 - - FROM flow_data -), -result_max as ( --костыль - SELECT -/* - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, - - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, -*/ - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 - - FROM result_ma -), -for_checkpoints as ( -/* - SELECT - 'job_citizen_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_citizen_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - - union all -*/ - SELECT - 'punishment_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'SUCCESS' as status, - current_timestamp as record_created - from result_max - -) -select * from for_checkpoints - N - - - 688 - 400 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl deleted file mode 100644 index 82712b4..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl +++ /dev/null @@ -1,142 +0,0 @@ - - - - change_status_to_processing - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/11 16:14:31.162 - - - 2025/06/11 16:14:31.162 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N - - - 784 - 352 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - SELECT - 'PROCESSING' AS status, - 'job_punishment' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - -UNION ALL - -SELECT - 'PROCESSING' AS status, - 'punishment_flow1' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - -UNION ALL - -SELECT - 'PROCESSING' AS status, - 'punishment_flow2' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - -UNION ALL - -SELECT - 'PROCESSING' AS status, - 'punishment_flow3' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - -UNION ALL - -SELECT - 'PROCESSING' AS status, - 'punishment_flow4' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - -UNION ALL - -SELECT - 'PROCESSING' AS status, - 'punishment_flow5' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - N - - - 368 - 352 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing_delta.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing_delta.hpl deleted file mode 100644 index 4408027..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing_delta.hpl +++ /dev/null @@ -1,102 +0,0 @@ - - - - change_status_to_processing_delta - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/16 13:42:26.494 - - - 2025/06/16 13:42:26.494 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N - - - 1248 - 352 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - SELECT - 'PROCESSING' AS status, - 'delta_punishment' AS job_name, - current_timestamp AS record_created ---FROM public.etl_checkpoints - N - - - 832 - 352 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_job_punishment_exists.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_punishment_job_exists.hpl similarity index 70% rename from mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_job_punishment_exists.hpl rename to mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_punishment_job_exists.hpl index 6333e4e..68cacfd 100644 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_job_punishment_exists.hpl +++ b/mappings/info_recruits/citizen_tables/punishment/checkpoints/check_if_punishment_job_exists.hpl @@ -1,7 +1,7 @@ - check_if_job_punishment_exists + check_if_punishment_job_exists Y @@ -13,23 +13,23 @@ 1000 100 - - 2025/06/11 15:20:18.267 + 2025/08/05 13:28:46.661 - - 2025/06/11 15:20:18.267 + 2025/08/05 13:28:46.661 - - Table input - Set variables - Y - Set variables Write to log N + + Table input + Set variables + Y + Set variables @@ -44,21 +44,16 @@ - job_name - PIPE - PARENT_WORKFLOW - - - status - STATUS + job_executed_flag + JOB_EXECUTED_FLAG PARENT_WORKFLOW Y - 688 - 352 + 672 + 336 @@ -75,29 +70,17 @@ ervu-dashboard N 0 - SELECT - COALESCE(job_name, 'job_punishment') AS job_name, - COALESCE(status, 'NEW') AS status, - current_timestamp::timestamp as record_created -FROM ( - SELECT job_name, status - FROM public.etl_checkpoints - WHERE job_name = 'job_punishment' - - UNION ALL - - SELECT NULL, NULL - WHERE NOT EXISTS ( - SELECT 1 - FROM public.etl_checkpoints - WHERE job_name = 'job_punishment' - ) -) t + SELECT EXISTS ( + SELECT 1 + FROM etl.job_execution + WHERE job_name = 'punishment_job' + limit 1 + ) AS job_executed_flag; N - 400 - 352 + 384 + 336 @@ -111,17 +94,17 @@ FROM ( none + Basic Y - - N 0 - Basic ${STATUS} + + - 960 - 240 + 944 + 224 diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl deleted file mode 100644 index 7a9995f..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl +++ /dev/null @@ -1,869 +0,0 @@ - - - - checkpoint_job_punishment - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/03 14:19:02.590 - - - 2025/06/03 14:19:02.590 - - - - - - Filter rows - Abort - N - - - JSON input state_child_flow1.json - Filter rows - N - - - JSON input state_child_flow2.json - Filter rows - N - - - JSON input state_child_flow3.json - Filter rows - N - - - JSON input state_child_flow4.json - Filter rows - N - - - JSON input state_child_flow5.json - Filter rows - N - - - Table input - Insert / update - Y - - - Dummy (do nothing) - JSON input state_child_flow1.json - N - - - Dummy (do nothing) - JSON input state_child_flow2.json - N - - - Dummy (do nothing) - JSON input state_child_flow3.json - N - - - Dummy (do nothing) - JSON input state_child_flow4.json - N - - - Dummy (do nothing) - JSON input state_child_flow5.json - N - - - - Abort - Abort - - Y - - 1 - - none - - - ABORT_WITH_ERROR - Y - 0 - - - 1264 - 592 - - - - Dummy (do nothing) - Dummy - - Y - - 1 - - none - - - - - 352 - 592 - - - - Filter rows - FilterRows - - Y - - 1 - - none - - - - - - - - - - - = - pipeline - N - - - - N - -1 - constant - -1 - child_flow1 - String - - - - - - = - status - N - AND - - N - -1 - constant - -1 - ERROR - String - - - - = - pipeline - N - - - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - - - - - = - pipeline - N - - - - N - -1 - constant - -1 - child_flow2 - String - - - - - - = - status - N - AND - - N - -1 - constant - -1 - ERROR - String - - - - = - pipeline - N - OR - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - - - - - = - pipeline - N - - - - N - -1 - constant - -1 - child_flow3 - String - - - - - - = - status - N - AND - - N - -1 - constant - -1 - ERROR - String - - - - = - pipeline - N - OR - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - - - - - = - pipeline - N - - - - N - -1 - constant - -1 - child_flow4 - String - - - - - - = - status - N - AND - - N - -1 - constant - -1 - ERROR - String - - - - = - pipeline - N - OR - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - - - - - = - pipeline - N - - - - N - -1 - constant - -1 - child_flow5 - String - - - - - - = - status - N - AND - - N - -1 - constant - -1 - ERROR - String - - - - = - pipeline - N - OR - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - = - pipeline - N - - - - N - -1 - constant - -1 - recruits_info_flow1 - String - - - - Abort - - - 944 - 592 - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - job_name - job_name - - public - etl_checkpoints
- - job_name - job_name - N - - - record_created - record_created - Y - - - status - status - Y - -
- N - - - 1264 - 208 - -
- - JSON input state_child_flow1.json - JsonInput - - Y - - 1 - - none - - - N - - N - N - N - N - N - Y - Y - Y - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow1.json - - - N - N - - - - pipeline - $.pipeline - String - - - - - -1 - -1 - none - N - - - status - $.status - String - - - - - -1 - -1 - none - N - - - 0 - N - N - - - - - - - - - - - - 640 - 432 - - - - JSON input state_child_flow2.json - JsonInput - - Y - - 1 - - none - - - N - - N - N - N - N - N - Y - Y - Y - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow2.json - - - N - N - - - - pipeline - $.pipeline - String - - - - - -1 - -1 - none - N - - - status - $.status - String - - - - - -1 - -1 - none - N - - - 0 - N - N - - - - - - - - - - - - 640 - 512 - - - - JSON input state_child_flow3.json - JsonInput - - Y - - 1 - - none - - - N - - N - N - N - N - N - Y - Y - Y - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow3.json - - - N - N - - - - pipeline - $.pipeline - String - - - - - -1 - -1 - none - N - - - status - $.status - String - - - - - -1 - -1 - none - N - - - 0 - N - N - - - - - - - - - - - - 640 - 592 - - - - JSON input state_child_flow4.json - JsonInput - - Y - - 1 - - none - - - N - - N - N - N - N - N - Y - Y - Y - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow4.json - - - N - N - - - - pipeline - $.pipeline - String - - - - - -1 - -1 - none - N - - - status - $.status - String - - - - - -1 - -1 - none - N - - - 0 - N - N - - - - - - - - - - - - 640 - 672 - - - - JSON input state_child_flow5.json - JsonInput - - Y - - 1 - - none - - - N - - N - N - N - N - N - Y - Y - Y - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow5.json - - - N - N - - - - pipeline - $.pipeline - String - - - - - -1 - -1 - none - N - - - status - $.status - String - - - - - -1 - -1 - none - N - - - 0 - N - N - - - - - - - - - - - - 640 - 752 - - - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH status_check AS ( - SELECT - bool_or(status = 'ERROR' AND job_name IN ( - 'punishment_flow1', - 'punishment_flow2', - 'punishment_flow3', - 'punishment_flow4', - 'punishment_flow5' - )) AS has_error, - count(*) FILTER ( - WHERE status = 'SUCCESS' AND job_name IN ( - 'punishment_flow1', - 'punishment_flow2', - 'punishment_flow3', - 'punishment_flow4', - 'punishment_flow5' - ) - ) = 5 AS all_success - FROM public.etl_checkpoints -) -SELECT - 'job_punishment' as job_name, - CASE - WHEN has_error THEN 'ERROR' - WHEN all_success THEN 'SUCCESS' - ELSE 'ERROR' - END AS status, - current_timestamp AS record_created -FROM status_check; - N - - - 896 - 208 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_punishment_error.hpl b/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_punishment_error.hpl deleted file mode 100644 index d8db141..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_punishment_error.hpl +++ /dev/null @@ -1,273 +0,0 @@ - - - - checkpoint_punishment_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/09 10:01:04.895 - - - 2025/06/09 10:01:04.895 - - - - - - Select values - Table output - N - - - Table input - Select values - N - - - Table input - Table output - Y - - - - Select values - SelectValues - - Y - - 1 - - none - - - - N - - idm_id - idm_id - String - -2 - -2 - - false - - - false - - - - - - - - - - 1008 - 608 - - - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.citizen_child ch on ch.recruit_id = cit.recruit_id -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 - FROM flow_data -), -result_max as ( --костыль - SELECT - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 - FROM result_ma -), -for_checkpoints as ( - SELECT - 'job_child_flow1' as job_name, - idm_flow1 as last_recruitment_id, - cr_flow1 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_child_flow2' as job_name, - idm_flow2 as last_recruitment_id, - cr_flow2 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_child_flow3' as job_name, - idm_flow3 as last_recruitment_id, - cr_flow3 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_child_flow4' as job_name, - idm_flow4 as last_recruitment_id, - cr_flow4 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max - - union all - - SELECT - 'job_child_flow5' as job_name, - idm_flow5 as last_recruitment_id, - cr_flow5 as recruitment_created_date, - 'ERROR' as status, - current_timestamp as record_created - from result_max -) -select * from for_checkpoints - N - - - 736 - 448 - - - - Table output - TableOutput - - Y - - 1 - - none - - - 1000 - ervu-dashboard - - - N - N - N - N - Y - N - public - N - etl_checkpoints
- N - Y - N - Y - - - 1248 - 448 - -
- - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/checkpoints/xxjob_create_files_child.hwf b/mappings/info_recruits/citizen_tables/punishment/checkpoints/xxjob_create_files_child.hwf deleted file mode 100644 index b31ca9f..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/checkpoints/xxjob_create_files_child.hwf +++ /dev/null @@ -1,235 +0,0 @@ - - - job_create_files_child - Y - - - - - - 2025/05/26 16:48:00.210 - - - 2025/05/26 16:48:00.210 - - - - - Start - - SPECIAL - - 1 - 12 - 60 - 0 - 0 - N - 0 - 1 - N - 576 - 496 - - - - state_child_flow2_new - - WRITE_TO_FILE - - N - { - "status": "NEW", - "pipeline": "child_flow2" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow2.json - N - 848 - 416 - - - - state_child_flow1_new - - WRITE_TO_FILE - - N - { - "status": "NEW", - "pipeline": "child_flow1" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow1.json - N - 848 - 336 - - - - state_child_flow3_new - - WRITE_TO_FILE - - N - { - "status": "NEW", - "pipeline": "child_flow3" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow3.json - N - 848 - 496 - - - - state_child_flow4_new - - WRITE_TO_FILE - - N - { - "status": "NEW", - "pipeline": "child_flow4" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow4.json - N - 848 - 576 - - - - state_child_flow5_new - - WRITE_TO_FILE - - N - { - "status": "NEW", - "pipeline": "child_flow5" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow5.json - N - 848 - 656 - - - - Success - - SUCCESS - - N - 1120 - 496 - - - - Delete file state_job_child - - DELETE_FILE - - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_job_child.json - N - 848 - 256 - - - - - - Start - state_child_flow3_new - Y - Y - Y - - - Start - state_child_flow2_new - Y - Y - Y - - - Start - state_child_flow1_new - Y - Y - Y - - - Start - state_child_flow4_new - Y - Y - Y - - - Start - state_child_flow5_new - Y - Y - Y - - - state_child_flow5_new - Success - Y - Y - N - - - state_child_flow4_new - Success - Y - Y - N - - - state_child_flow3_new - Success - Y - Y - N - - - state_child_flow2_new - Success - Y - Y - N - - - state_child_flow1_new - Success - Y - Y - N - - - Start - Delete file state_job_child - Y - Y - Y - - - Delete file state_job_child - Success - Y - Y - N - - - - - - diff --git a/mappings/info_recruits/citizen_tables/punishment/delta_punishment.hpl b/mappings/info_recruits/citizen_tables/punishment/delta_punishment.hpl deleted file mode 100644 index 0741988..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/delta_punishment.hpl +++ /dev/null @@ -1,162 +0,0 @@ - - - - delta_punishment - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/06/03 16:10:48.509 - - - 2025/06/03 16:10:48.509 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 1264 - 416 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id --AND '${ID_F1}' != '' -- Проверка на пустую строку - --AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 768 - 416 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/job_punishment.hwf b/mappings/info_recruits/citizen_tables/punishment/job_punishment.hwf index 04c4ac1..990e210 100644 --- a/mappings/info_recruits/citizen_tables/punishment/job_punishment.hwf +++ b/mappings/info_recruits/citizen_tables/punishment/job_punishment.hwf @@ -37,235 +37,12 @@ 0 1 N - 368 - 400 - - - - checkpoint_job_punishment.hpl (2) - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl - Basic - - Y - - N - local - N - N - Y - N - 1136 - 1280 - - - - recruitment_rows_five_flow_punishment.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/supportive_jobs/recruitment_rows_five_flow_punishment.hpl - Basic - - Y - - N - local - N - N - Y - Y - 2352 - 400 - - - - punishment_flow1.hpl - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl - Basic - - - ID_F1 - IDM_FLOW1 - - Y - - Y - local - N - N - Y - N - 2672 - 80 - - - - punishment_flow2.hpl - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl - Basic - - - ID_F2 - IDM_FLOW2 - - Y - - Y - local - N - N - Y - N - 2672 - 240 - - - - punishment_flow3.hpl - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl - Basic - - - ID_F3 - IDM_FLOW3 - - Y - - Y - local - N - N - Y - N - 2672 - 400 - - - - punishment_flow4.hpl - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl - Basic - - - ID_F4 - IDM_FLOW4 - - Y - - Y - local - N - N - Y - N - 2672 - 560 - - - - punishment_flow5.hpl - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl - Basic - - - ID_F5 - IDM_FLOW5 - - Y - - Y - local - N - N - Y - N - 2672 - 720 - - - - Abort workflow - - ABORT - - N - N - 2336 + 416 208 - Success punishment - - SUCCESS - - N - 3728 - 432 - - - - branching_citizen_spouse.hpl + check_if_punishment_job_exists.hpl PIPELINE @@ -275,7 +52,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_spouse/branching_citizen_spouse.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/check_if_punishment_job_exists.hpl Basic Y @@ -286,48 +63,29 @@ N Y N - 1584 - 1280 + 608 + 208 - Simple punishment WHERE SUCCESS + punishment_job_exists_check SIMPLE_EVAL - SUCCESS - string - true + boolean + false equal equal N variable - STATUS + JOB_EXECUTED_FLAG N - 1840 - 1792 + 880 + 208 - Simple punishment WHERE ERROR - - SIMPLE_EVAL - - ERROR - string - true - equal - equal - N - variable - STATUS - N - 1840 - 1280 - - - - recruitment_rows_five_flow_if_error.hpl + recruitments_five_flow.hpl PIPELINE @@ -337,7 +95,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/recruitment_rows_five_flow_if_error.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/recruitments_five_flow.hpl Basic Y @@ -348,23 +106,12 @@ N Y Y - 2384 - 1280 + 1120 + 208 - Abort workflow 2 - - ABORT - - N - N - 2288 - 1040 - - - - delta_punishment.hpl + recruitment_five_flow_on_error.hpl PIPELINE @@ -374,57 +121,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/delta_punishment.hpl - Basic - - - M_R_UP_DATE - ${M_R_UP_DATE} - - Y - - N - local - N - N - Y - N - 2640 - 1792 - - - - Success delta_punishment - - SUCCESS - - N - 3280 - 1792 - - - - error delta_punishment - - SUCCESS - - N - 3280 - 1872 - - - - check_if_job_punishment_exists.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/check_if_job_punishment_exists.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/recruitment_five_flow_on_error.hpl Basic Y @@ -435,30 +132,55 @@ N Y N - 576 - 400 + 1120 + 512 - Simple job_punishment_exists check NEW + check_if_need_to_repeat_job.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/check_if_need_to_repeat_job.hpl + Basic + + Y + + N + local + N + N + Y + N + 880 + 368 + + + + Simple evaluation SIMPLE_EVAL - NEW - string + boolean true equal equal N variable - STATUS + NEED_TO_REPEAT_JOB N - 896 - 400 + 880 + 512 - change_status_to_processing.hpl + recruitment_five_flow_delta.hpl PIPELINE @@ -468,7 +190,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/recruitment_five_flow_delta.hpl Basic Y @@ -479,1338 +201,61 @@ N Y N - 1264 - 400 - - - - change_status_punishment_flow1_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 80 - - - - change_status_punishment_flow1_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 160 - - - - change_status_punishment_flow2_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 240 - - - - change_status_punishment_flow2_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 320 - - - - change_status_punishment_flow3_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 400 - - - - change_status_punishment_flow3_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 480 - - - - change_status_punishment_flow4_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 560 - - - - change_status_punishment_flow4_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 640 - - - - change_status_punishment_flow5_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 720 - - - - change_status_punishment_flow5_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 800 - - - - checkpoint_job_punishment.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl - Basic - - Y - - N - local - N - N - Y - N - 3456 - 432 - - - - change_status_to_processing.hpl (2) - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing.hpl - Basic - - Y - - N - local - N - N - Y - N - 2112 - 1280 - - - - change_status_to_processing_delta.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_to_processing_delta.hpl - Basic - - Y - - N - local - N - N - Y - N - 2144 - 1792 - - - - change_status_delta_punishment_success.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1792 - - - - change_status_delta_punishment_error.hpl - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_delta_punishment_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1872 - - - - punishment_flow1.hpl 2 - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl - Basic - - - ID_F1 - IDM_FLOW1 - - Y - - Y - local - N - N - Y - N - 2672 - 960 - - - - punishment_flow2.hpl 2 - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl - Basic - - - ID_F2 - IDM_FLOW2 - - Y - - Y - local - N - N - Y - N - 2672 - 1120 - - - - punishment_flow3.hpl 2 - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl - Basic - - - ID_F3 - IDM_FLOW3 - - Y - - Y - local - N - N - Y - N - 2672 - 1280 - - - - punishment_flow4.hpl 2 - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl - Basic - - - ID_F4 - IDM_FLOW4 - - Y - - Y - local - N - N - Y - N - 2672 - 1440 - - - - punishment_flow5.hpl 2 - - PIPELINE - - N - N - N - N - N - Y - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl - Basic - - - ID_F5 - IDM_FLOW5 - - Y - - Y - local - N - N - Y - N - 2672 - 1600 - - - - Success new punishment 2 - - SUCCESS - - N - 3728 - 1312 - - - - change_status_punishment_flow1_success.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 960 - - - - change_status_punishment_flow1_error.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow1_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1040 - - - - change_status_punishment_flow2_success.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1120 - - - - change_status_punishment_flow2_error.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow2_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1200 - - - - change_status_punishment_flow3_success.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1280 - - - - change_status_punishment_flow3_error.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow3_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1360 - - - - change_status_punishment_flow4_success.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1440 - - - - change_status_punishment_flow4_error.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow4_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1520 - - - - change_status_punishment_flow5_success.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_success.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1600 - - - - change_status_punishment_flow5_error.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/change_status_punishment_flow5_error.hpl - Basic - - Y - - N - local - N - N - Y - N - 2992 - 1680 - - - - checkpoint_job_punishment.hpl 2 - - PIPELINE - - N - N - N - N - N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/checkpoints/checkpoint_job_punishment.hpl - Basic - - Y - - N - local - N - N - Y - N - 3456 - 1312 + 880 + 704 - - recruitment_rows_five_flow_punishment.hpl - punishment_flow1.hpl - Y - Y - N - - - recruitment_rows_five_flow_punishment.hpl - punishment_flow2.hpl - Y - Y - N - - - recruitment_rows_five_flow_punishment.hpl - punishment_flow3.hpl - Y - Y - N - - - recruitment_rows_five_flow_punishment.hpl - punishment_flow4.hpl - Y - Y - N - - - recruitment_rows_five_flow_punishment.hpl - punishment_flow5.hpl - Y - Y - N - - - recruitment_rows_five_flow_punishment.hpl - Abort workflow - Y - N - N - - - branching_citizen_spouse.hpl - Simple punishment WHERE ERROR - Y - N - Y - - - branching_citizen_spouse.hpl - Simple punishment WHERE SUCCESS - Y - N - Y - - - recruitment_rows_five_flow_if_error.hpl - Abort workflow 2 - Y - N - N - Start - check_if_job_punishment_exists.hpl + check_if_punishment_job_exists.hpl Y Y Y - check_if_job_punishment_exists.hpl - Simple job_punishment_exists check NEW + check_if_punishment_job_exists.hpl + punishment_job_exists_check Y Y N - Simple job_punishment_exists check NEW - change_status_to_processing.hpl + punishment_job_exists_check + recruitments_five_flow.hpl Y Y N - change_status_to_processing.hpl - recruitment_rows_five_flow_punishment.hpl + punishment_job_exists_check + check_if_need_to_repeat_job.hpl + Y + N + N + + + check_if_need_to_repeat_job.hpl + Simple evaluation Y Y N - punishment_flow1.hpl - change_status_punishment_flow1_success.hpl + Simple evaluation + recruitment_five_flow_on_error.hpl Y Y N - punishment_flow1.hpl - change_status_punishment_flow1_error.hpl + Simple evaluation + recruitment_five_flow_delta.hpl Y N N - - punishment_flow2.hpl - change_status_punishment_flow2_success.hpl - Y - Y - N - - - punishment_flow2.hpl - change_status_punishment_flow2_error.hpl - Y - N - N - - - punishment_flow3.hpl - change_status_punishment_flow3_success.hpl - Y - Y - N - - - punishment_flow3.hpl - change_status_punishment_flow3_error.hpl - Y - N - N - - - punishment_flow4.hpl - change_status_punishment_flow4_success.hpl - Y - Y - N - - - punishment_flow4.hpl - change_status_punishment_flow4_error.hpl - Y - N - N - - - punishment_flow5.hpl - change_status_punishment_flow5_success.hpl - Y - Y - N - - - punishment_flow5.hpl - change_status_punishment_flow5_error.hpl - Y - N - N - - - change_status_punishment_flow5_error.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow5_success.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow4_error.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow4_success.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow3_error.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow3_success.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow2_error.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow2_success.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow1_error.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - change_status_punishment_flow1_success.hpl - checkpoint_job_punishment.hpl - Y - N - Y - - - checkpoint_job_punishment.hpl - Success punishment - Y - Y - N - - - checkpoint_job_punishment.hpl (2) - branching_citizen_spouse.hpl - Y - N - Y - - - Simple job_punishment_exists check NEW - checkpoint_job_punishment.hpl (2) - Y - N - N - - - Simple punishment WHERE ERROR - change_status_to_processing.hpl (2) - Y - Y - N - - - change_status_to_processing.hpl (2) - recruitment_rows_five_flow_if_error.hpl - Y - Y - N - - - Simple punishment WHERE SUCCESS - change_status_to_processing_delta.hpl - Y - Y - N - - - delta_punishment.hpl - change_status_delta_punishment_success.hpl - Y - Y - N - - - change_status_delta_punishment_success.hpl - Success delta_punishment - Y - Y - N - - - delta_punishment.hpl - change_status_delta_punishment_error.hpl - Y - N - N - - - change_status_delta_punishment_error.hpl - error delta_punishment - Y - Y - N - - - change_status_to_processing_delta.hpl - delta_punishment.hpl - Y - Y - N - - - punishment_flow1.hpl 2 - change_status_punishment_flow1_success.hpl 2 - Y - Y - N - - - punishment_flow1.hpl 2 - change_status_punishment_flow1_error.hpl 2 - Y - N - N - - - punishment_flow2.hpl 2 - change_status_punishment_flow2_success.hpl 2 - Y - Y - N - - - punishment_flow2.hpl 2 - change_status_punishment_flow2_error.hpl 2 - Y - N - N - - - punishment_flow3.hpl 2 - change_status_punishment_flow3_success.hpl 2 - Y - Y - N - - - punishment_flow3.hpl 2 - change_status_punishment_flow3_error.hpl 2 - Y - N - N - - - punishment_flow4.hpl 2 - change_status_punishment_flow4_success.hpl 2 - Y - Y - N - - - punishment_flow4.hpl 2 - change_status_punishment_flow4_error.hpl 2 - Y - N - N - - - punishment_flow5.hpl 2 - change_status_punishment_flow5_success.hpl 2 - Y - Y - N - - - punishment_flow5.hpl 2 - change_status_punishment_flow5_error.hpl 2 - Y - N - N - - - change_status_punishment_flow1_success.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow1_error.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow2_success.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow2_error.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow3_success.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow3_error.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow4_success.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow4_error.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow5_success.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - change_status_punishment_flow5_error.hpl 2 - checkpoint_job_punishment.hpl 2 - Y - N - Y - - - checkpoint_job_punishment.hpl 2 - Success new punishment 2 - Y - Y - N - - - recruitment_rows_five_flow_if_error.hpl - punishment_flow3.hpl 2 - Y - Y - N - - - recruitment_rows_five_flow_if_error.hpl - punishment_flow2.hpl 2 - Y - Y - N - - - recruitment_rows_five_flow_if_error.hpl - punishment_flow1.hpl 2 - Y - Y - N - - - recruitment_rows_five_flow_if_error.hpl - punishment_flow4.hpl 2 - Y - Y - N - - - recruitment_rows_five_flow_if_error.hpl - punishment_flow5.hpl 2 - Y - Y - N - @@ -1827,13 +272,18 @@ N Segoe UI 9 - 72 - 1088 - 176 - 0001-01-01 00:00:00 + 149 + 976 + 0 + -3001-01-01 00:00:00 - +M_R_UP_DATE + +M_R_CR_DATE + +0001-01-01 00:00:00 + +3001-01-01 00:00:00 114 diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl new file mode 100644 index 0000000..01d3b7b --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl @@ -0,0 +1,580 @@ + + + + punishment_flow + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/08/05 14:31:22.799 + - + 2025/08/05 14:31:22.799 + + + + + + Create job execution record + Table input + Y + + + Table output + Change job status on error + Y + + + Change job status on error + Abort + Y + + + Filter rows + Change job status on success + Y + + + Table output + Detect empty stream + Y + + + Detect empty stream + Change job status on success + Y + + + Table input + Table output + Y + + + Table output + Group by + Y + + + Group by + Identify last row in a stream + Y + + + Identify last row in a stream + Add constants + Y + + + Add constants + Update + Y + + + Update + Filter rows + Y + + + Update + Change job status on error + Y + + + + Abort + Abort + + Y + + 1 + + none + + + ABORT_WITH_ERROR + Y + 0 + + + 1168 + 448 + + + + Add constants + Constant + + Y + + 1 + + none + + + + + -1 + has_punishment_execution_info + true + -1 + N + Boolean + + + -1 + has_sentence_info + true + -1 + N + Boolean + + + + + 880 + 624 + + + + Change job status on error + ExecSql + + Y + + 1 + + none + + + + + error_description + + + ervu-dashboard + Y + N + Y + Y + N + UPDATE etl.job_execution +SET status = 'ERROR', + error_description = ? +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}'; + + + + + 1008 + 448 + + + + Change job status on success + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + Y + N + Y + N + N + UPDATE etl.job_execution +SET status = 'SUCCESS' +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}' +and status = 'PROCESSING'; + + + + + 1488 + 624 + + + + Create job execution record + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id) +VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); + + + + + 80 + 320 + + + + Detect empty stream + DetectEmptyStream + + Y + + 1 + + none + + + + + 1488 + 320 + + + + Filter rows + FilterRows + + Y + + 1 + + none + + + + + + + = + last_row + N + - + + N + -1 + constant + -1 + Y + Boolean + + + + Change job status on success + + + 1200 + 624 + + + + Group by + GroupBy + + Y + + 1 + + none + + + N + N + ${java.io.tmpdir} + + + N + + + recruit_id + + + N + grp + + + 720 + 464 + + + + Identify last row in a stream + DetectLastRow + + Y + + 1 + + none + + + last_row + + + 720 + 624 + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + + WITH punishment_data AS ( + SELECT ri.recruit_id, + jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info + FROM ervu_dashboard.recruits_info ri + JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id + AND '${IDM_ID}' != '' + AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' + AND '${M_R_CR_DATE}'::timestamp >= ri.created_at + WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' +) +SELECT recruit_id, + punishment_info ->> 'id' AS punishment_external_id, + -- Блок "Сведения о вынесенном приговоре" + punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания + punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания + TO_DATE(punishment_info ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, -- Дата осуждения + punishment_info ->> 'naimSud' AS authority_name, -- Наименование суда + punishment_info ->> 'srokNakaz' AS sentence, -- Срок наказания + CASE + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '1' THEN 'Изменений срока наказания не было' + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '2' THEN 'Были изменения срока наказания' + ELSE punishment_info ->> 'kodIzmSrokNakaz' + END AS sentence_changed, -- Признак изменения срока + string_agg(law_articles, ', ') AS law_point, -- Статьи УК + -- Блок "Сведения об отбывании наказания" + punishment_info ->> 'katUcheta' AS registration_category, -- Категория учета + punishment_info ->> 'naimSubekt' AS region_name, -- Наименование субъекта + punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения + punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения + punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела + TO_DATE(punishment_info ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока + TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения + CASE + WHEN punishment_info ->> 'kodPerekvalif' = '1' THEN 'Изменений статьи не было' + WHEN punishment_info ->> 'kodPerekvalif' = '2' THEN 'Были изменения статьи' + ELSE punishment_info ->> 'kodPerekvalif' + END AS article_modification_flag, -- Признак переквалификации + punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения + TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения +FROM punishment_data +LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true +GROUP BY recruit_id, punishment_info; + Y + + + 336 + 320 + + + + Table output + TableOutput + + N + + 1 + + none + + + 1000 + ervu-dashboard + + + recruit_id + recruit_id + + + punishment_external_id + punishment_external_id + + + punishment_type + punishment_type + + + punishment_code + punishment_code + + + sentense_date + sentense_date + + + authority_name + authority_name + + + sentence + sentence + + + sentence_changed + sentence_changed + + + law_point + law_point + + + registration_category + registration_category + + + region_name + region_name + + + facility_name + facility_name + + + facility_address + facility_address + + + criminal_case_number + criminal_case_number + + + start_date + start_date + + + planned_date + planned_date + + + article_modification_flag + article_modification_flag + + + release_reason + release_reason + + + release_date + release_date + + + N + N + N + N + Y + N + ervu_dashboard + Y + punishment
+ N + Y + N + Y + + + 720 + 320 + +
+ + Update + Update + + N + + 1 + + none + + + 1000 + ervu-dashboard + N + + + = + recruit_id + recruit_id + + ervu_dashboard + citizen
+ + has_punishment_execution_info + has_punishment_execution_info + + + has_sentence_info + has_sentence_info + +
+ N + N + + + 1008 + 624 + +
+ + + Table output + Change job status on error + Y + + error_description + + error_code + + + + + + Update + Change job status on error + Y + + error_decription + + error_code + + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl deleted file mode 100644 index a5f6f18..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow1.hpl +++ /dev/null @@ -1,163 +0,0 @@ - - - - punishment_flow1 - Y - - - - Normal - 0 - - - N - 1000 - 100 - - - 2025/05/21 14:05:02.260 - - - 2025/05/21 14:05:02.260 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 944 - 288 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F1}' != '' -- Проверка на пустую строку - AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 448 - 288 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl deleted file mode 100644 index 1a606b8..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow2.hpl +++ /dev/null @@ -1,162 +0,0 @@ - - - - punishment_flow2 - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/05/21 14:05:02.260 - - - 2025/05/21 14:05:02.260 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 1184 - 352 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F2}' != '' -- Проверка на пустую строку - AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F2}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 688 - 352 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl deleted file mode 100644 index 3b0454f..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow3.hpl +++ /dev/null @@ -1,161 +0,0 @@ - - - - punishment_flow3 - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/05/21 14:05:02.260 - - - 2025/05/21 14:05:02.260 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 1200 - 384 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F3}' != '' -- Проверка на пустую строку - AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F3}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 704 - 384 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl deleted file mode 100644 index b3cb7c1..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow4.hpl +++ /dev/null @@ -1,161 +0,0 @@ - - - - punishment_flow4 - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/05/21 14:05:02.260 - - - 2025/05/21 14:05:02.260 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 1152 - 368 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F4}' != '' -- Проверка на пустую строку - AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F4}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 656 - 368 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl deleted file mode 100644 index d65536f..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow5.hpl +++ /dev/null @@ -1,161 +0,0 @@ - - - - punishment_flow5 - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/05/21 14:05:02.260 - - - 2025/05/21 14:05:02.260 - - - - - - Table input - Insert / update - Y - - - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - ervu_dashboard - punishment
- - recruit_id - recruit_id - N - - - authority_name - authority_name - Y - - - sentence - sentence - Y - - - sentence_place - sentence_place - Y - - - sentence_changed - sentence_changed - Y - - - punishment_type - punishment_type - Y - - - start_date - start_date - Y - - - release_date - release_date - Y - - - sentense_date - sentense_date - Y - - - law_point - law_point - Y - - - release_reason - release_reason - Y - -
- N - - - 1344 - 416 - -
- - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ugol AS ( - SELECT ri.recruit_id, - jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz - FROM ervu_dashboard.recruits_info ri - join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F5}' != '' -- Проверка на пустую строку - AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F5}' - AND '${M_R_CR_DATE}'::timestamp >= ri.created_at - WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' -) -SELECT recruit_id, - nakaz ->> 'naimSud' AS authority_name, - nakaz ->> 'srokNakaz' AS sentence, - nakaz ->> 'adresOrg' AS sentence_place, --- nakaz->>'vidNakaz' AS punishment_code, - nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed, - nakaz ->> 'vidNakaz' AS punishment_type, - TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, - TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, - TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, - string_agg(statiuk_elem, ', ') AS law_point, - nakaz ->> 'osnOsvob' AS release_reason -FROM ugol - LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true -GROUP BY recruit_id, nakaz; - Y - - - 848 - 416 - - - - - -
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl new file mode 100644 index 0000000..7debf9b --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl @@ -0,0 +1,604 @@ + + + + punishment_flow_delta + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/08/11 13:22:56.048 + - + 2025/08/11 13:22:56.048 + + + + + + Create job execution record + Table input + Y + + + Insert / update + Change job status on error + Y + + + Insert / update + Detect empty stream + Y + + + Detect empty stream + Change job status on success + Y + + + Filter rows + Change job status on success + Y + + + Change job status on error + Abort + Y + + + Table input + Insert / update + Y + + + Insert / update + Group by + Y + + + Identify last row in a stream + Add constants + Y + + + Group by + Identify last row in a stream + Y + + + Add constants + Update + Y + + + Update + Filter rows + Y + + + Update + Change job status on error + Y + + + + Abort + Abort + + Y + + 1 + + none + + + ABORT_WITH_ERROR + Y + 0 + + + 1120 + 384 + + + + Add constants + Constant + + Y + + 1 + + none + + + + + -1 + has_punishment_execution_info + true + -1 + N + Boolean + + + -1 + has_sentence_info + true + -1 + N + Boolean + + + + + 864 + 608 + + + + Change job status on error + ExecSql + + Y + + 1 + + none + + + + + error_description + + + ervu-dashboard + Y + N + Y + Y + N + UPDATE etl.job_execution +SET status = 'DELTA_ERROR', + error_description = ? +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}'; + + + + + 960 + 384 + + + + Change job status on success + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + Y + N + Y + N + N + UPDATE etl.job_execution +SET status = 'DELTA_SUCCESS' +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}' +and status = 'DELTA_PROCESSING'; + + + + + 1280 + 608 + + + + Create job execution record + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + UPDATE etl.job_execution +SET + status = 'DELTA_PROCESSING', + execution_datetime = DEFAULT, + error_description = NULL +where job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}'; + + + 128 + 224 + + + + Detect empty stream + DetectEmptyStream + + Y + + 1 + + none + + + + + 1280 + 224 + + + + Filter rows + FilterRows + + Y + + 1 + + none + + + + + + + = + last_row + N + - + + N + -1 + constant + -1 + Y + Boolean + + + + Change job status on success + + + 1072 + 608 + + + + Group by + GroupBy + + Y + + 1 + + none + + + N + N + ${java.io.tmpdir} + + + N + + + recruit_id + + + N + grp + + + 752 + 400 + + + + Identify last row in a stream + DetectLastRow + + Y + + 1 + + none + + + last_row + + + 752 + 608 + + + + Insert / update + InsertUpdate + + N + + 1 + + none + + + 100 + ervu-dashboard + + + = + recruit_id + recruit_id + + + + = + punishment_external_id + punishment_external_id + + + ervu_dashboard + punishment
+ + recruit_id + recruit_id + N + + + punishment_external_id + punishment_external_id + N + + + punishment_type + punishment_type + Y + + + punishment_code + punishment_code + Y + + + sentense_date + sentense_date + Y + + + authority_name + authority_name + Y + + + sentence + sentence + Y + + + sentence_changed + sentence_changed + Y + + + law_point + law_point + Y + + + registration_category + registration_category + Y + + + region_name + region_name + Y + + + facility_name + facility_name + Y + + + facility_address + facility_address + Y + + + criminal_case_number + criminal_case_number + Y + + + start_date + start_date + Y + + + planned_date + planned_date + Y + + + article_modification_flag + article_modification_flag + Y + + + release_reason + release_reason + Y + + + release_date + release_date + Y + +
+ N + + + 752 + 224 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + WITH punishment_data AS ( + SELECT ri.recruit_id, + jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info + FROM ervu_dashboard.recruits_info ri + JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id + AND '${IDM_ID}' != '' + AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' + AND '${M_R_CR_DATE}'::timestamp >= ri.created_at + AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp + WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' +) +SELECT recruit_id, + punishment_info ->> 'id' AS punishment_external_id, + -- Блок "Сведения о вынесенном приговоре" + punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания + punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания + TO_DATE(punishment_info ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, -- Дата осуждения + punishment_info ->> 'naimSud' AS authority_name, -- Наименование суда + punishment_info ->> 'srokNakaz' AS sentence, -- Срок наказания + CASE + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '1' THEN 'Изменений срока наказания не было' + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '2' THEN 'Были изменения срока наказания' + ELSE punishment_info ->> 'kodIzmSrokNakaz' + END AS sentence_changed, -- Признак изменения срока + string_agg(law_articles, ', ') AS law_point, -- Статьи УК + -- Блок "Сведения об отбывании наказания" + punishment_info ->> 'katUcheta' AS registration_category, -- Категория учета + punishment_info ->> 'naimSubekt' AS region_name, -- Наименование субъекта + punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения + punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения + punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела + TO_DATE(punishment_info ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока + TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения + CASE + WHEN punishment_info ->> 'kodPerekvalif' = '1' THEN 'Изменений статьи не было' + WHEN punishment_info ->> 'kodPerekvalif' = '2' THEN 'Были изменения статьи' + ELSE punishment_info ->> 'kodPerekvalif' + END AS article_modification_flag, -- Признак переквалификации + punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения + TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения +FROM punishment_data +LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true +GROUP BY recruit_id, punishment_info; + Y + + + 400 + 224 + + + + Update + Update + + N + + 1 + + none + + + 1000 + ervu-dashboard + N + + + = + recruit_id + recruit_id + + ervu_dashboard + citizen
+ + has_punishment_execution_info + has_punishment_execution_info + + + has_sentence_info + has_sentence_info + +
+ N + N + + + 960 + 608 + +
+ + + Insert / update + Change job status on error + Y + + error_description + + error_code + + + + + + Update + Change job status on error + Y + + error_description + + + + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl new file mode 100644 index 0000000..a84d0b0 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl @@ -0,0 +1,617 @@ + + + + punishment_flow_repeat + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/08/08 13:25:52.319 + - + 2025/08/08 13:25:52.319 + + + + + + Create job execution record + Table input + Y + + + Add constants + Update + Y + + + Change job status on error + Abort + Y + + + Detect empty stream + Change job status on success + Y + + + Filter rows + Change job status on success + Y + + + Group by + Identify last row in a stream 2 + Y + + + Identify last row in a stream 2 + Add constants + Y + + + Update + Change job status on error + Y + + + Update + Filter rows + Y + + + Insert / update + Detect empty stream + Y + + + Insert / update + Change job status on error + Y + + + Table input + Insert / update + Y + + + Insert / update + Group by + Y + + + + Abort + Abort + + Y + + 1 + + none + + + ABORT_WITH_ERROR + Y + 0 + + + 1152 + 432 + + + + Add constants + Constant + + Y + + 1 + + none + + + + + -1 + has_punishment_execution_info + true + -1 + N + Boolean + + + -1 + has_sentence_info + true + -1 + N + Boolean + + + + + 880 + 640 + + + + Change job status on error + ExecSql + + Y + + 1 + + none + + + + + error_description + + + ervu-dashboard + Y + N + Y + Y + N + UPDATE etl.job_execution +SET status = 'ERROR', + error_description = ? +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}'; + + + + + 992 + 432 + + + + Change job status on success + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + Y + N + Y + N + N + UPDATE etl.job_execution +SET status = 'SUCCESS' +WHERE job_name = '${JOB_NAME}' +and recruitment_id = '${IDM_ID}' +and status = 'PROCESSING'; + + + + + 1312 + 640 + + + + Create job execution record + ExecSql + + Y + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + INSERT INTO etl.job_execution ( + id, + job_name, + status, + execution_datetime, + error_description, + recruitment_id +) +VALUES ( + DEFAULT, + '${JOB_NAME}', + 'PROCESSING', + DEFAULT, + NULL, + '${IDM_ID}' +) +ON CONFLICT (job_name, recruitment_id) +DO UPDATE SET + status = 'PROCESSING', + execution_datetime = DEFAULT, + error_description = NULL; + + + 176 + 272 + + + + Detect empty stream + DetectEmptyStream + + Y + + 1 + + none + + + + + 1312 + 272 + + + + Filter rows + FilterRows + + Y + + 1 + + none + + + + + + + = + last_row + N + - + + N + -1 + constant + -1 + Y + Boolean + + + + Change job status on success + + + 1136 + 640 + + + + Group by + GroupBy + + Y + + 1 + + none + + + N + N + ${java.io.tmpdir} + + + N + + + recruit_id + + + N + grp + + + 688 + 432 + + + + Identify last row in a stream 2 + DetectLastRow + + Y + + 1 + + none + + + last_row + + + 688 + 640 + + + + Insert / update + InsertUpdate + + N + + 1 + + none + + + 1000 + ervu-dashboard + + + = + recruit_id + recruit_id + + + + = + punishment_external_id + punishment_external_id + + + ervu_dashboard + punishment
+ + recruit_id + recruit_id + N + + + punishment_external_id + punishment_external_id + N + + + punishment_type + punishment_type + Y + + + punishment_code + punishment_code + Y + + + sentense_date + sentense_date + Y + + + authority_name + authority_name + Y + + + sentence + sentence + Y + + + sentence_changed + sentence_changed + Y + + + law_point + law_point + Y + + + registration_category + registration_category + Y + + + region_name + region_name + Y + + + facility_name + facility_name + Y + + + facility_address + facility_address + Y + + + criminal_case_number + criminal_case_number + Y + + + start_date + start_date + Y + + + planned_date + planned_date + Y + + + article_modification_flag + article_modification_flag + Y + + + release_reason + release_reason + Y + + + release_date + release_date + Y + +
+ N + + + 688 + 272 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + WITH punishment_data AS ( + SELECT ri.recruit_id, + jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info + FROM ervu_dashboard.recruits_info ri + JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id + AND '${IDM_ID}' != '' + AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' + AND '${M_R_CR_DATE}'::timestamp >= ri.created_at + WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' +) +SELECT recruit_id, + punishment_info ->> 'id' AS punishment_external_id, + -- Блок "Сведения о вынесенном приговоре" + punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания + punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания + TO_DATE(punishment_info ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date, -- Дата осуждения + punishment_info ->> 'naimSud' AS authority_name, -- Наименование суда + punishment_info ->> 'srokNakaz' AS sentence, -- Срок наказания + CASE + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '1' THEN 'Изменений срока наказания не было' + WHEN punishment_info ->> 'kodIzmSrokNakaz' = '2' THEN 'Были изменения срока наказания' + ELSE punishment_info ->> 'kodIzmSrokNakaz' + END AS sentence_changed, -- Признак изменения срока + string_agg(law_articles, ', ') AS law_point, -- Статьи УК + -- Блок "Сведения об отбывании наказания" + punishment_info ->> 'katUcheta' AS registration_category, -- Категория учета + punishment_info ->> 'naimSubekt' AS region_name, -- Наименование субъекта + punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения + punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения + punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела + TO_DATE(punishment_info ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока + TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения + CASE + WHEN punishment_info ->> 'kodPerekvalif' = '1' THEN 'Изменений статьи не было' + WHEN punishment_info ->> 'kodPerekvalif' = '2' THEN 'Были изменения статьи' + ELSE punishment_info ->> 'kodPerekvalif' + END AS article_modification_flag, -- Признак переквалификации + punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения + TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения +FROM punishment_data +LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true +GROUP BY recruit_id, punishment_info; + Y + + + 416 + 272 + + + + Update + Update + + N + + 1 + + none + + + 1000 + ervu-dashboard + N + + + = + recruit_id + recruit_id + + ervu_dashboard + citizen
+ + has_punishment_execution_info + has_punishment_execution_info + + + has_sentence_info + has_sentence_info + +
+ N + N + + + 992 + 640 + +
+ + + Insert / update + Change job status on error + Y + + error_description + + error_code + + + + + + Update + Change job status on error + Y + + error_description + + + + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_delta.hpl b/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_delta.hpl new file mode 100644 index 0000000..45065a2 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_delta.hpl @@ -0,0 +1,360 @@ + + + + recruitment_five_flow_delta + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/08/11 13:16:11.204 + - + 2025/08/11 13:16:11.204 + + + + + + Table input + punishment_flow_delta.hpl + Y + + + Table input + punishment_flow_delta.hpl 2 + Y + + + Table input + punishment_flow_delta.hpl 3 + Y + + + Table input + punishment_flow_delta.hpl 4 + Y + + + Table input + punishment_flow_delta.hpl 5 + Y + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + + SELECT + r.idm_id as recruitment_id +FROM ervu_dashboard.recruitment r + LEFT JOIN etl.job_execution je + ON r.idm_id = je.recruitment_id + and job_name = 'punishment_job' +where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING'); + N + + + 352 + 288 + + + + punishment_flow_delta.hpl + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 544 + 128 + + + + punishment_flow_delta.hpl 2 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 544 + 208 + + + + punishment_flow_delta.hpl 3 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 544 + 288 + + + + punishment_flow_delta.hpl 4 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 544 + 368 + + + + punishment_flow_delta.hpl 5 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 544 + 448 + + + + + + diff --git a/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_on_error.hpl b/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_on_error.hpl new file mode 100644 index 0000000..da6ae9d --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/recruitment_five_flow_on_error.hpl @@ -0,0 +1,360 @@ + + + + recruitment_five_flow_on_error + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/08/05 12:54:50.126 + - + 2025/08/05 12:54:50.126 + + + + + + Table input + punishment_flow_repeat.hpl + Y + + + Table input + punishment_flow_repeat.hpl 3 + Y + + + Table input + punishment_flow_repeat.hpl 2 + Y + + + Table input + punishment_flow_repeat.hpl 4 + Y + + + Table input + punishment_flow_repeat.hpl 5 + Y + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + + SELECT + r.idm_id as recruitment_id +FROM ervu_dashboard.recruitment r + LEFT JOIN etl.job_execution je + ON r.idm_id = je.recruitment_id + and job_name = 'punishment_job' +where je.status is null or je.status in('ERROR', 'PROCESSING'); + N + + + 272 + 368 + + + + punishment_flow_repeat.hpl + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 464 + 208 + + + + punishment_flow_repeat.hpl 2 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 464 + 288 + + + + punishment_flow_repeat.hpl 3 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 464 + 368 + + + + punishment_flow_repeat.hpl 4 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 464 + 448 + + + + punishment_flow_repeat.hpl 5 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl + N + + 1 + + + + + IDM_ID + recruitment_id + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 464 + 528 + + + + + + diff --git a/mappings/info_recruits/citizen_tables/punishment/recruitment_rows_five_flow_if_error.hpl b/mappings/info_recruits/citizen_tables/punishment/recruitment_rows_five_flow_if_error.hpl deleted file mode 100644 index 4e3598a..0000000 --- a/mappings/info_recruits/citizen_tables/punishment/recruitment_rows_five_flow_if_error.hpl +++ /dev/null @@ -1,261 +0,0 @@ - - - - recruitment_rows_five_flow_if_error - Y - - - - Normal - - - N - 1000 - 100 - - - 2025/05/23 14:28:22.572 - - - 2025/05/23 14:28:22.572 - - - - - - Table input - Copy rows to result - Y - - - - Copy rows to result - RowsToResult - - Y - - 1 - - none - - - - - 880 - 288 - - - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - WITH ordered AS ( - SELECT - idm_id, - created_at, - ROW_NUMBER() OVER (ORDER BY created_at) AS rn, - COUNT(*) OVER () AS total_rows - FROM ervu_dashboard.recruitment -), -splitted AS ( - SELECT *, - CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num - FROM ordered -), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date - FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen cit - join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id - -), -flow_data AS ( - SELECT - fr.flow_num, - ri.idm_id, - (SELECT r.created_at FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - AND r.created_at BETWEEN fr.min_date AND fr.max_date - LIMIT 1) AS created_at - FROM recr_inf ri - CROSS JOIN flow_ranges fr - WHERE EXISTS ( - SELECT 1 FROM ervu_dashboard.recruitment r - WHERE r.idm_id = ri.idm_id - ) -), -result_ma as ( - SELECT - MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1, - (SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1, - - MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2, - (SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2, - - MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3, - (SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3, - - MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4, - (SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4, - - MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5, - (SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5 - FROM flow_data -), -result_max as ( --костыль - SELECT - CASE - WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow1 - END AS cr_flow1, - idm_flow1, - CASE - WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow2 - END AS cr_flow2, - idm_flow2, - CASE - WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow3 - END AS cr_flow3, - idm_flow3, - CASE - WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow4 - END AS cr_flow4, - idm_flow4, - CASE - WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp - ELSE cr_flow5 - END AS cr_flow5, - idm_flow5 - FROM result_ma -), -remains as ( - select - CASE - WHEN created_at >= (select cr_flow1 from result_max) and flow_num = 1 THEN created_at - ELSE null - END as cr_flow1, - CASE - WHEN created_at >= (select cr_flow1 from result_max) and flow_num = 1 THEN idm_id - ELSE null - END as idm_flow1, - - CASE - WHEN created_at >= (select cr_flow2 from result_max) and flow_num = 2 THEN created_at - ELSE null - END as cr_flow2, - CASE - WHEN created_at >= (select cr_flow2 from result_max) and flow_num = 2 THEN idm_id - ELSE null - END as idm_flow2, - - CASE - WHEN created_at >= (select cr_flow3 from result_max) and flow_num = 3 THEN created_at - ELSE null - END as cr_flow3, - CASE - WHEN created_at >= (select cr_flow3 from result_max) and flow_num = 3 THEN idm_id - ELSE null - END as idm_flow3, - - CASE - WHEN created_at >= (select cr_flow4 from result_max) and flow_num = 4 THEN created_at - ELSE null - END as cr_flow4, - CASE - WHEN created_at >= (select cr_flow4 from result_max) and flow_num = 4 THEN idm_id - ELSE null - END as idm_flow4, - - CASE - WHEN created_at >= (select cr_flow5 from result_max) and flow_num = 5 THEN created_at - ELSE null - END as cr_flow5, - CASE - WHEN created_at >= (select cr_flow5 from result_max) and flow_num = 5 THEN idm_id - ELSE null - END as idm_flow5 - from splitted -), -idm1 as ( - select - cr_flow1, - idm_flow1 - from remains - where cr_flow1 is not null and idm_flow1 is not null -), -idm2 as ( - select - cr_flow2, - idm_flow2 - from remains - where cr_flow2 is not null and idm_flow2 is not null -), -idm3 as ( - select - cr_flow3, - idm_flow3 - from remains - where cr_flow3 is not null and idm_flow3 is not null -), -idm4 as ( - select - cr_flow4, - idm_flow4 - from remains - where cr_flow4 is not null and idm_flow4 is not null -), -idm5 as ( - select - cr_flow5, - idm_flow5 - from remains - where cr_flow5 is not null and idm_flow5 is not null -) -select - i1.*, - i2.*, - i3.*, - i4.*, - i5.* -FROM - (SELECT *, ROW_NUMBER() OVER () as rn FROM idm1) i1 -FULL OUTER JOIN - (SELECT *, ROW_NUMBER() OVER () as rn FROM idm2) i2 ON i1.rn = i2.rn -FULL OUTER JOIN - (SELECT *, ROW_NUMBER() OVER () as rn FROM idm3) i3 ON i1.rn = i3.rn -FULL OUTER JOIN - (SELECT *, ROW_NUMBER() OVER () as rn FROM idm4) i4 ON i1.rn = i4.rn -FULL OUTER JOIN - (SELECT *, ROW_NUMBER() OVER () as rn FROM idm5) i5 ON i1.rn = i5.rn -ORDER BY COALESCE(i1.rn, i2.rn, i3.rn, i4.rn, i5.rn) -limit 2 - N - - - 512 - 288 - - - - - - diff --git a/mappings/info_recruits/citizen_tables/punishment/recruitments_five_flow.hpl b/mappings/info_recruits/citizen_tables/punishment/recruitments_five_flow.hpl new file mode 100644 index 0000000..33ee4da --- /dev/null +++ b/mappings/info_recruits/citizen_tables/punishment/recruitments_five_flow.hpl @@ -0,0 +1,356 @@ + + + + recruitments_five_flow + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/04/18 09:48:01.970 + - + 2025/04/18 09:48:01.970 + + + + + + Get all recruitments ordered by created_date + punishment_flow.hpl + Y + + + Get all recruitments ordered by created_date + punishment_flow.hpl 2 + Y + + + Get all recruitments ordered by created_date + punishment_flow.hpl 3 + Y + + + Get all recruitments ordered by created_date + punishment_flow.hpl 4 + Y + + + Get all recruitments ordered by created_date + punishment_flow.hpl 5 + Y + + + + Get all recruitments ordered by created_date + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + + SELECT +idm_id AS recruitment +FROM ervu_dashboard.recruitment; + N + + + 432 + 304 + + + + punishment_flow.hpl + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl + N + + 1 + + + + + IDM_ID + recruitment + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 704 + 144 + + + + punishment_flow.hpl 2 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl + N + + 1 + + + + + IDM_ID + recruitment + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 704 + 224 + + + + punishment_flow.hpl 3 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl + N + + 1 + + + + + IDM_ID + recruitment + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 704 + 304 + + + + punishment_flow.hpl 4 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl + N + + 1 + + + + + IDM_ID + recruitment + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 704 + 384 + + + + punishment_flow.hpl 5 + PipelineExecutor + + Y + + 1 + + none + + + local + ${PROJECT_HOME}/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl + N + + 1 + + + + + IDM_ID + recruitment + + + + JOB_NAME + + punishment_job + + Y + + + ExecutionTime + ExecutionResult + ExecutionNrErrors + ExecutionLinesRead + ExecutionLinesWritten + ExecutionLinesInput + ExecutionLinesOutput + ExecutionLinesRejected + ExecutionLinesUpdated + ExecutionLinesDeleted + ExecutionFilesRetrieved + ExecutionExitStatus + ExecutionLogText + ExecutionLogChannelId + + + FileName + + + + 704 + 464 + + + + + + From 026d2325e7d4c99dfb9269f36e378b465010a9cd Mon Sep 17 00:00:00 2001 From: "adel.ka" Date: Mon, 25 Aug 2025 10:11:28 +0300 Subject: [PATCH 2/2] =?UTF-8?q?ERVU-529:=20=D0=9A=D1=80=D0=B0=D1=81=D0=BE?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../citizen_tables/punishment/parallel/punishment_flow.hpl | 2 +- .../punishment/parallel/punishment_flow_delta.hpl | 5 ++--- .../punishment/parallel/punishment_flow_repeat.hpl | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl index 01d3b7b..a1eb3ff 100644 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow.hpl @@ -363,7 +363,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' ) SELECT recruit_id, - punishment_info ->> 'id' AS punishment_external_id, + (punishment_info ->> 'id')::uuid AS punishment_external_id, -- Блок "Сведения о вынесенном приговоре" punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl index 7debf9b..013b7cb 100644 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_delta.hpl @@ -359,13 +359,11 @@ and recruitment_id = '${IDM_ID}'; = recruit_id recruit_id - = punishment_external_id punishment_external_id - ervu_dashboard punishment
@@ -485,6 +483,7 @@ and recruitment_id = '${IDM_ID}'; ervu-dashboard N + WITH punishment_data AS ( SELECT ri.recruit_id, jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info @@ -497,7 +496,7 @@ and recruitment_id = '${IDM_ID}'; WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' ) SELECT recruit_id, - punishment_info ->> 'id' AS punishment_external_id, + (punishment_info ->> 'id')::uuid AS punishment_external_id, -- Блок "Сведения о вынесенном приговоре" punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания diff --git a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl index a84d0b0..f24f92e 100644 --- a/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/punishment/parallel/punishment_flow_repeat.hpl @@ -373,13 +373,11 @@ DO UPDATE SET = recruit_id recruit_id - = punishment_external_id punishment_external_id - ervu_dashboard punishment
@@ -499,6 +497,7 @@ DO UPDATE SET ervu-dashboard N + WITH punishment_data AS ( SELECT ri.recruit_id, jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info @@ -510,7 +509,7 @@ DO UPDATE SET WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' ) SELECT recruit_id, - punishment_info ->> 'id' AS punishment_external_id, + (punishment_info ->> 'id')::uuid AS punishment_external_id, -- Блок "Сведения о вынесенном приговоре" punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания