+citizen_guardianship

This commit is contained in:
r.gaztdinov 2025-06-17 15:32:10 +03:00
parent 27fd94ddcb
commit c1279b6231
35 changed files with 4437 additions and 876 deletions

View file

@ -2,4 +2,4 @@ ARG RUNTIME_IMAGE=repo.micord.ru/tools/etl-base:0.0.1-sha1e61336f
FROM $RUNTIME_IMAGE
COPY mappings_new /opt/etl/config/projects/mappings
COPY mappings /opt/etl/config/projects/mappings

View file

@ -188,7 +188,7 @@ result_max as ( --костыль
),
for_checkpoints as (
SELECT
'job_child_flow1' as job_name,
'child_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,

View file

@ -5,12 +5,23 @@
<description/>
<extended_description/>
<workflow_version/>
<workflow_status>0</workflow_status>
<created_user>-</created_user>
<created_date>2025/06/05 14:27:15.055</created_date>
<modified_user>-</modified_user>
<modified_date>2025/06/05 14:27:15.055</modified_date>
<parameters>
</parameters>
<parameter>
<name>M_R_CR_DATE</name>
<default_value>3001-01-01 00:00:00</default_value>
<description/>
</parameter>
<parameter>
<name>M_R_UP_DATE</name>
<default_value/>
<description/>
</parameter>
</parameters>
<actions>
<action>
<name>Start</name>
@ -92,13 +103,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow1.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F1</name>
<stream_name>IDM_FLOW1</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -118,13 +133,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow2.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F2</name>
<stream_name>IDM_FLOW2</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -170,13 +189,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow4.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F4</name>
<stream_name>IDM_FLOW4</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -342,13 +365,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow1.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F1</name>
<stream_name>IDM_FLOW1</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -368,13 +395,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow2.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F2</name>
<stream_name>IDM_FLOW2</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -394,13 +425,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow3.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F3</name>
<stream_name>IDM_FLOW3</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -420,13 +455,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow4.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F4</name>
<stream_name>IDM_FLOW4</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -446,13 +485,17 @@
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/parallel/child_flow5.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>ID_F5</name>
<stream_name>IDM_FLOW5</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
@ -498,8 +541,15 @@
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/delta_child.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>M_R_UP_DATE</name>
<stream_name/>
<value>${M_R_UP_DATE}</value>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
@ -1248,8 +1298,6 @@
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/change_status_delta_child_success.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
@ -1276,8 +1324,6 @@
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/checkpoints/change_status_delta_child_error.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
@ -1793,6 +1839,29 @@
</hop>
</hops>
<notepads>
<notepad>
<backgroundcolorblue>251</backgroundcolorblue>
<backgroundcolorgreen>232</backgroundcolorgreen>
<backgroundcolorred>201</backgroundcolorred>
<bordercolorblue>90</bordercolorblue>
<bordercolorgreen>58</bordercolorgreen>
<bordercolorred>14</bordercolorred>
<fontbold>N</fontbold>
<fontcolorblue>90</fontcolorblue>
<fontcolorgreen>58</fontcolorgreen>
<fontcolorred>14</fontcolorred>
<fontitalic>N</fontitalic>
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>72</height>
<xloc>1088</xloc>
<yloc>176</yloc>
<note>0001-01-01 00:00:00
3001-01-01 00:00:00
</note>
<width>114</width>
</notepad>
</notepads>
<attributes/>
</workflow>

View file

@ -64,89 +64,6 @@
<yloc>400</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>
<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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>448</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -211,6 +128,89 @@ join child on r.recruit_id = child.recruit_id</sql>
<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>
<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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>448</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Select values 4 2</source_transform>

View file

@ -26,52 +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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F2}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F2}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id</sql>
<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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F2}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F2}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -26,52 +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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F3}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F3}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>672</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id</sql>
<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>with child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F3}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F3}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>672</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -26,52 +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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F4}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F4}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>528</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id</sql>
<yloc>320</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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F4}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F4}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>528</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -26,52 +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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F5}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F5}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update</name>
<type>InsertUpdate</type>
@ -136,6 +90,52 @@ join child on r.recruit_id = child.recruit_id</sql>
<yloc>368</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 child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F5}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F5}'
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -407,10 +407,13 @@
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/citizen/delta_citizen.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>M_R_UP_DATE</name>
<stream_name/>
<value>${M_R_UP_DATE}</value>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
@ -1863,7 +1866,7 @@
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>72</height>
<xloc>2480</xloc>
<xloc>2464</xloc>
<yloc>1168</yloc>
<note>0001-01-01 00:00:00

