+snils_inn

This commit is contained in:
Ruslan 2025-07-17 11:27:20 +05:00
parent 0d3fc1031f
commit fcfb9fdb35
61 changed files with 8606 additions and 778 deletions

View file

@ -131,7 +131,9 @@
'job_citizen_guardianship',
'job_passport',
'job_citizen_spouse',
'job_prosecution'
'job_prosecution',
'job_punishment',
'job_snils_inn'
)) AS has_error,
count(*) FILTER (
WHERE status = 'SUCCESS' AND job_name IN (
@ -139,9 +141,11 @@
'job_citizen_guardianship',
'job_passport',
'job_citizen_spouse',
'job_prosecution'
'job_prosecution',
'job_punishment',
'job_snils_inn'
)
) = 5 AS all_success
) = 7 AS all_success
FROM public.etl_checkpoints
)
SELECT

View file

@ -86,7 +86,7 @@
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'delta_prosecution' AS job_name,
'delta_citizen_spouse' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>

View file

@ -82,7 +82,7 @@ flow_ranges AS (
recr_inf AS (
SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id
FROM ervu_dashboard.citizen cit
join ervu_dashboard.prosecution ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.citizen_spouse ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (

View file

@ -85,14 +85,14 @@
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_citizen_spouse' as job_name,
'delta_prosecution' as job_name,
'ERROR' as status,
current_timestamp as record_created
union all
SELECT
'job_citizen_spouse' as job_name,
'job_prosecution' as job_name,
'ERROR' as status,
current_timestamp as record_created

View file

@ -85,14 +85,14 @@
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_citizen_spouse' as job_name,
'delta_prosecution' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
union all
SELECT
'job_citizen_spouse' as job_name,
'job_prosecution' as job_name,
'SUCCESS' as status,
current_timestamp as record_created

View file

@ -86,7 +86,7 @@
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'delta_citizen_spouse' AS job_name,
'delta_prosecution' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>

View file

@ -337,7 +337,7 @@
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/citizen_spouse/recruitment_rows_five_flow_if_error.hpl</filename>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/prosecution/recruitment_rows_five_flow_if_error.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
@ -806,7 +806,9 @@
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/citizen_spouse/checkpoints/change_status_to_processing_delta.hpl</filename>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/prosecution/checkpoints/change_status_to_processing_delta.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>

View file

@ -82,7 +82,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.prosecution ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (

View file

@ -85,14 +85,14 @@
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_citizen_spouse' as job_name,
'delta_punishment' as job_name,
'ERROR' as status,
current_timestamp as record_created
union all
SELECT
'job_citizen_spouse' as job_name,
'job_punishment' as job_name,
'ERROR' as status,
current_timestamp as record_created

View file

@ -85,14 +85,14 @@
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_citizen_spouse' as job_name,
'delta_punishment' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
union all
SELECT
'job_citizen_spouse' as job_name,
'job_punishment' as job_name,
'SUCCESS' as status,
current_timestamp as record_created

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -188,7 +188,7 @@ result_max as ( --костыль
),
for_checkpoints as (
SELECT
'citizen_spouse_flow1' as job_name,
'punishment_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'ERROR' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -188,7 +188,7 @@ result_max as ( --костыль
),
for_checkpoints as (
SELECT
'citizen_spouse_flow1' as job_name,
'punishment_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -202,7 +202,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow2' as job_name,
'punishment_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'ERROR' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -202,7 +202,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow2' as job_name,
'punishment_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -213,7 +213,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow3' as job_name,
'punishment_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'ERROR' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -213,7 +213,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow3' as job_name,
'punishment_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -224,7 +224,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow4' as job_name,
'punishment_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'ERROR' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -224,7 +224,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow4' as job_name,
'punishment_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -234,7 +234,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow5' as job_name,
'punishment_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'ERROR' as status,

View file

@ -119,7 +119,7 @@ flow_ranges AS (
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_spouse ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
@ -234,7 +234,7 @@ for_checkpoints as (
union all
*/
SELECT
'citizen_spouse_flow5' as job_name,
'punishment_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -86,7 +86,7 @@
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'job_citizen_spouse' AS job_name,
'job_punishment' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
@ -94,7 +94,7 @@ UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow1' AS job_name,
'punishment_flow1' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
@ -102,7 +102,7 @@ UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow2' AS job_name,
'punishment_flow2' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
@ -110,7 +110,7 @@ UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow3' AS job_name,
'punishment_flow3' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
@ -118,7 +118,7 @@ UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow4' AS job_name,
'punishment_flow4' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
@ -126,7 +126,7 @@ UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow5' AS job_name,
'punishment_flow5' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>

View file

@ -86,7 +86,7 @@
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'delta_prosecution' AS job_name,
'delta_punishment' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>

View file

@ -76,13 +76,13 @@
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
COALESCE(job_name, 'job_citizen_spouse') AS job_name,
COALESCE(job_name, 'job_punishment') AS job_name,
COALESCE(status, 'NEW') AS status,
current_timestamp::timestamp as record_created
FROM (
SELECT job_name, status
FROM public.etl_checkpoints
WHERE job_name = 'job_citizen_spouse'
WHERE job_name = 'job_punishment'
UNION ALL
@ -90,7 +90,7 @@ FROM (
WHERE NOT EXISTS (
SELECT 1
FROM public.etl_checkpoints
WHERE job_name = 'job_citizen_spouse'
WHERE job_name = 'job_punishment'
)
) t</sql>
<variables_active>N</variables_active>

View file

@ -830,25 +830,25 @@
<sql>WITH status_check AS (
SELECT
bool_or(status = 'ERROR' AND job_name IN (
'citizen_spouse_flow1',
'citizen_spouse_flow2',
'citizen_spouse_flow3',
'citizen_spouse_flow4',
'citizen_spouse_flow5'
'punishment_flow1',
'punishment_flow2',
'punishment_flow3',
'punishment_flow4',
'punishment_flow5'
)) AS has_error,
count(*) FILTER (
WHERE status = 'SUCCESS' AND job_name IN (
'citizen_spouse_flow1',
'citizen_spouse_flow2',
'citizen_spouse_flow3',
'citizen_spouse_flow4',
'citizen_spouse_flow5'
'punishment_flow1',
'punishment_flow2',
'punishment_flow3',
'punishment_flow4',
'punishment_flow5'
)
) = 5 AS all_success
FROM public.etl_checkpoints
)
SELECT
'job_citizen_spouse' as job_name,
'job_punishment' as job_name,
CASE
WHEN has_error THEN 'ERROR'
WHEN all_success THEN 'SUCCESS'

View file

@ -26,71 +26,6 @@
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>624</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -111,68 +46,114 @@ JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1024</xloc>
<yloc>352</yloc>
<xloc>1264</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id --AND '${ID_F1}' != '' -- Проверка на пустую строку
--AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -21,49 +21,12 @@
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Select values 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2</from>
<to>Get variables</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>recruitment_id</name>
<precision>-1</precision>
<trim_type>none</trim_type>
<type>String</type>
<variable>ID_F1</variable>
</field>
</fields>
<attributes/>
<GUI>
<xloc>976</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -85,60 +48,60 @@
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
@ -149,43 +112,6 @@
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Select values 4 2</name>
<type>SelectValues</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<select_unspecified>N</select_unspecified>
<meta>
<name>ID_F1</name>
<rename>ID_F1</rename>
<type>String</type>
<length>-2</length>
<precision>-2</precision>
<conversion_mask/>
<date_format_lenient>false</date_format_lenient>
<date_format_locale/>
<date_format_timezone/>
<lenient_string_to_number>false</lenient_string_to_number>
<encoding/>
<decimal_symbol/>
<grouping_symbol/>
<currency_symbol/>
<storage_type/>
</meta>
</fields>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
@ -200,49 +126,30 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -251,18 +158,6 @@ JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Select values 4 2</source_transform>
<target_transform>Get variables</target_transform>
<is_enabled>Y</is_enabled>
<nr_valuename/>
<descriptions_valuename/>
<fields_valuename/>
<codes_valuename/>
<max_errors/>
<max_pct_errors/>
<min_pct_rows/>
</error>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -44,69 +44,70 @@
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1280</xloc>
<xloc>1184</xloc>
<yloc>352</yloc>
</GUI>
</transform>
@ -124,53 +125,34 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F2}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F2}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>784</xloc>
<xloc>688</xloc>
<yloc>352</yloc>
</GUI>
</transform>

View file

@ -46,68 +46,68 @@
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>336</yloc>
<xloc>1200</xloc>
<yloc>384</yloc>
</GUI>
</transform>
<transform>
@ -124,54 +124,35 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F3}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F3}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>336</yloc>
<xloc>704</xloc>
<yloc>384</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -46,68 +46,68 @@
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1184</xloc>
<yloc>384</yloc>
<xloc>1152</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform>
@ -124,54 +124,35 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F4}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F4}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>384</yloc>
<xloc>656</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -46,68 +46,68 @@
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_spouse</table>
<table>punishment</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<name>authority_name</name>
<rename>authority_name</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<name>sentence</name>
<rename>sentence</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<name>sentence_place</name>
<rename>sentence_place</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<name>sentence_changed</name>
<rename>sentence_changed</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<name>punishment_type</name>
<rename>punishment_type</rename>
<update>Y</update>
</value>
<value>
<name>marriage_az_number</name>
<rename>marriage_az_number</rename>
<name>start_date</name>
<rename>start_date</rename>
<update>Y</update>
</value>
<value>
<name>marriage_date</name>
<rename>marriage_date</rename>
<name>release_date</name>
<rename>release_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_az_number</name>
<rename>divorce_az_number</rename>
<name>sentense_date</name>
<rename>sentense_date</rename>
<update>Y</update>
</value>
<value>
<name>divorce_date</name>
<rename>divorce_date</rename>
<name>law_point</name>
<rename>law_point</rename>
<update>Y</update>
</value>
<value>
<name>information_excluded</name>
<rename>information_excluded</rename>
<name>release_reason</name>
<rename>release_reason</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>352</yloc>
<xloc>1344</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
@ -124,54 +124,35 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH suprug AS (
SELECT
supr.supri AS supr,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend' AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend' AS divorce_date,
CASE
WHEN (ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1') THEN true
ELSE false
END AS information_excluded,
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
JOIN LATERAL (
SELECT jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr ON true
<sql>WITH ugol AS (
SELECT ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F5}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F5}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT
r.recruit_id AS recruit_id,
supr->>'rodstvSvyazSuprugNaim' AS kinship_type,
CONCAT_WS(' ',
supr->'svedFLBS'->'fio'->>'familiya',
supr->'svedFLBS'->'fio'->>'imya',
supr->'svedFLBS'->'fio'->>'otchestvo'
) AS full_name,
MAKE_DATE(
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den','')::int
) AS birth_date,
(supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
supr->'svedSmert'->>'nomerZapis' AS death_az_number,
marriage_az_number,
marriage_date::date,
divorce_az_number,
divorce_date::date,
information_excluded
FROM ervu_dashboard.citizen r
JOIN suprug ON r.recruit_id = suprug.recruit_id</sql>
SELECT recruit_id,
nakaz ->> 'naimSud' AS authority_name,
nakaz ->> 'srokNakaz' AS sentence,
nakaz ->> 'adresOrg' AS sentence_place,
-- nakaz->>'vidNakaz' AS punishment_code,
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
nakaz ->> 'vidNakaz' AS punishment_type,
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
string_agg(statiuk_elem, ', ') AS law_point,
nakaz ->> 'osnOsvob' AS release_reason
FROM ugol
LEFT JOIN LATERAL jsonb_array_elements_text(nakaz -> 'statiUK') AS statiuk_elem ON true
GROUP BY recruit_id, nakaz;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>352</yloc>
<xloc>848</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -82,7 +82,7 @@ flow_ranges AS (
recr_inf AS (
SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id
FROM ervu_dashboard.citizen cit
join ervu_dashboard.prosecution ch on ch.recruit_id = cit.recruit_id
join ervu_dashboard.punishment ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>branching_snils_inn</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/09 09:54:43.724</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/09 09:54:43.724</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Set variables 2</from>
<to>Write to log 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Set variables 2</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Set variables 2</name>
<type>SetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<field_name>pipeline</field_name>
<variable_name>PIPE</variable_name>
<variable_type>PARENT_WORKFLOW</variable_type>
</field>
<field>
<field_name>status</field_name>
<variable_name>STATUS</variable_name>
<variable_type>PARENT_WORKFLOW</variable_type>
</field>
</fields>
<use_formatting>Y</use_formatting>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>256</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>select
status as STATUS,
job_name AS PIPELINE
from public.etl_checkpoints
where job_name = 'job_citizen_spouse'</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>816</xloc>
<yloc>256</yloc>
</GUI>
</transform>
<transform>
<name>Write to log 2</name>
<type>WriteToLog</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<displayHeader>Y</displayHeader>
<fields>
<field>
<name>pipeline</name>
</field>
<field>
<name>status</name>
</field>
</fields>
<limitRows>N</limitRows>
<limitRowsNumber>0</limitRowsNumber>
<loglevel>Basic</loglevel>
<logmessage>${PIPE}
${STATUS}</logmessage>
<attributes/>
<GUI>
<xloc>1280</xloc>
<yloc>256</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_delta_snils_inn_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 12:20:06.191</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 12:20:06.191</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_snils_inn' as job_name,
'ERROR' as status,
current_timestamp as record_created
union all
SELECT
'job_snils_inn' as job_name,
'ERROR' as status,
current_timestamp as record_created
</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>784</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_delta_snils_inn_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 12:20:06.191</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 12:20:06.191</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql> SELECT
'delta_snils_inn' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
union all
SELECT
'job_snils_inn' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>784</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow1_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow1_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow2_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow2_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow3_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow3_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow4_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow4_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow5_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_snils_inn_flow5_success</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 09:14:18.787</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 09:14:18.787</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>last_recruitment_id</name>
<rename>last_recruitment_id</rename>
<update>Y</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_created_date</name>
<rename>recruitment_created_date</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils 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
'snils_inn_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</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_to_processing</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/11 16:14:31.162</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/11 16:14:31.162</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>784</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'job_citizen_spouse' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow1' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow2' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow3' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow4' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_spouse_flow5' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>368</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_to_processing_delta</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/16 13:42:26.494</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/16 13:42:26.494</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1248</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
'PROCESSING' AS status,
'delta_snils_inn' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>check_if_job_snils_inn_exists</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/11 15:20:18.267</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/11 15:20:18.267</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Set variables</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Set variables</from>
<to>Write to log</to>
<enabled>N</enabled>
</hop>
</order>
<transform>
<name>Set variables</name>
<type>SetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<field_name>job_name</field_name>
<variable_name>PIPE</variable_name>
<variable_type>PARENT_WORKFLOW</variable_type>
</field>
<field>
<field_name>status</field_name>
<variable_name>STATUS</variable_name>
<variable_type>PARENT_WORKFLOW</variable_type>
</field>
</fields>
<use_formatting>Y</use_formatting>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
COALESCE(job_name, 'job_snils_inn') 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_snils_inn'
UNION ALL
SELECT NULL, NULL
WHERE NOT EXISTS (
SELECT 1
FROM public.etl_checkpoints
WHERE job_name = 'job_snils_inn'
)
) t</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>400</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Write to log</name>
<type>WriteToLog</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<displayHeader>Y</displayHeader>
<fields>
</fields>
<limitRows>N</limitRows>
<limitRowsNumber>0</limitRowsNumber>
<loglevel>Basic</loglevel>
<logmessage>${STATUS}</logmessage>
<attributes/>
<GUI>
<xloc>960</xloc>
<yloc>240</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,869 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>checkpoint_job_snils_inn</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/03 14:19:02.590</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/03 14:19:02.590</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Filter rows</from>
<to>Abort</to>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow1.json</from>
<to>Filter rows</to>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow2.json</from>
<to>Filter rows</to>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow3.json</from>
<to>Filter rows</to>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow4.json</from>
<to>Filter rows</to>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow5.json</from>
<to>Filter rows</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Dummy (do nothing)</from>
<to>JSON input state_child_flow1.json</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Dummy (do nothing)</from>
<to>JSON input state_child_flow2.json</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Dummy (do nothing)</from>
<to>JSON input state_child_flow3.json</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Dummy (do nothing)</from>
<to>JSON input state_child_flow4.json</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Dummy (do nothing)</from>
<to>JSON input state_child_flow5.json</to>
<enabled>N</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
<type>Abort</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<abort_option>ABORT_WITH_ERROR</abort_option>
<always_log_rows>Y</always_log_rows>
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1264</xloc>
<yloc>592</yloc>
</GUI>
</transform>
<transform>
<name>Dummy (do nothing)</name>
<type>Dummy</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>352</xloc>
<yloc>592</yloc>
</GUI>
</transform>
<transform>
<name>Filter rows</name>
<type>FilterRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<compare>
<condition>
<conditions>
<condition>
<conditions>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>child_flow1</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>status</leftvalue>
<negated>N</negated>
<operator>AND</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>ERROR</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>child_flow2</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>status</leftvalue>
<negated>N</negated>
<operator>AND</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>ERROR</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>OR</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>child_flow3</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>status</leftvalue>
<negated>N</negated>
<operator>AND</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>ERROR</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>OR</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>child_flow4</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>status</leftvalue>
<negated>N</negated>
<operator>AND</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>ERROR</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>OR</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>child_flow5</text>
<type>String</type>
</value>
</condition>
<condition>
<conditions>
</conditions>
<function>=</function>
<leftvalue>status</leftvalue>
<negated>N</negated>
<operator>AND</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>ERROR</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>OR</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
</conditions>
<function>=</function>
<leftvalue>pipeline</leftvalue>
<negated>N</negated>
<operator>-</operator>
<value>
<isnull>N</isnull>
<length>-1</length>
<name>constant</name>
<precision>-1</precision>
<text>recruits_info_flow1</text>
<type>String</type>
</value>
</condition>
</compare>
<send_true_to>Abort</send_true_to>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>592</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>job_name</field>
<name>job_name</name>
</key>
<schema>public</schema>
<table>etl_checkpoints</table>
<value>
<name>job_name</name>
<rename>job_name</rename>
<update>N</update>
</value>
<value>
<name>record_created</name>
<rename>record_created</rename>
<update>Y</update>
</value>
<value>
<name>status</name>
<rename>status</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1264</xloc>
<yloc>208</yloc>
</GUI>
</transform>
<transform>
<name>JSON input state_child_flow1.json</name>
<type>JsonInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<include>N</include>
<include_field/>
<rownum>N</rownum>
<addresultfile>N</addresultfile>
<readurl>N</readurl>
<removeSourceField>N</removeSourceField>
<IsIgnoreEmptyFile>N</IsIgnoreEmptyFile>
<doNotFailIfNoFile>Y</doNotFailIfNoFile>
<ignoreMissingPath>Y</ignoreMissingPath>
<defaultPathLeafToNull>Y</defaultPathLeafToNull>
<rownum_field/>
<file>
<name>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow1.json</name>
<filemask/>
<exclude_filemask/>
<file_required>N</file_required>
<include_subfolders>N</include_subfolders>
</file>
<fields>
<field>
<name>pipeline</name>
<path>$.pipeline</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
<field>
<name>status</name>
<path>$.status</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
</fields>
<limit>0</limit>
<IsInFields>N</IsInFields>
<IsAFile>N</IsAFile>
<valueField/>
<shortFileFieldName/>
<pathFieldName/>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<uriNameFieldName/>
<rootUriNameFieldName/>
<extensionFieldName/>
<sizeFieldName/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>432</yloc>
</GUI>
</transform>
<transform>
<name>JSON input state_child_flow2.json</name>
<type>JsonInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<include>N</include>
<include_field/>
<rownum>N</rownum>
<addresultfile>N</addresultfile>
<readurl>N</readurl>
<removeSourceField>N</removeSourceField>
<IsIgnoreEmptyFile>N</IsIgnoreEmptyFile>
<doNotFailIfNoFile>Y</doNotFailIfNoFile>
<ignoreMissingPath>Y</ignoreMissingPath>
<defaultPathLeafToNull>Y</defaultPathLeafToNull>
<rownum_field/>
<file>
<name>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow2.json</name>
<filemask/>
<exclude_filemask/>
<file_required>N</file_required>
<include_subfolders>N</include_subfolders>
</file>
<fields>
<field>
<name>pipeline</name>
<path>$.pipeline</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
<field>
<name>status</name>
<path>$.status</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
</fields>
<limit>0</limit>
<IsInFields>N</IsInFields>
<IsAFile>N</IsAFile>
<valueField/>
<shortFileFieldName/>
<pathFieldName/>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<uriNameFieldName/>
<rootUriNameFieldName/>
<extensionFieldName/>
<sizeFieldName/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>512</yloc>
</GUI>
</transform>
<transform>
<name>JSON input state_child_flow3.json</name>
<type>JsonInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<include>N</include>
<include_field/>
<rownum>N</rownum>
<addresultfile>N</addresultfile>
<readurl>N</readurl>
<removeSourceField>N</removeSourceField>
<IsIgnoreEmptyFile>N</IsIgnoreEmptyFile>
<doNotFailIfNoFile>Y</doNotFailIfNoFile>
<ignoreMissingPath>Y</ignoreMissingPath>
<defaultPathLeafToNull>Y</defaultPathLeafToNull>
<rownum_field/>
<file>
<name>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow3.json</name>
<filemask/>
<exclude_filemask/>
<file_required>N</file_required>
<include_subfolders>N</include_subfolders>
</file>
<fields>
<field>
<name>pipeline</name>
<path>$.pipeline</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
<field>
<name>status</name>
<path>$.status</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
</fields>
<limit>0</limit>
<IsInFields>N</IsInFields>
<IsAFile>N</IsAFile>
<valueField/>
<shortFileFieldName/>
<pathFieldName/>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<uriNameFieldName/>
<rootUriNameFieldName/>
<extensionFieldName/>
<sizeFieldName/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>592</yloc>
</GUI>
</transform>
<transform>
<name>JSON input state_child_flow4.json</name>
<type>JsonInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<include>N</include>
<include_field/>
<rownum>N</rownum>
<addresultfile>N</addresultfile>
<readurl>N</readurl>
<removeSourceField>N</removeSourceField>
<IsIgnoreEmptyFile>N</IsIgnoreEmptyFile>
<doNotFailIfNoFile>Y</doNotFailIfNoFile>
<ignoreMissingPath>Y</ignoreMissingPath>
<defaultPathLeafToNull>Y</defaultPathLeafToNull>
<rownum_field/>
<file>
<name>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow4.json</name>
<filemask/>
<exclude_filemask/>
<file_required>N</file_required>
<include_subfolders>N</include_subfolders>
</file>
<fields>
<field>
<name>pipeline</name>
<path>$.pipeline</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
<field>
<name>status</name>
<path>$.status</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
</fields>
<limit>0</limit>
<IsInFields>N</IsInFields>
<IsAFile>N</IsAFile>
<valueField/>
<shortFileFieldName/>
<pathFieldName/>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<uriNameFieldName/>
<rootUriNameFieldName/>
<extensionFieldName/>
<sizeFieldName/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>672</yloc>
</GUI>
</transform>
<transform>
<name>JSON input state_child_flow5.json</name>
<type>JsonInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<include>N</include>
<include_field/>
<rownum>N</rownum>
<addresultfile>N</addresultfile>
<readurl>N</readurl>
<removeSourceField>N</removeSourceField>
<IsIgnoreEmptyFile>N</IsIgnoreEmptyFile>
<doNotFailIfNoFile>Y</doNotFailIfNoFile>
<ignoreMissingPath>Y</ignoreMissingPath>
<defaultPathLeafToNull>Y</defaultPathLeafToNull>
<rownum_field/>
<file>
<name>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/state_child_flow5.json</name>
<filemask/>
<exclude_filemask/>
<file_required>N</file_required>
<include_subfolders>N</include_subfolders>
</file>
<fields>
<field>
<name>pipeline</name>
<path>$.pipeline</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
<field>
<name>status</name>
<path>$.status</path>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<length>-1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
<repeat>N</repeat>
</field>
</fields>
<limit>0</limit>
<IsInFields>N</IsInFields>
<IsAFile>N</IsAFile>
<valueField/>
<shortFileFieldName/>
<pathFieldName/>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<uriNameFieldName/>
<rootUriNameFieldName/>
<extensionFieldName/>
<sizeFieldName/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>752</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH status_check AS (
SELECT
bool_or(status = 'ERROR' AND job_name IN (
'snils_inn_flow1',
'snils_inn_flow2',
'snils_inn_flow3',
'snils_inn_flow4',
'snils_inn_flow5'
)) AS has_error,
count(*) FILTER (
WHERE status = 'SUCCESS' AND job_name IN (
'snils_inn_flow1',
'snils_inn_flow2',
'snils_inn_flow3',
'snils_inn_flow4',
'snils_inn_flow5'
)
) = 5 AS all_success
FROM public.etl_checkpoints
)
SELECT
'job_snils_inn' 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;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>896</xloc>
<yloc>208</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>checkpoint_snils_inn_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/09 10:01:04.895</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/09 10:01:04.895</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Select values</from>
<to>Table output</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Select values</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Select values</name>
<type>SelectValues</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<select_unspecified>N</select_unspecified>
<meta>
<name>idm_id</name>
<rename>idm_id</rename>
<type>String</type>
<length>-2</length>
<precision>-2</precision>
<conversion_mask/>
<date_format_lenient>false</date_format_lenient>
<date_format_locale/>
<date_format_timezone/>
<lenient_string_to_number>false</lenient_string_to_number>
<encoding/>
<decimal_symbol/>
<grouping_symbol/>
<currency_symbol/>
<storage_type/>
</meta>
</fields>
<attributes/>
<GUI>
<xloc>1008</xloc>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH ordered AS (
SELECT
idm_id,
created_at,
ROW_NUMBER() OVER (ORDER BY created_at) AS rn,
COUNT(*) OVER () AS total_rows
FROM ervu_dashboard.recruitment
),
splitted AS (
SELECT *,
CEIL(total_rows / 5.0) AS part_size,
FLOOR((rn - 1) / CEIL(total_rows / 5.0)) + 1 AS flow_num
FROM ordered
),
flow_ranges AS (
SELECT
flow_num,
MIN(created_at) AS min_date,
MAX(created_at) AS max_date
FROM splitted
GROUP BY flow_num
),
recr_inf AS (
SELECT DISTINCT COALESCE(cit.recruitment_id, cit.target_recruitment_id) AS idm_id
FROM ervu_dashboard.citizen cit
join ervu_dashboard.citizen_child ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
FROM flow_data
),
result_max as ( --костыль
SELECT
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
FROM result_ma
),
for_checkpoints as (
SELECT
'job_child_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_child_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_child_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_child_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_child_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
)
select * from for_checkpoints</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>448</yloc>
</GUI>
</transform>
<transform>
<name>Table output</name>
<type>TableOutput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>1000</commit>
<connection>ervu-dashboard</connection>
<fields>
</fields>
<ignore_errors>N</ignore_errors>
<only_when_have_rows>N</only_when_have_rows>
<partitioning_daily>N</partitioning_daily>
<partitioning_enabled>N</partitioning_enabled>
<partitioning_monthly>Y</partitioning_monthly>
<return_keys>N</return_keys>
<schema>public</schema>
<specify_fields>N</specify_fields>
<table>etl_checkpoints</table>
<tablename_in_field>N</tablename_in_field>
<tablename_in_table>Y</tablename_in_table>
<truncate>N</truncate>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1248</xloc>
<yloc>448</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>delta_snils_inn</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/06/03 16:10:48.509</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/03 16:10:48.509</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1184</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1184</xloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id --AND '${ID_F1}' != '' -- Проверка на пустую строку
--AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>704</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>snils_inn_flow1</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<pipeline_status>0</pipeline_status>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/21 14:05:02.260</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/21 14:05:02.260</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
<name/>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>928</xloc>
<yloc>208</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
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
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>448</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
<name/>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>928</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>snils_inn_flow2</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/21 14:05:02.260</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/21 14:05:02.260</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1152</xloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
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
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>672</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>snils_inn_flow3</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/21 14:05:02.260</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/21 14:05:02.260</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1120</xloc>
<yloc>336</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1120</xloc>
<yloc>496</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
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
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>snils_inn_flow4</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/21 14:05:02.260</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/21 14:05:02.260</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>544</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
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
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>464</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>snils_inn_flow5</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/21 14:05:02.260</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/21 14:05:02.260</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Insert / update inn</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update snils</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update inn</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>inn</field>
</key>
<schema>ervu_dashboard</schema>
<table>inn</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>inn</name>
<rename>inn</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1200</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update snils</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>IS NOT NULL</condition>
<field>snils</field>
</key>
<schema>ervu_dashboard</schema>
<table>snils</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
<value>
<name>actual</name>
<rename>actual</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1200</xloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH
base as (
SELECT
ri.recruit_id,
ri.info
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
)
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
true AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
null as inn,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
false AS actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
true as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
UNION ALL
SELECT
recruit_id,
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
null as snils,
false as actual
FROM base
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>recruitment_rows_five_flow_if_error</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/05/23 14:28:22.572</created_date>
<modified_user>-</modified_user>
<modified_date>2025/05/23 14:28:22.572</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Copy rows to result</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Copy rows to result</name>
<type>RowsToResult</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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.snils ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
FROM flow_data
),
result_max as ( --костыль
SELECT
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
FROM result_ma
),
remains as (
select
CASE
WHEN created_at &gt;= (select cr_flow1 from result_max) and flow_num = 1 THEN created_at
ELSE null
END as cr_flow1,
CASE
WHEN created_at >= (select cr_flow1 from result_max) and flow_num = 1 THEN idm_id
ELSE null
END as idm_flow1,
CASE
WHEN created_at >= (select cr_flow2 from result_max) and flow_num = 2 THEN created_at
ELSE null
END as cr_flow2,
CASE
WHEN created_at >= (select cr_flow2 from result_max) and flow_num = 2 THEN idm_id
ELSE null
END as idm_flow2,
CASE
WHEN created_at >= (select cr_flow3 from result_max) and flow_num = 3 THEN created_at
ELSE null
END as cr_flow3,
CASE
WHEN created_at >= (select cr_flow3 from result_max) and flow_num = 3 THEN idm_id
ELSE null
END as idm_flow3,
CASE
WHEN created_at >= (select cr_flow4 from result_max) and flow_num = 4 THEN created_at
ELSE null
END as cr_flow4,
CASE
WHEN created_at >= (select cr_flow4 from result_max) and flow_num = 4 THEN idm_id
ELSE null
END as idm_flow4,
CASE
WHEN created_at >= (select cr_flow5 from result_max) and flow_num = 5 THEN created_at
ELSE null
END as cr_flow5,
CASE
WHEN created_at >= (select cr_flow5 from result_max) and flow_num = 5 THEN idm_id
ELSE null
END as idm_flow5
from splitted
),
idm1 as (
select
cr_flow1,
idm_flow1
from remains
where cr_flow1 is not null and idm_flow1 is not null
),
idm2 as (
select
cr_flow2,
idm_flow2
from remains
where cr_flow2 is not null and idm_flow2 is not null
),
idm3 as (
select
cr_flow3,
idm_flow3
from remains
where cr_flow3 is not null and idm_flow3 is not null
),
idm4 as (
select
cr_flow4,
idm_flow4
from remains
where cr_flow4 is not null and idm_flow4 is not null
),
idm5 as (
select
cr_flow5,
idm_flow5
from remains
where cr_flow5 is not null and idm_flow5 is not null
)
select
i1.*,
i2.*,
i3.*,
i4.*,
i5.*
FROM
(SELECT *, ROW_NUMBER() OVER () as rn FROM idm1) i1
FULL OUTER JOIN
(SELECT *, ROW_NUMBER() OVER () as rn FROM idm2) i2 ON i1.rn = i2.rn
FULL OUTER JOIN
(SELECT *, ROW_NUMBER() OVER () as rn FROM idm3) i3 ON i1.rn = i3.rn
FULL OUTER JOIN
(SELECT *, ROW_NUMBER() OVER () as rn FROM idm4) i4 ON i1.rn = i4.rn
FULL OUTER JOIN
(SELECT *, ROW_NUMBER() OVER () as rn FROM idm5) i5 ON i1.rn = i5.rn
ORDER BY COALESCE(i1.rn, i2.rn, i3.rn, i4.rn, i5.rn)
limit 2</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>512</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -191,7 +191,7 @@
<attributes_hac/>
</action>
<action>
<name>Workflow 6</name>
<name>job_snils_inn.hwf</name>
<description/>
<type>WORKFLOW</type>
<attributes/>
@ -199,16 +199,27 @@
<add_time>N</add_time>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/snils_inn/job_snils_inn.hwf</filename>
<loglevel>Nothing</loglevel>
<parameters>
<parameter>
<name>M_R_UP_DATE</name>
<value>${M_R_UP_DATE}</value>
</parameter>
<parameter>
<name>M_R_CR_DATE</name>
<value>${M_R_CR_DATE}</value>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>800</xloc>
<yloc>480</yloc>
<yloc>560</yloc>
<attributes_hac/>
</action>
<action>
@ -229,7 +240,7 @@
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>800</xloc>
<yloc>560</yloc>
<yloc>640</yloc>
<attributes_hac/>
</action>
<action>
@ -250,7 +261,7 @@
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>800</xloc>
<yloc>640</yloc>
<yloc>720</yloc>
<attributes_hac/>
</action>
<action>
@ -271,7 +282,7 @@
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>800</xloc>
<yloc>720</yloc>
<yloc>800</yloc>
<attributes_hac/>
</action>
<action>
@ -284,6 +295,42 @@
<yloc>400</yloc>
<attributes_hac/>
</action>
<action>
<name>job_punishment.hwf</name>
<description/>
<type>WORKFLOW</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/punishment/job_punishment.hwf</filename>
<logext/>
<logfile/>
<loglevel>Nothing</loglevel>
<parameters>
<parameter>
<name>M_R_UP_DATE</name>
<stream_name/>
<value>${M_R_UP_DATE}</value>
</parameter>
<parameter>
<name>M_R_CR_DATE</name>
<stream_name/>
<value>${M_R_CR_DATE}</value>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>800</xloc>
<yloc>480</yloc>
<attributes_hac/>
</action>
</actions>
<hops>
<hop>
@ -323,8 +370,8 @@
</hop>
<hop>
<from>Start</from>
<to>Workflow 6</to>
<enabled>N</enabled>
<to>job_snils_inn.hwf</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
@ -385,7 +432,7 @@
<unconditional>N</unconditional>
</hop>
<hop>
<from>Workflow 6</from>
<from>job_snils_inn.hwf</from>
<to>Success</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
@ -412,6 +459,20 @@
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>Start</from>
<to>job_punishment.hwf</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
<hop>
<from>job_punishment.hwf</from>
<to>Success</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
</hops>
<notepads>
<notepad>

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>recruitment_rows_five_flow_punishment</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/04/18 09:48:01.970</created_date>
<modified_user>-</modified_user>
<modified_date>2025/04/18 09:48:01.970</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Copy rows to result</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Copy rows to result</name>
<type>RowsToResult</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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 3</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>464</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>recruitment_rows_five_flow_snils_inn</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2025/04/18 09:48:01.970</created_date>
<modified_user>-</modified_user>
<modified_date>2025/04/18 09:48:01.970</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Copy rows to result</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Copy rows to result</name>
<type>RowsToResult</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>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 3</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>464</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>