свежая версия со стенда

This commit is contained in:
Булат Хайруллин 2025-04-07 20:31:30 +03:00
parent d288a7519e
commit 13aeb606dc
280 changed files with 75366 additions and 20884 deletions

View file

@ -0,0 +1,350 @@
<?xml version="1.0" encoding="UTF-8"?>
<workflow>
<name>job_ratings</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<workflow_version/>
<workflow_status>0</workflow_status>
<created_user>-</created_user>
<created_date>2024/12/24 16:11:59.295</created_date>
<modified_user>-</modified_user>
<modified_date>2024/12/24 16:11:59.295</modified_date>
<parameters>
<parameter>
<name>REG_ID</name>
<default_value/>
<description/>
</parameter>
<parameter>
<name>VK_ARRAY</name>
<default_value/>
<description/>
</parameter>
</parameters>
<actions>
<action>
<name>Start</name>
<description/>
<type>SPECIAL</type>
<attributes/>
<DayOfMonth>1</DayOfMonth>
<hour>12</hour>
<intervalMinutes>60</intervalMinutes>
<intervalSeconds>0</intervalSeconds>
<minutes>0</minutes>
<repeat>N</repeat>
<schedulerType>0</schedulerType>
<weekDay>1</weekDay>
<parallel>Y</parallel>
<xloc>464</xloc>
<yloc>256</yloc>
<attributes_hac/>
</action>
<action>
<name>rows_id-array_reg.hpl</name>
<description/>
<type>PIPELINE</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/region/rows_id-array_reg.hpl</filename>
<loglevel>Basic</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>
<parallel>Y</parallel>
<xloc>704</xloc>
<yloc>256</yloc>
<attributes_hac/>
</action>
<action>
<name>ratings.appear_subpoena.hpl</name>
<description/>
<type>PIPELINE</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/ratings/ratings.appear_subpoena.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>VK_ARRAY</name>
<stream_name>VK_ARRAY_ID</stream_name>
</parameter>
<parameter>
<name>REG_ID</name>
<stream_name>RECRUITMENT_REG_ID</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1104</xloc>
<yloc>144</yloc>
<attributes_hac/>
</action>
<action>
<name>ratings.conscription_info.hpl</name>
<description/>
<type>PIPELINE</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>Y</exec_per_row>
<filename>${PROJECT_HOME}/ratings/ratings.conscription_info.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>VK_ARRAY</name>
<stream_name>VK_ARRAY_ID</stream_name>
</parameter>
<parameter>
<name>REG_ID</name>
<stream_name>RECRUITMENT_REG_ID</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>Y</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1104</xloc>
<yloc>256</yloc>
<attributes_hac/>
</action>
<action>
<name>ratings.consideration_complaint.hpl</name>
<description/>
<type>PIPELINE</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/ratings/ratings.consideration_complaint.hpl</filename>
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>VK_ARRAY</name>
<stream_name>VK_ARRAY_ID</stream_name>
</parameter>
<parameter>
<name>REG_ID</name>
<stream_name>RECRUITMENT_REG_ID</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1104</xloc>
<yloc>368</yloc>
<attributes_hac/>
</action>
<action>
<name>Success</name>
<description/>
<type>SUCCESS</type>
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<yloc>144</yloc>
<attributes_hac/>
</action>
<action>
<name>Success 2</name>
<description/>
<type>SUCCESS</type>
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<yloc>256</yloc>
<attributes_hac/>
</action>
<action>
<name>Success 3</name>
<description/>
<type>SUCCESS</type>
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<yloc>368</yloc>
<attributes_hac/>
</action>
<action>
<name>SQL ratings.appear_subppoena</name>
<description/>
<type>SQL</type>
<attributes/>
<connection>ervu-dashboard</connection>
<sendOneStatement>N</sendOneStatement>
<sql>delete from ratings.appear_subppoena where recording_date = current_date</sql>
<sqlfromfile>N</sqlfromfile>
<useVariableSubstitution>N</useVariableSubstitution>
<parallel>N</parallel>
<xloc>832</xloc>
<yloc>144</yloc>
<attributes_hac/>
</action>
<action>
<name>SQL ratings.conscription_info</name>
<description/>
<type>SQL</type>
<attributes/>
<connection>ervu-dashboard</connection>
<sendOneStatement>N</sendOneStatement>
<sql>delete from ratings.conscription_info where recording_date = current_date</sql>
<sqlfromfile>N</sqlfromfile>
<useVariableSubstitution>N</useVariableSubstitution>
<parallel>N</parallel>
<xloc>832</xloc>
<yloc>256</yloc>
<attributes_hac/>
</action>
<action>
<name>SQL ratings.consideration_complaint</name>
<description/>
<type>SQL</type>
<attributes/>
<connection>ervu-dashboard</connection>
<sendOneStatement>N</sendOneStatement>
<sql>delete from ratings.consideration_complaint where recording_date = current_date</sql>
<sqlfromfile>N</sqlfromfile>
<useVariableSubstitution>N</useVariableSubstitution>
<parallel>N</parallel>
<xloc>832</xloc>
<yloc>368</yloc>
<attributes_hac/>
</action>
</actions>
<hops>
<hop>
<from>Start</from>
<to>rows_id-array_reg.hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
<hop>
<from>ratings.appear_subpoena.hpl</from>
<to>Success</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>ratings.consideration_complaint.hpl</from>
<to>Success 3</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>ratings.conscription_info.hpl</from>
<to>Success 2</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>rows_id-array_reg.hpl</from>
<to>SQL ratings.appear_subppoena</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>SQL ratings.appear_subppoena</from>
<to>ratings.appear_subpoena.hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>rows_id-array_reg.hpl</from>
<to>SQL ratings.conscription_info</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>SQL ratings.conscription_info</from>
<to>ratings.conscription_info.hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>rows_id-array_reg.hpl</from>
<to>SQL ratings.consideration_complaint</to>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>SQL ratings.consideration_complaint</from>
<to>ratings.consideration_complaint.hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>Start</from>
<to>SQL ratings.consideration_complaint</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</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>496</xloc>
<yloc>48</yloc>
<note>запуск после отработки регионов /region/job_recruitments_region</note>
<width>372</width>
</notepad>
</notepads>
<attributes/>
</workflow>