View file

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1--,
/*
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
/*
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
SELECT
'citizen_guardianship_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1--,
/*
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
/*
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
SELECT
'citizen_guardianship_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
--MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
--(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2--,
/*
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
*/
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2--,
/*
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
--MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
--(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2--,
/*
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
*/
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2--,
/*
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
*/
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3--,
/*
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
*/
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3--,
/*
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
*/
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3--,
/*
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4,
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
*/
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3--,
/*
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
*/
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--,
/*
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
*/
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4--,
/*
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
*/
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--,
/*
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
*/
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1--,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
*/
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4--,
/*
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
*/
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
/*
union all
SELECT
'job_citizen_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
*/
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--,
*/
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
*/
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'ERROR' as status,
current_timestamp as record_created
from result_max
)
select * from for_checkpoints</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_citizen_guardianship_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.citizen_guardianship ch on ch.recruit_id = cit.recruit_id
),
flow_data AS (
SELECT
fr.flow_num,
ri.idm_id,
(SELECT r.created_at FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
AND r.created_at BETWEEN fr.min_date AND fr.max_date
LIMIT 1) AS created_at
FROM recr_inf ri
CROSS JOIN flow_ranges fr
WHERE EXISTS (
SELECT 1 FROM ervu_dashboard.recruitment r
WHERE r.idm_id = ri.idm_id
)
),
result_ma as (
SELECT
/*
MAX(created_at) FILTER(WHERE flow_num = 1) AS cr_flow1,
(SELECT idm_id FROM flow_data WHERE flow_num = 1 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow1,
MAX(created_at) FILTER(WHERE flow_num = 2) AS cr_flow2,
(SELECT idm_id FROM flow_data WHERE flow_num = 2 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow2,
MAX(created_at) FILTER(WHERE flow_num = 3) AS cr_flow3,
(SELECT idm_id FROM flow_data WHERE flow_num = 3 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow3,
MAX(created_at) FILTER(WHERE flow_num = 4) AS cr_flow4,
(SELECT idm_id FROM flow_data WHERE flow_num = 4 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow4--,
*/
MAX(created_at) FILTER(WHERE flow_num = 5) AS cr_flow5,
(SELECT idm_id FROM flow_data WHERE flow_num = 5 ORDER BY created_at DESC NULLS LAST LIMIT 1) AS idm_flow5
FROM flow_data
),
result_max as ( --костыль
SELECT
/*
CASE
WHEN cr_flow1 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow1
END AS cr_flow1,
idm_flow1,
CASE
WHEN cr_flow2 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow2
END AS cr_flow2,
idm_flow2,
CASE
WHEN cr_flow3 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow3
END AS cr_flow3,
idm_flow3,
CASE
WHEN cr_flow4 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow4
END AS cr_flow4,
idm_flow4,
*/
CASE
WHEN cr_flow5 is null THEN '0001-01-01 00:00:00'::timestamp
ELSE cr_flow5
END AS cr_flow5,
idm_flow5
FROM result_ma
),
for_checkpoints as (
/*
SELECT
'job_citizen_flow1' as job_name,
idm_flow1 as last_recruitment_id,
cr_flow1 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow2' as job_name,
idm_flow2 as last_recruitment_id,
cr_flow2 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow3' as job_name,
idm_flow3 as last_recruitment_id,
cr_flow3 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
SELECT
'job_citizen_flow4' as job_name,
idm_flow4 as last_recruitment_id,
cr_flow4 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
union all
*/
SELECT
'citizen_guardianship_flow5' as job_name,
idm_flow5 as last_recruitment_id,
cr_flow5 as recruitment_created_date,
'SUCCESS' as status,
current_timestamp as record_created
from result_max
)
select * from for_checkpoints</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,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>change_status_delta_citizen_guardianship_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_child' as job_name,
'ERROR' as status,
current_timestamp as record_created
union all
SELECT
'job_child' as job_name,
'ERROR' as status,
current_timestamp as record_created
</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_citizen_guardianship_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_child' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
union all
SELECT
'job_child' as job_name,
'SUCCESS' as status,
current_timestamp as record_created
</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,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_guardianship' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_guardianship_flow1' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_guardianship_flow2' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_guardianship_flow3' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_guardianship_flow4' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints
UNION ALL
SELECT
'PROCESSING' AS status,
'citizen_guardianship_flow5' AS job_name,
current_timestamp AS record_created
--FROM public.etl_checkpoints</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_child' 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_citizen_guardianship_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_citizen_guardianship') AS job_name,
COALESCE(status, 'NEW') AS status,
current_timestamp::timestamp as record_created
FROM (
SELECT job_name, status
FROM public.etl_checkpoints
WHERE job_name = 'job_citizen_guardianship'
UNION ALL
SELECT NULL, NULL
WHERE NOT EXISTS (
SELECT 1
FROM public.etl_checkpoints
WHERE job_name = 'job_citizen_guardianship'
)
) t</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

