This commit is contained in:
Ruslan 2024-09-23 17:36:50 +03:00
parent 969f9d982c
commit fbd6bed123
37 changed files with 9620 additions and 3106 deletions

View file

@ -0,0 +1,665 @@
<?xml version="1.0" encoding="UTF-8"?>
<transformation>
<info>
<name>appeals.reasons_appeal</name>
<description/>
<extended_description/>
<trans_version/>
<trans_type>Normal</trans_type>
<trans_status>0</trans_status>
<directory>/</directory>
<parameters>
</parameters>
<log>
<trans-log-table>
<connection/>
<schema/>
<table/>
<size_limit_lines/>
<interval/>
<timeout_days/>
<field>
<id>ID_BATCH</id>
<enabled>Y</enabled>
<name>ID_BATCH</name>
</field>
<field>
<id>CHANNEL_ID</id>
<enabled>Y</enabled>
<name>CHANNEL_ID</name>
</field>
<field>
<id>TRANSNAME</id>
<enabled>Y</enabled>
<name>TRANSNAME</name>
</field>
<field>
<id>STATUS</id>
<enabled>Y</enabled>
<name>STATUS</name>
</field>
<field>
<id>LINES_READ</id>
<enabled>Y</enabled>
<name>LINES_READ</name>
<subject/>
</field>
<field>
<id>LINES_WRITTEN</id>
<enabled>Y</enabled>
<name>LINES_WRITTEN</name>
<subject/>
</field>
<field>
<id>LINES_UPDATED</id>
<enabled>Y</enabled>
<name>LINES_UPDATED</name>
<subject/>
</field>
<field>
<id>LINES_INPUT</id>
<enabled>Y</enabled>
<name>LINES_INPUT</name>
<subject/>
</field>
<field>
<id>LINES_OUTPUT</id>
<enabled>Y</enabled>
<name>LINES_OUTPUT</name>
<subject/>
</field>
<field>
<id>LINES_REJECTED</id>
<enabled>Y</enabled>
<name>LINES_REJECTED</name>
<subject/>
</field>
<field>
<id>ERRORS</id>
<enabled>Y</enabled>
<name>ERRORS</name>
</field>
<field>
<id>STARTDATE</id>
<enabled>Y</enabled>
<name>STARTDATE</name>
</field>
<field>
<id>ENDDATE</id>
<enabled>Y</enabled>
<name>ENDDATE</name>
</field>
<field>
<id>LOGDATE</id>
<enabled>Y</enabled>
<name>LOGDATE</name>
</field>
<field>
<id>DEPDATE</id>
<enabled>Y</enabled>
<name>DEPDATE</name>
</field>
<field>
<id>REPLAYDATE</id>
<enabled>Y</enabled>
<name>REPLAYDATE</name>
</field>
<field>
<id>LOG_FIELD</id>
<enabled>Y</enabled>
<name>LOG_FIELD</name>
</field>
<field>
<id>EXECUTING_SERVER</id>
<enabled>N</enabled>
<name>EXECUTING_SERVER</name>
</field>
<field>
<id>EXECUTING_USER</id>
<enabled>N</enabled>
<name>EXECUTING_USER</name>
</field>
<field>
<id>CLIENT</id>
<enabled>N</enabled>
<name>CLIENT</name>
</field>
</trans-log-table>
<perf-log-table>
<connection/>
<schema/>
<table/>
<interval/>
<timeout_days/>
<field>
<id>ID_BATCH</id>
<enabled>Y</enabled>
<name>ID_BATCH</name>
</field>
<field>
<id>SEQ_NR</id>
<enabled>Y</enabled>
<name>SEQ_NR</name>
</field>
<field>
<id>LOGDATE</id>
<enabled>Y</enabled>
<name>LOGDATE</name>
</field>
<field>
<id>TRANSNAME</id>
<enabled>Y</enabled>
<name>TRANSNAME</name>
</field>
<field>
<id>STEPNAME</id>
<enabled>Y</enabled>
<name>STEPNAME</name>
</field>
<field>
<id>STEP_COPY</id>
<enabled>Y</enabled>
<name>STEP_COPY</name>
</field>
<field>
<id>LINES_READ</id>
<enabled>Y</enabled>
<name>LINES_READ</name>
</field>
<field>
<id>LINES_WRITTEN</id>
<enabled>Y</enabled>
<name>LINES_WRITTEN</name>
</field>
<field>
<id>LINES_UPDATED</id>
<enabled>Y</enabled>
<name>LINES_UPDATED</name>
</field>
<field>
<id>LINES_INPUT</id>
<enabled>Y</enabled>
<name>LINES_INPUT</name>
</field>
<field>
<id>LINES_OUTPUT</id>
<enabled>Y</enabled>
<name>LINES_OUTPUT</name>
</field>
<field>
<id>LINES_REJECTED</id>
<enabled>Y</enabled>
<name>LINES_REJECTED</name>
</field>
<field>
<id>ERRORS</id>
<enabled>Y</enabled>
<name>ERRORS</name>
</field>
<field>
<id>INPUT_BUFFER_ROWS</id>
<enabled>Y</enabled>
<name>INPUT_BUFFER_ROWS</name>
</field>
<field>
<id>OUTPUT_BUFFER_ROWS</id>
<enabled>Y</enabled>
<name>OUTPUT_BUFFER_ROWS</name>
</field>
</perf-log-table>
<channel-log-table>
<connection/>
<schema/>
<table/>
<timeout_days/>
<field>
<id>ID_BATCH</id>
<enabled>Y</enabled>
<name>ID_BATCH</name>
</field>
<field>
<id>CHANNEL_ID</id>
<enabled>Y</enabled>
<name>CHANNEL_ID</name>
</field>
<field>
<id>LOG_DATE</id>
<enabled>Y</enabled>
<name>LOG_DATE</name>
</field>
<field>
<id>LOGGING_OBJECT_TYPE</id>
<enabled>Y</enabled>
<name>LOGGING_OBJECT_TYPE</name>
</field>
<field>
<id>OBJECT_NAME</id>
<enabled>Y</enabled>
<name>OBJECT_NAME</name>
</field>
<field>
<id>OBJECT_COPY</id>
<enabled>Y</enabled>
<name>OBJECT_COPY</name>
</field>
<field>
<id>REPOSITORY_DIRECTORY</id>
<enabled>Y</enabled>
<name>REPOSITORY_DIRECTORY</name>
</field>
<field>
<id>FILENAME</id>
<enabled>Y</enabled>
<name>FILENAME</name>
</field>
<field>
<id>OBJECT_ID</id>
<enabled>Y</enabled>
<name>OBJECT_ID</name>
</field>
<field>
<id>OBJECT_REVISION</id>
<enabled>Y</enabled>
<name>OBJECT_REVISION</name>
</field>
<field>
<id>PARENT_CHANNEL_ID</id>
<enabled>Y</enabled>
<name>PARENT_CHANNEL_ID</name>
</field>
<field>
<id>ROOT_CHANNEL_ID</id>
<enabled>Y</enabled>
<name>ROOT_CHANNEL_ID</name>
</field>
</channel-log-table>
<step-log-table>
<connection/>
<schema/>
<table/>
<timeout_days/>
<field>
<id>ID_BATCH</id>
<enabled>Y</enabled>
<name>ID_BATCH</name>
</field>
<field>
<id>CHANNEL_ID</id>
<enabled>Y</enabled>
<name>CHANNEL_ID</name>
</field>
<field>
<id>LOG_DATE</id>
<enabled>Y</enabled>
<name>LOG_DATE</name>
</field>
<field>
<id>TRANSNAME</id>
<enabled>Y</enabled>
<name>TRANSNAME</name>
</field>
<field>
<id>STEPNAME</id>
<enabled>Y</enabled>
<name>STEPNAME</name>
</field>
<field>
<id>STEP_COPY</id>
<enabled>Y</enabled>
<name>STEP_COPY</name>
</field>
<field>
<id>LINES_READ</id>
<enabled>Y</enabled>
<name>LINES_READ</name>
</field>
<field>
<id>LINES_WRITTEN</id>
<enabled>Y</enabled>
<name>LINES_WRITTEN</name>
</field>
<field>
<id>LINES_UPDATED</id>
<enabled>Y</enabled>
<name>LINES_UPDATED</name>
</field>
<field>
<id>LINES_INPUT</id>
<enabled>Y</enabled>
<name>LINES_INPUT</name>
</field>
<field>
<id>LINES_OUTPUT</id>
<enabled>Y</enabled>
<name>LINES_OUTPUT</name>
</field>
<field>
<id>LINES_REJECTED</id>
<enabled>Y</enabled>
<name>LINES_REJECTED</name>
</field>
<field>
<id>ERRORS</id>
<enabled>Y</enabled>
<name>ERRORS</name>
</field>
<field>
<id>LOG_FIELD</id>
<enabled>N</enabled>
<name>LOG_FIELD</name>
</field>
</step-log-table>
<metrics-log-table>
<connection/>
<schema/>
<table/>
<timeout_days/>
<field>
<id>ID_BATCH</id>
<enabled>Y</enabled>
<name>ID_BATCH</name>
</field>
<field>
<id>CHANNEL_ID</id>
<enabled>Y</enabled>
<name>CHANNEL_ID</name>
</field>
<field>
<id>LOG_DATE</id>
<enabled>Y</enabled>
<name>LOG_DATE</name>
</field>
<field>
<id>METRICS_DATE</id>
<enabled>Y</enabled>
<name>METRICS_DATE</name>
</field>
<field>
<id>METRICS_CODE</id>
<enabled>Y</enabled>
<name>METRICS_CODE</name>
</field>
<field>
<id>METRICS_DESCRIPTION</id>
<enabled>Y</enabled>
<name>METRICS_DESCRIPTION</name>
</field>
<field>
<id>METRICS_SUBJECT</id>
<enabled>Y</enabled>
<name>METRICS_SUBJECT</name>
</field>
<field>
<id>METRICS_TYPE</id>
<enabled>Y</enabled>
<name>METRICS_TYPE</name>
</field>
<field>
<id>METRICS_VALUE</id>
<enabled>Y</enabled>
<name>METRICS_VALUE</name>
</field>
</metrics-log-table>
</log>
<maxdate>
<connection/>
<table/>
<field/>
<offset>0.0</offset>
<maxdiff>0.0</maxdiff>
</maxdate>
<size_rowset>10000</size_rowset>
<sleep_time_empty>50</sleep_time_empty>
<sleep_time_full>50</sleep_time_full>
<unique_connections>N</unique_connections>
<feedback_shown>Y</feedback_shown>
<feedback_size>50000</feedback_size>
<using_thread_priorities>Y</using_thread_priorities>
<shared_objects_file/>
<capture_step_performance>N</capture_step_performance>
<step_performance_capturing_delay>1000</step_performance_capturing_delay>
<step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
<dependencies>
</dependencies>
<partitionschemas>
</partitionschemas>
<slaveservers>
<slaveserver>
<name>local</name>
<hostname>localhost</hostname>
<port>8888</port>
<webAppName/>
<username>cluster</username>
<password>Encrypted 2be98afc86aa7f2e4cb1aa265cd86aac8</password>
<proxy_hostname/>
<proxy_port/>
<non_proxy_hosts/>
<master>Y</master>
<sslMode>N</sslMode>
</slaveserver>
</slaveservers>
<clusterschemas>
</clusterschemas>
<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>
<key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA=</key_for_session_key>
<is_key_private>N</is_key_private>
</info>
<notepads>
</notepads>
<connection>
<name>ervu-dashboard</name>
<server>dashboard-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
<database>dashboard-dbname</database>
<port>1111</port>
<username>dashboard-dbuser</username>
<password>Encrypted 2daf9dca008c89396af54aa72ce93bcc9</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute>
<code>EXTRA_OPTION_POSTGRESQL.stringtype</code>
<attribute>unspecified</attribute>
</attribute>
<attribute>
<code>FORCE_IDENTIFIERS_TO_LOWERCASE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>FORCE_IDENTIFIERS_TO_UPPERCASE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>IS_CLUSTERED</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>PORT_NUMBER</code>
<attribute>1111</attribute>
</attribute>
<attribute>
<code>PRESERVE_RESERVED_WORD_CASE</code>
<attribute>Y</attribute>
</attribute>
<attribute>
<code>QUOTE_ALL_FIELDS</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>SUPPORTS_BOOLEAN_DATA_TYPE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>SUPPORTS_TIMESTAMP_DATA_TYPE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>USE_POOLING</code>
<attribute>N</attribute>
</attribute>
</attributes>
</connection>
<connection>
<name>postgres.appeal-document-service</name>
<server>appeal-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
<database>appeal-dbname</database>
<port>2222</port>
<username>appeal-dbuser</username>
<password>Encrypted 2be98afa91ad79785a754aa72ce93bcc9</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute>
<code>FORCE_IDENTIFIERS_TO_LOWERCASE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>FORCE_IDENTIFIERS_TO_UPPERCASE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>IS_CLUSTERED</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>PORT_NUMBER</code>
<attribute>2222</attribute>
</attribute>
<attribute>
<code>PRESERVE_RESERVED_WORD_CASE</code>
<attribute>Y</attribute>
</attribute>
<attribute>
<code>QUOTE_ALL_FIELDS</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>SUPPORTS_BOOLEAN_DATA_TYPE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>SUPPORTS_TIMESTAMP_DATA_TYPE</code>
<attribute>N</attribute>
</attribute>
<attribute>
<code>USE_POOLING</code>
<attribute>N</attribute>
</attribute>
</attributes>
</connection>
<order>
<hop>
<from>Table input (appeal_document) РФ</from>
<to>Insert / update (main_dashboard.appeals)</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Insert / update (main_dashboard.appeals)</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>N</update_bypassed>
<lookup>
<schema>main_dashboard</schema>
<table>appeals</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>total_appeals</name>
<rename>total_appeals</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>752</xloc>
<yloc>176</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (appeal_document) РФ</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.appeal-document-service</connection>
<sql>WITH
t1 AS (
SELECT COUNT(*) AS total_appeals
FROM public.appeal_document
) -- нет причин обжалований
SELECT
t1.total_appeals,
'00' AS recruitment_id,
0 AS incorrect_inf,
0 AS no_data,
0 AS other,
0 AS incorrect_inf_percent,
0 AS no_data_percent,
0 AS other_percent
FROM t1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>176</yloc>
<draw>Y</draw>
</GUI>
</step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>
</slave-step-copy-partition-distribution>
<slave_transformation>N</slave_transformation>
<attributes/>
</transformation>

