свежая версия со стенда
This commit is contained in:
parent
d288a7519e
commit
13aeb606dc
280 changed files with 75366 additions and 20884 deletions
|
|
@ -21,36 +21,11 @@
|
|||
<notepads>
|
||||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/женщины</from>
|
||||
<to>Insert / update (total_registered.driver_license) 2 2 2</to>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/мужчины</from>
|
||||
<to>Insert / update (total_registered.driver_license) 2 2</to>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/все</from>
|
||||
<to>Insert / update (total_registered.driver_license) 2</to>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Get variables 2 2</from>
|
||||
<to>Select values 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Get variables 2 2 2</from>
|
||||
<to>Select values 2 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Get variables 2 2 3</from>
|
||||
<to>Select values 2 2 3</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/все</from>
|
||||
<to>Get variables 2 2</to>
|
||||
|
|
@ -62,529 +37,40 @@
|
|||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/мужчины</from>
|
||||
<to>Get variables 2 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Select values 2 2 2</from>
|
||||
<to>Insert / update (total_registered.driver_license) 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (person_registry) РФ/женщины</from>
|
||||
<to>Get variables 2 2 3</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Select values 2 2 3</from>
|
||||
<to>Insert / update (total_registered.driver_license) 2 2 2</to>
|
||||
<from>Execute SQL script</from>
|
||||
<to>Table input (person_registry) РФ/все</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Insert / update (total_registered.driver_license) 2</name>
|
||||
<type>InsertUpdate</type>
|
||||
<name>Execute SQL script</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>"all_M_W"</field>
|
||||
<name>gender</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>total_registered</schema>
|
||||
<table>driver_license</table>
|
||||
<value>
|
||||
<name>"A"</name>
|
||||
<rename>a</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B"</name>
|
||||
<rename>b</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C"</name>
|
||||
<rename>c</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D"</name>
|
||||
<rename>d</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E"</name>
|
||||
<rename>e</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope</name>
|
||||
<rename>nope</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"A_repcent"</name>
|
||||
<rename>a_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B_repcent"</name>
|
||||
<rename>b_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C_repcent"</name>
|
||||
<rename>c_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D_repcent"</name>
|
||||
<rename>d_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E_repcent"</name>
|
||||
<rename>e_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"all_M_W"</name>
|
||||
<rename>gender</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope_repcent</name>
|
||||
<rename>nope_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>recruitment_id</name>
|
||||
<rename>recruitment_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>Y</update_bypassed>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>DELETE FROM total_registered.driver_license
|
||||
WHERE recording_date = current_date
|
||||
AND schema = 'Ministry'
|
||||
AND recruitment_id = '${REG_ID}'</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>128</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update (total_registered.driver_license) 2 2</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>"all_M_W"</field>
|
||||
<name>gender</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>total_registered</schema>
|
||||
<table>driver_license</table>
|
||||
<value>
|
||||
<name>"A"</name>
|
||||
<rename>a</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B"</name>
|
||||
<rename>b</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C"</name>
|
||||
<rename>c</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D"</name>
|
||||
<rename>d</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E"</name>
|
||||
<rename>e</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope</name>
|
||||
<rename>nope</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"A_repcent"</name>
|
||||
<rename>a_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B_repcent"</name>
|
||||
<rename>b_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C_repcent"</name>
|
||||
<rename>c_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D_repcent"</name>
|
||||
<rename>d_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E_repcent"</name>
|
||||
<rename>e_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope_repcent</name>
|
||||
<rename>nope_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"all_M_W"</name>
|
||||
<rename>gender</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>recruitment_id</name>
|
||||
<rename>recruitment_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>Y</update_bypassed>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>256</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update (total_registered.driver_license) 2 2 2</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>"all_M_W"</field>
|
||||
<name>gender</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>total_registered</schema>
|
||||
<table>driver_license</table>
|
||||
<value>
|
||||
<name>"A"</name>
|
||||
<rename>a</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B"</name>
|
||||
<rename>b</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C"</name>
|
||||
<rename>c</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D"</name>
|
||||
<rename>d</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E"</name>
|
||||
<rename>e</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope</name>
|
||||
<rename>nope</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"A_repcent"</name>
|
||||
<rename>a_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B_repcent"</name>
|
||||
<rename>b_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C_repcent"</name>
|
||||
<rename>c_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D_repcent"</name>
|
||||
<rename>d_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E_repcent"</name>
|
||||
<rename>e_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope_repcent</name>
|
||||
<rename>nope_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"all_M_W"</name>
|
||||
<rename>gender</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>recruitment_id</name>
|
||||
<rename>recruitment_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>Y</update_bypassed>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<xloc>608</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<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>postgres.person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH categorized AS (
|
||||
SELECT
|
||||
r.id,
|
||||
r.gender,
|
||||
-- Проверяем наличие хотя бы одной категории, используем DISTINCT для уникальных рекрутов
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%A%' THEN 1 ELSE 0 END) AS has_A,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%B%' THEN 1 ELSE 0 END) AS has_B,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%C%' THEN 1 ELSE 0 END) AS has_C,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%D%' THEN 1 ELSE 0 END) AS has_D,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%E%' THEN 1 ELSE 0 END) AS has_E
|
||||
FROM public.recruits_info ri
|
||||
JOIN public.recruits r ON ri.recruit_id = r.id
|
||||
LEFT JOIN jsonb_array_elements(ri.info->'svedVoditUdost'->'voditUdost'->'svedKat') AS cat ON true
|
||||
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
|
||||
AND r.current_recruitment_id IS NOT NULL
|
||||
AND r.target_recruitment_id IS NOT NULL
|
||||
GROUP BY r.id, r.gender
|
||||
),
|
||||
aggregated AS (
|
||||
SELECT
|
||||
'ALL' AS gender,
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
-- Считаем количество уникальных рекрутов с каждой категорией
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A > 0) AS a,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_B > 0) AS b,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_C > 0) AS c,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_D > 0) AS d,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_E > 0) AS e,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A = 0 AND has_B = 0 AND has_C = 0 AND has_D = 0 AND has_E = 0) AS nope,
|
||||
COUNT(DISTINCT r.id) AS total
|
||||
FROM categorized r
|
||||
)
|
||||
SELECT *,
|
||||
ROUND((a * 100.0) / NULLIF(total, 0), 2) AS a_percent,
|
||||
ROUND((b * 100.0) / NULLIF(total, 0), 2) AS b_percent,
|
||||
ROUND((c * 100.0) / NULLIF(total, 0), 2) AS c_percent,
|
||||
ROUND((d * 100.0) / NULLIF(total, 0), 2) AS d_percent,
|
||||
ROUND((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
|
||||
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
|
||||
FROM aggregated;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>128</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<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>postgres.person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH categorized AS (
|
||||
SELECT
|
||||
r.id,
|
||||
r.gender,
|
||||
-- Проверяем наличие хотя бы одной категории, используем DISTINCT для уникальных рекрутов
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%A%' THEN 1 ELSE 0 END) AS has_A,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%B%' THEN 1 ELSE 0 END) AS has_B,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%C%' THEN 1 ELSE 0 END) AS has_C,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%D%' THEN 1 ELSE 0 END) AS has_D,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%E%' THEN 1 ELSE 0 END) AS has_E
|
||||
FROM public.recruits_info ri
|
||||
JOIN public.recruits r ON ri.recruit_id = r.id
|
||||
LEFT JOIN jsonb_array_elements(ri.info->'svedVoditUdost'->'voditUdost'->'svedKat') AS cat ON true
|
||||
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
|
||||
AND r.current_recruitment_id IS NOT NULL
|
||||
AND r.target_recruitment_id IS NOT NULL
|
||||
AND r.gender = 'FEMALE'
|
||||
GROUP BY r.id, r.gender
|
||||
),
|
||||
aggregated AS (
|
||||
SELECT
|
||||
'W' AS gender,
|
||||
'${REG_ID}' as recruitment_id,
|
||||
-- Считаем количество уникальных рекрутов с каждой категорией
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A > 0) AS a,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_B > 0) AS b,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_C > 0) AS c,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_D > 0) AS d,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_E > 0) AS e,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A = 0 AND has_B = 0 AND has_C = 0 AND has_D = 0 AND has_E = 0) AS nope,
|
||||
COUNT(DISTINCT r.id) AS total
|
||||
FROM categorized r
|
||||
)
|
||||
SELECT *,
|
||||
ROUND((a * 100.0) / NULLIF(total, 0), 2) AS a_percent,
|
||||
ROUND((b * 100.0) / NULLIF(total, 0), 2) AS b_percent,
|
||||
ROUND((c * 100.0) / NULLIF(total, 0), 2) AS c_percent,
|
||||
ROUND((d * 100.0) / NULLIF(total, 0), 2) AS d_percent,
|
||||
ROUND((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
|
||||
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
|
||||
FROM aggregated;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<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>postgres.person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH categorized AS (
|
||||
SELECT
|
||||
r.id,
|
||||
r.gender,
|
||||
-- Проверяем наличие хотя бы одной категории, используем DISTINCT для уникальных рекрутов
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%A%' THEN 1 ELSE 0 END) AS has_A,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%B%' THEN 1 ELSE 0 END) AS has_B,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%C%' THEN 1 ELSE 0 END) AS has_C,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%D%' THEN 1 ELSE 0 END) AS has_D,
|
||||
MAX(CASE WHEN cat->>'kategoriya' like '%E%' THEN 1 ELSE 0 END) AS has_E
|
||||
FROM public.recruits_info ri
|
||||
JOIN public.recruits r ON ri.recruit_id = r.id
|
||||
LEFT JOIN jsonb_array_elements(ri.info->'svedVoditUdost'->'voditUdost'->'svedKat') AS cat ON true
|
||||
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
|
||||
AND r.current_recruitment_id IS NOT NULL
|
||||
AND r.target_recruitment_id IS NOT NULL
|
||||
AND r.gender = 'MALE'
|
||||
GROUP BY r.id, r.gender
|
||||
),
|
||||
aggregated AS (
|
||||
SELECT
|
||||
'M' AS gender,
|
||||
'${REG_ID}' as recruitment_id,
|
||||
-- Считаем количество уникальных рекрутов с каждой категорией
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A > 0) AS a,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_B > 0) AS b,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_C > 0) AS c,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_D > 0) AS d,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_E > 0) AS e,
|
||||
COUNT(DISTINCT r.id) FILTER (WHERE has_A = 0 AND has_B = 0 AND has_C = 0 AND has_D = 0 AND has_E = 0) AS nope,
|
||||
COUNT(DISTINCT r.id) AS total
|
||||
FROM categorized r
|
||||
)
|
||||
SELECT *,
|
||||
ROUND((a * 100.0) / NULLIF(total, 0), 2) AS a_percent,
|
||||
ROUND((b * 100.0) / NULLIF(total, 0), 2) AS b_percent,
|
||||
ROUND((c * 100.0) / NULLIF(total, 0), 2) AS c_percent,
|
||||
ROUND((d * 100.0) / NULLIF(total, 0), 2) AS d_percent,
|
||||
ROUND((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
|
||||
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
|
||||
FROM aggregated;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>256</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Get variables 2 2</name>
|
||||
<type>GetVariable</type>
|
||||
|
|
@ -614,8 +100,137 @@ FROM aggregated;</sql>
|
|||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>192</yloc>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update (total_registered.driver_license) 2</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>"all_M_W"</field>
|
||||
<name>gender</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>schema</field>
|
||||
<name>schema</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>convicts</field>
|
||||
<name>convicts</name>
|
||||
</key>
|
||||
<schema>total_registered</schema>
|
||||
<table>driver_license</table>
|
||||
<value>
|
||||
<name>"A"</name>
|
||||
<rename>a</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B"</name>
|
||||
<rename>b</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C"</name>
|
||||
<rename>c</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D"</name>
|
||||
<rename>d</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E"</name>
|
||||
<rename>e</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope</name>
|
||||
<rename>nope</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"A_repcent"</name>
|
||||
<rename>a_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"B_repcent"</name>
|
||||
<rename>b_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"C_repcent"</name>
|
||||
<rename>c_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"D_repcent"</name>
|
||||
<rename>d_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"E_repcent"</name>
|
||||
<rename>e_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>"all_M_W"</name>
|
||||
<rename>gender</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>nope_repcent</name>
|
||||
<rename>nope_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>recruitment_id</name>
|
||||
<rename>recruitment_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>schema</name>
|
||||
<rename>schema</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>convicts</name>
|
||||
<rename>convicts</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>total_count</name>
|
||||
<rename>total</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>Y</update_bypassed>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1584</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -668,13 +283,13 @@ FROM aggregated;</sql>
|
|||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>896</xloc>
|
||||
<yloc>192</yloc>
|
||||
<xloc>1312</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Get variables 2 2 2</name>
|
||||
<type>GetVariable</type>
|
||||
<name>Table input (person_registry) РФ/все</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -683,167 +298,79 @@ FROM aggregated;</sql>
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<fields>
|
||||
<field>
|
||||
<length>-1</length>
|
||||
<name>REG_ID</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<length>-1</length>
|
||||
<name>VK_ARRAY</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
</fields>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>SELECT
|
||||
COALESCE(SUM(total_count), 0) total,
|
||||
COALESCE(SUM("A"), 0) a,
|
||||
COALESCE(SUM("B"), 0) b,
|
||||
COALESCE(SUM("C"), 0) c,
|
||||
COALESCE(SUM("D"), 0) d,
|
||||
COALESCE(SUM("E"), 0) e,
|
||||
COALESCE(SUM(nope), 0) nope,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM("A") / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) a_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM("B") / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) b_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM("C") / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) c_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM("D") / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) d_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM("E") / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) e_percent, -- нет такой категории
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_count) > 0
|
||||
THEN ROUND((SUM(nope) / SUM(total_count) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) nope_percent,
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
"all_M_W" AS gender,
|
||||
convicts,
|
||||
'Ministry' AS schema
|
||||
FROM total_registered.driver_license
|
||||
WHERE recruitment_id = ANY ('${VK_ARRAY}')
|
||||
AND schema = 'Region'
|
||||
AND recording_date = CURRENT_DATE
|
||||
GROUP BY "all_M_W", convicts;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>304</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Select values 2 2 2</name>
|
||||
<type>SelectValues</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<fields>
|
||||
<select_unspecified>N</select_unspecified>
|
||||
<meta>
|
||||
<name>REG_ID</name>
|
||||
<rename>REG_ID</rename>
|
||||
<type>String</type>
|
||||
<length>-2</length>
|
||||
<precision>-2</precision>
|
||||
<conversion_mask/>
|
||||
<date_format_lenient>false</date_format_lenient>
|
||||
<date_format_locale/>
|
||||
<date_format_timezone/>
|
||||
<lenient_string_to_number>false</lenient_string_to_number>
|
||||
<encoding/>
|
||||
<decimal_symbol/>
|
||||
<grouping_symbol/>
|
||||
<currency_symbol/>
|
||||
<storage_type/>
|
||||
</meta>
|
||||
<meta>
|
||||
<name>VK_ARRAY</name>
|
||||
<rename>VK_ARRAY</rename>
|
||||
<type>String</type>
|
||||
<length>-2</length>
|
||||
<precision>-2</precision>
|
||||
<conversion_mask/>
|
||||
<date_format_lenient>false</date_format_lenient>
|
||||
<date_format_locale/>
|
||||
<date_format_timezone/>
|
||||
<lenient_string_to_number>false</lenient_string_to_number>
|
||||
<encoding/>
|
||||
<decimal_symbol/>
|
||||
<grouping_symbol/>
|
||||
<currency_symbol/>
|
||||
<storage_type/>
|
||||
</meta>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>896</xloc>
|
||||
<yloc>304</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Get variables 2 2 3</name>
|
||||
<type>GetVariable</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<fields>
|
||||
<field>
|
||||
<length>-1</length>
|
||||
<name>REG_ID</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<length>-1</length>
|
||||
<name>VK_ARRAY</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>464</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Select values 2 2 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>
|
||||
<meta>
|
||||
<name>REG_ID</name>
|
||||
<rename>REG_ID</rename>
|
||||
<type>String</type>
|
||||
<length>-2</length>
|
||||
<precision>-2</precision>
|
||||
<conversion_mask/>
|
||||
<date_format_lenient>false</date_format_lenient>
|
||||
<date_format_locale/>
|
||||
<date_format_timezone/>
|
||||
<lenient_string_to_number>false</lenient_string_to_number>
|
||||
<encoding/>
|
||||
<decimal_symbol/>
|
||||
<grouping_symbol/>
|
||||
<currency_symbol/>
|
||||
<storage_type/>
|
||||
</meta>
|
||||
<meta>
|
||||
<name>VK_ARRAY</name>
|
||||
<rename>VK_ARRAY</rename>
|
||||
<type>String</type>
|
||||
<length>-2</length>
|
||||
<precision>-2</precision>
|
||||
<conversion_mask/>
|
||||
<date_format_lenient>false</date_format_lenient>
|
||||
<date_format_locale/>
|
||||
<date_format_timezone/>
|
||||
<lenient_string_to_number>false</lenient_string_to_number>
|
||||
<encoding/>
|
||||
<decimal_symbol/>
|
||||
<grouping_symbol/>
|
||||
<currency_symbol/>
|
||||
<storage_type/>
|
||||
</meta>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>896</xloc>
|
||||
<yloc>464</yloc>
|
||||
<xloc>864</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue