diff --git a/mappings/info_recruits/citizen_tables/citizen/branching_citizen_delta.hpl b/mappings/info_recruits/citizen_tables/citizen/branching_citizen_delta.hpl new file mode 100644 index 0000000..b9ba0f6 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/branching_citizen_delta.hpl @@ -0,0 +1,222 @@ + + + + branching_citizen_delta + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/06/03 14:40:44.856 + - + 2025/06/03 14:40:44.856 + + + + + + JSON input state_job_citizen.json + Set variables + N + + + Set variables + Write to log + N + + + Table input + Set variables + Y + + + + JSON input state_job_citizen.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_job_citizen.json + + + N + N + + + + pipeline + $.pipeline + String + + + + + -1 + -1 + none + N + + + status + $.status + String + + + + + -1 + -1 + none + N + + + 0 + N + N + + + + + + + + + + + + 864 + 528 + + + + Set variables + SetVariable + + Y + + 1 + + none + + + + + pipeline + PIPE + PARENT_WORKFLOW + + + status + STATUS + PARENT_WORKFLOW + + + Y + + + 1104 + 368 + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT + COALESCE(job_name, 'job_citizen_delta') AS PIPELINE, + COALESCE(status, 'ERROR') AS STATUS, + current_timestamp::timestamp as record_created +FROM ( + select + CASE + WHEN status = 'PROCESSING' THEN 'ERROR' + ELSE status + END AS status, + job_name + from public.etl_checkpoints + where job_name = 'job_citizen_delta' + + UNION ALL + + SELECT NULL, NULL + WHERE NOT EXISTS ( + SELECT 1 + FROM public.etl_checkpoints + WHERE job_name = 'job_citizen_delta' + ) +) t + N + + + 864 + 368 + + + + Write to log + WriteToLog + + Y + + 1 + + none + + + Y + + + pipeline + + + status + + + N + 0 + Basic + ${PIPE} +${STATUS} + + + 1328 + 368 + + + + + + diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_error.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_error.hpl similarity index 91% rename from mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_error.hpl rename to mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_error.hpl index 70a1caa..819e767 100644 --- a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_error.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_error.hpl @@ -1,7 +1,7 @@ - change_status_delta_citizen_error + change_status_delta_citizen_flow1_error Y @@ -44,7 +44,6 @@ = job_name job_name - public etl_checkpoints
@@ -86,17 +85,9 @@ N 0 SELECT - 'delta_citizen' as job_name, + 'delta_citizen_flow1' as job_name, 'ERROR' as status, current_timestamp as record_created - -union all - - SELECT - 'job_citizen' as job_name, - 'ERROR' as status, - current_timestamp as record_created - N diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_success.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_success.hpl similarity index 92% rename from mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_success.hpl rename to mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_success.hpl index eaacddb..3435708 100644 --- a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_success.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_success.hpl @@ -1,7 +1,7 @@ - change_status_delta_citizen_success + change_status_delta_citizen_flow1_success Y @@ -85,17 +85,9 @@ N 0 SELECT - 'delta_citizen' as job_name, + 'delta_citizen_flow1' as job_name, 'SUCCESS' as status, current_timestamp as record_created - -union all - - SELECT - 'job_citizen' as job_name, - 'SUCCESS' as status, - current_timestamp as record_created - N diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_error.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_error.hpl new file mode 100644 index 0000000..ffa25fd --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_error.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow2_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_citizen_flow2' as job_name, + 'ERROR' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_success.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_success.hpl new file mode 100644 index 0000000..03be9d0 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_success.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow2_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_citizen_flow2' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_error.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_error.hpl new file mode 100644 index 0000000..8eaf1b0 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_error.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow3_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_citizen_flow3' as job_name, + 'ERROR' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_success.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_success.hpl new file mode 100644 index 0000000..d8f6392 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_success.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow3_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_citizen_flow3' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_error.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_error.hpl new file mode 100644 index 0000000..374d4ce --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_error.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow4_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_citizen_flow4' as job_name, + 'ERROR' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_success.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_success.hpl new file mode 100644 index 0000000..3078ef9 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_success.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow4_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_citizen_flow4' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_error.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_error.hpl new file mode 100644 index 0000000..9157f91 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_error.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow5_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_citizen_flow5' as job_name, + 'ERROR' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_success.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_success.hpl new file mode 100644 index 0000000..e92df83 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_success.hpl @@ -0,0 +1,102 @@ + + + + change_status_delta_citizen_flow5_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_citizen_flow5' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/checkpoints/checkpoint_job_citizen_delta.hpl b/mappings/info_recruits/citizen_tables/citizen/checkpoints/checkpoint_job_citizen_delta.hpl new file mode 100644 index 0000000..46f35f5 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/checkpoints/checkpoint_job_citizen_delta.hpl @@ -0,0 +1,869 @@ + + + + checkpoint_job_citizen_delta + 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_citizen_flow1.json + Filter rows + N + + + JSON input state_recruits_info_flow2.json + Filter rows + N + + + JSON input state_recruits_info_flow3.json + Filter rows + N + + + JSON input state_recruits_info_flow4.json + Filter rows + N + + + JSON input state_recruits_info_flow5.json + Filter rows + N + + + Dummy (do nothing) + JSON input state_recruits_info_flow3.json + N + + + Dummy (do nothing) + JSON input state_recruits_info_flow2.json + N + + + Dummy (do nothing) + JSON input state_citizen_flow1.json + N + + + Dummy (do nothing) + JSON input state_recruits_info_flow4.json + N + + + Dummy (do nothing) + JSON input state_recruits_info_flow5.json + N + + + Table input + Insert / update + Y + + + + Abort + Abort + + Y + + 1 + + none + + + ABORT_WITH_ERROR + Y + 0 + + + 1264 + 592 + + + + Dummy (do nothing) + Dummy + + Y + + 1 + + none + + + + + 384 + 592 + + + + Filter rows + FilterRows + + Y + + 1 + + none + + + + + + + + + + + = + pipeline + N + - + + N + -1 + constant + -1 + citizen_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 + citizen_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 + citizen_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 + citizen_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 + citizen_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 + + + 1072 + 240 + +
+ + JSON input state_citizen_flow1.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_citizen_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_recruits_info_flow2.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_citizen_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_recruits_info_flow3.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_citizen_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_recruits_info_flow4.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_citizen_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_recruits_info_flow5.json + JsonInput + + Y + + 1 + + none + + + N + + N + N + N + N + N + Y + Y + Y + + + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/state_citizen_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 ( + 'delta_citizen_flow1', + 'delta_citizen_flow2', + 'delta_citizen_flow3', + 'delta_citizen_flow4', + 'delta_citizen_flow5' + )) AS has_error, + count(*) FILTER ( + WHERE status = 'SUCCESS' AND job_name IN ( + 'delta_citizen_flow1', + 'delta_citizen_flow2', + 'delta_citizen_flow3', + 'delta_citizen_flow4', + 'delta_citizen_flow5' + ) + ) = 5 AS all_success + FROM public.etl_checkpoints +) +SELECT + 'job_citizen_delta' 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 + + + 704 + 240 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf b/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf index c361a43..89220fe 100644 --- a/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf +++ b/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf @@ -323,8 +323,8 @@ variable STATUS N - 2736 - 2656 + 2464 + 2464 @@ -372,7 +372,7 @@ - delta_citizen.hpl + delta_citizen_flow1.hpl PIPELINE @@ -381,44 +381,28 @@ N N N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/delta_citizen.hpl + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow1.hpl Basic M_R_UP_DATE ${M_R_UP_DATE} + + ID_F1 + IDM_FLOW1 + Y - N + Y local N N Y N - 3664 - 2656 - - - - Success delta_citizen - - SUCCESS - - N - 4144 - 2656 - - - - error delta_citizen - - SUCCESS - - N - 4144 - 2736 + 3424 + 2640 @@ -440,7 +424,7 @@ N N 3184 - 1952 + 1968 @@ -509,8 +493,8 @@ N Y N - 2512 - 1344 + 3152 + 1536 @@ -1220,7 +1204,7 @@ - change_status_delta_citizen_success.hpl + change_status_delta_citizen_flow1_success.hpl PIPELINE @@ -1230,7 +1214,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_success.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_success.hpl Basic Y @@ -1241,12 +1225,12 @@ N Y N - 3920 - 2656 + 3680 + 2640 - change_status_delta_citizen_error.hpl + change_status_delta_citizen_flow1_error.hpl PIPELINE @@ -1256,7 +1240,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_error.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow1_error.hpl Basic Y @@ -1267,8 +1251,8 @@ N Y N - 3920 - 2736 + 3680 + 2720 @@ -1293,8 +1277,8 @@ N Y N - 2896 - 2144 + 3232 + 2368 @@ -1319,8 +1303,485 @@ N Y N - 3088 - 2656 + 3168 + 3136 + + + + recruitment_rows_five_flow_citizen.hpl 2 + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/supportive_jobs/recruitment_rows_five_flow_citizen.hpl + Basic + + + CR_DATE + CREATE_DATE + + Y + + N + local + N + N + Y + Y + 3168 + 2960 + + + + delta_citizen_flow2.hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow2.hpl + Basic + + + M_R_UP_DATE + ${M_R_UP_DATE} + + + ID_F2 + IDM_FLOW2 + + Y + + Y + local + N + N + Y + N + 3424 + 2800 + + + + change_status_delta_citizen_flow2_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 2800 + + + + change_status_delta_citizen_flow2_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow2_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 2880 + + + + delta_citizen_flow3.hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow3.hpl + Basic + + + M_R_UP_DATE + ${M_R_UP_DATE} + + + ID_F3 + IDM_FLOW3 + + Y + + Y + local + N + N + Y + N + 3424 + 2960 + + + + change_status_delta_citizen_flow3_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 2960 + + + + change_status_delta_citizen_flow3_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow3_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 3040 + + + + delta_citizen_flow4.hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow4.hpl + Basic + + + M_R_UP_DATE + ${M_R_UP_DATE} + + + ID_F4 + IDM_FLOW4 + + Y + + Y + local + N + N + Y + N + 3424 + 3120 + + + + change_status_delta_citizen_flow4_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 3120 + + + + change_status_delta_citizen_flow4_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow4_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 3200 + + + + delta_citizen_flow5.hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow5.hpl + Basic + + + M_R_UP_DATE + ${M_R_UP_DATE} + + + ID_F5 + IDM_FLOW5 + + Y + + Y + local + N + N + Y + N + 3424 + 3280 + + + + change_status_delta_citizen_flow5_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 3280 + + + + change_status_delta_citizen_flow5_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/change_status_delta_citizen_flow5_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 3680 + 3360 + + + + checkpoint_job_citizen_delta.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/checkpoints/checkpoint_job_citizen_delta.hpl + Basic + + Y + + N + local + N + N + Y + N + 4032 + 2960 + + + + citizen_delta success + + SUCCESS + + N + 4256 + 2960 + + + + Abort workflow 2 2 + + ABORT + + N + N + 3200 + 2752 + + + + Simple delta_citizen WHERE ERROR + + SIMPLE_EVAL + + ERROR + string + true + equal + equal + N + variable + STATUS + N + 2880 + 2960 + + + + delta_citizen success + + SUCCESS + + N + 2976 + 2800 + + + + branching_citizen_delta.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/branching_citizen_delta.hpl + + + Basic + + Y + + N + local + N + N + Y + N + 2592 + 2960 @@ -1409,20 +1870,6 @@ N N - - Simple job_citizen_exists check NEW - change_status_to_processing.hpl - Y - Y - N - - - change_status_to_processing.hpl - recruitment_rows_five_flow_citizen.hpl - Y - Y - N - citizen_flow1.hpl change_status_citizen_flow1_success.hpl @@ -1760,57 +2207,253 @@ Y - delta_citizen.hpl - change_status_delta_citizen_success.hpl + delta_citizen_flow1.hpl + change_status_delta_citizen_flow1_success.hpl Y Y N - change_status_delta_citizen_success.hpl - Success delta_citizen - Y - Y - N - - - delta_citizen.hpl - change_status_delta_citizen_error.hpl + delta_citizen_flow1.hpl + change_status_delta_citizen_flow1_error.hpl Y N N - change_status_delta_citizen_error.hpl - error delta_citizen + recruitment_rows_five_flow_citizen.hpl + change_status_to_processing.hpl Y Y N - Simple recruits_info WHERE ERROR + Simple job_citizen_exists check NEW + recruitment_rows_five_flow_citizen.hpl + Y + Y + N + + + recruitment_rows_five_flow_if_error.hpl change_status_to_processing.hpl 2 Y Y N - change_status_to_processing.hpl 2 + Simple recruits_info WHERE ERROR recruitment_rows_five_flow_if_error.hpl Y Y - Y - - - Simple recruits_info WHERE SUCCESS - change_status_to_processing_delta.hpl - Y - Y N - change_status_to_processing_delta.hpl - delta_citizen.hpl + recruitment_rows_five_flow_citizen.hpl 2 + delta_citizen_flow1.hpl + Y + Y + N + + + delta_citizen_flow2.hpl + change_status_delta_citizen_flow2_success.hpl + Y + Y + N + + + delta_citizen_flow2.hpl + change_status_delta_citizen_flow2_error.hpl + Y + N + N + + + delta_citizen_flow3.hpl + change_status_delta_citizen_flow3_success.hpl + Y + Y + N + + + delta_citizen_flow3.hpl + change_status_delta_citizen_flow3_error.hpl + Y + N + N + + + delta_citizen_flow4.hpl + change_status_delta_citizen_flow4_success.hpl + Y + Y + N + + + delta_citizen_flow4.hpl + change_status_delta_citizen_flow4_error.hpl + Y + N + N + + + delta_citizen_flow5.hpl + change_status_delta_citizen_flow5_success.hpl + Y + Y + N + + + delta_citizen_flow5.hpl + change_status_delta_citizen_flow5_error.hpl + Y + N + N + + + recruitment_rows_five_flow_citizen.hpl 2 + delta_citizen_flow3.hpl + Y + Y + N + + + recruitment_rows_five_flow_citizen.hpl 2 + delta_citizen_flow2.hpl + Y + Y + N + + + recruitment_rows_five_flow_citizen.hpl 2 + delta_citizen_flow4.hpl + Y + Y + N + + + recruitment_rows_five_flow_citizen.hpl 2 + delta_citizen_flow5.hpl + Y + Y + N + + + change_status_delta_citizen_flow3_success.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow2_error.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow2_success.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow1_error.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow1_success.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow3_error.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow4_success.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow4_error.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow5_success.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + change_status_delta_citizen_flow5_error.hpl + checkpoint_job_citizen_delta.hpl + Y + N + Y + + + checkpoint_job_citizen_delta.hpl + citizen_delta success + Y + Y + N + + + recruitment_rows_five_flow_citizen.hpl 2 + Abort workflow 2 2 + Y + N + N + + + Simple delta_citizen WHERE ERROR + recruitment_rows_five_flow_citizen.hpl 2 + Y + Y + N + + + Simple delta_citizen WHERE ERROR + delta_citizen success + Y + N + N + + + Simple recruits_info WHERE SUCCESS + branching_citizen_delta.hpl + Y + Y + N + + + branching_citizen_delta.hpl + Simple delta_citizen WHERE ERROR + Y + Y + N + + + recruitment_rows_five_flow_citizen.hpl 2 + change_status_to_processing_delta.hpl Y Y N diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow1.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow1.hpl new file mode 100644 index 0000000..cf2529f --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow1.hpl @@ -0,0 +1,319 @@ + + + + delta_citizen_flow1 + 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 + citizen
+ + recruit_id + recruit_id + N + + + system_pgs_status + system_pgs_status + Y + + + full_name + full_name + Y + + + last_name + last_name + Y + + + first_name + first_name + Y + + + middle_name + middle_name + Y + + + gender + gender + Y + + + birth_date + birth_date + Y + + + age + age + Y + + + birth_place + birth_place + Y + + + phone + phone + Y + + + email + email + Y + + + date_registration + date_registration + Y + + + date_deregistration + date_deregistration + Y + + + recruit_create_date + recruit_create_date + Y + + + update_date + update_date + Y + + + vu_current_info + vu_current_info + Y + + + recruitment_id + recruitment_id + Y + + + target_recruitment_id + target_recruitment_id + Y + + + deferment_liberation + deferment_liberation + Y + + + reason_registration + reason_registration + Y + + + residence + residence + Y + + + start_date_residence + start_date_residence + Y + + + end_date_residence + end_date_residence + Y + + + address_place_stay + address_place_stay + Y + + + start_date_place_stay + start_date_place_stay + Y + + + end_date_place_stay + end_date_place_stay + Y + + + type_place_stay + type_place_stay + Y + + + id_ern + id_ern + Y + +
+ N + + + 1104 + 352 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu_person_registry + N + 0 + with +adresses as ( -- по одному ли адресу тут должно быть?? +SELECT + r.id as recruit_id, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg +FROM + public.recruits AS r +LEFT JOIN + LATERAL jsonb_array_elements(r.addresses) AS addr ON true +WHERE '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp + AND '${ID_F1}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F1}' +GROUP BY + r.id +) +SELECT + r.system_pgs_status, + r.full_name, + r.last_name, + r.first_name, + r.middle_name, + r.gender, + --ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils, + --ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn, + r.birth_date, + EXTRACT(YEAR FROM AGE(r.birth_date)) AS age, + r.birth_place, + r.phone, + r.email, + r.id AS recruit_id, --ri.recruit_id, + --ri.info, + --r.vu_current_info, + r.military_registration_date AS date_registration, + r.vu_unset_date AS date_deregistration, + --ri.info->'svedFL'->'svedSemPolozh'->>'semPolozhNaim' AS marital_status, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series, + --ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date, + r.system_create_date AS recruit_create_date, + r.system_update_date AS update_date, + CASE + WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT' + ELSE 'NOTCONVICT' + END AS convicts, + r.current_recruitment_id AS recruitment_id, + r.target_recruitment_id, + CASE + WHEN ddd.hidden IS false then ddd.hidden + ELSE true + END AS deferment_liberation,-- когда hidden ис фолс отсрочка есть, когда тру или нулл - нет + mrr.value AS reason_registration + adr.actualAddress as residence, -- адрес места жительства + adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства + adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства + adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания + adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания + adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания + case + when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица' + when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы' + else null + end as type_place_stay, -- тип регистрации + -- address_actual -- Адрес фактического проживания ***1 + -- source_info_actual -- Источник сведений о месте фактического проживания ***1 + -- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1 + -- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1 + system_id_ern AS id_ern -- id единого регистра населения +FROM public.recruits AS r +JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${ID_F1}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F1}' + AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp +LEFT JOIN ( + SELECT + ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn, + recruit_id, + hidden + FROM public.decision_deferment_dto + ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false +JOIN public.military_registration_reason AS mrr ON r.registration_reasons::jsonb @> to_jsonb(mrr.code::text) +--JOIN public.recruits_history rh on rh.recruit_id=r.id +--WHERE r.system_update_date >= '${UP_D}' +join adresses adr ON r.recruit_id=adr.recruit_id + +-- ***1 - страница личные сведения есть поле, нет данных + Y + + + 624 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow2.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow2.hpl new file mode 100644 index 0000000..9ce6d7a --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow2.hpl @@ -0,0 +1,319 @@ + + + + delta_citizen_flow2 + 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 + citizen
+ + recruit_id + recruit_id + N + + + system_pgs_status + system_pgs_status + Y + + + full_name + full_name + Y + + + last_name + last_name + Y + + + first_name + first_name + Y + + + middle_name + middle_name + Y + + + gender + gender + Y + + + birth_date + birth_date + Y + + + age + age + Y + + + birth_place + birth_place + Y + + + phone + phone + Y + + + email + email + Y + + + date_registration + date_registration + Y + + + date_deregistration + date_deregistration + Y + + + recruit_create_date + recruit_create_date + Y + + + update_date + update_date + Y + + + vu_current_info + vu_current_info + Y + + + recruitment_id + recruitment_id + Y + + + target_recruitment_id + target_recruitment_id + Y + + + deferment_liberation + deferment_liberation + Y + + + reason_registration + reason_registration + Y + + + residence + residence + Y + + + start_date_residence + start_date_residence + Y + + + end_date_residence + end_date_residence + Y + + + address_place_stay + address_place_stay + Y + + + start_date_place_stay + start_date_place_stay + Y + + + end_date_place_stay + end_date_place_stay + Y + + + type_place_stay + type_place_stay + Y + + + id_ern + id_ern + Y + +
+ N + + + 1104 + 352 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu_person_registry + N + 0 + with +adresses as ( -- по одному ли адресу тут должно быть?? +SELECT + r.id as recruit_id, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg +FROM + public.recruits AS r +LEFT JOIN + LATERAL jsonb_array_elements(r.addresses) AS addr ON true +WHERE '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp + AND '${ID_F2}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F2}' +GROUP BY + r.id +) +SELECT + r.system_pgs_status, + r.full_name, + r.last_name, + r.first_name, + r.middle_name, + r.gender, + --ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils, + --ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn, + r.birth_date, + EXTRACT(YEAR FROM AGE(r.birth_date)) AS age, + r.birth_place, + r.phone, + r.email, + r.id AS recruit_id, --ri.recruit_id, + --ri.info, + --r.vu_current_info, + r.military_registration_date AS date_registration, + r.vu_unset_date AS date_deregistration, + --ri.info->'svedFL'->'svedSemPolozh'->>'semPolozhNaim' AS marital_status, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series, + --ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date, + r.system_create_date AS recruit_create_date, + r.system_update_date AS update_date, + CASE + WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT' + ELSE 'NOTCONVICT' + END AS convicts, + r.current_recruitment_id AS recruitment_id, + r.target_recruitment_id, + CASE + WHEN ddd.hidden IS false then ddd.hidden + ELSE true + END AS deferment_liberation,-- когда hidden ис фолс отсрочка есть, когда тру или нулл - нет + mrr.value AS reason_registration + adr.actualAddress as residence, -- адрес места жительства + adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства + adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства + adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания + adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания + adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания + case + when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица' + when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы' + else null + end as type_place_stay, -- тип регистрации + -- address_actual -- Адрес фактического проживания ***1 + -- source_info_actual -- Источник сведений о месте фактического проживания ***1 + -- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1 + -- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1 + system_id_ern AS id_ern -- id единого регистра населения +FROM public.recruits AS r +JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${ID_F2}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F2}' + AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp +LEFT JOIN ( + SELECT + ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn, + recruit_id, + hidden + FROM public.decision_deferment_dto + ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false +JOIN public.military_registration_reason AS mrr ON r.registration_reasons::jsonb @> to_jsonb(mrr.code::text) +--JOIN public.recruits_history rh on rh.recruit_id=r.id +--WHERE r.system_update_date >= '${UP_D}' +join adresses adr ON r.recruit_id=adr.recruit_id + +-- ***1 - страница личные сведения есть поле, нет данных + Y + + + 624 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow3.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow3.hpl new file mode 100644 index 0000000..4759817 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow3.hpl @@ -0,0 +1,319 @@ + + + + delta_citizen_flow3 + 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 + citizen
+ + recruit_id + recruit_id + N + + + system_pgs_status + system_pgs_status + Y + + + full_name + full_name + Y + + + last_name + last_name + Y + + + first_name + first_name + Y + + + middle_name + middle_name + Y + + + gender + gender + Y + + + birth_date + birth_date + Y + + + age + age + Y + + + birth_place + birth_place + Y + + + phone + phone + Y + + + email + email + Y + + + date_registration + date_registration + Y + + + date_deregistration + date_deregistration + Y + + + recruit_create_date + recruit_create_date + Y + + + update_date + update_date + Y + + + vu_current_info + vu_current_info + Y + + + recruitment_id + recruitment_id + Y + + + target_recruitment_id + target_recruitment_id + Y + + + deferment_liberation + deferment_liberation + Y + + + reason_registration + reason_registration + Y + + + residence + residence + Y + + + start_date_residence + start_date_residence + Y + + + end_date_residence + end_date_residence + Y + + + address_place_stay + address_place_stay + Y + + + start_date_place_stay + start_date_place_stay + Y + + + end_date_place_stay + end_date_place_stay + Y + + + type_place_stay + type_place_stay + Y + + + id_ern + id_ern + Y + +
+ N + + + 1104 + 352 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu_person_registry + N + 0 + with +adresses as ( -- по одному ли адресу тут должно быть?? +SELECT + r.id as recruit_id, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg +FROM + public.recruits AS r +LEFT JOIN + LATERAL jsonb_array_elements(r.addresses) AS addr ON true +WHERE '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp + AND '${ID_F3}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F3}' +GROUP BY + r.id +) +SELECT + r.system_pgs_status, + r.full_name, + r.last_name, + r.first_name, + r.middle_name, + r.gender, + --ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils, + --ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn, + r.birth_date, + EXTRACT(YEAR FROM AGE(r.birth_date)) AS age, + r.birth_place, + r.phone, + r.email, + r.id AS recruit_id, --ri.recruit_id, + --ri.info, + --r.vu_current_info, + r.military_registration_date AS date_registration, + r.vu_unset_date AS date_deregistration, + --ri.info->'svedFL'->'svedSemPolozh'->>'semPolozhNaim' AS marital_status, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series, + --ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date, + r.system_create_date AS recruit_create_date, + r.system_update_date AS update_date, + CASE + WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT' + ELSE 'NOTCONVICT' + END AS convicts, + r.current_recruitment_id AS recruitment_id, + r.target_recruitment_id, + CASE + WHEN ddd.hidden IS false then ddd.hidden + ELSE true + END AS deferment_liberation,-- когда hidden ис фолс отсрочка есть, когда тру или нулл - нет + mrr.value AS reason_registration + adr.actualAddress as residence, -- адрес места жительства + adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства + adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства + adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания + adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания + adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания + case + when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица' + when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы' + else null + end as type_place_stay, -- тип регистрации + -- address_actual -- Адрес фактического проживания ***1 + -- source_info_actual -- Источник сведений о месте фактического проживания ***1 + -- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1 + -- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1 + system_id_ern AS id_ern -- id единого регистра населения +FROM public.recruits AS r +JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${ID_F3}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F3}' + AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp +LEFT JOIN ( + SELECT + ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn, + recruit_id, + hidden + FROM public.decision_deferment_dto + ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false +JOIN public.military_registration_reason AS mrr ON r.registration_reasons::jsonb @> to_jsonb(mrr.code::text) +--JOIN public.recruits_history rh on rh.recruit_id=r.id +--WHERE r.system_update_date >= '${UP_D}' +join adresses adr ON r.recruit_id=adr.recruit_id + +-- ***1 - страница личные сведения есть поле, нет данных + Y + + + 624 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow4.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow4.hpl new file mode 100644 index 0000000..d209638 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow4.hpl @@ -0,0 +1,319 @@ + + + + delta_citizen_flow4 + 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 + citizen
+ + recruit_id + recruit_id + N + + + system_pgs_status + system_pgs_status + Y + + + full_name + full_name + Y + + + last_name + last_name + Y + + + first_name + first_name + Y + + + middle_name + middle_name + Y + + + gender + gender + Y + + + birth_date + birth_date + Y + + + age + age + Y + + + birth_place + birth_place + Y + + + phone + phone + Y + + + email + email + Y + + + date_registration + date_registration + Y + + + date_deregistration + date_deregistration + Y + + + recruit_create_date + recruit_create_date + Y + + + update_date + update_date + Y + + + vu_current_info + vu_current_info + Y + + + recruitment_id + recruitment_id + Y + + + target_recruitment_id + target_recruitment_id + Y + + + deferment_liberation + deferment_liberation + Y + + + reason_registration + reason_registration + Y + + + residence + residence + Y + + + start_date_residence + start_date_residence + Y + + + end_date_residence + end_date_residence + Y + + + address_place_stay + address_place_stay + Y + + + start_date_place_stay + start_date_place_stay + Y + + + end_date_place_stay + end_date_place_stay + Y + + + type_place_stay + type_place_stay + Y + + + id_ern + id_ern + Y + +
+ N + + + 1104 + 352 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu_person_registry + N + 0 + with +adresses as ( -- по одному ли адресу тут должно быть?? +SELECT + r.id as recruit_id, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg +FROM + public.recruits AS r +LEFT JOIN + LATERAL jsonb_array_elements(r.addresses) AS addr ON true +WHERE '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp + AND '${ID_F4}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F4}' +GROUP BY + r.id +) +SELECT + r.system_pgs_status, + r.full_name, + r.last_name, + r.first_name, + r.middle_name, + r.gender, + --ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils, + --ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn, + r.birth_date, + EXTRACT(YEAR FROM AGE(r.birth_date)) AS age, + r.birth_place, + r.phone, + r.email, + r.id AS recruit_id, --ri.recruit_id, + --ri.info, + --r.vu_current_info, + r.military_registration_date AS date_registration, + r.vu_unset_date AS date_deregistration, + --ri.info->'svedFL'->'svedSemPolozh'->>'semPolozhNaim' AS marital_status, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series, + --ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date, + r.system_create_date AS recruit_create_date, + r.system_update_date AS update_date, + CASE + WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT' + ELSE 'NOTCONVICT' + END AS convicts, + r.current_recruitment_id AS recruitment_id, + r.target_recruitment_id, + CASE + WHEN ddd.hidden IS false then ddd.hidden + ELSE true + END AS deferment_liberation,-- когда hidden ис фолс отсрочка есть, когда тру или нулл - нет + mrr.value AS reason_registration + adr.actualAddress as residence, -- адрес места жительства + adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства + adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства + adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания + adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания + adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания + case + when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица' + when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы' + else null + end as type_place_stay, -- тип регистрации + -- address_actual -- Адрес фактического проживания ***1 + -- source_info_actual -- Источник сведений о месте фактического проживания ***1 + -- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1 + -- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1 + system_id_ern AS id_ern -- id единого регистра населения +FROM public.recruits AS r +JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${ID_F4}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F4}' + AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp +LEFT JOIN ( + SELECT + ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn, + recruit_id, + hidden + FROM public.decision_deferment_dto + ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false +JOIN public.military_registration_reason AS mrr ON r.registration_reasons::jsonb @> to_jsonb(mrr.code::text) +--JOIN public.recruits_history rh on rh.recruit_id=r.id +--WHERE r.system_update_date >= '${UP_D}' +join adresses adr ON r.recruit_id=adr.recruit_id + +-- ***1 - страница личные сведения есть поле, нет данных + Y + + + 624 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow5.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow5.hpl new file mode 100644 index 0000000..d3c3287 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/delta_citizen_flow5.hpl @@ -0,0 +1,319 @@ + + + + delta_citizen_flow5 + 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 + citizen
+ + recruit_id + recruit_id + N + + + system_pgs_status + system_pgs_status + Y + + + full_name + full_name + Y + + + last_name + last_name + Y + + + first_name + first_name + Y + + + middle_name + middle_name + Y + + + gender + gender + Y + + + birth_date + birth_date + Y + + + age + age + Y + + + birth_place + birth_place + Y + + + phone + phone + Y + + + email + email + Y + + + date_registration + date_registration + Y + + + date_deregistration + date_deregistration + Y + + + recruit_create_date + recruit_create_date + Y + + + update_date + update_date + Y + + + vu_current_info + vu_current_info + Y + + + recruitment_id + recruitment_id + Y + + + target_recruitment_id + target_recruitment_id + Y + + + deferment_liberation + deferment_liberation + Y + + + reason_registration + reason_registration + Y + + + residence + residence + Y + + + start_date_residence + start_date_residence + Y + + + end_date_residence + end_date_residence + Y + + + address_place_stay + address_place_stay + Y + + + start_date_place_stay + start_date_place_stay + Y + + + end_date_place_stay + end_date_place_stay + Y + + + type_place_stay + type_place_stay + Y + + + id_ern + id_ern + Y + +
+ N + + + 1104 + 352 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu_person_registry + N + 0 + with +adresses as ( -- по одному ли адресу тут должно быть?? +SELECT + r.id as recruit_id, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd, + MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg +FROM + public.recruits AS r +LEFT JOIN + LATERAL jsonb_array_elements(r.addresses) AS addr ON true +WHERE '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp + AND '${ID_F5}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F5}' +GROUP BY + r.id +) +SELECT + r.system_pgs_status, + r.full_name, + r.last_name, + r.first_name, + r.middle_name, + r.gender, + --ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils, + --ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn, + r.birth_date, + EXTRACT(YEAR FROM AGE(r.birth_date)) AS age, + r.birth_place, + r.phone, + r.email, + r.id AS recruit_id, --ri.recruit_id, + --ri.info, + --r.vu_current_info, + r.military_registration_date AS date_registration, + r.vu_unset_date AS date_deregistration, + --ri.info->'svedFL'->'svedSemPolozh'->>'semPolozhNaim' AS marital_status, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number, + --ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series, + --ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date, + r.system_create_date AS recruit_create_date, + r.system_update_date AS update_date, + CASE + WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT' + ELSE 'NOTCONVICT' + END AS convicts, + r.current_recruitment_id AS recruitment_id, + r.target_recruitment_id, + CASE + WHEN ddd.hidden IS false then ddd.hidden + ELSE true + END AS deferment_liberation,-- когда hidden ис фолс отсрочка есть, когда тру или нулл - нет + mrr.value AS reason_registration + adr.actualAddress as residence, -- адрес места жительства + adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства + adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства + adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания + adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания + adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания + case + when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица' + when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы' + else null + end as type_place_stay, -- тип регистрации + -- address_actual -- Адрес фактического проживания ***1 + -- source_info_actual -- Источник сведений о месте фактического проживания ***1 + -- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1 + -- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1 + system_id_ern AS id_ern -- id единого регистра населения +FROM public.recruits AS r +JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${ID_F5}' != '' -- Проверка на пустую строку + AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F5}' + AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date + AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp +LEFT JOIN ( + SELECT + ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn, + recruit_id, + hidden + FROM public.decision_deferment_dto + ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false +JOIN public.military_registration_reason AS mrr ON r.registration_reasons::jsonb @> to_jsonb(mrr.code::text) +--JOIN public.recruits_history rh on rh.recruit_id=r.id +--WHERE r.system_update_date >= '${UP_D}' +join adresses adr ON r.recruit_id=adr.recruit_id + +-- ***1 - страница личные сведения есть поле, нет данных + Y + + + 624 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen/recruitment_rows_five_flow_if_error.hpl b/mappings/info_recruits/citizen_tables/citizen/recruitment_rows_five_flow_if_error.hpl index 6fbdf56..7b54fee 100644 --- a/mappings/info_recruits/citizen_tables/citizen/recruitment_rows_five_flow_if_error.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/recruitment_rows_five_flow_if_error.hpl @@ -57,7 +57,17 @@ ervu-dashboard N 0 - WITH ordered AS ( + WITH +fr_check AS ( + SELECT + last_recruitment_id AS recruitment_id, + recruitment_created_date, + status, + job_name + FROM public.etl_checkpoints + WHERE status = 'ERROR' AND job_name IN ('citizen_flow1', 'citizen_flow2', 'citizen_flow3', 'citizen_flow4', 'citizen_flow5') +), +ordered AS ( SELECT idm_id, created_at, @@ -68,130 +78,46 @@ splitted AS ( SELECT *, CEIL(total_rows / 5.0) AS part_size, - FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num + FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num, + ((rn - 1) % CEIL(total_rows / 5.0)) + 1 AS position FROM ordered ), -flow_ranges AS ( - SELECT - flow_num, - MIN(created_at) AS min_date, - MAX(created_at) AS max_date +pivoted AS ( + SELECT + position, + MAX(CASE WHEN flow_num = 1 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow1') THEN created_at END) AS cr_flow1, + MAX(CASE WHEN flow_num = 1 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow1') THEN idm_id::text END) AS idm_flow1, + MAX(CASE WHEN flow_num = 2 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow2') THEN created_at END) AS cr_flow2, + MAX(CASE WHEN flow_num = 2 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow2') THEN idm_id::text END) AS idm_flow2, + MAX(CASE WHEN flow_num = 3 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow3') THEN created_at END) AS cr_flow3, + MAX(CASE WHEN flow_num = 3 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow3') THEN idm_id::text END) AS idm_flow3, + MAX(CASE WHEN flow_num = 4 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow4') THEN created_at END) AS cr_flow4, + MAX(CASE WHEN flow_num = 4 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow4') THEN idm_id::text END) AS idm_flow4, + MAX(CASE WHEN flow_num = 5 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow5') THEN created_at END) AS cr_flow5, + MAX(CASE WHEN flow_num = 5 AND created_at >= (SELECT recruitment_created_date FROM fr_check WHERE job_name = 'citizen_flow5') THEN idm_id::text END) AS idm_flow5 FROM splitted - GROUP BY flow_num -), -recr_inf AS ( - SELECT DISTINCT COALESCE(recruitment_id, target_recruitment_id) AS idm_id - FROM ervu_dashboard.citizen -), -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 + GROUP BY position ), 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 + SELECT + position, + cr_flow1, + idm_flow1::uuid, + cr_flow2, + idm_flow2::uuid, + cr_flow3, + idm_flow3::uuid, + cr_flow4, + idm_flow4::uuid, + cr_flow5, + idm_flow5::uuid + FROM pivoted + WHERE (cr_flow1 IS NOT NULL AND idm_flow1 IS NOT NULL) + OR (cr_flow2 IS NOT NULL AND idm_flow2 IS NOT NULL) + OR (cr_flow3 IS NOT NULL AND idm_flow3 IS NOT NULL) + OR (cr_flow4 IS NOT NULL AND idm_flow4 IS NOT NULL) + OR (cr_flow5 IS NOT NULL AND idm_flow5 IS NOT NULL) + order by position ), idm1 as ( select diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_error.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_error.hpl index 4e89c60..b0b2801 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_error.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_error.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow2' as job_name, 'ERROR' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_success.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_success.hpl index afca95d..eec52d6 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_success.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_success.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow2' as job_name, 'SUCCESS' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_error.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_error.hpl index 716cbe0..e2befc8 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_error.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_error.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow3' as job_name, 'ERROR' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_success.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_success.hpl index 62ce1a9..f1f1510 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_success.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_success.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow3' as job_name, 'SUCCESS' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_error.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_error.hpl index b00be52..4241b74 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_error.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_error.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow4' as job_name, 'ERROR' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_success.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_success.hpl index ef2204c..a174f35 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_success.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_success.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow4' as job_name, 'SUCCESS' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_error.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_error.hpl index a08ee41..8d4e2a8 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_error.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_error.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow5' as job_name, 'ERROR' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_success.hpl b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_success.hpl index e14b05b..a34c584 100644 --- a/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_success.hpl +++ b/mappings/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_success.hpl @@ -85,7 +85,7 @@ N 0 SELECT - 'delta_recruits_info_flow1' as job_name, + 'delta_recruits_info_flow5' as job_name, 'SUCCESS' as status, current_timestamp as record_created diff --git a/mappings/info_recruits/raw_data/info_recruits/job_recruits_info.hwf b/mappings/info_recruits/raw_data/info_recruits/job_recruits_info.hwf index 0db3ef4..2fc61be 100644 --- a/mappings/info_recruits/raw_data/info_recruits/job_recruits_info.hwf +++ b/mappings/info_recruits/raw_data/info_recruits/job_recruits_info.hwf @@ -1317,7 +1317,7 @@ - Success new citizen 2 + recruits_info success after error SUCCESS @@ -1506,7 +1506,7 @@ - change_status_delta_recruits_info_flow1_success.hpl 2 + change_status_delta_recruits_info_flow2_success.hpl PIPELINE @@ -1516,7 +1516,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_success.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_success.hpl Basic Y @@ -1532,7 +1532,7 @@ - change_status_delta_recruits_info_flow1_error.hpl 2 + change_status_delta_recruits_info_flow2_error.hpl PIPELINE @@ -1542,7 +1542,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_error.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow2_error.hpl Basic Y @@ -1592,7 +1592,7 @@ - change_status_delta_recruits_info_flow1_success.hpl 3 + change_status_delta_recruits_info_flow3_success.hpl PIPELINE @@ -1602,7 +1602,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_success.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_success.hpl Basic Y @@ -1618,7 +1618,7 @@ - change_status_delta_recruits_info_flow1_error.hpl 3 + change_status_delta_recruits_info_flow3_error.hpl PIPELINE @@ -1628,7 +1628,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_error.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow3_error.hpl Basic Y @@ -1678,7 +1678,7 @@ - change_status_delta_recruits_info_flow1_success.hpl 4 + change_status_delta_recruits_info_flow4_success.hpl PIPELINE @@ -1688,7 +1688,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_success.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_success.hpl Basic Y @@ -1704,7 +1704,7 @@ - change_status_delta_recruits_info_flow1_error.hpl 4 + change_status_delta_recruits_info_flow4_error.hpl PIPELINE @@ -1714,7 +1714,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_error.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow4_error.hpl Basic Y @@ -1764,7 +1764,7 @@ - change_status_delta_recruits_info_flow1_success.hpl 5 + change_status_delta_recruits_info_flow5_success.hpl PIPELINE @@ -1774,7 +1774,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_success.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_success.hpl Basic Y @@ -1790,7 +1790,7 @@ - change_status_delta_recruits_info_flow1_error.hpl 5 + change_status_delta_recruits_info_flow5_error.hpl PIPELINE @@ -1800,7 +1800,7 @@ N N N - ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow1_error.hpl + ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/checkpoints/change_status_delta_recruits_info_flow5_error.hpl Basic Y @@ -1842,7 +1842,7 @@ - Success + recruits_info_delta success SUCCESS @@ -1863,8 +1863,6 @@ N N ${PROJECT_HOME}/info_recruits/raw_data/info_recruits/branching_recruits_info_delta.hpl - - Basic Y @@ -1885,11 +1883,7 @@ SIMPLE_EVAL ERROR - string - - - true equal equal @@ -1907,7 +1901,7 @@ SUCCESS N - 2016 + 2000 2768 @@ -1986,7 +1980,7 @@ job_checkpoints_recruits_info.hwf recruitment_rows_five_flow_if_error.hpl - Y + N Y N @@ -2335,7 +2329,7 @@
checkpoint_job_recruits_info.hpl (2) 2 - Success new citizen 2 + recruits_info success after error Y Y N @@ -2406,7 +2400,7 @@ Simple recruits_info WHERE ERROR job_checkpoints_recruits_info.hwf - Y + N Y N @@ -2454,56 +2448,56 @@ delta_recruits_info_flow2.hpl - change_status_delta_recruits_info_flow1_success.hpl 2 + change_status_delta_recruits_info_flow2_success.hpl Y Y N delta_recruits_info_flow2.hpl - change_status_delta_recruits_info_flow1_error.hpl 2 + change_status_delta_recruits_info_flow2_error.hpl Y N N delta_recruits_info_flow3.hpl - change_status_delta_recruits_info_flow1_success.hpl 3 + change_status_delta_recruits_info_flow3_success.hpl Y Y N delta_recruits_info_flow3.hpl - change_status_delta_recruits_info_flow1_error.hpl 3 + change_status_delta_recruits_info_flow3_error.hpl Y N N delta_recruits_info_flow4.hpl - change_status_delta_recruits_info_flow1_success.hpl 4 + change_status_delta_recruits_info_flow4_success.hpl Y Y N delta_recruits_info_flow4.hpl - change_status_delta_recruits_info_flow1_error.hpl 4 + change_status_delta_recruits_info_flow4_error.hpl Y N N delta_recruits_info_flow5.hpl - change_status_delta_recruits_info_flow1_success.hpl 5 + change_status_delta_recruits_info_flow5_success.hpl Y Y N delta_recruits_info_flow5.hpl - change_status_delta_recruits_info_flow1_error.hpl 5 + change_status_delta_recruits_info_flow5_error.hpl Y N N @@ -2551,56 +2545,56 @@ Y - change_status_delta_recruits_info_flow1_success.hpl 2 + change_status_delta_recruits_info_flow2_success.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_error.hpl 2 + change_status_delta_recruits_info_flow2_error.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_success.hpl 3 + change_status_delta_recruits_info_flow3_success.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_error.hpl 3 + change_status_delta_recruits_info_flow3_error.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_success.hpl 4 + change_status_delta_recruits_info_flow4_success.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_error.hpl 4 + change_status_delta_recruits_info_flow4_error.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_success.hpl 5 + change_status_delta_recruits_info_flow5_success.hpl checkpoint_job_recruits_info_delta.hpl Y N Y - change_status_delta_recruits_info_flow1_error.hpl 5 + change_status_delta_recruits_info_flow5_error.hpl checkpoint_job_recruits_info_delta.hpl Y N @@ -2608,7 +2602,7 @@ checkpoint_job_recruits_info_delta.hpl - Success + recruits_info_delta success Y Y N @@ -2641,6 +2635,13 @@ N N + + Simple recruits_info WHERE ERROR + recruitment_rows_five_flow_if_error.hpl + Y + Y + N + diff --git a/mappings/pack.pub_recruitment.hpl b/mappings/pack.pub_recruitment.hpl index ceca4e0..79aa9ef 100644 --- a/mappings/pack.pub_recruitment.hpl +++ b/mappings/pack.pub_recruitment.hpl @@ -111,8 +111,8 @@ rt.idm_id, rt.schema, rt.military_code AS code, - rt.updated_at, - ROW_NUMBER() OVER (ORDER BY rt.idm_id) AS rn_recruitment + rt.updated_at--, + --ROW_NUMBER() OVER (ORDER BY rt.idm_id) AS rn_recruitment FROM public.recruitment rt WHERE rt.idm_id ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'