View file

@ -556,54 +556,12 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 3</from>
<to>Select values 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 3</from>
<to>Insert / update (main_dashboard.appeals)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (appeal_document) РФ</from>
<to>Get variables 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (appeal_document) РФ</from>
<to>Insert / update (main_dashboard.appeals)</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 3</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>416</xloc>
<yloc>304</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (main_dashboard.appeals)</name>
<type>InsertUpdate</type>
@ -682,36 +640,8 @@
</output>
</remotesteps>
<GUI>
<xloc>768</xloc>
<yloc>160</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 3</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>544</xloc>
<yloc>304</yloc>
<xloc>752</xloc>
<yloc>176</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -727,13 +657,37 @@
<schema_name/>
</partitioning>
<connection>postgres.appeal-document-service</connection>
<sql>with
t1 as (select count(*) as total_appeals from
public.appeal_document ad),
t2 as (select (avg(trim(both '"' from (ad.extra_info -> 'resultDate')::text)::date - appeal_date)) as average_consideration from public.appeal_document ad)
select t1.total_appeals, t2.average_consideration, '00' as recruitment_id,
0 as resolved, 0 as average_rating, 0 as average_to_face, 0 as average_epgu, 0 as average_to_face_percent, 0 as average_epgu_percent
from t1 full outer join t2 on 1 = 1</sql>
<sql>WITH
t1 AS (
SELECT COUNT(*) AS total_appeals
FROM public.appeal_document
),
t2 AS (
SELECT
ROUND(
AVG(
(TRIM(BOTH '"' FROM (ad.extra_info ->> 'resultDate')::text)::date - ad.appeal_date)
),
2
) AS average_consideration
FROM public.appeal_document ad
),
resolved AS (-- решенные обжалования, возможно не верно
SELECT COUNT(*) AS resolved
FROM public.appeal_document ad
WHERE ad.extra_info->>'result' = '1'
)
SELECT
t1.total_appeals,
t2.average_consideration,
r.resolved,
'00' AS recruitment_id,
0 AS average_rating,
0 AS average_to_face,
0 AS average_epgu,
0 AS average_to_face_percent,
0 AS average_epgu_percent
FROM t1, t2, resolved AS r;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -748,8 +702,8 @@ from t1 full outer join t2 on 1 = 1</sql>
</output>
</remotesteps>
<GUI>
<xloc>224</xloc>
<yloc>160</yloc>
<xloc>400</xloc>
<yloc>176</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -556,36 +556,6 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 4</from>
<to>Select values 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4</from>
<to>Insert / update (main_dashboard.recruitment_campaign)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) РФ/осень</from>
<to>Get variables 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2</from>
<to>Select values 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2</from>
<to>Insert / update (main_dashboard.recruitment_campaign) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) РФ/весна</from>
<to>Get variables 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) РФ/весна</from>
<to>Insert / update (main_dashboard.recruitment_campaign) 2</to>
@ -597,60 +567,6 @@
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 4</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>480</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 4 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>480</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (main_dashboard.recruitment_campaign)</name>
<type>InsertUpdate</type>
@ -682,17 +598,17 @@
</key>
<value>
<name>subpoenas_sent</name>
<rename>subpoenas_sent</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas</name>
<rename>appeared_on_subpoenas</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas</name>
<rename>not_appeared_on_subpoenas</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
@ -750,8 +666,8 @@
</output>
</remotesteps>
<GUI>
<xloc>960</xloc>
<yloc>128</yloc>
<xloc>928</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -786,17 +702,17 @@
</key>
<value>
<name>subpoenas_sent</name>
<rename>subpoenas_sent</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas</name>
<rename>appeared_on_subpoenas</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas</name>
<rename>not_appeared_on_subpoenas</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
@ -854,63 +770,7 @@
</output>
</remotesteps>
<GUI>
<xloc>960</xloc>
<yloc>192</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>656</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>656</xloc>
<xloc>928</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
@ -927,29 +787,68 @@
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoenas_sent FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code ='3'),
t2 as (select count(distinct subpoena.id) as appeared_on_subpoenas FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code in ('4.1','4.2')),
t3 as (select count(distinct subpoena.id) as not_appeared_on_subpoenas FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code ='5')
select t1.subpoenas_sent, t2.appeared_on_subpoenas, t3.not_appeared_on_subpoenas, 1 as org, '00' as recruitment_id, 'Весна' as spring_autumn,
0 as new_recruits, 0 as postponement_have_right, 0 as postponement_granted, 0 as appeared_on_subpoenas_percent, 0 as not_appeared_on_subpoenas_percent, 0 as postponement_have_right_percent, 0 as postponement_granted_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM public.subpoena s
JOIN public.subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN public.subpoena_status AS ss ON ss.id = s.status_id
JOIN public.subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN public.subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN public.restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN public.restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN public.subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type = '1' -- от 18 до 30 лет и нет отсрочки (нужны эти условия), резделение весна/осень
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
)
SELECT
t1.count_subpoena,
t2.count_appeared,
t3.count_not_appeared,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_on_subpoenas_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_on_subpoenas_percent,
0 as new_recruits,
0 as postponement_have_right,
0 as postponement_granted,
0 as postponement_have_right_percent,
0 as postponement_granted_percent,
'Весна' as spring_autumn,
'00' AS recruitment_id,
1 AS org
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -964,8 +863,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1
</output>
</remotesteps>
<GUI>
<xloc>208</xloc>
<yloc>192</yloc>
<xloc>512</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -981,29 +880,68 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoenas_sent FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code ='3'),
t2 as (select count(distinct subpoena.id) as appeared_on_subpoenas FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code in ('4.1','4.2')),
t3 as (select count(distinct subpoena.id) as not_appeared_on_subpoenas FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type='3' and sub_stat_hist.code ='5')
select t1.subpoenas_sent, t2.appeared_on_subpoenas, t3.not_appeared_on_subpoenas, 1 as org, '00' as recruitment_id, 'Осень' as spring_autumn,
0 as new_recruits, 0 as postponement_have_right, 0 as postponement_granted, 0 as appeared_on_subpoenas_percent, 0 as not_appeared_on_subpoenas_percent, 0 as postponement_have_right_percent, 0 as postponement_granted_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM public.subpoena s
JOIN public.subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN public.subpoena_status AS ss ON ss.id = s.status_id
JOIN public.subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN public.subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN public.restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN public.restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN public.subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type = '1' -- от 18 до 30 лет и нет отсрочки (нужны эти условия), резделение весна/осень
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
)
SELECT
t1.count_subpoena,
t2.count_appeared,
t3.count_not_appeared,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_on_subpoenas_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_on_subpoenas_percent,
0 as new_recruits,
0 as postponement_have_right,
0 as postponement_granted,
0 as postponement_have_right_percent,
0 as postponement_granted_percent,
'Осень' as spring_autumn,
'00' AS recruitment_id,
1 AS org
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -1018,8 +956,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1
</output>
</remotesteps>
<GUI>
<xloc>208</xloc>
<yloc>128</yloc>
<xloc>512</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -556,54 +556,12 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 2</from>
<to>Select values 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 2</from>
<to>Insert / update (main_dashboard.total_registered)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ</from>
<to>Get variables 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ</from>
<to>Insert / update (main_dashboard.total_registered)</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>464</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (main_dashboard.total_registered)</name>
<type>InsertUpdate</type>
@ -687,36 +645,8 @@
</output>
</remotesteps>
<GUI>
<xloc>912</xloc>
<yloc>240</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>608</xloc>
<yloc>352</yloc>
<xloc>1008</xloc>
<yloc>512</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -732,18 +662,21 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>with
t1 as (select count(*) total_count from public.recruits r
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null),
t2 as (select count(*) filter(where gender='MALE') male_count
from public.recruits r
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null),
t3 as (select count(*) filter(where gender='FEMALE') female_count
from public.recruits r
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null)
select t1.total_count, t2.male_count, t3.female_count, '00' as recruitment_id,
0 as mobilization_criterion, 0 as volunteer_criterion, 0 as contract_criterion, 0 as mobilization_criterion_percent, 0 as volunteer_criterion_percent, 0 as contract_criterion_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1</sql>
<sql>SELECT
COUNT(*) AS total_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
'00' AS recruitment_id,
0 AS mobilization_criterion,
0 AS volunteer_criterion,
0 AS contract_criterion,
0 AS mobilization_criterion_percent,
0 AS volunteer_criterion_percent,
0 AS contract_criterion_percent
FROM public.recruits r
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -758,8 +691,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1</sql>
</output>
</remotesteps>
<GUI>
<xloc>192</xloc>
<yloc>240</yloc>
<xloc>672</xloc>
<yloc>512</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -556,54 +556,12 @@
</attributes>
</connection>
<order>
<hop>
<from>Table input 2 (person_registry) РФ</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 (main_dashboard.waiting_registration)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input 2 (person_registry) РФ</from>
<to>Insert / update (main_dashboard.waiting_registration)</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>592</xloc>
<yloc>320</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (main_dashboard.waiting_registration)</name>
<type>InsertUpdate</type>
@ -672,6 +630,11 @@
<rename>contract_criterion_percent</rename>
<update>Y</update>
</value>
<value>
<name>waiting_registration_percent</name>
<rename>waiting_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
@ -687,36 +650,8 @@
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>144</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>736</xloc>
<yloc>320</yloc>
<xloc>816</xloc>
<yloc>336</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -732,13 +667,22 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>with
t1 as (select count(*) waiting_count from public.recruits r where r.system_pgs_status = '1'),
t2 as (select count(*) filter(where gender='MALE') male_count from public.recruits r where r.system_pgs_status = '1'),
t3 as (select count(*) filter(where gender='FEMALE') female_count from public.recruits r where r.system_pgs_status = '1')
select t1.waiting_count, t2.male_count, t3.female_count, '00' as recruitment_id,
0 as mobilization_criterion, 0 as volunteer_criterion, 0 as contract_criterion, 0 as mobilization_criterion_percent, 0 as volunteer_criterion_percent, 0 as contract_criterion_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1</sql>
<sql>SELECT
COUNT(*) AS waiting_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
'00' AS recruitment_id,
0 AS mobilization_criterion,
0 AS volunteer_criterion,
0 AS contract_criterion,
0 AS mobilization_criterion_percent,
0 AS volunteer_criterion_percent,
0 AS contract_criterion_percent,
ROUND(COALESCE((COUNT(*)::DECIMAL / NULLIF((SELECT COUNT(*) FROM public.recruits), 0) * 100), 0), 2) AS waiting_percent
FROM public.recruits r
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -753,8 +697,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1</sql>
</output>
</remotesteps>
<GUI>
<xloc>336</xloc>
<yloc>144</yloc>
<xloc>496</xloc>
<yloc>336</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -543,36 +543,6 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 4</from>
<to>Select values 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4</from>
<to>Insert / update (recruitment_campaign.subpoenas)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) осень/РФ</from>
<to>Get variables 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2</from>
<to>Select values 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2</from>
<to>Insert / update (recruitment_campaign.subpoenas) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) Весна/РФ</from>
<to>Get variables 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) осень/РФ</from>
<to>Insert / update (recruitment_campaign.subpoenas)</to>
@ -584,60 +554,6 @@
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 4</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>432</xloc>
<yloc>368</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 4 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>432</xloc>
<yloc>480</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (recruitment_campaign.subpoenas)</name>
<type>InsertUpdate</type>
@ -669,37 +585,37 @@
</key>
<value>
<name>subpoena</name>
<rename>subpoena</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared</name>
<rename>appeared</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared</name>
<rename>not_appeared</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_ap_good_reason</name>
<rename>not_ap_good_reason</rename>
<rename>count_not_ap_good_reason</rename>
<update>Y</update>
</value>
<value>
<name>introduced_measures</name>
<rename>introduced_measures</rename>
<rename>count_introduced_measures</rename>
<update>Y</update>
</value>
<value>
<name>ap_not_required</name>
<rename>ap_not_required</rename>
<rename>count_ap_not_required</rename>
<update>Y</update>
</value>
<value>
<name>restrictions_applied</name>
<rename>restrictions_applied</rename>
<rename>count_restrictions_applied</rename>
<update>Y</update>
</value>
<value>
@ -779,51 +695,51 @@
<lookup>
<schema>recruitment_campaign</schema>
<table>subpoenas</table>
<key>
<name>spring_autumn</name>
<field>spring_autumn</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>spring_autumn</name>
<field>spring_autumn</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>subpoena</name>
<rename>subpoena</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared</name>
<rename>appeared</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared</name>
<rename>not_appeared</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_ap_good_reason</name>
<rename>not_ap_good_reason</rename>
<rename>count_not_ap_good_reason</rename>
<update>Y</update>
</value>
<value>
<name>introduced_measures</name>
<rename>introduced_measures</rename>
<rename>count_introduced_measures</rename>
<update>Y</update>
</value>
<value>
<name>ap_not_required</name>
<rename>ap_not_required</rename>
<rename>count_ap_not_required</rename>
<update>Y</update>
</value>
<value>
<name>restrictions_applied</name>
<rename>restrictions_applied</rename>
<rename>count_restrictions_applied</rename>
<update>Y</update>
</value>
<value>
@ -886,62 +802,6 @@
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>592</xloc>
<yloc>368</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>592</xloc>
<yloc>480</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (subpoena) Весна/РФ</name>
<type>TableInput</type>
@ -954,51 +814,125 @@
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoena FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code ='3'),
t2 as (select count(distinct subpoena.id) as appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code in ('4.1','4.2')),
t3 as (select count(distinct subpoena.id) as not_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code ='5'),
t4 as (select count(*) as not_ap_good_reason FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code='5.1'),
t5 as (select count(distinct subpoena.id) as ap_not_required FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code in ('3.8','5.2')),
t6 as (select count(distinct rdi.id) as restrictions_applied from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and subpoena_reason.type = '3'),
t7 as (select count(distinct rdi.id) as introduced_measures from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and rdi.applied_date is not null and subpoena_reason.type = '3')
select t1.subpoena, t2.appeared, t3.not_appeared, t4.not_ap_good_reason, t5.ap_not_required, t6.restrictions_applied, t7.introduced_measures, 1 as mil_reg, '00' as recruitment_id, 1 as org,
0 as appeared_percent, 0 as not_appeared_percent, 0 as not_ap_good_reason_percent, 0 as ap_not_required_percent, 0 as restrictions_applied_percent, 0 as introduced_measures_percent, 0 as rest, 'Весна' as spring_autumn
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join t4 on 1 = 1 full outer join t5 on 1 = 1 full outer join t6 on 1 = 1 full outer join t7 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM public.subpoena s
JOIN public.subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN public.subpoena_status AS ss ON ss.id = s.status_id
JOIN public.subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN public.subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN public.restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN public.restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN public.subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type = '3'
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t4 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
),
t5 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
FROM last_status
WHERE sub_stat_hist = '5.1'
),
t6 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
FROM last_status
WHERE sub_stat_hist IN ('3.8', '5.2')
),
t7 AS ( -- количество повесток по которым применены ограничения
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
FROM last_status
WHERE restr_dc IS NULL
),
t8 AS ( -- количество повесток по которым введены меры
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
FROM last_status
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
),
t9 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
FROM last_status
WHERE d_code = '14'
),
t10 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
FROM last_status
WHERE d_code = '7'
),
t11 AS (
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
FROM last_status
)
SELECT
t1.count_subpoena,
t2.average_appeared,
t3.count_appeared,
t4.count_not_appeared,
t5.count_not_ap_good_reason,
t6.count_ap_not_required,
t7.count_restrictions_applied,
t8.count_introduced_measures,
t9.count_paper,
t10.count_electron,
t11.count_restrictions,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_percent,
ROUND(count_not_ap_good_reason * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_ap_good_reason_percent,
ROUND(count_ap_not_required * 100.0 / NULLIF(count_subpoena, 0), 2) AS ap_not_required_percent,
ROUND(count_electron * 100.0 / NULLIF(count_subpoena, 0), 2) AS electron_percent,
ROUND(count_paper * 100.0 / NULLIF(count_subpoena, 0), 2) AS paper_percent,
ROUND(count_restrictions_applied * 100.0 / NULLIF(count_subpoena, 0), 2) AS restrictions_applied_percent,
ROUND(count_introduced_measures * 100.0 / NULLIF(count_subpoena, 0), 2) AS introduced_measures_percent,
'00' AS recruitment_id,
0 as rest,
'Весна' as spring_autumn,
1 AS org
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1
FULL OUTER JOIN t7 ON 1 = 1
FULL OUTER JOIN t8 ON 1 = 1
FULL OUTER JOIN t9 ON 1 = 1
FULL OUTER JOIN t10 ON 1 = 1
FULL OUTER JOIN t11 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -1030,51 +964,125 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoena FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code ='3'),
t2 as (select count(distinct subpoena.id) as appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code in ('4.1','4.2')),
t3 as (select count(distinct subpoena.id) as not_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code ='5'),
t4 as (select count(*) as not_ap_good_reason FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code='5.1'),
t5 as (select count(distinct subpoena.id) as ap_not_required FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='3' and sub_stat_hist.code in ('3.8','5.2')),
t6 as (select count(distinct rdi.id) as restrictions_applied from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and subpoena_reason.type = '3'),
t7 as (select count(distinct rdi.id) as introduced_measures from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and rdi.applied_date is not null and subpoena_reason.type = '3')
select t1.subpoena, t2.appeared, t3.not_appeared, t4.not_ap_good_reason, t5.ap_not_required, t6.restrictions_applied, t7.introduced_measures, 1 as mil_reg, '00' as recruitment_id, 1 as org,
0 as appeared_percent, 0 as not_appeared_percent, 0 as not_ap_good_reason_percent, 0 as ap_not_required_percent, 0 as restrictions_applied_percent, 0 as introduced_measures_percent, 0 as rest, 'Осень' as spring_autumn
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join t4 on 1 = 1 full outer join t5 on 1 = 1 full outer join t6 on 1 = 1 full outer join t7 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM public.subpoena s
JOIN public.subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN public.subpoena_status AS ss ON ss.id = s.status_id
JOIN public.subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN public.subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN public.restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN public.restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN public.subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type = '3' -- код про призывную комиссию
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t4 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
),
t5 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
FROM last_status
WHERE sub_stat_hist = '5.1'
),
t6 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
FROM last_status
WHERE sub_stat_hist IN ('3.8', '5.2')
),
t7 AS ( -- количество повесток по которым применены ограничения
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
FROM last_status
WHERE restr_dc IS NULL
),
t8 AS ( -- количество повесток по которым введены меры
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
FROM last_status
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
),
t9 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
FROM last_status
WHERE d_code = '14'
),
t10 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
FROM last_status
WHERE d_code = '7'
),
t11 AS (
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
FROM last_status
)
SELECT
t1.count_subpoena,
t2.average_appeared,
t3.count_appeared,
t4.count_not_appeared,
t5.count_not_ap_good_reason,
t6.count_ap_not_required,
t7.count_restrictions_applied,
t8.count_introduced_measures,
t9.count_paper,
t10.count_electron,
t11.count_restrictions,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_percent,
ROUND(count_not_ap_good_reason * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_ap_good_reason_percent,
ROUND(count_ap_not_required * 100.0 / NULLIF(count_subpoena, 0), 2) AS ap_not_required_percent,
ROUND(count_electron * 100.0 / NULLIF(count_subpoena, 0), 2) AS electron_percent,
ROUND(count_paper * 100.0 / NULLIF(count_subpoena, 0), 2) AS paper_percent,
ROUND(count_restrictions_applied * 100.0 / NULLIF(count_subpoena, 0), 2) AS restrictions_applied_percent,
ROUND(count_introduced_measures * 100.0 / NULLIF(count_subpoena, 0), 2) AS introduced_measures_percent,
'00' AS recruitment_id,
0 as rest,
'Осень' as spring_autumn,
1 AS org
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1
FULL OUTER JOIN t7 ON 1 = 1
FULL OUTER JOIN t8 ON 1 = 1
FULL OUTER JOIN t9 ON 1 = 1
FULL OUTER JOIN t10 ON 1 = 1
FULL OUTER JOIN t11 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>

View file

@ -557,147 +557,36 @@
</connection>
<order>
<hop>
<from>Get variables</from>
<to>Select values</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/все</from>
<to>Get variables</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values</from>
<to>Insert / update (total_registered.age)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 2</from>
<to>Select values 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины</from>
<to>Get variables 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 2 2</from>
<to>Select values 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины</from>
<to>Get variables 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 2</from>
<to>Insert / update (total_registered.age) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 2 2</from>
<to>Insert / update (total_registered.age) 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины</from>
<from>Table input (person_registry) РФ/женщины/на учете</from>
<to>Insert / update (total_registered.age) 3</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины</from>
<from>Table input (person_registry) РФ/мужчины/на учете</from>
<to>Insert / update (total_registered.age) 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/все</from>
<from>Table input (person_registry) РФ/все/на учете</from>
<to>Insert / update (total_registered.age)</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/все/не на учете</from>
<to>Insert / update (total_registered.age) 4</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины/не на учете</from>
<to>Insert / update (total_registered.age) 3 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины/не на учете</from>
<to>Insert / update (total_registered.age) 2 2</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>656</xloc>
<yloc>608</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>656</xloc>
<yloc>704</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>656</xloc>
<yloc>800</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.age)</name>
<type>InsertUpdate</type>
@ -988,6 +877,151 @@
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.age) 2 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>age</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>"17_yaers"</name>
<rename>17_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years"</name>
<rename>18-26_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years"</name>
<rename>27-30_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years"</name>
<rename>31-35_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years"</name>
<rename>36-40_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>"46-50_years"</name>
<rename>46-50_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"17_yaers_percent"</name>
<rename>17_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years_percent"</name>
<rename>18-26_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years_percent"</name>
<rename>27-30_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years_percent"</name>
<rename>31-35_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years_percent"</name>
<rename>36-40_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years_percent"</name>
<rename>41-45_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"46-50_years_percent"</name>
<rename>46-50_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years_percent"</name>
<rename>51+_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>672</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.age) 3</name>
<type>InsertUpdate</type>
@ -1134,8 +1168,8 @@
</GUI>
</step>
<step>
<name>Select values</name>
<type>SelectValues</type>
<name>Insert / update (total_registered.age) 3 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -1144,9 +1178,126 @@
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<select_unspecified>N</select_unspecified>
</fields>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>age</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>"17_yaers"</name>
<rename>17_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years"</name>
<rename>18-26_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years"</name>
<rename>27-30_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years"</name>
<rename>31-35_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years"</name>
<rename>36-40_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>"46-50_years"</name>
<rename>46-50_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"17_yaers_percent"</name>
<rename>17_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years_percent"</name>
<rename>18-26_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years_percent"</name>
<rename>27-30_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years_percent"</name>
<rename>31-35_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years_percent"</name>
<rename>36-40_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years_percent"</name>
<rename>41-45_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"46-50_years_percent"</name>
<rename>46-50_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years_percent"</name>
<rename>51+_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
@ -1156,14 +1307,14 @@
</output>
</remotesteps>
<GUI>
<xloc>800</xloc>
<yloc>608</yloc>
<xloc>1024</xloc>
<yloc>768</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 2</name>
<type>SelectValues</type>
<name>Insert / update (total_registered.age) 4</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -1172,9 +1323,126 @@
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<select_unspecified>N</select_unspecified>
</fields>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>age</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>"17_yaers"</name>
<rename>17_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years"</name>
<rename>18-26_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years"</name>
<rename>27-30_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years"</name>
<rename>31-35_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years"</name>
<rename>36-40_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years"</name>
<rename>41-45_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>"46-50_years"</name>
<rename>46-50_year_count</rename>
<update>Y</update>
</value>
<value>
<name>"17_yaers_percent"</name>
<rename>17_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"18-26_years_percent"</name>
<rename>18-26_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"27-30_years_percent"</name>
<rename>27-30_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"31-35_years_percent"</name>
<rename>31-35_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"36-40_years_percent"</name>
<rename>36-40_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"41-45_years_percent"</name>
<rename>41-45_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"46-50_years_percent"</name>
<rename>46-50_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>"51+_years_percent"</name>
<rename>51+_year_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
@ -1184,41 +1452,13 @@
</output>
</remotesteps>
<GUI>
<xloc>800</xloc>
<yloc>704</yloc>
<xloc>1024</xloc>
<yloc>576</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>800</xloc>
<yloc>800</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/все</name>
<name>Table input (person_registry) РФ/все/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -1299,7 +1539,88 @@ FROM age_counts, total_count;</sql>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/женщины</name>
<name>Table input (person_registry) РФ/все/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>WITH total_count AS (
SELECT COUNT(*) AS total
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
),
age_counts AS (
SELECT
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17) AS "17_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26) AS "18-26_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30) AS "27-30_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35) AS "31-35_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40) AS "36-40_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45) AS "41-45_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50) AS "46-50_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51) AS "51+_year_count"
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "51+_year_percent",
'00' as recruitment_id,
'ALL' as gender,
'false' as registered
FROM age_counts, total_count;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>576</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/женщины/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -1380,7 +1701,88 @@ FROM age_counts, total_count;</sql>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины</name>
<name>Table input (person_registry) РФ/женщины/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>WITH total_count AS (
SELECT COUNT(*) AS total
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.gender = 'FEMALE' AND r.vu_current_info->>'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
),
age_counts AS (
SELECT
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17) AS "17_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26) AS "18-26_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30) AS "27-30_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35) AS "31-35_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40) AS "36-40_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45) AS "41-45_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50) AS "46-50_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51) AS "51+_year_count"
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.gender = 'FEMALE' AND r.vu_current_info->>'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "51+_year_percent",
'00' as recruitment_id,
'W' as gender,
'false' as registered
FROM age_counts, total_count;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>768</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -1460,6 +1862,87 @@ FROM age_counts, total_count;</sql>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>WITH total_count AS (
SELECT COUNT(*) AS total
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.gender = 'MALE' AND r.vu_current_info->>'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
),
age_counts AS (
SELECT
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17) AS "17_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26) AS "18-26_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30) AS "27-30_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35) AS "31-35_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40) AS "36-40_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45) AS "41-45_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50) AS "46-50_year_count",
COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51) AS "51+_year_count"
FROM public.recruits r
join public.recruits_info ri on ri.recruit_id=r.id
WHERE r.gender = 'MALE' AND r.vu_current_info->>'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0),2) AS "51+_year_percent",
'00' as recruitment_id,
'M' as gender,
'false' as registered
FROM age_counts, total_count;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>672</yloc>
<draw>Y</draw>
</GUI>
</step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>