View file

@ -0,0 +1,228 @@
<?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>

View file

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>ratings.conscription_info</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:16:57.706</created_date>
<modified_user>-</modified_user>
<modified_date>2024/12/24 16:16:57.706</modified_date>
</info>
<notepads>
</notepads>
<order>
<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>
<hop>
<from>Table input</from>
<to>Get variables</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>816</xloc>
<yloc>368</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>
<key>
<condition>=</condition>
<field>spring_autumn</field>
<name>spring_autumn</name>
</key>
<schema>ratings</schema>
<table>conscription_info</table>
<value>
<name>execution</name>
<rename>appear_mil_com</rename>
<update>Y</update>
</value>
<value>
<name>execution_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>
<value>
<name>spring_autumn</name>
<rename>spring_autumn</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1200</xloc>
<yloc>368</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>992</xloc>
<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>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 = '3'
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,
CASE
WHEN EXTRACT(MONTH FROM ls.create_date) BETWEEN 1 AND 6 THEN 'Весна'
WHEN EXTRACT(MONTH FROM ls.create_date) BETWEEN 7 AND 12 THEN 'Осень'
END AS spring_autumn
FROM subpoena_data ls
--WHERE ls.create_date >= DATE_TRUNC('year', CURRENT_DATE)
)
SELECT
'${REG_ID}' AS region_id,
tt.spring_autumn,
COUNT(distinct tt.subpoena_id) FILTER (WHERE tt.sub_stat_hist IN ('5')) AS appear_mil_com,
ROUND(
COUNT(distinct tt.subpoena_id) FILTER (WHERE tt.sub_stat_hist IN ('5'))::NUMERIC / NULLIF(COUNT(distinct tt.subpoena_id), 0) * 100, 2
) AS appear_mil_com_percent
FROM season_separations tt
group by tt.spring_autumn</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>

View file

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
<info>
<name>ratings.consideration_complaint</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:18:12.882</created_date>
<modified_user>-</modified_user>
<modified_date>2024/12/24 16:18:12.882</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>Table input</from>
<to>Get variables</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables</from>
<to>Select values</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values</from>
<to>Insert / update</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>REG_ID</name>
<precision>-1</precision>
<trim_type>none</trim_type>
<type>String</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>624</xloc>
<yloc>416</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>region_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
<name2/>
</key>
<schema>ratings</schema>
<table>consideration_complaint</table>
<value>
<name>consideration_complaint</name>
<rename>consideration_complaint</rename>
<update>Y</update>
</value>
<value>
<name>consideration_complaint_percent</name>
<rename>consideration_complaint_percent</rename>
<update>Y</update>
</value>
<value>
<name>id_region</name>
<rename>region_id</rename>
<update>N</update>
</value>
<value>
<name>recording_date</name>
<rename>recording_date</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>976</xloc>
<yloc>224</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>784</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>-- '1' - Удовлетворена, '2' - Частично удовлетворена, '3' - Отказано в удовлетворении
--WITH total AS (
-- SELECT *
-- FROM public.appeal_document ad
-- WHERE extra_info->>'result' IN ('1', '2', '3')
-- AND (
-- '${VK_ARRAY}' IS NULL
-- OR '${VK_ARRAY}' = ''
-- OR ad.vk_id = ANY (
-- string_to_array(
-- trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
-- )::uuid[]
-- )
-- )
--)
--SELECT
-- '${REG_ID}' AS region_id,
-- COUNT(*) FILTER (WHERE tt.extra_info->>'result' IN ('1', '2')) AS consideration_complaint,
-- ROUND(
-- COUNT(*) FILTER (WHERE tt.extra_info->>'result' IN ('1', '2'))::NUMERIC / NULLIF(COUNT(*), 0) * 100, 2
-- ) AS consideration_complaint_percent
--FROM total tt;
select
count(*) as total_count,
count(*) FILTER (where solution_type='Решено') AS consideration_complaint,
COALESCE(ROUND((count(*) FILTER (where solution_type='Решено'))* 100 / NULLIF(count(*),0), 0),0) as consideration_complaint_percent,
region_id,
current_date as recording_date
from appeals.appeals_list
where region_id is not null
group by region_id</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>400</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>