diff --git a/Dockerfile b/Dockerfile index 0508a6b..b3e41e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,4 @@ ARG RUNTIME_IMAGE=repo.micord.ru/tools/etl-base:0.0.1-sha1e61336f FROM $RUNTIME_IMAGE -COPY mappings_new /opt/etl/config/projects/mappings +COPY mappings /opt/etl/config/projects/mappings diff --git a/mappings/info_recruits/citizen_tables/child/checkpoints/change_status_child_flow1_success.hpl b/mappings/info_recruits/citizen_tables/child/checkpoints/change_status_child_flow1_success.hpl index 3343de5..4339f92 100644 --- a/mappings/info_recruits/citizen_tables/child/checkpoints/change_status_child_flow1_success.hpl +++ b/mappings/info_recruits/citizen_tables/child/checkpoints/change_status_child_flow1_success.hpl @@ -188,7 +188,7 @@ result_max as ( --костыль ), for_checkpoints as ( SELECT - 'job_child_flow1' as job_name, + 'child_flow1' as job_name, idm_flow1 as last_recruitment_id, cr_flow1 as recruitment_created_date, 'SUCCESS' as status, diff --git a/mappings/info_recruits/citizen_tables/child/job_child.hwf b/mappings/info_recruits/citizen_tables/child/job_child.hwf index 7d764c3..feb6081 100644 --- a/mappings/info_recruits/citizen_tables/child/job_child.hwf +++ b/mappings/info_recruits/citizen_tables/child/job_child.hwf @@ -5,12 +5,23 @@ + 0 - 2025/06/05 14:27:15.055 - 2025/06/05 14:27:15.055 - + + M_R_CR_DATE + 3001-01-01 00:00:00 + + + + M_R_UP_DATE + + + + Start @@ -92,13 +103,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow1.hpl Basic + + ID_F1 + IDM_FLOW1 + Y - N + Y local N N @@ -118,13 +133,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow2.hpl Basic + + ID_F2 + IDM_FLOW2 + Y - N + Y local N N @@ -170,13 +189,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow4.hpl Basic + + ID_F4 + IDM_FLOW4 + Y - N + Y local N N @@ -342,13 +365,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow1.hpl Basic + + ID_F1 + IDM_FLOW1 + Y - N + Y local N N @@ -368,13 +395,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow2.hpl Basic + + ID_F2 + IDM_FLOW2 + Y - N + Y local N N @@ -394,13 +425,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow3.hpl Basic + + ID_F3 + IDM_FLOW3 + Y - N + Y local N N @@ -420,13 +455,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow4.hpl Basic + + ID_F4 + IDM_FLOW4 + Y - N + Y local N N @@ -446,13 +485,17 @@ N N N - N + Y ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow5.hpl Basic + + ID_F5 + IDM_FLOW5 + Y - N + Y local N N @@ -498,8 +541,15 @@ N N ${PROJECT_HOME}/info_recruits/citizen_tables/child/delta_child.hpl + + Basic + + M_R_UP_DATE + + ${M_R_UP_DATE} + Y N @@ -1248,8 +1298,6 @@ N N ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/change_status_delta_child_success.hpl - - Basic Y @@ -1276,8 +1324,6 @@ N N ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/change_status_delta_child_error.hpl - - Basic Y @@ -1793,6 +1839,29 @@ + + 251 + 232 + 201 + 90 + 58 + 14 + N + 90 + 58 + 14 + N + Segoe UI + 9 + 72 + 1088 + 176 + 0001-01-01 00:00:00 + +3001-01-01 00:00:00 + + 114 + diff --git a/mappings/info_recruits/citizen_tables/child/parallel/child_flow1.hpl b/mappings/info_recruits/citizen_tables/child/parallel/child_flow1.hpl index 255ea10..527cc57 100644 --- a/mappings/info_recruits/citizen_tables/child/parallel/child_flow1.hpl +++ b/mappings/info_recruits/citizen_tables/child/parallel/child_flow1.hpl @@ -64,89 +64,6 @@ 400 - - Select values 4 2 - SelectValues - - Y - - 1 - - none - - - - N - - ID_F1 - ID_F1 - String - -2 - -2 - - false - - - false - - - - - - - - - - 720 - 400 - - - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) -select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number -from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id - Y - - - 448 - 288 - - Insert / update InsertUpdate @@ -211,6 +128,89 @@ join child on r.recruit_id = child.recruit_id 288 + + Select values 4 2 + SelectValues + + Y + + 1 + + none + + + + N + + ID_F1 + ID_F1 + String + -2 + -2 + + false + + + false + + + + + + + + + + 720 + 400 + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + with child as +(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, + ri.recruit_id +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 jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' +) +select + r.recruit_id::uuid recruit_id, + ch->>'naimRodstvSvyazReb' kinship_type, + concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', + ch->'svedFLBS'->'fio'->>'imya', + ch->'svedFLBS'->'fio'->>'otchestvo') full_name, + make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, + make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, + ch->'svedSmert'->>'nomerZapis' death_az_number, + ch->'svedAZRozhd'->>'nomerZapis' birth_az_number +from ervu_dashboard.citizen r +join child on r.recruit_id = child.recruit_id + Y + + + 448 + 288 + + Select values 4 2 diff --git a/mappings/info_recruits/citizen_tables/child/parallel/child_flow2.hpl b/mappings/info_recruits/citizen_tables/child/parallel/child_flow2.hpl index 25a1f51..4ae2357 100644 --- a/mappings/info_recruits/citizen_tables/child/parallel/child_flow2.hpl +++ b/mappings/info_recruits/citizen_tables/child/parallel/child_flow2.hpl @@ -26,52 +26,6 @@ Y - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) -select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number -from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id - Y - - - 560 - 288 - - Insert / update InsertUpdate @@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id 288 + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + with child as +(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, + ri.recruit_id +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 jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' +) +select + r.recruit_id::uuid recruit_id, + ch->>'naimRodstvSvyazReb' kinship_type, + concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', + ch->'svedFLBS'->'fio'->>'imya', + ch->'svedFLBS'->'fio'->>'otchestvo') full_name, + make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, + make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, + ch->'svedSmert'->>'nomerZapis' death_az_number, + ch->'svedAZRozhd'->>'nomerZapis' birth_az_number +from ervu_dashboard.citizen r +join child on r.recruit_id = child.recruit_id + Y + + + 560 + 288 + + diff --git a/mappings/info_recruits/citizen_tables/child/parallel/child_flow3.hpl b/mappings/info_recruits/citizen_tables/child/parallel/child_flow3.hpl index b54983c..1ccf803 100644 --- a/mappings/info_recruits/citizen_tables/child/parallel/child_flow3.hpl +++ b/mappings/info_recruits/citizen_tables/child/parallel/child_flow3.hpl @@ -26,52 +26,6 @@ Y - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) -select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number -from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id - Y - - - 672 - 352 - - Insert / update InsertUpdate @@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id 352 + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + with child as +(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, + ri.recruit_id +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 jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' +) +select + r.recruit_id::uuid recruit_id, + ch->>'naimRodstvSvyazReb' kinship_type, + concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', + ch->'svedFLBS'->'fio'->>'imya', + ch->'svedFLBS'->'fio'->>'otchestvo') full_name, + make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, + make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, + ch->'svedSmert'->>'nomerZapis' death_az_number, + ch->'svedAZRozhd'->>'nomerZapis' birth_az_number +from ervu_dashboard.citizen r +join child on r.recruit_id = child.recruit_id + Y + + + 672 + 352 + + diff --git a/mappings/info_recruits/citizen_tables/child/parallel/child_flow4.hpl b/mappings/info_recruits/citizen_tables/child/parallel/child_flow4.hpl index ae5598f..626f607 100644 --- a/mappings/info_recruits/citizen_tables/child/parallel/child_flow4.hpl +++ b/mappings/info_recruits/citizen_tables/child/parallel/child_flow4.hpl @@ -26,52 +26,6 @@ Y - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) -select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number -from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id - Y - - - 528 - 320 - - Insert / update InsertUpdate @@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id 320 + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + with child as +(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, + ri.recruit_id +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 jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' +) +select + r.recruit_id::uuid recruit_id, + ch->>'naimRodstvSvyazReb' kinship_type, + concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', + ch->'svedFLBS'->'fio'->>'imya', + ch->'svedFLBS'->'fio'->>'otchestvo') full_name, + make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, + make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, + ch->'svedSmert'->>'nomerZapis' death_az_number, + ch->'svedAZRozhd'->>'nomerZapis' birth_az_number +from ervu_dashboard.citizen r +join child on r.recruit_id = child.recruit_id + Y + + + 528 + 320 + + diff --git a/mappings/info_recruits/citizen_tables/child/parallel/child_flow5.hpl b/mappings/info_recruits/citizen_tables/child/parallel/child_flow5.hpl index 36bf1e2..f76ea69 100644 --- a/mappings/info_recruits/citizen_tables/child/parallel/child_flow5.hpl +++ b/mappings/info_recruits/citizen_tables/child/parallel/child_flow5.hpl @@ -26,52 +26,6 @@ Y - - Table input - TableInput - - Y - - 1 - - none - - - ervu-dashboard - N - 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) -select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number -from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id - Y - - - 560 - 368 - - Insert / update InsertUpdate @@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id 368 + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + with child as +(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, + ri.recruit_id +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 jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' +) +select + r.recruit_id::uuid recruit_id, + ch->>'naimRodstvSvyazReb' kinship_type, + concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', + ch->'svedFLBS'->'fio'->>'imya', + ch->'svedFLBS'->'fio'->>'otchestvo') full_name, + make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, + make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, + NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, + ch->'svedSmert'->>'nomerZapis' death_az_number, + ch->'svedAZRozhd'->>'nomerZapis' birth_az_number +from ervu_dashboard.citizen r +join child on r.recruit_id = child.recruit_id + Y + + + 560 + 368 + + diff --git a/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf b/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf index d04a1f1..62b2ba5 100644 --- a/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf +++ b/mappings/info_recruits/citizen_tables/citizen/job_citizen.hwf @@ -407,10 +407,13 @@ N N ${PROJECT_HOME}/info_recruits/citizen_tables/citizen/delta_citizen.hpl + + Basic M_R_UP_DATE + ${M_R_UP_DATE} Y @@ -1863,7 +1866,7 @@ Segoe UI 9 72 - 2480 + 2464 1168 0001-01-01 00:00:00 diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_error.hpl new file mode 100644 index 0000000..e6a5f14 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_error.hpl @@ -0,0 +1,250 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_success.hpl new file mode 100644 index 0000000..571a7cf --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_success.hpl @@ -0,0 +1,250 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_error.hpl new file mode 100644 index 0000000..7b836c5 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_error.hpl @@ -0,0 +1,254 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_success.hpl new file mode 100644 index 0000000..5ce643b --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_success.hpl @@ -0,0 +1,254 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_error.hpl new file mode 100644 index 0000000..4046d93 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_error.hpl @@ -0,0 +1,255 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_success.hpl new file mode 100644 index 0000000..ba9817b --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_success.hpl @@ -0,0 +1,255 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_error.hpl new file mode 100644 index 0000000..09bc827 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_error.hpl @@ -0,0 +1,256 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_success.hpl new file mode 100644 index 0000000..4d21654 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_success.hpl @@ -0,0 +1,256 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_error.hpl new file mode 100644 index 0000000..88fd368 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_error.hpl @@ -0,0 +1,256 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_success.hpl new file mode 100644 index 0000000..0807eed --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_success.hpl @@ -0,0 +1,256 @@ + + + + change_status_citizen_guardianship_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.citizen_guardianship 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 + 'citizen_guardianship_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/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_error.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_error.hpl new file mode 100644 index 0000000..1ed36b6 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_error.hpl @@ -0,0 +1,110 @@ + + + + change_status_delta_citizen_guardianship_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_child' as job_name, + 'ERROR' as status, + current_timestamp as record_created + +union all + + SELECT + 'job_child' as job_name, + 'ERROR' as status, + current_timestamp as record_created + + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_success.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_success.hpl new file mode 100644 index 0000000..a29a1fa --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_delta_citizen_guardianship_success.hpl @@ -0,0 +1,110 @@ + + + + change_status_delta_citizen_guardianship_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_child' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + +union all + + SELECT + 'job_child' as job_name, + 'SUCCESS' as status, + current_timestamp as record_created + + + N + + + 784 + 304 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing.hpl new file mode 100644 index 0000000..68d82dc --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing.hpl @@ -0,0 +1,142 @@ + + + + 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_citizen_guardianship' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + +UNION ALL + +SELECT + 'PROCESSING' AS status, + 'citizen_guardianship_flow1' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + +UNION ALL + +SELECT + 'PROCESSING' AS status, + 'citizen_guardianship_flow2' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + +UNION ALL + +SELECT + 'PROCESSING' AS status, + 'citizen_guardianship_flow3' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + +UNION ALL + +SELECT + 'PROCESSING' AS status, + 'citizen_guardianship_flow4' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + +UNION ALL + +SELECT + 'PROCESSING' AS status, + 'citizen_guardianship_flow5' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + N + + + 368 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing_delta.hpl new file mode 100644 index 0000000..8be76b7 --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing_delta.hpl @@ -0,0 +1,102 @@ + + + + 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_child' AS job_name, + current_timestamp AS record_created +--FROM public.etl_checkpoints + N + + + 832 + 352 + + + + + +
diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/check_if_job_citizen_guardianship_exists.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/check_if_job_citizen_guardianship_exists.hpl new file mode 100644 index 0000000..64a9b1d --- /dev/null +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/check_if_job_citizen_guardianship_exists.hpl @@ -0,0 +1,130 @@ + + + + check_if_job_citizen_guardianship_exists + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/06/11 15:20:18.267 + - + 2025/06/11 15:20:18.267 + + + + + + Table input + Set variables + Y + + + Set variables + Write to log + N + + + + Set variables + SetVariable + + Y + + 1 + + none + + + + + job_name + PIPE + PARENT_WORKFLOW + + + status + STATUS + PARENT_WORKFLOW + + + Y + + + 688 + 352 + + + + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT + COALESCE(job_name, 'job_citizen_guardianship') 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_citizen_guardianship' + + UNION ALL + + SELECT NULL, NULL + WHERE NOT EXISTS ( + SELECT 1 + FROM public.etl_checkpoints + WHERE job_name = 'job_citizen_guardianship' + ) +) t + N + + + 400 + 352 + + + + Write to log + WriteToLog + + Y + + 1 + + none + + + Y + + + N + 0 + Basic + ${STATUS} + + + 960 + 240 + + + + + + diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/checkpoint_job_citizen_guardianship.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/checkpoint_job_citizen_guardianship.hpl index 2208648..0413a04 100644 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/checkpoint_job_citizen_guardianship.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/checkpoint_job_citizen_guardianship.hpl @@ -23,31 +23,61 @@ Filter rows Abort - Y + N JSON input state_child_flow1.json Filter rows - Y + N JSON input state_child_flow2.json Filter rows - Y + N JSON input state_child_flow3.json Filter rows - Y + N JSON input state_child_flow4.json Filter rows - Y + N JSON input state_child_flow5.json Filter rows + N + + + 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 + + + Table input + Insert / update Y @@ -97,7 +127,6 @@ N -1 - constant -1 child_flow1 @@ -146,7 +175,6 @@ N -1 - constant -1 child_flow2 @@ -195,7 +223,6 @@ N -1 - constant -1 child_flow3 @@ -244,7 +271,6 @@ N -1 - constant -1 child_flow4 @@ -293,7 +319,6 @@ N -1 - constant -1 child_flow5 @@ -727,6 +752,117 @@ 752 + + Dummy (do nothing) + Dummy + + Y + + 1 + + none + + + + + 336 + 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 + + + 1312 + 272 + +
+ + Table input + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + WITH status_check AS ( + SELECT + bool_or(status = 'ERROR' AND job_name IN ( + 'citizen_guardianship_flow1', + 'citizen_guardianship_flow2', + 'citizen_guardianship_flow3', + 'citizen_guardianship_flow4', + 'citizen_guardianship_flow5' + )) AS has_error, + count(*) FILTER ( + WHERE status = 'SUCCESS' AND job_name IN ( + 'citizen_guardianship_flow1', + 'citizen_guardianship_flow2', + 'citizen_guardianship_flow3', + 'citizen_guardianship_flow4', + 'citizen_guardianship_flow5' + ) + ) = 5 AS all_success + FROM public.etl_checkpoints +) +SELECT + 'job_citizen_guardianship' 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 + + + 944 + 272 + + diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_delta.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_delta.json deleted file mode 100644 index bad58b4..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_delta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "status": "SUCCESS", - "pipeline": "delta_citizen_guardianship", - "max_create_date": "2025/04/08 20:21:38.528691000", - "max_update_date": "2025/04/09 00:25:46.935442000" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow1.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow1.json deleted file mode 100644 index 7eb1d8b..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow1.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "NEW", - "pipeline": "citizen_guardianship_flow1" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow2.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow2.json deleted file mode 100644 index be87d47..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow2.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "NEW", - "pipeline": "citizen_guardianship_flow2" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow3.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow3.json deleted file mode 100644 index 1020dd2..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow3.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "NEW", - "pipeline": "citizen_guardianship_flow3" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow4.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow4.json deleted file mode 100644 index bffebc8..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow4.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "NEW", - "pipeline": "citizen_guardianship_flow4" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow5.json b/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow5.json deleted file mode 100644 index 765bb1a..0000000 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/checkpoints/state_citizen_guardianship_flow5.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "NEW", - "pipeline": "citizen_guardianship_flow5" -} \ No newline at end of file diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/job_citizen_guardianship.hwf b/mappings/info_recruits/citizen_tables/citizen_guardianship/job_citizen_guardianship.hwf index 113453a..aaf31e2 100644 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/job_citizen_guardianship.hwf +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/job_citizen_guardianship.hwf @@ -5,12 +5,23 @@ + 0 - 2025/06/05 14:27:15.055 - 2025/06/05 14:27:15.055 - + + M_R_CR_DATE + 3001-01-01 00:00:00 + + + + M_R_UP_DATE + + + +
Start @@ -26,23 +37,7 @@ 0 1 N - 624 - 400 - - - - Checks if files exist state_job_child.json - - FILES_EXIST - - - - - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_job_child.json - - - N - 848 + 416 400 @@ -73,7 +68,7 @@
- recruitment_rows_five_flow_child.hpl + recruitment_rows_five_flow_citizen_guardianship.hpl PIPELINE @@ -83,7 +78,7 @@ N N N - ${PROJECT_HOME}/info_recruits/supportive_jobs/recruitment_rows_five_flow_child.hpl + ${PROJECT_HOME}/info_recruits/supportive_jobs/recruitment_rows_five_flow_citizen_guardianship.hpl Basic Y @@ -94,12 +89,12 @@ N Y Y - 1488 + 1872 400 - child_flow1.hpl + citizen_guardianship_flow1.hpl PIPELINE @@ -108,24 +103,31 @@ N N N - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow1.hpl + Y + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow1.hpl + + Basic + + ID_F1 + IDM_FLOW1 + + Y - N + Y local N N Y N - 1808 + 2192 80 - child_flow2.hpl + citizen_guardianship_flow2.hpl PIPELINE @@ -135,7 +137,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow2.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow2.hpl Basic Y @@ -146,12 +148,12 @@ N Y N - 1808 + 2192 240 - child_flow3.hpl + citizen_guardianship_flow3.hpl PIPELINE @@ -161,7 +163,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow3.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow3.hpl Basic Y @@ -172,12 +174,12 @@ N Y N - 1808 + 2192 400 - child_flow4.hpl + citizen_guardianship_flow4.hpl PIPELINE @@ -187,7 +189,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow4.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow4.hpl Basic Y @@ -198,12 +200,12 @@ N Y N - 1808 + 2192 560 - child_flow5.hpl + citizen_guardianship_flow5.hpl PIPELINE @@ -213,7 +215,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow5.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow5.hpl Basic Y @@ -224,180 +226,10 @@ N Y N - 1808 + 2192 720 - - Write state_child_flow1 SUCCESS - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "child_flow1" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow1.json - N - 2096 - 80 - - - - Write state_child_flow1 ERROR - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "child_flow1" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow1.json - N - 2096 - 160 - - - - Write state_child_flow2 SUCCESS - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "child_flow2" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow2.json - N - 2096 - 240 - - - - Write state_child_flow2 ERROR - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "child_flow2" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow2.json - N - 2096 - 320 - - - - Write state_child_flow3 SUCCESS - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "child_flow3" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow3.json - N - 2096 - 400 - - - - Write state_child_flow3 ERROR - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "child_flow3" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow3.json - N - 2096 - 480 - - - - Write state_child_flow4 SUCCESS - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "child_flow4" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow4.json - N - 2096 - 560 - - - - Write state_child_flow4 ERROR - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "child_flow4" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow4.json - N - 2096 - 640 - - - - Write state_child_flow5 SUCCESS - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "child_flow5" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow5.json - N - 2096 - 720 - - - - Write state_child_flow5 ERROR - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "child_flow5" -} - N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow5.json - N - 2096 - 800 - - Abort workflow @@ -405,12 +237,12 @@ N N - 1472 + 1856 208 - checkpoint_job_child.hpl + checkpoint_job_citizen_guardianship.hpl PIPELINE @@ -420,7 +252,7 @@ N N N - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/checkpoint_job_child.hpl + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/checkpoint_job_citizen_guardianship.hpl Basic Y @@ -431,8 +263,8 @@ N Y N - 2496 - 384 + 2912 + 416 @@ -441,44 +273,8 @@ SUCCESS N - 3024 - 384 - - - - state_job_child_success - - WRITE_TO_FILE - - N - { - "status": "SUCCESS", - "pipeline": "job_child" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_job_child.json - N - 2784 - 384 - - - - state_job_child_error - - WRITE_TO_FILE - - N - { - "status": "ERROR", - "pipeline": "job_child" -} - N - UTF-8 - ${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_job_child.json - N - 2784 - 480 + 3360 + 416 @@ -575,7 +371,7 @@ variable STATUS N - 1840 + 1824 1280 @@ -1080,6 +876,10 @@ ${PROJECT_HOME}/info_recruits/citizen_tables/child/delta_child.hpl Basic + + M_R_UP_DATE + ${M_R_UP_DATE} + Y N @@ -1152,239 +952,380 @@ 1872 + + check_if_job_citizen_guardianship_exists.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/check_if_job_citizen_guardianship_exists.hpl + Basic + + Y + + N + local + N + N + Y + N + 656 + 400 + + + + Simple job_citizen_guardianship_exists check NEW + + SIMPLE_EVAL + + NEW + string + true + equal + equal + N + variable + STATUS + N + 1072 + 400 + + + + change_status_to_processing.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_to_processing.hpl + Basic + + Y + + N + local + N + N + Y + N + 1408 + 400 + + + + change_status_citizen_guardianship_flow1_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 80 + + + + change_status_citizen_guardianship_flow1_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow1_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 160 + + + + change_status_citizen_guardianship_flow2_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 240 + + + + change_status_citizen_guardianship_flow2_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow2_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 320 + + + + change_status_citizen_guardianship_flow3_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 400 + + + + change_status_citizen_guardianship_flow3_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow3_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 480 + + + + change_status_citizen_guardianship_flow4_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 560 + + + + change_status_citizen_guardianship_flow4_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow4_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 640 + + + + change_status_citizen_guardianship_flow5_success.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_success.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 720 + + + + change_status_citizen_guardianship_flow5_error.hpl + + PIPELINE + + N + N + N + N + N + N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/checkpoints/change_status_citizen_guardianship_flow5_error.hpl + Basic + + Y + + N + local + N + N + Y + N + 2512 + 800 + +
- Start - Checks if files exist state_job_child.json - Y - Y - Y - - - Checks if files exist state_job_child.json - checkpoint_job_child.hpl (2) + recruitment_rows_five_flow_citizen_guardianship.hpl + citizen_guardianship_flow1.hpl Y Y N - Checks if files exist state_job_child.json - recruitment_rows_five_flow_child.hpl - Y - N - N - - - recruitment_rows_five_flow_child.hpl - child_flow1.hpl - Y + recruitment_rows_five_flow_citizen_guardianship.hpl + citizen_guardianship_flow2.hpl + N Y N - recruitment_rows_five_flow_child.hpl - child_flow2.hpl - Y + recruitment_rows_five_flow_citizen_guardianship.hpl + citizen_guardianship_flow3.hpl + N Y N - recruitment_rows_five_flow_child.hpl - child_flow3.hpl - Y + recruitment_rows_five_flow_citizen_guardianship.hpl + citizen_guardianship_flow4.hpl + N Y N - recruitment_rows_five_flow_child.hpl - child_flow4.hpl - Y + recruitment_rows_five_flow_citizen_guardianship.hpl + citizen_guardianship_flow5.hpl + N Y N - recruitment_rows_five_flow_child.hpl - child_flow5.hpl - Y - Y - N - - - child_flow1.hpl - Write state_child_flow1 SUCCESS - Y - Y - N - - - child_flow1.hpl - Write state_child_flow1 ERROR - Y - N - N - - - child_flow2.hpl - Write state_child_flow2 SUCCESS - Y - Y - N - - - child_flow2.hpl - Write state_child_flow2 ERROR - Y - N - N - - - child_flow3.hpl - Write state_child_flow3 SUCCESS - Y - Y - N - - - child_flow3.hpl - Write state_child_flow3 ERROR - Y - N - N - - - child_flow4.hpl - Write state_child_flow4 SUCCESS - Y - Y - N - - - child_flow4.hpl - Write state_child_flow4 ERROR - Y - N - N - - - child_flow5.hpl - Write state_child_flow5 SUCCESS - Y - Y - N - - - child_flow5.hpl - Write state_child_flow5 ERROR - Y - N - N - - - recruitment_rows_five_flow_child.hpl + recruitment_rows_five_flow_citizen_guardianship.hpl Abort workflow Y N N - - Write state_child_flow1 SUCCESS - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow1 ERROR - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow2 SUCCESS - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow2 ERROR - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow3 SUCCESS - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow3 ERROR - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow4 SUCCESS - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow4 ERROR - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow5 SUCCESS - checkpoint_job_child.hpl - Y - N - Y - - - Write state_child_flow5 ERROR - checkpoint_job_child.hpl - Y - N - Y - - - state_job_child_success - Success new citizen - Y - Y - N - - - state_job_child_error - Success new citizen - Y - Y - N - - - checkpoint_job_child.hpl - state_job_child_success - Y - Y - N - - - checkpoint_job_child.hpl - state_job_child_error - Y - N - N - checkpoint_job_child.hpl (2) state_job_child_success 2 @@ -1665,6 +1606,188 @@ N N + + Start + check_if_job_citizen_guardianship_exists.hpl + Y + Y + Y + + + check_if_job_citizen_guardianship_exists.hpl + Simple job_citizen_guardianship_exists check NEW + Y + Y + N + + + Simple job_citizen_guardianship_exists check NEW + change_status_to_processing.hpl + Y + Y + N + + + change_status_to_processing.hpl + recruitment_rows_five_flow_citizen_guardianship.hpl + Y + Y + N + + + citizen_guardianship_flow1.hpl + change_status_citizen_guardianship_flow1_success.hpl + Y + Y + N + + + citizen_guardianship_flow1.hpl + change_status_citizen_guardianship_flow1_error.hpl + Y + N + N + + + citizen_guardianship_flow2.hpl + change_status_citizen_guardianship_flow2_success.hpl + Y + Y + N + + + citizen_guardianship_flow2.hpl + change_status_citizen_guardianship_flow2_error.hpl + Y + N + N + + + citizen_guardianship_flow3.hpl + change_status_citizen_guardianship_flow3_success.hpl + Y + Y + N + + + citizen_guardianship_flow3.hpl + change_status_citizen_guardianship_flow3_error.hpl + Y + N + N + + + citizen_guardianship_flow4.hpl + change_status_citizen_guardianship_flow4_success.hpl + Y + Y + N + + + citizen_guardianship_flow4.hpl + change_status_citizen_guardianship_flow4_error.hpl + Y + N + N + + + citizen_guardianship_flow5.hpl + change_status_citizen_guardianship_flow5_success.hpl + Y + Y + N + + + citizen_guardianship_flow5.hpl + change_status_citizen_guardianship_flow5_error.hpl + Y + N + N + + + change_status_citizen_guardianship_flow1_success.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow1_error.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow2_success.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow2_error.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow3_success.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow3_error.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow4_success.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow4_error.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow5_success.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + change_status_citizen_guardianship_flow5_error.hpl + checkpoint_job_citizen_guardianship.hpl + Y + N + Y + + + checkpoint_job_citizen_guardianship.hpl + Success new citizen + Y + Y + N + + + Simple job_citizen_guardianship_exists check NEW + checkpoint_job_child.hpl (2) + Y + N + N + diff --git a/mappings/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow1.hpl b/mappings/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow1.hpl index 6b0c517..29ca621 100644 --- a/mappings/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow1.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_guardianship/parallel/citizen_guardianship_flow1.hpl @@ -64,6 +64,55 @@ 400 + + Insert / update + InsertUpdate + + Y + + 1 + + none + + + 100 + ervu-dashboard + + + = + recruit_id + recruit_id + + ervu_dashboard + citizen_guardianship
+ + recruit_id + recruit_id + N + + + birth_date + birth_date + Y + + + full_name + full_name + Y + + + snils + snils + Y + +
+ N + + + 944 + 288 + +
Select values 4 2 SelectValues @@ -115,31 +164,25 @@ ervu-dashboard N 0 - with child as -(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch, - ri.recruit_id -from ervu_person_registry_raw.recruits_info ri + with person as +(select jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') ch, + ri.recruit_id +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 >= r.system_create_date -where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array' -) + AND '${M_R_CR_DATE}'::timestamp >= ri.created_at +where jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array') select - r.recruit_id::uuid recruit_id, - ch->>'naimRodstvSvyazReb' kinship_type, - concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya', - ch->'svedFLBS'->'fio'->>'imya', - ch->'svedFLBS'->'fio'->>'otchestvo') full_name, - make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int, - NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date, - make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int, - NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date, - ch->'svedSmert'->>'nomerZapis' death_az_number, - ch->'svedAZRozhd'->>'nomerZapis' birth_az_number + r.recruit_id AS recruit_id, + concat_ws(' ', ch->'fioOpek'->>'familiya', + ch->'fioOpek'->>'imya', + ch->'fioOpek'->>'otchestvo') full_name, + make_date(NULLIF(ch->'dataRozhdDok'->>'god', '')::int, + NULLIF(ch->'dataRozhdDok'->>'mesyacz','')::int, + NULLIF(ch->'dataRozhdDok'->>'den','')::int) birth_date, + ch->>'snils' snils from ervu_dashboard.citizen r -join child on r.recruit_id = child.recruit_id +join person on r.recruit_id = person.recruit_id Y @@ -147,70 +190,6 @@ join child on r.recruit_id = child.recruit_id 288 - - Insert / update - InsertUpdate - - Y - - 1 - - none - - - 100 - ervu-dashboard - - - = - recruit_id - recruit_id - - ervu_dashboard - citizen_child
- - recruit_id - recruit_id - N - - - birth_az_number - birth_az_number - Y - - - birth_date - birth_date - Y - - - death_az_number - death_az_number - Y - - - death_date - death_date - Y - - - full_name - full_name - Y - - - kinship_type - kinship_type - Y - -
- N - - - 944 - 288 - -
Select values 4 2 diff --git a/mappings/info_recruits/job_info_recruits_from_json.hwf b/mappings/info_recruits/job_info_recruits_from_json.hwf index 967cb3a..1dbc556 100644 --- a/mappings/info_recruits/job_info_recruits_from_json.hwf +++ b/mappings/info_recruits/job_info_recruits_from_json.hwf @@ -25,7 +25,7 @@ N 0 1 - N + Y 496 400 @@ -40,13 +40,10 @@ N N ${PROJECT_HOME}/info_recruits/citizen_tables/child/job_child.hwf - - Nothing M_R_CR_DATE - ${M_R_CR_DATE} Y @@ -62,7 +59,7 @@ - Workflow 2 + job_citizen_guardianship.hwf WORKFLOW @@ -70,10 +67,13 @@ N N N + ${PROJECT_HOME}/info_recruits/citizen_tables/citizen_guardianship/job_citizen_guardianship.hwf + Nothing Y N + local N N Y @@ -250,8 +250,8 @@ Start - Workflow 2 - N + job_citizen_guardianship.hwf + Y Y Y @@ -326,7 +326,7 @@ N - Workflow 2 + job_citizen_guardianship.hwf Success Y Y @@ -369,6 +369,26 @@ + + 251 + 232 + 201 + 90 + 58 + 14 + N + 90 + 58 + 14 + N + Segoe UI + 9 + 26 + 976 + 48 + в следующий пайплайн(check_status_job_info_recruits_from_json.hpl) родительского воркфлоу вписать новый созданный воркфлоу, который создан тут + 849 + diff --git a/mappings/info_recruits/supportive_jobs/recruitment_rows_five_flow_citizen_guardianship.hpl b/mappings/info_recruits/supportive_jobs/recruitment_rows_five_flow_citizen_guardianship.hpl new file mode 100644 index 0000000..6a2f529 --- /dev/null +++ b/mappings/info_recruits/supportive_jobs/recruitment_rows_five_flow_citizen_guardianship.hpl @@ -0,0 +1,121 @@ + + + + recruitment_rows_five_flow_citizen_guardianship + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/04/18 09:48:01.970 + - + 2025/04/18 09:48:01.970 + + + + + + Table input + Copy rows to result + Y + + + + Copy rows to result + RowsToResult + + Y + + 1 + + none + + + + + 832 + 304 + + + + 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, + ((rn - 1) % CEIL(total_rows / 5.0)) + 1 AS position + FROM ordered +), +pivoted AS ( + SELECT + position, + + MAX(CASE WHEN flow_num = 1 THEN created_at END) AS cr_flow1, + MAX(CASE WHEN flow_num = 1 THEN idm_id::text END) AS idm_flow1, + + MAX(CASE WHEN flow_num = 2 THEN created_at END) AS cr_flow2, + MAX(CASE WHEN flow_num = 2 THEN idm_id::text END) AS idm_flow2, + + MAX(CASE WHEN flow_num = 3 THEN created_at END) AS cr_flow3, + MAX(CASE WHEN flow_num = 3 THEN idm_id::text END) AS idm_flow3, + + MAX(CASE WHEN flow_num = 4 THEN created_at END) AS cr_flow4, + MAX(CASE WHEN flow_num = 4 THEN idm_id::text END) AS idm_flow4, + + MAX(CASE WHEN flow_num = 5 THEN created_at END) AS cr_flow5, + MAX(CASE WHEN flow_num = 5 THEN idm_id::text END) AS idm_flow5 + + FROM splitted + GROUP BY position + ORDER BY position +) +SELECT + 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 +limit 5 + N + + + 464 + 304 + + + + + +