View file

@ -557,20 +557,35 @@
</connection>
<order>
<hop>
<from>Table input (person_registry) РФ/все</from>
<from>Table input (person_registry) РФ/все/на учете</from>
<to>Insert / update (total_registered.busyness)</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины</from>
<from>Table input (person_registry) РФ/мужчины/на учете</from>
<to>Insert / update (total_registered.busyness) 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины</from>
<from>Table input (person_registry) РФ/женщины/на учете</from>
<to>Insert / update (total_registered.busyness) 3</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/все/не на учете</from>
<to>Insert / update (total_registered.busyness) 4</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины/не на учете</from>
<to>Insert / update (total_registered.busyness) 3 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины/не на учете</from>
<to>Insert / update (total_registered.busyness) 2 2</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Insert / update (total_registered.busyness)</name>
@ -772,6 +787,106 @@
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.busyness) 2 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>busyness</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>study</name>
<rename>study</rename>
<update>Y</update>
</value>
<value>
<name>work</name>
<rename>work</rename>
<update>Y</update>
</value>
<value>
<name>study_percent</name>
<rename>study_percent</rename>
<update>Y</update>
</value>
<value>
<name>work_percent</name>
<rename>work_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>not_work</name>
<rename>not_work</rename>
<update>Y</update>
</value>
<value>
<name>not_work_percent</name>
<rename>not_work_percent</rename>
<update>Y</update>
</value>
<value>
<name>busyness</name>
<rename>total_people</rename>
<update>Y</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>672</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.busyness) 3</name>
<type>InsertUpdate</type>
@ -873,7 +988,207 @@
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/все</name>
<name>Insert / update (total_registered.busyness) 3 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>busyness</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>study</name>
<rename>study</rename>
<update>Y</update>
</value>
<value>
<name>work</name>
<rename>work</rename>
<update>Y</update>
</value>
<value>
<name>study_percent</name>
<rename>study_percent</rename>
<update>Y</update>
</value>
<value>
<name>work_percent</name>
<rename>work_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>not_work</name>
<rename>not_work</rename>
<update>Y</update>
</value>
<value>
<name>not_work_percent</name>
<rename>not_work_percent</rename>
<update>Y</update>
</value>
<value>
<name>busyness</name>
<rename>total_people</rename>
<update>Y</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>768</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.busyness) 4</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>Y</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>busyness</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>gender</name>
<field>"all_M_W"</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>registered</name>
<field>registered</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>study</name>
<rename>study</rename>
<update>Y</update>
</value>
<value>
<name>work</name>
<rename>work</rename>
<update>Y</update>
</value>
<value>
<name>study_percent</name>
<rename>study_percent</rename>
<update>Y</update>
</value>
<value>
<name>work_percent</name>
<rename>work_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>registered</name>
<rename>registered</rename>
<update>N</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>not_work</name>
<rename>not_work</rename>
<update>Y</update>
</value>
<value>
<name>not_work_percent</name>
<rename>not_work_percent</rename>
<update>Y</update>
</value>
<value>
<name>busyness</name>
<rename>total_people</rename>
<update>Y</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>576</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/все/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -999,7 +1314,133 @@ FROM summary;</sql>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/женщины</name>
<name>Table input (person_registry) РФ/все/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>-- в json отсутствует инфа об обучении в школе
WITH status_info AS (
SELECT
-- Проверка на обучение в вузе (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedVUZ'->'vuz') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedVUZ'->'vuz') AS vuz
WHERE vuz->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_vuz,
-- Проверка на обучение в колледже (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedKolledzh'->'kolledzh') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedKolledzh'->'kolledzh') AS kolledzh
WHERE kolledzh->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_college,
-- Проверка на работу (есть информация и работает)
(
CASE
WHEN jsonb_typeof(info->'svedTrud'->'trudDeyat') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedTrud'->'trudDeyat') AS trud
WHERE trud->>'prAktMestRab' = '1'
)
ELSE false
END
) AS is_working,
-- Проверка на отсутствие сведений о вузе
info->'svedVUZ'->>'prOtsSvedVUZ' = '1' AS no_info_vuz,
-- Проверка на отсутствие сведений о колледже
info->'svedKolledzh'->>'prOtsSvedKolledzh' = '1' AS no_info_college,
-- Проверка на отсутствие сведений о работе
info->'svedTrud'->>'prOtsSvedTrud' = '1' AS no_info_work
FROM public.recruits_info ri
JOIN public.recruits r ON ri.recruit_id = r.id
WHERE r.vu_current_info -> 'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
),
summary AS (
SELECT
-- Количество людей, которые учатся (в вузе или колледже)
COUNT(CASE WHEN is_studying_in_vuz OR is_studying_in_college THEN 1 END) AS study,
-- Количество людей, которые работают
COUNT(CASE WHEN is_working THEN 1 END) AS work,
-- Количество людей, которые ни учатся, ни работают
-- COUNT(CASE WHEN NOT is_studying_in_vuz AND NOT is_studying_in_college AND NOT is_working THEN 1 END) AS not_work,
-- Количество людей, для которых отсутствуют сведения о вузе, колледже и работе
COUNT(CASE WHEN no_info_vuz AND no_info_college AND no_info_work THEN 1 END) AS no_info,
-- Общее количество людей
COUNT(*) AS total_people
FROM status_info
)
SELECT
'ALL' as gender,
'false' as registered,
'00' as recruitment_id,
study,
work,
0 as not_work,
0 as not_work_percent,
total_people,
-- Процент людей, которые учатся
ROUND(study * 100.0 / NULLIF(total_people, 0), 2) AS study_percent,
-- Процент людей, которые работают
ROUND(work * 100.0 / NULLIF(total_people, 0), 2) AS work_percent
-- Процент людей, которые ни учатся, ни работают
-- ROUND(not_work * 100.0 / NULLIF(total_people, 0), 2) AS not_work_percent
-- Процент людей, для которых отсутствуют сведения
-- ROUND(no_info * 100.0 / NULLIF(total_people, 0), 2) AS no_info_percent
FROM summary;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>576</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/женщины/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -1126,7 +1567,134 @@ FROM summary;</sql>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины</name>
<name>Table input (person_registry) РФ/женщины/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>-- в json отсутствует инфа об обучении в школе
WITH status_info AS (
SELECT
-- Проверка на обучение в вузе (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedVUZ'->'vuz') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedVUZ'->'vuz') AS vuz
WHERE vuz->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_vuz,
-- Проверка на обучение в колледже (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedKolledzh'->'kolledzh') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedKolledzh'->'kolledzh') AS kolledzh
WHERE kolledzh->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_college,
-- Проверка на работу (есть информация и работает)
(
CASE
WHEN jsonb_typeof(info->'svedTrud'->'trudDeyat') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedTrud'->'trudDeyat') AS trud
WHERE trud->>'prAktMestRab' = '1'
)
ELSE false
END
) AS is_working,
-- Проверка на отсутствие сведений о вузе
info->'svedVUZ'->>'prOtsSvedVUZ' = '1' AS no_info_vuz,
-- Проверка на отсутствие сведений о колледже
info->'svedKolledzh'->>'prOtsSvedKolledzh' = '1' AS no_info_college,
-- Проверка на отсутствие сведений о работе
info->'svedTrud'->>'prOtsSvedTrud' = '1' AS no_info_work
FROM public.recruits_info ri
JOIN public.recruits r ON ri.recruit_id = r.id
WHERE r.vu_current_info -> 'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
AND gender = 'FEMALE'
),
summary AS (
SELECT
-- Количество людей, которые учатся (в вузе или колледже)
COUNT(CASE WHEN is_studying_in_vuz OR is_studying_in_college THEN 1 END) AS study,
-- Количество людей, которые работают
COUNT(CASE WHEN is_working THEN 1 END) AS work,
-- Количество людей, которые ни учатся, ни работают
-- COUNT(CASE WHEN NOT is_studying_in_vuz AND NOT is_studying_in_college AND NOT is_working THEN 1 END) AS not_work,
-- Количество людей, для которых отсутствуют сведения о вузе, колледже и работе
COUNT(CASE WHEN no_info_vuz AND no_info_college AND no_info_work THEN 1 END) AS no_info,
-- Общее количество людей
COUNT(*) AS total_people
FROM status_info
)
SELECT
'W' as gender,
'false' as registered,
'00' as recruitment_id,
0 as not_work,
0 as not_work_percent,
study,
work,
total_people,
-- Процент людей, которые учатся
ROUND(study * 100.0 / NULLIF(total_people, 0), 2) AS study_percent,
-- Процент людей, которые работают
ROUND(work * 100.0 / NULLIF(total_people, 0), 2) AS work_percent
-- Процент людей, которые ни учатся, ни работают
-- ROUND(not_work * 100.0 / NULLIF(total_people, 0), 2) AS not_work_percent
-- Процент людей, для которых отсутствуют сведения
-- ROUND(no_info * 100.0 / NULLIF(total_people, 0), 2) AS no_info_percent
FROM summary;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>768</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -1252,6 +1820,133 @@ FROM summary;</sql>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/мужчины/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>-- в json отсутствует инфа об обучении в школе
WITH status_info AS (
SELECT
-- Проверка на обучение в вузе (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedVUZ'->'vuz') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedVUZ'->'vuz') AS vuz
WHERE vuz->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_vuz,
-- Проверка на обучение в колледже (есть информация и обучается)
(
CASE
WHEN jsonb_typeof(info->'svedKolledzh'->'kolledzh') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedKolledzh'->'kolledzh') AS kolledzh
WHERE kolledzh->>'kodStatus' = '1'
)
ELSE false
END
) AS is_studying_in_college,
-- Проверка на работу (есть информация и работает)
(
CASE
WHEN jsonb_typeof(info->'svedTrud'->'trudDeyat') = 'array' THEN
EXISTS (
SELECT 1
FROM jsonb_array_elements(info->'svedTrud'->'trudDeyat') AS trud
WHERE trud->>'prAktMestRab' = '1'
)
ELSE false
END
) AS is_working,
-- Проверка на отсутствие сведений о вузе
info->'svedVUZ'->>'prOtsSvedVUZ' = '1' AS no_info_vuz,
-- Проверка на отсутствие сведений о колледже
info->'svedKolledzh'->>'prOtsSvedKolledzh' = '1' AS no_info_college,
-- Проверка на отсутствие сведений о работе
info->'svedTrud'->>'prOtsSvedTrud' = '1' AS no_info_work
FROM public.recruits_info ri
JOIN public.recruits r ON ri.recruit_id = r.id
WHERE r.vu_current_info -> 'isMilitaryRegistered' = 'false' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
AND gender = 'MALE'
),
summary AS (
SELECT
-- Количество людей, которые учатся (в вузе или колледже)
COUNT(CASE WHEN is_studying_in_vuz OR is_studying_in_college THEN 1 END) AS study,
-- Количество людей, которые работают
COUNT(CASE WHEN is_working THEN 1 END) AS work,
-- Количество людей, которые ни учатся, ни работают
-- COUNT(CASE WHEN NOT is_studying_in_vuz AND NOT is_studying_in_college AND NOT is_working THEN 1 END) AS not_work,
-- Количество людей, для которых отсутствуют сведения о вузе, колледже и работе
COUNT(CASE WHEN no_info_vuz AND no_info_college AND no_info_work THEN 1 END) AS no_info,
-- Общее количество людей
COUNT(*) AS total_people
FROM status_info
)
SELECT
'M' as gender,
'false' as registered,
'00' as recruitment_id,
0 as not_work_percent,
0 as not_work,
study,
work,
total_people,
-- Процент людей, которые учатся
ROUND(study * 100.0 / NULLIF(total_people, 0), 2) AS study_percent,
-- Процент людей, которые работают
ROUND(work * 100.0 / NULLIF(total_people, 0), 2) AS work_percent
-- Процент людей, которые ни учатся, ни работают
-- ROUND(not_work * 100.0 / NULLIF(total_people, 0), 2) AS not_work_percent
-- Процент людей, для которых отсутствуют сведения
-- ROUND(no_info * 100.0 / NULLIF(total_people, 0), 2) AS no_info_percent
FROM summary;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>400</xloc>
<yloc>672</yloc>
<draw>Y</draw>
</GUI>
</step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>