@ -23,31 +23,61 @@
<hop>
<from>Filter rows</from>
<to>Abort</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow1.json</from>
<to>Filter rows</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow2.json</from>
<to>Filter rows</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow3.json</from>
<to>Filter rows</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow4.json</from>
<to>Filter rows</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>JSON input state_child_flow5.json</from>
<to>Filter rows</to>
<enabled>N</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>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
@ -97,7 +127,6 @@
<value>
<isnull>N</isnull>
<length>-1</length>
<mask/>
<name>constant</name>
<precision>-1</precision>
<text>child_flow1</text>
@ -146,7 +175,6 @@
<value>
<isnull>N</isnull>
<length>-1</length>
<mask/>
<name>constant</name>
<precision>-1</precision>
<text>child_flow2</text>
@ -195,7 +223,6 @@
<value>
<isnull>N</isnull>
<length>-1</length>
<mask/>
<name>constant</name>
<precision>-1</precision>
<text>child_flow3</text>
@ -244,7 +271,6 @@
<value>
<isnull>N</isnull>
<length>-1</length>
<mask/>
<name>constant</name>
<precision>-1</precision>
<text>child_flow4</text>
@ -293,7 +319,6 @@
<value>
<isnull>N</isnull>
<length>-1</length>
<mask/>
<name>constant</name>
<precision>-1</precision>
<text>child_flow5</text>
@ -727,6 +752,117 @@
<yloc>752</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>336</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>1312</xloc>
<yloc>272</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 (
'citizen_guardianship_flow1',
'citizen_guardianship_flow2',
'citizen_guardianship_flow3',
'citizen_guardianship_flow4',
'citizen_guardianship_flow5'
)) AS has_error,
count(*) FILTER (
WHERE status = 'SUCCESS' AND job_name IN (
'citizen_guardianship_flow1',
'citizen_guardianship_flow2',
'citizen_guardianship_flow3',
'citizen_guardianship_flow4',
'citizen_guardianship_flow5'
)
) = 5 AS all_success
FROM public.etl_checkpoints
)
SELECT
'job_citizen_guardianship' as job_name,
CASE
WHEN has_error THEN 'ERROR'
WHEN all_success THEN 'SUCCESS'
ELSE 'ERROR'
END AS status,
current_timestamp AS record_created
FROM status_check;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>272</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -1,6 +0,0 @@
{
"status": "SUCCESS",
"pipeline": "delta_citizen_guardianship",
"max_create_date": "2025/04/08 20:21:38.528691000",
"max_update_date": "2025/04/09 00:25:46.935442000"
}

View file

@ -1,4 +0,0 @@
{
"status": "NEW",
"pipeline": "citizen_guardianship_flow1"
}

View file

@ -1,4 +0,0 @@
{
"status": "NEW",
"pipeline": "citizen_guardianship_flow2"
}

View file

@ -1,4 +0,0 @@
{
"status": "NEW",
"pipeline": "citizen_guardianship_flow3"
}

View file

@ -1,4 +0,0 @@
{
"status": "NEW",
"pipeline": "citizen_guardianship_flow4"
}

View file

@ -1,4 +0,0 @@
{
"status": "NEW",
"pipeline": "citizen_guardianship_flow5"
}

View file

