228 lines
6 KiB
XML
228 lines
6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<pipeline>
|
|
<info>
|
|
<name>ratings.appear_subpoena</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>2024/12/24 16:15:10.943</created_date>
|
|
<modified_user>-</modified_user>
|
|
<modified_date>2024/12/24 16:15:10.943</modified_date>
|
|
</info>
|
|
<notepads>
|
|
</notepads>
|
|
<order>
|
|
<hop>
|
|
<from>Table input</from>
|
|
<to>Get variables</to>
|
|
<enabled>Y</enabled>
|
|
</hop>
|
|
<hop>
|
|
<from>Get variables</from>
|
|
<to>Select values</to>
|
|
<enabled>Y</enabled>
|
|
</hop>
|
|
<hop>
|
|
<from>Select values</from>
|
|
<to>Insert / update</to>
|
|
<enabled>Y</enabled>
|
|
</hop>
|
|
</order>
|
|
<transform>
|
|
<name>Get variables</name>
|
|
<type>GetVariable</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<fields>
|
|
<field>
|
|
<length>-1</length>
|
|
<name>REG_ID</name>
|
|
<precision>-1</precision>
|
|
<trim_type>none</trim_type>
|
|
<type>String</type>
|
|
</field>
|
|
</fields>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>592</xloc>
|
|
<yloc>256</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>id_region</field>
|
|
<name>REG_ID</name>
|
|
</key>
|
|
<schema>ratings</schema>
|
|
<table>appear_subppoena</table>
|
|
<value>
|
|
<name>appear_mil_com</name>
|
|
<rename>appear_mil_com</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>appear_mil_com_percent</name>
|
|
<rename>appear_mil_com_percent</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>id_region</name>
|
|
<rename>region_id</rename>
|
|
<update>N</update>
|
|
</value>
|
|
</lookup>
|
|
<update_bypassed>N</update_bypassed>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>976</xloc>
|
|
<yloc>256</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform>
|
|
<name>Select values</name>
|
|
<type>SelectValues</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<fields>
|
|
<select_unspecified>N</select_unspecified>
|
|
<meta>
|
|
<name>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>
|
|
</fields>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>768</xloc>
|
|
<yloc>256</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform>
|
|
<name>Table input</name>
|
|
<type>TableInput</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<connection>postgres.subpoena</connection>
|
|
<execute_each_row>N</execute_each_row>
|
|
<limit>0</limit>
|
|
<sql>WITH
|
|
subpoena_data AS (
|
|
SELECT
|
|
s.id AS subpoena_id,
|
|
s.create_date,
|
|
s.department_id AS recruitment_id,
|
|
s.status_id,
|
|
sr.type,
|
|
ssh.code AS sub_stat_hist,
|
|
s.send_date,
|
|
sh.date_time::timestamp AS history_date,
|
|
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn
|
|
FROM public.subpoena s
|
|
JOIN subpoena_status ss ON s.status_id = ss.id
|
|
JOIN subpoena_reason AS sr ON sr.id = s.reason_id
|
|
JOIN subpoena_history AS sh ON sh.subpoena_id = s.id
|
|
JOIN subpoena_status AS ssh ON ssh.id = sh.status_id
|
|
WHERE ('${VK_ARRAY}' IS NULL
|
|
OR '${VK_ARRAY}' = ''
|
|
OR s.department_id = ANY (
|
|
string_to_array(
|
|
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
|
|
)::uuid[]
|
|
)
|
|
)
|
|
AND sr.type IS NOT NULL
|
|
AND ssh.code NOT IN ('3.7','3.72', '3.71')
|
|
AND EXISTS (
|
|
SELECT 1
|
|
FROM subpoena_history sh2
|
|
WHERE sh2.subpoena_id = s.id
|
|
AND sh2.status_id = (SELECT id FROM subpoena_status WHERE code = '3')
|
|
)
|
|
),
|
|
last_status AS (
|
|
SELECT *
|
|
FROM subpoena_data
|
|
WHERE rn = 1
|
|
),
|
|
season_separations AS (
|
|
SELECT distinct
|
|
ls.recruitment_id,
|
|
ls.create_date,
|
|
ls.sub_stat_hist,
|
|
ls.subpoena_id,
|
|
ls.history_date
|
|
FROM last_status ls
|
|
WHERE ls.create_date >= DATE_TRUNC('year', CURRENT_DATE)
|
|
)
|
|
SELECT
|
|
'${REG_ID}' AS region_id,
|
|
COUNT(*) FILTER (WHERE tt.sub_stat_hist IN ('4.1', '4.2')) AS appear_mil_com,
|
|
ROUND(
|
|
COUNT(*) FILTER (WHERE tt.sub_stat_hist IN ('4.1', '4.2'))::NUMERIC / NULLIF(COUNT(*), 0) * 100, 2
|
|
) AS appear_mil_com_percent
|
|
FROM season_separations tt
|
|
HAVING COUNT(*) FILTER (WHERE tt.sub_stat_hist IN ('4.1', '4.2')) > 0;
|
|
</sql>
|
|
<variables_active>Y</variables_active>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>416</xloc>
|
|
<yloc>256</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform_error_handling>
|
|
</transform_error_handling>
|
|
<attributes/>
|
|
</pipeline>
|