View file

@ -556,51 +556,6 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 4</from>
<to>Select values 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/все</from>
<to>Get variables 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4</from>
<to>Insert / update (total_registered.child_minor)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2</from>
<to>Select values 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/мужчины</from>
<to>Get variables 4 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2 2</from>
<to>Select values 4 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/женщины</from>
<to>Get variables 4 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2 2</from>
<to>Insert / update (total_registered.child_minor) 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2</from>
<to>Insert / update (total_registered.child_minor) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/женщины</from>
<to>Insert / update (total_registered.child_minor) 3</to>
@ -617,87 +572,6 @@
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 4</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>560</xloc>
<yloc>592</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 4 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>576</xloc>
<yloc>688</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 4 2 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>576</xloc>
<yloc>784</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.child_minor)</name>
<type>InsertUpdate</type>
@ -1010,90 +884,6 @@
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>752</xloc>
<yloc>592</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>768</xloc>
<yloc>688</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4 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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>752</xloc>
<yloc>784</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry)РФ/все</name>
<type>TableInput</type>

View file

@ -556,51 +556,6 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables</from>
<to>Select values</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/все</from>
<to>Get variables</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values</from>
<to>Insert / update (total_registered.driver_license) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 2</from>
<to>Select values 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 2</from>
<to>Insert / update (total_registered.driver_license) 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/мужчины</from>
<to>Get variables 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 2 2</from>
<to>Select values 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 2 2</from>
<to>Insert / update (total_registered.driver_license) 2 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины</from>
<to>Get variables 2 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/женщины</from>
<to>Insert / update (total_registered.driver_license) 2 2 2</to>
@ -617,87 +572,6 @@
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>848</xloc>
<yloc>496</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 2</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>848</xloc>
<yloc>592</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>848</xloc>
<yloc>688</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.driver_license) 2</name>
<type>InsertUpdate</type>
@ -1025,90 +899,6 @@
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>992</xloc>
<yloc>496</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>992</xloc>
<yloc>592</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>992</xloc>
<yloc>688</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/все</name>
<type>TableInput</type>

