ervu-dashboard-etl/v1_apache-hop dash mapping/region/appeals.reasons_appeal(reg).hpl
2025-01-30 18:08:59 +03:00

365 lines
10 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>appeals.reasons_appeal(reg)</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/01/27 11:51:55.468</created_date>
<modified_user>-</modified_user>
<modified_date>2025/01/27 11:51:55.468</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Execute SQL script</from>
<to>Table input (appeal_document) регионы</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Get variables 3 2</from>
<to>Select values 3 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Insert / update (main_dashboard.appeals) 2</from>
<to>Execute SQL script 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Select values 3 2</from>
<to>Insert / update (main_dashboard.appeals) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (appeal_document) регионы</from>
<to>Get variables 3 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (appeal_document) регионы</from>
<to>Insert / update (main_dashboard.appeals) 2</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Execute SQL script</name>
<type>ExecSql</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<arguments>
</arguments>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<quoteString>N</quoteString>
<replace_variables>N</replace_variables>
<set_params>N</set_params>
<single_statement>N</single_statement>
<sql>DELETE FROM appeals.reasons_appeal
WHERE recording_date = current_date
AND schema = 'Organization'</sql>
<attributes/>
<GUI>
<xloc>512</xloc>
<yloc>336</yloc>
</GUI>
</transform>
<transform>
<name>Execute SQL script 2</name>
<type>ExecSql</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<arguments>
</arguments>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<quoteString>N</quoteString>
<replace_variables>Y</replace_variables>
<set_params>N</set_params>
<single_statement>N</single_statement>
<sql>DELETE FROM appeals.reasons_appeal
WHERE recording_date = current_date
AND schema = 'REG_LVL'
</sql>
<attributes/>
<GUI>
<xloc>1296</xloc>
<yloc>336</yloc>
</GUI>
</transform>
<transform>
<name>Get variables 3 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>
<name>REG_ID</name>
<precision>-1</precision>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<length>-1</length>
<name>VK_ARRAY</name>
<precision>-1</precision>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<length>-1</length>
<name>SCM</name>
<precision>-1</precision>
<trim_type>none</trim_type>
<type>String</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>816</xloc>
<yloc>432</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (main_dashboard.appeals) 2</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>recruitment_id</field>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>schema</field>
<name>schema</name>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
</key>
<schema>appeals</schema>
<table>reasons_appeal</table>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>schema</name>
<rename>schema</rename>
<update>N</update>
</value>
<value>
<name>appeal</name>
<rename>appeal</rename>
<update>Y</update>
</value>
<value>
<name>incorrect_inf</name>
<rename>incorrect_inf</rename>
<update>Y</update>
</value>
<value>
<name>incorrect_inf_percent</name>
<rename>incorrect_inf_percent</rename>
<update>Y</update>
</value>
<value>
<name>no_data</name>
<rename>no_data</rename>
<update>Y</update>
</value>
<value>
<name>no_data_percent</name>
<rename>no_data_percent</rename>
<update>Y</update>
</value>
<value>
<name>other</name>
<rename>other</rename>
<update>Y</update>
</value>
<value>
<name>other_percent</name>
<rename>other_percent</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>336</yloc>
</GUI>
</transform>
<transform>
<name>Select values 3 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>
<meta>
<name>SCM</name>
<rename>SCM</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>960</xloc>
<yloc>432</yloc>
</GUI>
</transform>
<transform>
<name>Table input (appeal_document) регионы</name>
<type>TableInput</type>
<description/>
<distribute>N</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
ids AS (
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_REG}'), ','))::uuid AS recruitment_id
),
total_appeals AS (
SELECT *
FROM appeals.appeals_list
WHERE
region_id::uuid IN (SELECT recruitment_id FROM ids)
AND (reasons_appeal IS NULL OR
reasons_appeal IN ('Отзыв жалобы', 'Некорректные данные', 'Досыл документов', 'Несогласие с решением'))
),
summary_counts AS (
SELECT
region_id AS recruitment_id,
COUNT(*) AS total_appeals,
SUM(CASE WHEN reasons_appeal = 'Некорректные данные' THEN 1 ELSE 0 END) AS incorrect_inf,
SUM(CASE WHEN reasons_appeal IS NULL THEN 1 ELSE 0 END) AS no_data,
SUM(CASE WHEN reasons_appeal IN ('Отзыв жалобы', 'Досыл документов', 'Несогласие с решением') THEN 1 ELSE 0 END) AS other
FROM total_appeals
GROUP BY recruitment_id
)
SELECT
'Organization' AS schema,
i.recruitment_id,
current_date AS recording_date,
COALESCE(sc.total_appeals, 0) AS appeal,
COALESCE(sc.incorrect_inf, 0) AS incorrect_inf,
COALESCE(sc.no_data, 0) AS no_data,
COALESCE(sc.other, 0) AS other,
COALESCE(ROUND(sc.incorrect_inf * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS incorrect_inf_percent,
COALESCE(ROUND(sc.no_data * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS no_data_percent,
COALESCE(ROUND(sc.other * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS other_percent
FROM ids i
LEFT JOIN summary_counts sc ON sc.recruitment_id = i.recruitment_id;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>336</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>