diff --git a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow.hpl b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow.hpl index 0dde8af..2b3b647 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow.hpl @@ -33,8 +33,8 @@ Segoe UI 9 294 - 160 - 704 + 176 + 576 + @@ -92,29 +92,24 @@ Update Y + + Table output + Filter rows + Y + Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - - - Identify last row in a stream Detect empty stream Y - Identify last row in a stream + Table input sort_by_recruit_id Y - Table output - Filter rows + Table input + Table output Y @@ -134,7 +129,7 @@ 0 - 1536 + 1200 480 @@ -170,7 +165,7 @@ and recruitment_id = '${IDM_ID}'; - 1328 + 1024 480 @@ -202,8 +197,8 @@ and recruitment_id = '${IDM_ID}'; - 1536 - 160 + 1200 + 192 @@ -248,8 +243,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 688 - 160 + 496 + 192 @@ -284,25 +279,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 1536 - 320 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 688 + 1200 320 @@ -310,7 +287,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Table input TableInput - Y + N 1 @@ -320,34 +297,19 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); ervu-dashboard N - SELECT - ri.recruit_id, - CASE - WHEN elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVyezd')::date - ELSE NULL - END as date_crossing, - CASE - WHEN elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVozvrashh')::date - ELSE NULL - END as return_date, - true as border_crossed -FROM ervu_dashboard.recruits_info ri -JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id - AND '${IDM_ID}' != '' -- Проверка на пустую строку - AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) - --AND '${M_R_CR_DATE}'::timestamp >= ri.created_at -JOIN LATERAL ( - SELECT elem - FROM jsonb_array_elements( - CASE - WHEN jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' - THEN ri.info->'svedFL'->'extend'->'svedPeresechGran' - ELSE '[]'::jsonb - END - ) as elem - WHERE (elem->>'dataVyezd' IS NOT NULL AND elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$') - OR (elem->>'dataVozvrashh' IS NOT NULL AND elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$') -) AS filtered_elems ON true + WITH filteredData AS (SELECT ri.recruit_id, + ri.info->'svedFL'->'extend'->'svedPeresechGran' as border_cross_arr, + ctid + FROM ervu_dashboard.recruits_info ri + WHERE jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' + AND coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' +) +SELECT to_date(border_cross_elem->>'dataVyezd' , 'YYYY-MM-DD') as date_crossing, + to_date(border_cross_elem->>'dataVozvrashh' , 'YYYY-MM-DD') as return_date, + true as border_crossed, + fd.ctid = (select max(ctid) from filteredData) as last_row +FROM filteredData fd + CROSS JOIN LATERAL jsonb_array_elements(border_cross_arr) AS border_cross_elem; Y @@ -397,7 +359,7 @@ JOIN LATERAL ( Y - 976 + 784 320 @@ -432,7 +394,7 @@ JOIN LATERAL ( Y - 976 + 784 480 @@ -466,7 +428,7 @@ JOIN LATERAL ( - 688 + 496 480 diff --git a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_delta.hpl b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_delta.hpl index 57007d8..e462631 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_delta.hpl @@ -18,32 +18,6 @@ 2025/08/11 13:22:56.048 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 120 - 288 - 640 - + - -1. Перенести решение проблем описанных в ревью по первичному flow. -2. Как планируется не дублировать данные по рекруту(допустим на первичке были скопированы 2 даты, мы обновли запись и добавили еще пересечение) в новом запуске мы заного добавим 2 новые даты, + задублируем уже добавленные? -3. Insert/update нет error_description для error_handling -4. Update нет error_description для error_handling - - 1349 - @@ -82,28 +56,23 @@ Y - Table input - Identify last row in a stream + Insert / update + Filter rows Y - Identify last row in a stream + Table input sort_by_recruit_id Y - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream + Table input Detect empty stream Y - Insert / update - Filter rows + Table input + Insert / update Y @@ -123,8 +92,8 @@ 0 - 1520 - 544 + 1328 + 480 @@ -159,8 +128,8 @@ and recruitment_id = '${IDM_ID}'; - 1248 - 544 + 1056 + 480 @@ -191,8 +160,8 @@ and recruitment_id = '${IDM_ID}'; - 1408 - 160 + 1056 + 208 @@ -240,8 +209,8 @@ and recruitment_id = '${IDM_ID}'; - 752 - 160 + 560 + 208 @@ -276,25 +245,7 @@ and recruitment_id = '${IDM_ID}'; Change job status on success - 1408 - 352 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 752 + 1056 352 @@ -316,16 +267,13 @@ and recruitment_id = '${IDM_ID}'; = recruit_id recruit_id + = date_crossing date_crossing - - - = - return_date - return_date + ervu_dashboard border_crossing
@@ -348,7 +296,7 @@ and recruitment_id = '${IDM_ID}'; N - 960 + 768 352 @@ -356,7 +304,7 @@ and recruitment_id = '${IDM_ID}'; Table input TableInput - Y + N 1 @@ -365,35 +313,20 @@ and recruitment_id = '${IDM_ID}'; ervu-dashboard N - SELECT - ri.recruit_id, - CASE - WHEN elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVyezd')::date - ELSE NULL - END as date_crossing, - CASE - WHEN elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVozvrashh')::date - ELSE NULL - END as return_date, - true as border_crossed -FROM ervu_dashboard.recruits_info ri -JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id - AND '${IDM_ID}' != '' -- Проверка на пустую строку - AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) - AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp - --AND '${M_R_CR_DATE}'::timestamp >= ri.created_at -JOIN LATERAL ( - SELECT elem - FROM jsonb_array_elements( - CASE - WHEN jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' - THEN ri.info->'svedFL'->'extend'->'svedPeresechGran' - ELSE '[]'::jsonb - END - ) as elem - WHERE (elem->>'dataVyezd' IS NOT NULL AND elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$') - OR (elem->>'dataVozvrashh' IS NOT NULL AND elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$') -) AS filtered_elems ON true + + WITH filteredData AS (SELECT ri.recruit_id, + ri.info->'svedFL'->'extend'->'svedPeresechGran' as border_cross_arr, + ctid + FROM ervu_dashboard.recruits_info ri + WHERE jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' + AND coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' +) +SELECT to_date(border_cross_elem->>'dataVyezd' , 'YYYY-MM-DD') as date_crossing, + to_date(border_cross_elem->>'dataVozvrashh' , 'YYYY-MM-DD') as return_date, + true as border_crossed, + fd.ctid = (select max(ctid) from filteredData) as last_row +FROM filteredData fd + CROSS JOIN LATERAL jsonb_array_elements(border_cross_arr) AS border_cross_elem; Y @@ -415,16 +348,13 @@ JOIN LATERAL ( 10000 ervu-dashboard Y + = recruit_id recruit_id - - - <> - border_crossed - border_crossed + ervu_dashboard citizen
@@ -437,8 +367,8 @@ JOIN LATERAL ( Y - 960 - 544 + 768 + 480 @@ -471,8 +401,8 @@ JOIN LATERAL ( - 752 - 544 + 560 + 480 diff --git a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_repeat.hpl index a505c2f..cae03fe 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/parallel/border_crossing_flow_repeat.hpl @@ -33,8 +33,8 @@ Segoe UI 9 73 - 176 - 400 + 96 + 592 + 1.Перенести решение проблем по ревью из первичного флоу @@ -79,28 +79,23 @@ Y - Table input - Identify last row in a stream + Insert / update + Filter rows Y - Identify last row in a stream + Table input Insert / update Y - Identify last row in a stream - sort_by_recruit_id - Y - - - Identify last row in a stream + Table input Detect empty stream Y - Insert / update - Filter rows + Table input + sort_by_recruit_id Y @@ -120,8 +115,8 @@ 0 - 1408 - 416 + 1136 + 336 @@ -156,8 +151,8 @@ and recruitment_id = '${IDM_ID}'; - 1184 - 416 + 944 + 336 @@ -188,7 +183,7 @@ and recruitment_id = '${IDM_ID}'; - 1568 + 944 48 @@ -252,7 +247,7 @@ DO UPDATE SET - 672 + 480 48 @@ -288,25 +283,7 @@ DO UPDATE SET Change job status on success - 1568 - 208 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 672 + 944 208 @@ -328,19 +305,11 @@ DO UPDATE SET = recruit_id recruit_id - = date_crossing date_crossing - - - - = - return_date - return_date - ervu_dashboard border_crossing
@@ -363,7 +332,7 @@ DO UPDATE SET Y - 944 + 736 208 @@ -371,7 +340,7 @@ DO UPDATE SET Table input TableInput - Y + N 1 @@ -380,34 +349,19 @@ DO UPDATE SET ervu-dashboard N - SELECT - ri.recruit_id, - CASE - WHEN elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVyezd')::date - ELSE NULL - END as date_crossing, - CASE - WHEN elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$' THEN (elem->>'dataVozvrashh')::date - ELSE NULL - END as return_date, - true as border_crossed -FROM ervu_dashboard.recruits_info ri -JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id - AND '${IDM_ID}' != '' -- Проверка на пустую строку - AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) - --AND '${M_R_CR_DATE}'::timestamp >= ri.created_at -JOIN LATERAL ( - SELECT elem - FROM jsonb_array_elements( - CASE - WHEN jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' - THEN ri.info->'svedFL'->'extend'->'svedPeresechGran' - ELSE '[]'::jsonb - END - ) as elem - WHERE (elem->>'dataVyezd' IS NOT NULL AND elem->>'dataVyezd' ~ '^\d{4}-\d{2}-\d{2}$') - OR (elem->>'dataVozvrashh' IS NOT NULL AND elem->>'dataVozvrashh' ~ '^\d{4}-\d{2}-\d{2}$') -) AS filtered_elems ON true + WITH filteredData AS (SELECT ri.recruit_id, + ri.info->'svedFL'->'extend'->'svedPeresechGran' as border_cross_arr, + ctid + FROM ervu_dashboard.recruits_info ri + WHERE jsonb_typeof(ri.info->'svedFL'->'extend'->'svedPeresechGran') = 'array' + AND coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' +) +SELECT to_date(border_cross_elem->>'dataVyezd' , 'YYYY-MM-DD') as date_crossing, + to_date(border_cross_elem->>'dataVozvrashh' , 'YYYY-MM-DD') as return_date, + true as border_crossed, + fd.ctid = (select max(ctid) from filteredData) as last_row +FROM filteredData fd + CROSS JOIN LATERAL jsonb_array_elements(border_cross_arr) AS border_cross_elem; Y @@ -451,8 +405,8 @@ JOIN LATERAL ( Y - 896 - 416 + 736 + 336 @@ -485,8 +439,8 @@ JOIN LATERAL ( - 672 - 416 + 480 + 336 diff --git a/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_delta.hpl b/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_delta.hpl index 931bd44..6617a84 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_delta.hpl @@ -209,7 +209,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 656 + 640 240 @@ -260,7 +260,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 672 + 640 320 @@ -311,8 +311,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 672 - 384 + 640 + 400 @@ -362,8 +362,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 672 - 464 + 640 + 480 diff --git a/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_on_error.hpl b/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_on_error.hpl index b6ec75d..b0a9a16 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_on_error.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/recruitment_five_flow_on_error.hpl @@ -18,28 +18,6 @@ 2025/08/05 12:54:50.126 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 57 - 256 - 656 - + - -1.Заменить зашитое название джобы в input на переменную JOB_NAME? - 414 - @@ -347,7 +325,7 @@ where je.status is null or je.status in('ERROR', 'PROCESSING'); - 560 + 544 544 diff --git a/mappings/info_recruits/citizen_tables/border_crossing/recruitments_five_flow.hpl b/mappings/info_recruits/citizen_tables/border_crossing/recruitments_five_flow.hpl index bb63083..93fc9b2 100644 --- a/mappings/info_recruits/citizen_tables/border_crossing/recruitments_five_flow.hpl +++ b/mappings/info_recruits/citizen_tables/border_crossing/recruitments_five_flow.hpl @@ -118,8 +118,8 @@ FROM ervu_dashboard.recruitment - 736 - 144 + 672 + 160 @@ -169,7 +169,7 @@ FROM ervu_dashboard.recruitment - 736 + 672 240 @@ -220,8 +220,8 @@ FROM ervu_dashboard.recruitment - 752 - 336 + 672 + 320 @@ -271,8 +271,8 @@ FROM ervu_dashboard.recruitment - 768 - 416 + 672 + 400 @@ -322,8 +322,8 @@ FROM ervu_dashboard.recruitment - 752 - 512 + 672 + 480