2024-11-11 15:38:02 +03:00
<?xml version="1.0" encoding="UTF-8"?>
2024-10-16 10:38:29 +03:00
<pipeline>
<info>
<name>total_registered.removed_registry(reg)</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<pipeline_status>0</pipeline_status>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2024/08/02 11:56:22.507</created_date>
<modified_user>-</modified_user>
<modified_date>2024/08/02 11:56:22.507</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Get variables 2 2</from>
<to>Select values 2 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Select values 2 2</from>
<to>Insert / update (total_registered.removed_registry) 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (decision-document-service) регион 2</from>
<to>Get variables 2 2</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Get variables 2 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
2024-11-11 15:38:02 +03:00
<name>REG_ID</name>
2024-10-16 10:38:29 +03:00
<precision>-1</precision>
<trim_type>none</trim_type>
2024-11-11 15:38:02 +03:00
<type>String</type>
2024-10-16 10:38:29 +03:00
</field>
<field>
<length>-1</length>
2024-11-11 15:38:02 +03:00
<name>VK_ARRAY</name>
2024-10-16 10:38:29 +03:00
<precision>-1</precision>
<trim_type>none</trim_type>
2024-11-11 15:38:02 +03:00
<type>String</type>
2024-10-16 10:38:29 +03:00
</field>
</fields>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (total_registered.removed_registry) 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
2024-11-11 15:38:02 +03:00
<connection>ervu-dashboard</connection>
2024-10-16 10:38:29 +03:00
<lookup>
<key>
<condition>=</condition>
2024-11-11 15:38:02 +03:00
<field>recruitment_id</field>
<name>REG_ID</name>
2024-10-16 10:38:29 +03:00
</key>
2024-11-11 15:38:02 +03:00
<schema>total_registered</schema>
<table>removed_registry</table>
2024-10-16 10:38:29 +03:00
<value>
<name>age_limit</name>
<rename>age_limit</rename>
<update>Y</update>
</value>
<value>
<name>death</name>
<rename>death</rename>
<update>Y</update>
</value>
<value>
<name>removed_registry</name>
<rename>removed_registry</rename>
<update>Y</update>
</value>
<value>
<name>deprivation_citizenship</name>
<rename>deprivation_citizenship</rename>
<update>Y</update>
</value>
<value>
<name>travel_abroad</name>
<rename>travel_abroad</rename>
<update>Y</update>
</value>
<value>
<name>living_abroad</name>
<rename>travel_abroad</rename>
<update>Y</update>
</value>
<value>
<name>other</name>
<rename>other</rename>
<update>Y</update>
</value>
<value>
<name>deprivation_citizen_percents</name>
<rename>deprivation_citizen_percents</rename>
<update>Y</update>
</value>
<value>
<name>age_limit_percent</name>
<rename>age_limit_percent</rename>
<update>Y</update>
</value>
<value>
<name>death_percent</name>
<rename>death_percent</rename>
<update>Y</update>
</value>
<value>
<name>travel_abroad_percent</name>
<rename>travel_abroad_percent</rename>
<update>Y</update>
</value>
<value>
<name>living_abroad_percent</name>
<rename>living_abroad_percent</rename>
<update>Y</update>
</value>
<value>
<name>other_percent</name>
<rename>other_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
</lookup>
2024-11-11 15:38:02 +03:00
<update_bypassed>N</update_bypassed>
2024-10-16 10:38:29 +03:00
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Select values 2 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>REG_ID</name>
<rename>REG_ID</rename>
<type>String</type>
<length>-2</length>
<precision>-2</precision>
<conversion_mask/>
<date_format_lenient>false</date_format_lenient>
<date_format_locale/>
<date_format_timezone/>
<lenient_string_to_number>false</lenient_string_to_number>
<encoding/>
<decimal_symbol/>
<grouping_symbol/>
<currency_symbol/>
<storage_type/>
</meta>
<meta>
<name>VK_ARRAY</name>
<rename>VK_ARRAY</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>816</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Table input (decision-document-service) регион 2</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.decision-document-service</connection>
2024-11-11 15:38:02 +03:00
<execute_each_row>N</execute_each_row>
<limit>0</limit>
2024-10-16 10:38:29 +03:00
<sql>WITH
total_info AS (
SELECT
COUNT(*) AS removed_registry,
COUNT(CASE WHEN d.extra_info ->> 'cause' = 'ageLimit' THEN 1 END) AS age_limit, -- Количество по причине предельный возраст
COUNT(CASE WHEN d.extra_info ->> 'cause' = 'notAlive' THEN 1 END) AS death, -- Количество по причине смерть
COUNT(CASE WHEN (d.extra_info ->> 'cause' IS NULL OR d.extra_info ->> 'cause' NOT IN ('ageLimit', 'notAlive')) THEN 1 END) AS other,
ROUND(COUNT(CASE WHEN d.extra_info ->> 'cause' = 'ageLimit' THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2) AS age_limit_percent,
ROUND(COUNT(CASE WHEN d.extra_info ->> 'cause' = 'notAlive' THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2) AS death_percent,
2024-11-11 15:38:02 +03:00
ROUND(COUNT(CASE WHEN (d.extra_info ->> 'cause' IS NULL OR d.extra_info ->> 'cause' NOT IN ('ageLimit', 'notAlive')) THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2) AS other_percent
2024-10-16 10:38:29 +03:00
FROM public.recruit AS r
JOIN public.decision AS d
ON d.recruit_id = r.id
JOIN public.decision_type AS dt
ON dt.id = d.type_id
WHERE r.system_pgs_status = '1.3'
AND r.current_recruitment IS NOT NULL
AND dt.code in ('9','10')
2024-11-11 15:38:02 +03:00
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
2024-10-16 10:38:29 +03:00
)
SELECT
'${REG_ID}' AS recruitment_id,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.removed_registry, 0) END AS removed_registry,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.age_limit, 0) END AS age_limit,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.death, 0) END AS death,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.other, 0) END AS other,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.age_limit_percent, 0) END AS age_limit_percent,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.death_percent, 0) END AS death_percent,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COALESCE(total_info.other_percent, 0) END AS other_percent,
'0' AS deprivation_citizenship,
'0' AS travel_abroad,
'0' AS living_abroad,
'0' AS deprivation_citizen_percents,
'0' AS travel_abroad_percent,
'0' AS living_abroad_percent
FROM total_info</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>400</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>