@ -64,6 +64,55 @@
<yloc>400</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>recruit_id</field>
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_guardianship</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<update>Y</update>
</value>
<value>
<name>snils</name>
<rename>snils</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Select values 4 2</name>
<type>SelectValues</type>
@ -115,31 +164,25 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>with child as
(select jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') ch,
ri.recruit_id
from ervu_person_registry_raw.recruits_info ri
<sql>with person as
(select jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') ch,
ri.recruit_id
from ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}'::timestamp >= r.system_create_date
where jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
where jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array')
select
r.recruit_id::uuid recruit_id,
ch->>'naimRodstvSvyazReb' kinship_type,
concat_ws(' ', ch->'svedFLBS'->'fio'->>'familiya',
ch->'svedFLBS'->'fio'->>'imya',
ch->'svedFLBS'->'fio'->>'otchestvo') full_name,
make_date(NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'den','')::int) birth_date,
make_date(NULLIF(ch->'svedSmert'->'dataSmert'->>'god', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz','')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den','')::int) death_date,
ch->'svedSmert'->>'nomerZapis' death_az_number,
ch->'svedAZRozhd'->>'nomerZapis' birth_az_number
r.recruit_id AS recruit_id,
concat_ws(' ', ch->'fioOpek'->>'familiya',
ch->'fioOpek'->>'imya',
ch->'fioOpek'->>'otchestvo') full_name,
make_date(NULLIF(ch->'dataRozhdDok'->>'god', '')::int,
NULLIF(ch->'dataRozhdDok'->>'mesyacz','')::int,
NULLIF(ch->'dataRozhdDok'->>'den','')::int) birth_date,
ch->>'snils' snils
from ervu_dashboard.citizen r
join child on r.recruit_id = child.recruit_id</sql>
join person on r.recruit_id = person.recruit_id</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -147,70 +190,6 @@ join child on r.recruit_id = child.recruit_id</sql>
<yloc>288</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>recruit_id</field>
<name>recruit_id</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_child</table>
<value>
<name>recruit_id</name>
<rename>recruit_id</rename>
<update>N</update>
</value>
<value>
<name>birth_az_number</name>
<rename>birth_az_number</rename>
<update>Y</update>
</value>
<value>
<name>birth_date</name>
<rename>birth_date</rename>
<update>Y</update>
</value>
<value>
<name>death_az_number</name>
<rename>death_az_number</rename>
<update>Y</update>
</value>
<value>
<name>death_date</name>
<rename>death_date</rename>
<update>Y</update>
</value>
<value>
<name>full_name</name>
<rename>full_name</rename>
<update>Y</update>
</value>
<value>
<name>kinship_type</name>
<rename>kinship_type</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Select values 4 2</source_transform>

View file

@ -25,7 +25,7 @@
<repeat>N</repeat>
<schedulerType>0</schedulerType>
<weekDay>1</weekDay>
<parallel>N</parallel>
<parallel>Y</parallel>
<xloc>496</xloc>
<yloc>400</yloc>
<attributes_hac/>
@ -40,13 +40,10 @@
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/info_recruits/citizen_tables/child/job_child.hwf</filename>
<logext/>
<logfile/>
<loglevel>Nothing</loglevel>
<parameters>
<parameter>
<name>M_R_CR_DATE</name>
<stream_name/>
<value>${M_R_CR_DATE}</value>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
@ -62,7 +59,7 @@
<attributes_hac/>
</action>
<action>
<name>Workflow 2</name>
<name>job_citizen_guardianship.hwf</name>
<description/>
<type>WORKFLOW</type>
<attributes/>
@ -70,10 +67,13 @@
<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/citizen_guardianship/job_citizen_guardianship.hwf</filename>
<loglevel>Nothing</loglevel>
<parameters>
<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>
@ -250,8 +250,8 @@
</hop>
<hop>
<from>Start</from>
<to>Workflow 2</to>
<enabled>N</enabled>
<to>job_citizen_guardianship.hwf</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
@ -326,7 +326,7 @@
<unconditional>N</unconditional>
</hop>
<hop>
<from>Workflow 2</from>
<from>job_citizen_guardianship.hwf</from>
<to>Success</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
@ -369,6 +369,26 @@
</hop>
</hops>
<notepads>
<notepad>
<backgroundcolorblue>251</backgroundcolorblue>
<backgroundcolorgreen>232</backgroundcolorgreen>
<backgroundcolorred>201</backgroundcolorred>
<bordercolorblue>90</bordercolorblue>
<bordercolorgreen>58</bordercolorgreen>
<bordercolorred>14</bordercolorred>
<fontbold>N</fontbold>
<fontcolorblue>90</fontcolorblue>
<fontcolorgreen>58</fontcolorgreen>
<fontcolorred>14</fontcolorred>
<fontitalic>N</fontitalic>
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>26</height>
<xloc>976</xloc>
<yloc>48</yloc>
<note>в следующий пайплайн(check_status_job_info_recruits_from_json.hpl) родительского воркфлоу вписать новый созданный воркфлоу, который создан тут</note>
<width>849</width>
</notepad>
</notepads>
<attributes/>
</workflow>

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>recruitment_rows_five_flow_citizen_guardianship</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 5</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>464</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>