View file

@ -505,7 +505,7 @@
</attributes>
</connection>
<connection>
<name>postgres.person_registry</name>
<name>ervu_person_registry</name>
<server>person-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
@ -557,53 +557,16 @@
</connection>
<order>
<hop>
<from>Table input (person_registry) РФ</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 (total_registered.reg_mil_cat)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ</from>
<from>Table input (person_registry) РФ/на учете</from>
<to>Insert / update (total_registered.reg_mil_cat)</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (person_registry) РФ/не на учете</from>
<to>Insert / update (total_registered.reg_mil_cat) 2</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>448</xloc>
<yloc>416</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.reg_mil_cat)</name>
<type>InsertUpdate</type>
@ -713,14 +676,14 @@
</output>
</remotesteps>
<GUI>
<xloc>816</xloc>
<yloc>144</yloc>
<xloc>736</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values</name>
<type>SelectValues</type>
<name>Insert / update (total_registered.reg_mil_cat) 2</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -729,9 +692,95 @@
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<select_unspecified>N</select_unspecified>
</fields>
<connection>ervu-dashboard</connection>
<commit>100</commit>
<update_bypassed>N</update_bypassed>
<lookup>
<schema>total_registered</schema>
<table>reg_mil_cat</table>
<key>
<name>recruitment_id</name>
<field>recruitment_id</field>
<condition>=</condition>
<name2/>
</key>
<key>
<name>mil_reg</name>
<field>mil_reg</field>
<condition>=</condition>
<name2/>
</key>
<value>
<name>first_reg_17</name>
<rename>first_reg_17</rename>
<update>Y</update>
</value>
<value>
<name>first_reg_18</name>
<rename>first_reg_18</rename>
<update>Y</update>
</value>
<value>
<name>"mil_spec_W"</name>
<rename>mil_spec_w</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>returned_dep_liberty</name>
<rename>returned_dep_liberty</rename>
<update>Y</update>
</value>
<value>
<name>punished</name>
<rename>punished</rename>
<update>Y</update>
</value>
<value>
<name>received_citizenship</name>
<rename>received_citizenship</rename>
<update>Y</update>
</value>
<value>
<name>first_reg_17_percent</name>
<rename>first_reg_17_percent</rename>
<update>Y</update>
</value>
<value>
<name>first_reg_18_percent</name>
<rename>first_reg_18_percent</rename>
<update>Y</update>
</value>
<value>
<name>returned_dep_liberty_percent</name>
<rename>returned_dep_liberty_percent</rename>
<update>Y</update>
</value>
<value>
<name>"mil_spec_W_percent"</name>
<rename>mil_spec_w_percent</rename>
<update>Y</update>
</value>
<value>
<name>punished_percent</name>
<rename>punished_percent</rename>
<update>Y</update>
</value>
<value>
<name>received_citizenship_percent</name>
<rename>received_citizenship_percent</rename>
<update>Y</update>
</value>
<value>
<name>mil_reg</name>
<rename>mil_reg</rename>
<update>N</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
<remotesteps>
@ -741,13 +790,13 @@
</output>
</remotesteps>
<GUI>
<xloc>592</xloc>
<xloc>736</xloc>
<yloc>416</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ</name>
<name>Table input (person_registry) РФ/на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
@ -757,48 +806,88 @@
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>WITH
<connection>ervu_person_registry</connection>
<sql>WITH base_data AS (
-- Основной набор данных
SELECT
r.registration_reasons,
r.gender,
r.vu_current_info ->> 'isMilitaryRegistered' AS is_military_registered
FROM public.recruits r
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL
),
total AS (
-- Общее количество записей
SELECT COUNT(*) AS total_count
FROM base_data
),
t1 AS (
-- Первоначальная постановка 17 лет
SELECT COUNT(*) AS first_reg_17
FROM recruits r
WHERE r.system_pgs_status = '1'
AND AGE(CURRENT_DATE, r.birth_date) &lt; INTERVAL '18 years'
FROM base_data
WHERE registration_reasons @> '"5"'
),
t2 AS (
-- Первоначальная постановка совершеннолетние
-- Первоначальная постановка 18 лет
SELECT COUNT(*) AS first_reg_18
FROM recruits r
WHERE r.system_pgs_status = '1'
AND AGE(CURRENT_DATE, r.birth_date) >= INTERVAL '18 years'
FROM base_data
WHERE registration_reasons @> '"6"'
OR registration_reasons @> '"3"'
OR registration_reasons @> '"1"'
OR registration_reasons @> '"4"'
OR registration_reasons @> '"2"'
),
t3 AS (
-- Совершеннолетние женщины с ВУС
-- Женщины, получившие ВУС
SELECT COUNT(*) AS mil_spec_w
FROM recruits r
WHERE r.system_pgs_status = '1'
AND AGE(CURRENT_DATE, r.birth_date) >= INTERVAL '18 years'
AND r.gender = 'FEMALE'
FROM base_data
WHERE registration_reasons @> '"3"' AND gender = 'FEMALE'
),
t4 AS (
-- Возвратившиеся из мест лишения свободы
SELECT COUNT(*) AS returned_dep_liberty
FROM base_data
WHERE registration_reasons @> '"1"'
),
t5 AS (
-- Отбывающие наказание в местах лишения свободы
SELECT COUNT(*) AS punished
FROM base_data
WHERE registration_reasons @> '"4"'
),
t6 AS (
-- Получившие гражданство
SELECT COUNT(*) AS received_citizenship
FROM base_data
WHERE registration_reasons @> '"2"'
)
SELECT
t1.first_reg_17,
t2.first_reg_18,
t3.mil_spec_w,
'00' AS recruitment_id,
0 AS returned_dep_liberty,
0 AS punished,
0 AS received_citizenship,
0 AS first_reg_17_percent,
0 AS first_reg_18_percent,
0 AS returned_dep_liberty_percent,
0 AS mil_spec_w_percent,
0 AS punished_percent,
0 AS received_citizenship_percent,
1 AS mil_reg,
total.total_count,
t1.first_reg_17,
t2.first_reg_18,
t3.mil_spec_w,
t4.returned_dep_liberty,
t5.punished,
t6.received_citizenship,
-- Вычисление процентов
ROUND(t1.first_reg_17 * 100.0 / NULLIF(total.total_count, 0), 2) AS first_reg_17_percent,
ROUND(t2.first_reg_18 * 100.0 / NULLIF(total.total_count, 0), 2) AS first_reg_18_percent,
ROUND(t4.returned_dep_liberty * 100.0 / NULLIF(total.total_count, 0), 2) AS returned_dep_liberty_percent,
ROUND(t3.mil_spec_w * 100.0 / NULLIF(total.total_count, 0), 2) AS mil_spec_w_percent,
ROUND(t5.punished * 100.0 / NULLIF(total.total_count, 0), 2) AS punished_percent,
ROUND(t6.received_citizenship * 100.0 / NULLIF(total.total_count, 0), 2) AS received_citizenship_percent,
'00' AS recruitment_id,
1 AS mil_reg,
1 AS org
FROM t1
FROM total
FULL OUTER JOIN t1 ON 1 = 1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1;</sql>
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -813,8 +902,120 @@ FULL OUTER JOIN t3 ON 1 = 1;</sql>
</output>
</remotesteps>
<GUI>
<xloc>176</xloc>
<yloc>144</yloc>
<xloc>304</xloc>
<yloc>288</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input (person_registry) РФ/не на учете</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<sql>WITH base_data AS (
-- Основной набор данных
SELECT
r.registration_reasons,
r.gender,
r.vu_current_info ->> 'isMilitaryRegistered' AS is_military_registered
FROM public.recruits r
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL
),
total AS (
-- Общее количество записей
SELECT COUNT(*) AS total_count
FROM base_data
),
t1 AS (
-- Первоначальная постановка 17 лет
SELECT COUNT(*) AS first_reg_17
FROM base_data
WHERE registration_reasons @> '"5"'
),
t2 AS (
-- Первоначальная постановка 18 лет
SELECT COUNT(*) AS first_reg_18
FROM base_data
WHERE registration_reasons @> '"6"'
OR registration_reasons @> '"3"'
OR registration_reasons @> '"1"'
OR registration_reasons @> '"4"'
OR registration_reasons @> '"2"'
),
t3 AS (
-- Женщины, получившие ВУС
SELECT COUNT(*) AS mil_spec_w
FROM base_data
WHERE registration_reasons @> '"3"' AND gender = 'FEMALE'
),
t4 AS (
-- Возвратившиеся из мест лишения свободы
SELECT COUNT(*) AS returned_dep_liberty
FROM base_data
WHERE registration_reasons @> '"1"'
),
t5 AS (
-- Отбывающие наказание в местах лишения свободы
SELECT COUNT(*) AS punished
FROM base_data
WHERE registration_reasons @> '"4"'
),
t6 AS (
-- Получившие гражданство
SELECT COUNT(*) AS received_citizenship
FROM base_data
WHERE registration_reasons @> '"2"'
)
SELECT
total.total_count,
t1.first_reg_17,
t2.first_reg_18,
t3.mil_spec_w,
t4.returned_dep_liberty,
t5.punished,
t6.received_citizenship,
-- Вычисление процентов
ROUND(t1.first_reg_17 * 100.0 / NULLIF(total.total_count, 0), 2) AS first_reg_17_percent,
ROUND(t2.first_reg_18 * 100.0 / NULLIF(total.total_count, 0), 2) AS first_reg_18_percent,
ROUND(t4.returned_dep_liberty * 100.0 / NULLIF(total.total_count, 0), 2) AS returned_dep_liberty_percent,
ROUND(t3.mil_spec_w * 100.0 / NULLIF(total.total_count, 0), 2) AS mil_spec_w_percent,
ROUND(t5.punished * 100.0 / NULLIF(total.total_count, 0), 2) AS punished_percent,
ROUND(t6.received_citizenship * 100.0 / NULLIF(total.total_count, 0), 2) AS received_citizenship_percent,
'00' AS recruitment_id,
0 AS mil_reg,
1 AS org
FROM total
FULL OUTER JOIN t1 ON 1 = 1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
<variables_active>N</variables_active>
<lazy_conversion_active>N</lazy_conversion_active>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>304</xloc>
<yloc>416</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -556,101 +556,17 @@
</attributes>
</connection>
<order>
<hop>
<from>Get variables 4</from>
<to>Select values 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena)РФ/рег</from>
<to>Get variables 4</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4</from>
<to>Insert / update (total_registered.subpoenas)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 3</from>
<to>Select values 4 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 3</from>
<to>Insert / update (total_registered.subpoenas) 2</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) РФ/не рег</from>
<to>Get variables 4 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) РФ/не рег</from>
<to>Insert / update (total_registered.subpoenas) 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (subpoena)РФ/рег</from>
<to>Insert / update (total_registered.subpoenas)</to>
<from>Table input (subpoena) РФ/не рег</from>
<to>Insert / update (total_registered.subpoenas) 2</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Get variables 4</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>480</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Get variables 4 3</name>
<type>GetVariable</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>480</xloc>
<yloc>448</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Insert / update (total_registered.subpoenas)</name>
<type>InsertUpdate</type>
@ -682,12 +598,12 @@
</key>
<value>
<name>subpoena</name>
<rename>subpoena</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared</name>
<rename>appeared</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
@ -697,37 +613,37 @@
</value>
<value>
<name>not_appeared</name>
<rename>not_appeared</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_ap_good_reason</name>
<rename>not_ap_good_reason</rename>
<rename>count_not_ap_good_reason</rename>
<update>Y</update>
</value>
<value>
<name>introduced_measures</name>
<rename>introduced_measures</rename>
<rename>count_introduced_measures</rename>
<update>Y</update>
</value>
<value>
<name>ap_not_required</name>
<rename>ap_not_required</rename>
<rename>count_ap_not_required</rename>
<update>Y</update>
</value>
<value>
<name>electron</name>
<rename>electron</rename>
<rename>count_electron</rename>
<update>Y</update>
</value>
<value>
<name>paper</name>
<rename>paper</rename>
<rename>count_paper</rename>
<update>Y</update>
</value>
<value>
<name>restrictions_applied</name>
<rename>restrictions_applied</rename>
<rename>count_restrictions_applied</rename>
<update>Y</update>
</value>
<value>
@ -790,8 +706,8 @@
</output>
</remotesteps>
<GUI>
<xloc>864</xloc>
<yloc>64</yloc>
<xloc>672</xloc>
<yloc>272</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -826,12 +742,12 @@
</key>
<value>
<name>subpoena</name>
<rename>subpoena</rename>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared</name>
<rename>appeared</rename>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
@ -841,37 +757,37 @@
</value>
<value>
<name>not_appeared</name>
<rename>not_appeared</rename>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_ap_good_reason</name>
<rename>not_ap_good_reason</rename>
<rename>count_not_ap_good_reason</rename>
<update>Y</update>
</value>
<value>
<name>introduced_measures</name>
<rename>introduced_measures</rename>
<rename>count_introduced_measures</rename>
<update>Y</update>
</value>
<value>
<name>ap_not_required</name>
<rename>ap_not_required</rename>
<rename>count_ap_not_required</rename>
<update>Y</update>
</value>
<value>
<name>electron</name>
<rename>electron</rename>
<rename>count_electron</rename>
<update>Y</update>
</value>
<value>
<name>paper</name>
<rename>paper</rename>
<rename>count_paper</rename>
<update>Y</update>
</value>
<value>
<name>restrictions_applied</name>
<rename>restrictions_applied</rename>
<rename>count_restrictions_applied</rename>
<update>Y</update>
</value>
<value>
@ -933,65 +849,9 @@
<output>
</output>
</remotesteps>
<GUI>
<xloc>864</xloc>
<yloc>160</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>672</xloc>
<yloc>352</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Select values 4 3</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>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>672</xloc>
<yloc>448</yloc>
<yloc>432</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -1007,65 +867,124 @@
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoena FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='1' and sub_stat_hist.code ='3'),
t2 as (select round(avg(extract(day from subpoena_history.date_time::timestamp - (subpoena.send_date::timestamptz AT time zone 'UTC')::timestamp)), 1) as average_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type = '1' and (sub_stat_hist.code = '4.1' or sub_stat_hist.code = '4.2')),
t3 as (select count(distinct subpoena.id) as appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='1' and sub_stat_hist.code in ('4.1','4.2')),
t4 as (select count(distinct subpoena.id) as not_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='1' and sub_stat_hist.code ='5'),
t5 as (select count(*) as not_ap_good_reason FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='1' and sub_stat_hist.code='5.1'),
t6 as (select count(distinct subpoena.id) as ap_not_required FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type='1' and sub_stat_hist.code in ('3.8','5.2')),
t7 as (select count(distinct rdi.id) as restrictions_applied from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and subpoena_reason.type = '1'),
t8 as (select count(distinct rdi.id) as introduced_measures from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and rdi.applied_date is not null and subpoena_reason.type = '1'),
t9 as (select count(distinct subpoena.id) as paper FROM subpoena
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
join subpoena_send_info on subpoena_send_info.subpoena_id = subpoena.id
where subpoena_reason.type = '1' and subpoena_send_info.delivery_code = '14'),
t10 as (select count(distinct subpoena.id) as electron FROM subpoena
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
join subpoena_send_info on subpoena_send_info.subpoena_id = subpoena.id
where subpoena_reason.type = '1' and subpoena_send_info.delivery_code = '7')
select t1.subpoena, t2.average_appeared, t3.appeared, t4.not_appeared, t5.not_ap_good_reason, t6.ap_not_required, t7.restrictions_applied, t8.introduced_measures, t9.paper, t10.electron, '00' as recruitment_id, 1 as org, 0 as mil_reg,
0 as appeared_percent, 0 as not_appeared_percent, 0 as not_ap_good_reason_percent, 0 as ap_not_required_percent, 0 as electron_percent, 0 as paper_percent, 0 as restrictions_applied_percent, 0 as introduced_measures_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join t4 on 1 = 1 full outer join t5 on 1 = 1 full outer join t6 on 1 = 1 full outer join t7 on 1 = 1 full outer join t8 on 1 = 1 full outer join t9 on 1 = 1 full outer join t10 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM subpoena s
JOIN subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN subpoena_status AS ss ON ss.id = s.status_id
JOIN subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type = '1'
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t4 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
),
t5 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
FROM last_status
WHERE sub_stat_hist = '5.1'
),
t6 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
FROM last_status
WHERE sub_stat_hist IN ('3.8', '5.2')
),
t7 AS ( -- количество повесток по которым применены ограничения
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
FROM last_status
WHERE restr_dc IS NULL
),
t8 AS ( -- количество повесток по которым введены меры
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
FROM last_status
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
),
t9 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
FROM last_status
WHERE d_code = '14'
),
t10 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
FROM last_status
WHERE d_code = '7'
),
t11 AS (
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
FROM last_status
)
SELECT
t1.count_subpoena,
t2.average_appeared,
t3.count_appeared,
t4.count_not_appeared,
t5.count_not_ap_good_reason,
t6.count_ap_not_required,
t7.count_restrictions_applied,
t8.count_introduced_measures,
t9.count_paper,
t10.count_electron,
t11.count_restrictions,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_percent,
ROUND(count_not_ap_good_reason * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_ap_good_reason_percent,
ROUND(count_ap_not_required * 100.0 / NULLIF(count_subpoena, 0), 2) AS ap_not_required_percent,
ROUND(count_electron * 100.0 / NULLIF(count_subpoena, 0), 2) AS electron_percent,
ROUND(count_paper * 100.0 / NULLIF(count_subpoena, 0), 2) AS paper_percent,
ROUND(count_restrictions_applied * 100.0 / NULLIF(count_subpoena, 0), 2) AS restrictions_applied_percent,
ROUND(count_introduced_measures * 100.0 / NULLIF(count_subpoena, 0), 2) AS introduced_measures_percent,
'00' AS recruitment_id,
1 AS org,
0 AS mil_reg
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1
FULL OUTER JOIN t7 ON 1 = 1
FULL OUTER JOIN t8 ON 1 = 1
FULL OUTER JOIN t9 ON 1 = 1
FULL OUTER JOIN t10 ON 1 = 1
FULL OUTER JOIN t11 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -1080,8 +999,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join
</output>
</remotesteps>
<GUI>
<xloc>256</xloc>
<yloc>160</yloc>
<xloc>336</xloc>
<yloc>432</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -1097,65 +1016,124 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>with
t1 as (select count(distinct subpoena.id) as subpoena FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type !='1' and sub_stat_hist.code ='3'),
t2 as (select round(avg(extract(day from subpoena_history.date_time::timestamp - (subpoena.send_date::timestamptz AT time zone 'UTC')::timestamp)), 1) as average_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where subpoena_reason.type != '1' and (sub_stat_hist.code = '4.1' or sub_stat_hist.code = '4.2')),
t3 as (select count(distinct subpoena.id) as appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type !='1' and sub_stat_hist.code in ('4.1','4.2')),
t4 as (select count(distinct subpoena.id) as not_appeared FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type !='1' and sub_stat_hist.code ='5'),
t5 as (select count(*) as not_ap_good_reason FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type !='1' and sub_stat_hist.code='5.1'),
t6 as (select count(distinct subpoena.id) as ap_not_required FROM subpoena
JOIN subpoena_history ON subpoena_history.subpoena_id = subpoena.id
JOIN subpoena_status AS sub_status ON sub_status.id = subpoena.status_id
JOIN subpoena_status AS sub_stat_hist ON sub_stat_hist.id = subpoena_history.status_id
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
where not subpoena_reason.type !='1' and sub_stat_hist.code in ('3.8','5.2')),
t7 as (select count(distinct rdi.id) as restrictions_applied from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and subpoena_reason.type != '1'),
t8 as (select count(distinct rdi.id) as introduced_measures from restriction_document_item rdi
join restriction_document on restriction_document.id = rdi.restriction_document_create_id
join subpoena on subpoena.id = restriction_document.subpoena_id
join subpoena_reason on subpoena_reason.id = subpoena.reason_id
where rdi.restriction_document_cancel_id is null and rdi.applied_date is not null and subpoena_reason.type != '1'),
t9 as (select count(distinct subpoena.id) as paper FROM subpoena
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
join subpoena_send_info on subpoena_send_info.subpoena_id = subpoena.id
where subpoena_reason.type != '1' and subpoena_send_info.delivery_code = '14'),
t10 as (select count(distinct subpoena.id) as electron FROM subpoena
JOIN subpoena_reason ON subpoena_reason.id = subpoena.reason_id
join subpoena_send_info on subpoena_send_info.subpoena_id = subpoena.id
where subpoena_reason.type != '1' and subpoena_send_info.delivery_code = '7')
select t1.subpoena, t2.average_appeared, t3.appeared, t4.not_appeared, t5.not_ap_good_reason, t6.ap_not_required, t7.restrictions_applied, t8.introduced_measures, t9.paper, t10.electron, '00' as recruitment_id, 1 as org, 1 as mil_reg,
0 as appeared_percent, 0 as not_appeared_percent, 0 as not_ap_good_reason_percent, 0 as ap_not_required_percent, 0 as electron_percent, 0 as paper_percent, 0 as restrictions_applied_percent, 0 as introduced_measures_percent
from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join t4 on 1 = 1 full outer join t5 on 1 = 1 full outer join t6 on 1 = 1 full outer join t7 on 1 = 1 full outer join t8 on 1 = 1 full outer join t9 on 1 = 1 full outer join t10 on 1 = 1
</sql>
<sql>WITH subpoena_data AS (
SELECT
s.id AS subpoena_id,
s.status_id,
sr.type,
ssh.code AS sub_stat_hist,
s.send_date,
sh.date_time::timestamp AS history_date,
rdi.restriction_document_cancel_id AS restr_dc,
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn -- добавляем строку для получения последнего статуса
FROM subpoena s
JOIN subpoena_history AS sh ON sh.subpoena_id = s.id
JOIN subpoena_status AS ss ON ss.id = s.status_id
JOIN subpoena_status AS ssh ON ssh.id = sh.status_id
JOIN subpoena_reason AS sr ON sr.id = s.reason_id
LEFT JOIN restriction_document AS rd ON rd.subpoena_id = s.id
LEFT JOIN restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
LEFT JOIN subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
WHERE sr.type != '1'
),
-- фильтруем только последние статусы для каждой повестки
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1 -- выбираем только последнюю запись для каждой повестки
),
-- Подсчет различных метрик
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
FROM last_status
WHERE sub_stat_hist IS NOT NULL
),
t2 AS (
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t3 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
FROM last_status
WHERE sub_stat_hist = '4.1' OR sub_stat_hist = '4.2'
),
t4 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
FROM last_status
WHERE sub_stat_hist = '5'
),
t5 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
FROM last_status
WHERE sub_stat_hist = '5.1'
),
t6 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
FROM last_status
WHERE sub_stat_hist IN ('3.8', '5.2')
),
t7 AS ( -- количество повесток по которым применены ограничения
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
FROM last_status
WHERE restr_dc IS NULL
),
t8 AS ( -- количество повесток по которым введены меры
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
FROM last_status
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
),
t9 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
FROM last_status
WHERE d_code = '14'
),
t10 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
FROM last_status
WHERE d_code = '7'
),
t11 AS (
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
FROM last_status
)
SELECT
t1.count_subpoena,
t2.average_appeared,
t3.count_appeared,
t4.count_not_appeared,
t5.count_not_ap_good_reason,
t6.count_ap_not_required,
t7.count_restrictions_applied,
t8.count_introduced_measures,
t9.count_paper,
t10.count_electron,
t11.count_restrictions,
ROUND(count_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS appeared_percent,
ROUND(count_not_appeared * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_appeared_percent,
ROUND(count_not_ap_good_reason * 100.0 / NULLIF(count_subpoena, 0), 2) AS not_ap_good_reason_percent,
ROUND(count_ap_not_required * 100.0 / NULLIF(count_subpoena, 0), 2) AS ap_not_required_percent,
ROUND(count_electron * 100.0 / NULLIF(count_subpoena, 0), 2) AS electron_percent,
ROUND(count_paper * 100.0 / NULLIF(count_subpoena, 0), 2) AS paper_percent,
ROUND(count_restrictions_applied * 100.0 / NULLIF(count_subpoena, 0), 2) AS restrictions_applied_percent,
ROUND(count_introduced_measures * 100.0 / NULLIF(count_subpoena, 0), 2) AS introduced_measures_percent,
'00' AS recruitment_id,
1 AS org,
1 AS mil_reg
FROM t1
FULL OUTER JOIN t2 ON 1 = 1
FULL OUTER JOIN t3 ON 1 = 1
FULL OUTER JOIN t4 ON 1 = 1
FULL OUTER JOIN t5 ON 1 = 1
FULL OUTER JOIN t6 ON 1 = 1
FULL OUTER JOIN t7 ON 1 = 1
FULL OUTER JOIN t8 ON 1 = 1
FULL OUTER JOIN t9 ON 1 = 1
FULL OUTER JOIN t10 ON 1 = 1
FULL OUTER JOIN t11 ON 1 = 1;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -1170,8 +1148,8 @@ from t1 full outer join t2 on 1 = 1 full outer join t3 on 1 = 1 full outer join
</output>
</remotesteps>
<GUI>
<xloc>224</xloc>
<yloc>64</yloc>
<xloc>336</xloc>
<yloc>272</yloc>
<draw>Y</draw>
</GUI>
</step>