+subpoena, temporary_measure

This commit is contained in:
Ruslan 2024-10-07 14:32:34 +03:00
parent aa93c87e07
commit 15fa09aeac
11 changed files with 3029 additions and 1437 deletions

View file

@ -799,8 +799,8 @@
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
s.recruit_id, -- Добавляем recruit_id, если оно существует в таблице s (subpoena)
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn
s.recruit_id, -- recruit_id добавляем, если есть
sh.date_time
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
@ -812,10 +812,22 @@
WHERE sr.type = '1'
AND EXTRACT(YEAR FROM AGE(s.date_birth)) BETWEEN 18 AND 30
),
last_status_data AS (
-- Выбираем последнюю дату истории для каждой subpoena
SELECT
s.subpoena_id,
MAX(s.history_date) AS last_history_date
FROM subpoena_data s
GROUP BY s.subpoena_id
),
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1
-- Соединяем таблицу с максимальной датой и оригинальные данные, чтобы выбрать последние записи
SELECT
sd.*
FROM subpoena_data sd
JOIN last_status_data lsd
ON sd.subpoena_id = lsd.subpoena_id
AND sd.history_date = lsd.last_history_date
),
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
@ -897,8 +909,8 @@ JOIN t4 ON true;</sql>
rdi.applied_date AS ap_date,
rdi.id AS rdi_id,
ssi.delivery_code AS d_code,
s.recruit_id, -- Добавляем recruit_id, если оно существует в таблице s (subpoena)
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn
s.recruit_id, -- recruit_id добавляем, если есть
sh.date_time
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
@ -910,10 +922,22 @@ JOIN t4 ON true;</sql>
WHERE sr.type = '1'
AND EXTRACT(YEAR FROM AGE(s.date_birth)) BETWEEN 18 AND 30
),
last_status_data AS (
-- Выбираем последнюю дату истории для каждой subpoena
SELECT
s.subpoena_id,
MAX(s.history_date) AS last_history_date
FROM subpoena_data s
GROUP BY s.subpoena_id
),
last_status AS (
SELECT *
FROM subpoena_data
WHERE rn = 1
-- Соединяем таблицу с максимальной датой и оригинальные данные, чтобы выбрать последние записи
SELECT
sd.*
FROM subpoena_data sd
JOIN last_status_data lsd
ON sd.subpoena_id = lsd.subpoena_id
AND sd.history_date = lsd.last_history_date
),
t1 AS (
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena

View file

@ -662,23 +662,65 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>WITH recruit_data AS (
<sql>WITH extracted_children AS (
SELECT
ri.recruit_id,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM
public.recruits_info ri
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
),
children_birth_dates AS (
SELECT
recruit_id,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'den')::int AS day,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'mesyacz')::int AS month,
(child::jsonb->'svedFLBS'->'dataRozhdDok'-&gt;&gt;'god')::int AS year
FROM
extracted_children
),
children_count AS (
SELECT
recruit_id,
COUNT(*) AS children_under_16
FROM
children_birth_dates
WHERE
AGE(make_date(year, month, day)) &lt; interval '16 years'
GROUP BY
recruit_id
),
recruit_data AS (
SELECT
COUNT(*) AS total_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
COUNT(*) FILTER (
WHERE (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 70
AND gender = 'MALE')
AND gender = 'MALE') -- мужчины от 18 до 70 лет
OR
(EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 45
AND gender = 'FEMALE')
AND gender = 'FEMALE') -- женщины от 18 до 45 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
AND COALESCE(cc.children_under_16, 0) &lt; 5 -- исключить рекрутов с 5 и более детьми младше 16 лет
) AS mobilization_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 30
AND gender = 'MALE'
) AS volunteer_criterion
FROM public.recruits r
AND gender = 'MALE' -- мужчины от 18 до 30 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
) AS volunteer_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 50
AND gender = 'MALE' -- мужчины от 18 до 50 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
AND ri.info->'svedSudim'->>'prOtsSvedSudim' = '1' -- признак отсутствия данных о судимости
) AS contract_criterion
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
LEFT JOIN children_count AS cc
ON r.id = cc.recruit_id
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL
@ -690,10 +732,10 @@ SELECT
'00' AS recruitment_id,
mobilization_criterion,
volunteer_criterion,
0 AS contract_criterion,
ROUND(mobilization_criterion::NUMERIC / total_count * 100, 2) AS mobilization_criterion_percent,
ROUND(volunteer_criterion::NUMERIC / total_count * 100, 2) AS volunteer_criterion_percent, -- неправильный критерий
0 AS contract_criterion_percent
contract_criterion,
ROUND(mobilization_criterion::NUMERIC / NULLIF(total_count, 0) * 100, 2) AS mobilization_criterion_percent,
ROUND(volunteer_criterion::NUMERIC / NULLIF(total_count, 0) * 100, 2) AS volunteer_criterion_percent,
ROUND(contract_criterion::NUMERIC / NULLIF(total_count, 0) * 100, 2) AS contract_criterion_percent
FROM recruit_data;</sql>
<limit>0</limit>
<lookup/>

View file

@ -667,39 +667,81 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>WITH recruit_data AS (
<sql>WITH extracted_children AS (
SELECT
ri.recruit_id,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM
public.recruits_info ri
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
),
children_birth_dates AS (
SELECT
recruit_id,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'den')::int AS day,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'mesyacz')::int AS month,
(child::jsonb->'svedFLBS'->'dataRozhdDok'-&gt;&gt;'god')::int AS year
FROM
extracted_children
),
children_count AS (
SELECT
recruit_id,
COUNT(*) AS children_under_16
FROM
children_birth_dates
WHERE
AGE(make_date(year, month, day)) &lt; interval '16 years'
GROUP BY
recruit_id
),
recruit_data AS (
SELECT
COUNT(*) AS waiting_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
COUNT(*) FILTER (
WHERE (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 70
AND gender = 'MALE')
AND gender = 'MALE') -- мужчины от 18 до 70 лет
OR
(EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 45
AND gender = 'FEMALE')
AND gender = 'FEMALE') -- женщины от 18 до 45 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
AND COALESCE(cc.children_under_16, 0) &lt; 5 -- исключить рекрутов с 5 и более детьми младше 16 лет
) AS mobilization_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 30
AND gender = 'MALE'
) AS volunteer_criterion
FROM public.recruits r
AND gender = 'MALE' -- мужчины от 18 до 30 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
) AS volunteer_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 50
AND gender = 'MALE' -- мужчины от 18 до 50 лет
AND (conscription IS NULL OR conscription = false) -- отсутствие отсрочки
AND ri.info->'svedSudim'->>'prOtsSvedSudim' = '1' -- признак отсутствия данных о судимости
) AS contract_criterion
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
LEFT JOIN children_count AS cc
ON r.id = cc.recruit_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
waiting_count,
ROUND(COALESCE((waiting_count::DECIMAL / NULLIF((SELECT COUNT(*) FROM public.recruits), 0) * 100), 0), 2) AS waiting_percent,
male_count,
female_count,
'00' AS recruitment_id,
mobilization_criterion,
volunteer_criterion,
0 AS contract_criterion,
ROUND(mobilization_criterion::NUMERIC / waiting_count * 100, 2) AS mobilization_criterion_percent,
ROUND(volunteer_criterion::NUMERIC / waiting_count * 100, 2) AS volunteer_criterion_percent,
0 AS contract_criterion_percent,
ROUND(COALESCE((waiting_count::DECIMAL / NULLIF((SELECT COUNT(*) FROM public.recruits), 0) * 100), 0), 2) AS waiting_percent
contract_criterion,
ROUND(mobilization_criterion::NUMERIC / NULLIF(waiting_count, 0) * 100, 2) AS mobilization_criterion_percent,
ROUND(volunteer_criterion::NUMERIC / NULLIF(waiting_count, 0) * 100, 2) AS volunteer_criterion_percent,
ROUND(contract_criterion::NUMERIC / NULLIF(waiting_count, 0) * 100, 2) AS contract_criterion_percent
FROM recruit_data;</sql>
<limit>0</limit>
<lookup/>

View file

@ -915,35 +915,41 @@
SELECT
r.id,
r.gender,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "A")') AS has_A,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "B")') AS has_B,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "C")') AS has_C,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "D")') AS has_D,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "E")') AS has_E
-- Проверяем наличие хотя бы одной категории, используем 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
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
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,
'00' as recruitment_id,
COUNT(*) FILTER (WHERE NOT has_A AND NOT has_B AND NOT has_C AND NOT has_D AND NOT has_E) AS nope,
COUNT(*) FILTER (WHERE has_A) AS a,
COUNT(*) FILTER (WHERE has_B) AS b,
COUNT(*) FILTER (WHERE has_C) AS c,
COUNT(*) FILTER (WHERE has_D) AS d,
COUNT(*) FILTER (WHERE has_E) AS e,
COUNT(*) AS total
FROM categorized
'00' 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((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent,
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((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
FROM aggregated;</sql>
<limit>0</limit>
<lookup/>
@ -980,35 +986,42 @@ FROM aggregated;</sql>
SELECT
r.id,
r.gender,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "A")') AS has_A,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "B")') AS has_B,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "C")') AS has_C,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "D")') AS has_D,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "E")') AS has_E
-- Проверяем наличие хотя бы одной категории, используем 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
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and gender = 'FEMALE' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
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,
'00' as recruitment_id,
COUNT(*) FILTER (WHERE NOT has_A AND NOT has_B AND NOT has_C AND NOT has_D AND NOT has_E) AS nope,
COUNT(*) FILTER (WHERE has_A) AS a,
COUNT(*) FILTER (WHERE has_B) AS b,
COUNT(*) FILTER (WHERE has_C) AS c,
COUNT(*) FILTER (WHERE has_D) AS d,
COUNT(*) FILTER (WHERE has_E) AS e,
COUNT(*) AS total
FROM categorized
-- Считаем количество уникальных рекрутов с каждой категорией
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((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent,
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((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
FROM aggregated;</sql>
<limit>0</limit>
<lookup/>
@ -1045,35 +1058,42 @@ FROM aggregated;</sql>
SELECT
r.id,
r.gender,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "A")') AS has_A,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "B")') AS has_B,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "C")') AS has_C,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "D")') AS has_D,
jsonb_path_exists(ri.info, '$.svedVoditUdost.voditUdost.svedKat[*]?(@.kategoriya like_regex "E")') AS has_E
-- Проверяем наличие хотя бы одной категории, используем 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
where r.vu_current_info -> 'isMilitaryRegistered' = 'true' and gender = 'MALE' and r.current_recruitment_id is not null and r.target_recruitment_id is not null
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,
'00' as recruitment_id,
COUNT(*) FILTER (WHERE NOT has_A AND NOT has_B AND NOT has_C AND NOT has_D AND NOT has_E) AS nope,
COUNT(*) FILTER (WHERE has_A) AS a,
COUNT(*) FILTER (WHERE has_B) AS b,
COUNT(*) FILTER (WHERE has_C) AS c,
COUNT(*) FILTER (WHERE has_D) AS d,
COUNT(*) FILTER (WHERE has_E) AS e,
COUNT(*) AS total
FROM categorized
-- Считаем количество уникальных рекрутов с каждой категорией
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((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent,
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((e * 100.0) / NULLIF(total, 0), 2) AS e_percent,
ROUND((nope * 100.0) / NULLIF(total, 0), 2) AS nope_percent
FROM aggregated;</sql>
<limit>0</limit>
<lookup/>

View file

@ -555,80 +555,9 @@
</attribute>
</attributes>
</connection>
<connection>
<name>postgres.person_registry</name>
<server>person-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
<database>person-dbname</database>
<port>4444</port>
<username>person-dbuser</username>
<password>Encrypted 2be98afb80fd5818ba554aa72ce93bcc9</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>4444</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 2 (person_registry)</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Merge join</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input (decision-document-service) РФ</from>
<to>Sort rows 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows 2</from>
<to>Merge join</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Merge join</from>
<to>Insert / update (total_registered.removed_registry)</to>
<enabled>Y</enabled>
</hop>
@ -683,7 +612,7 @@
</value>
<value>
<name>living_abroad</name>
<rename>travel_abroad</rename>
<rename>living_abroad</rename>
<update>Y</update>
</value>
<value>
@ -736,126 +665,8 @@
</output>
</remotesteps>
<GUI>
<xloc>1024</xloc>
<yloc>80</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Merge join</name>
<type>MergeJoin</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<join_type>FULL OUTER</join_type>
<step1>Sort rows 2</step1>
<step2>Sort rows</step2>
<keys_1>
<key>org</key>
</keys_1>
<keys_2>
<key>org</key>
</keys_2>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>560</xloc>
<yloc>80</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Sort rows</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<directory>%%java.io.tmpdir%%</directory>
<prefix>out</prefix>
<sort_size>1000000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>N</unique_rows>
<fields>
<field>
<name>org</name>
<ascending>Y</ascending>
<case_sensitive>N</case_sensitive>
<collator_enabled>N</collator_enabled>
<collator_strength>0</collator_strength>
<presorted>N</presorted>
</field>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>448</xloc>
<yloc>192</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Sort rows 2</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<directory>%%java.io.tmpdir%%</directory>
<prefix>out</prefix>
<sort_size>1000000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>N</unique_rows>
<fields>
<field>
<name>org</name>
<ascending>Y</ascending>
<case_sensitive>N</case_sensitive>
<collator_enabled>N</collator_enabled>
<collator_strength>0</collator_strength>
<presorted>N</presorted>
</field>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>464</xloc>
<yloc>80</yloc>
<xloc>912</xloc>
<yloc>224</yloc>
<draw>Y</draw>
</GUI>
</step>
@ -871,56 +682,30 @@
<schema_name/>
</partitioning>
<connection>postgres.decision-document-service</connection>
<sql>with t1 as
(select count(*) as age_limit
from public.decision d --(БД решений)
inner join public.decision_type dt on dt.id = d.type_id and dt.code = '9'
where d.extra_info -> 'cause' = '"ageLimit"') ,
t2 as (select count(*) as death
from public.decision d --(БД решений)
inner join public.decision_type dt on dt.id = d.type_id and dt.code = '9'
where d.extra_info -> 'cause' = '"notAlive"')
select t1.age_limit, t2.death, 1 as org, '00' as recruitment_id, 0 as deprivation_citizenship, 0 as travel_abroad, 0 as living_abroad, 0 as other,
0 as deprivation_citizen_percents, 0 as age_limit_percent, 0 as death_percent, 0 as travel_abroad_percent, 0 as living_abroad_percent, 0 as other_percent
from t1 full outer join t2 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>208</xloc>
<yloc>80</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table input 2 (person_registry)</name>
<type>TableInput</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>SELECT COUNT(*) AS removed_registry,
1 AS org
FROM public.recruits r
<sql>SELECT
COUNT(*) AS removed_registry,
COUNT(CASE WHEN d.extra_info ->> 'cause' = 'ageLimit' THEN 1 END) AS age_limit, -- Количество по причине предельный возраст
COUNT(CASE WHEN d.extra_info ->> 'cause' = 'notAlive' THEN 1 END) AS death, -- Количество по причине смерть
'0' AS deprivation_citizenship,
'0' AS travel_abroad,
'0' AS living_abroad,
'0' AS other,
'0' AS deprivation_citizen_percents,
ROUND(COUNT(CASE WHEN d.extra_info ->> 'cause' = 'ageLimit' THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2) AS age_limit_percent,
ROUND(COUNT(CASE WHEN d.extra_info ->> 'cause' = 'notAlive' THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2) AS death_percent,
'0' AS travel_abroad_percent,
'0' AS living_abroad_percent,
'0' AS other_percent,
'00' AS recruitment_id
FROM public.recruit AS r
JOIN public.decision AS d
ON d.recruit_id = r.id
JOIN public.decision_type AS dt
ON dt.id = d.type_id
WHERE r.system_pgs_status = '1.3'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL</sql>
AND r.current_recruitment IS NOT NULL
AND r.target_recruitment IS NOT NULL
AND dt.code = '9'</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>
@ -935,8 +720,8 @@ WHERE r.system_pgs_status = '1.3'
</output>
</remotesteps>
<GUI>
<xloc>208</xloc>
<yloc>192</yloc>
<xloc>464</xloc>
<yloc>224</yloc>
<draw>Y</draw>
</GUI>
</step>

View file

@ -360,8 +360,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>320</xloc>
<yloc>432</yloc>
<xloc>368</xloc>
<yloc>624</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -372,8 +372,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>1008</xloc>
<yloc>432</yloc>
<xloc>1056</xloc>
<yloc>624</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -410,8 +410,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>112</yloc>
<xloc>784</xloc>
<yloc>256</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -428,8 +428,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>112</yloc>
<xloc>640</xloc>
<yloc>256</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -446,8 +446,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>48</yloc>
<xloc>640</xloc>
<yloc>192</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -464,8 +464,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>176</yloc>
<xloc>640</xloc>
<yloc>320</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -482,8 +482,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>240</yloc>
<xloc>640</xloc>
<yloc>384</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -520,8 +520,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>48</yloc>
<xloc>784</xloc>
<yloc>192</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -558,8 +558,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>176</yloc>
<xloc>784</xloc>
<yloc>320</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -596,8 +596,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>240</yloc>
<xloc>784</xloc>
<yloc>384</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -614,8 +614,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>304</yloc>
<xloc>640</xloc>
<yloc>448</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -652,8 +652,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>304</yloc>
<xloc>784</xloc>
<yloc>448</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -670,8 +670,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>368</yloc>
<xloc>640</xloc>
<yloc>512</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -708,8 +708,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>368</yloc>
<xloc>784</xloc>
<yloc>512</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -726,8 +726,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>432</yloc>
<xloc>640</xloc>
<yloc>576</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -764,8 +764,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>432</yloc>
<xloc>784</xloc>
<yloc>576</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -782,8 +782,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>496</yloc>
<xloc>640</xloc>
<yloc>640</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -820,8 +820,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>496</yloc>
<xloc>784</xloc>
<yloc>640</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -838,8 +838,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>560</yloc>
<xloc>640</xloc>
<yloc>704</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -876,8 +876,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>560</yloc>
<xloc>784</xloc>
<yloc>704</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -894,8 +894,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>624</yloc>
<xloc>640</xloc>
<yloc>768</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -932,8 +932,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>624</yloc>
<xloc>784</xloc>
<yloc>768</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -950,8 +950,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>688</yloc>
<xloc>640</xloc>
<yloc>832</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -988,8 +988,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>688</yloc>
<xloc>784</xloc>
<yloc>832</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1006,8 +1006,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>752</yloc>
<xloc>640</xloc>
<yloc>896</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1044,8 +1044,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>752</yloc>
<xloc>784</xloc>
<yloc>896</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1062,8 +1062,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>816</yloc>
<xloc>640</xloc>
<yloc>960</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1100,8 +1100,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>816</yloc>
<xloc>784</xloc>
<yloc>960</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1118,8 +1118,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>880</yloc>
<xloc>640</xloc>
<yloc>1024</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1156,8 +1156,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>880</yloc>
<xloc>784</xloc>
<yloc>1024</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1174,8 +1174,8 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>592</xloc>
<yloc>944</yloc>
<xloc>640</xloc>
<yloc>1088</yloc>
<attributes_kjc/>
</entry>
<entry>
@ -1212,8 +1212,120 @@
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>736</xloc>
<yloc>944</yloc>
<xloc>784</xloc>
<yloc>1088</yloc>
<attributes_kjc/>
</entry>
<entry>
<name>SQL.subpoena</name>
<description/>
<type>SQL</type>
<attributes/>
<sql>delete from ervu_dashboard.subpoena</sql>
<useVariableSubstitution>F</useVariableSubstitution>
<sqlfromfile>F</sqlfromfile>
<sqlfilename/>
<sendOneStatement>F</sendOneStatement>
<connection>ervu-dashboard</connection>
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>640</xloc>
<yloc>1152</yloc>
<attributes_kjc/>
</entry>
<entry>
<name>subpoena</name>
<description/>
<type>TRANS</type>
<attributes/>
<specification_method>filename</specification_method>
<trans_object_id/>
<filename>${Internal.Entry.Current.Directory}/subpoena.ktr</filename>
<transname/>
<arg_from_previous>N</arg_from_previous>
<params_from_previous>N</params_from_previous>
<exec_per_row>N</exec_per_row>
<clear_rows>Y</clear_rows>
<clear_files>N</clear_files>
<set_logfile>N</set_logfile>
<logfile/>
<logext/>
<add_date>N</add_date>
<add_time>N</add_time>
<loglevel>Basic</loglevel>
<cluster>N</cluster>
<slave_server_name/>
<set_append_logfile>N</set_append_logfile>
<wait_until_finished>Y</wait_until_finished>
<follow_abort_remote>N</follow_abort_remote>
<create_parent_folder>N</create_parent_folder>
<logging_remote_work>N</logging_remote_work>
<run_configuration>Pentaho local</run_configuration>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>784</xloc>
<yloc>1152</yloc>
<attributes_kjc/>
</entry>
<entry>
<name>SQL.tempmeas</name>
<description/>
<type>SQL</type>
<attributes/>
<sql>delete from ervu_dashboard.temporary_measures</sql>
<useVariableSubstitution>F</useVariableSubstitution>
<sqlfromfile>F</sqlfromfile>
<sqlfilename/>
<sendOneStatement>F</sendOneStatement>
<connection>ervu-dashboard</connection>
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>640</xloc>
<yloc>1216</yloc>
<attributes_kjc/>
</entry>
<entry>
<name>temporary_measure</name>
<description/>
<type>TRANS</type>
<attributes/>
<specification_method>filename</specification_method>
<trans_object_id/>
<filename>${Internal.Entry.Current.Directory}/temporary_measure.ktr</filename>
<transname/>
<arg_from_previous>N</arg_from_previous>
<params_from_previous>N</params_from_previous>
<exec_per_row>N</exec_per_row>
<clear_rows>Y</clear_rows>
<clear_files>N</clear_files>
<set_logfile>N</set_logfile>
<logfile/>
<logext/>
<add_date>N</add_date>
<add_time>N</add_time>
<loglevel>Basic</loglevel>
<cluster>N</cluster>
<slave_server_name/>
<set_append_logfile>N</set_append_logfile>
<wait_until_finished>Y</wait_until_finished>
<follow_abort_remote>N</follow_abort_remote>
<create_parent_folder>N</create_parent_folder>
<logging_remote_work>N</logging_remote_work>
<run_configuration>Pentaho local</run_configuration>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<parallel>N</parallel>
<draw>Y</draw>
<nr>0</nr>
<xloc>784</xloc>
<yloc>1216</yloc>
<attributes_kjc/>
</entry>
</entries>
@ -1623,6 +1735,60 @@
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>SQL.subpoena</from>
<to>subpoena</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>subpoena</from>
<to>Success</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>Start</from>
<to>SQL.subpoena</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
<hop>
<from>SQL.tempmeas</from>
<to>temporary_measure</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>Start</from>
<to>SQL.tempmeas</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
<hop>
<from>temporary_measure</from>
<to>Success</to>
<from_nr>0</from_nr>
<to_nr>0</to_nr>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
</hops>
<notepads>
</notepads>

View file

@ -0,0 +1,691 @@
<?xml version="1.0" encoding="UTF-8"?>
<transformation>
<info>
<name>subpoena</name>
<description/>
<extended_description/>
<trans_version/>
<trans_type>Normal</trans_type>
<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>
</slaveservers>
<clusterschemas>
</clusterschemas>
<created_user>-</created_user>
<created_date>2024/08/15 14:02:51.713</created_date>
<modified_user>-</modified_user>
<modified_date>2024/08/15 14:02:51.713</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.subpoena</name>
<server>subpoena-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
<database>subpoena-dbname</database>
<port>5555</port>
<username>subpoena-dbuser</username>
<password>Encrypted 2beebdaaa1ac8978aaa54aa72ce93bcc9</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>5555</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</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql> SELECT
s.id AS subpoena_id, -- идентификатор повестки
s.recruit_id, -- идентификатор рекрута
s.department_id, -- идентификатор ВК
s.series, -- серия повестки
s.create_date, -- дата создания повестки
s.number, -- номер повестки
s.send_date, -- дата направления повестки
s.sig_info, -- открепленная ЭП
sr.name AS subpoena_reason, -- причина вызова по повестке
s.full_name_responsible_user AS fio_commiss, -- фио комиссара
s.recruitment_name, -- наименование военного комиссариата, направившего повестку
rt.address, -- адрес, по которому нужно явиться по повестке
s.visit_date, -- дата и время явки в ВК
ssi.track_number, -- уникальный номер заказного почтового отправления, которым направлена повестка
ss.name AS subpoena_status, -- статус повестки
ssi.act_number, -- номер акта об отказе во вручении повестки
ssi.delivery_fio, -- фио лица, оповестившего гражданина о последствиях отказа от получения повестки
CASE
WHEN ssi.is_delivered = true THEN ssi.delivery_date
ELSE NULL
END AS delivery_date, -- дата вручения
CASE
WHEN ssi.is_delivered = true THEN 'Вручена'
WHEN ssi.is_delivered = false THEN 'Не вручена'
ELSE 'Нет информации'
END AS delivery_status, -- признак вручения повестки
CASE
WHEN sd.type = 'DIRECTION' THEN sd.name
ELSE NULL
END AS method_sending, -- способ направления повестки
CASE
WHEN sd.type = 'DELIVERY' THEN sd.name
ELSE NULL
END AS method_delivery, -- способ вручения повестки
CASE
WHEN sa.fact_appearance = true THEN 'Явился'
WHEN sa.fact_appearance = false THEN 'Не явился'
ELSE 'Нет информации'
END AS appearance_status, -- признак явки или неявки
CASE
WHEN ss.code = '5.1' THEN 'Неявка по уважительной причине'
WHEN ss.code = '5' THEN 'Гражданин не явился'
ELSE NULL
END AS appearance -- уважительная или нет причина
-- нет версии повестки
FROM public.subpoena AS s
LEFT JOIN public.subpoena_reason AS sr
ON sr.id = s.reason_id
LEFT JOIN public.recruitment AS rt
ON rt.id = s.department_id
LEFT JOIN public.subpoena_send_info AS ssi
ON ssi.subpoena_id = s.id
LEFT JOIN public.send_dictionary AS sd
ON sd.code = ssi.send_code
LEFT JOIN public.subpoena_status AS ss
ON ss.id = s.status_id
LEFT JOIN public.subpoena_appearance AS sa
ON sa.subpoena_id = s.id;</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>208</xloc>
<yloc>208</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table output</name>
<type>TableOutput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<schema>ervu_dashboard</schema>
<table>subpoena</table>
<commit>1000</commit>
<truncate>N</truncate>
<ignore_errors>N</ignore_errors>
<use_batch>Y</use_batch>
<specify_fields>N</specify_fields>
<partitioning_enabled>N</partitioning_enabled>
<partitioning_field/>
<partitioning_daily>N</partitioning_daily>
<partitioning_monthly>Y</partitioning_monthly>
<tablename_in_field>N</tablename_in_field>
<tablename_field/>
<tablename_in_table>Y</tablename_in_table>
<return_keys>N</return_keys>
<return_field/>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>416</xloc>
<yloc>208</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

@ -0,0 +1,674 @@
<?xml version="1.0" encoding="UTF-8"?>
<transformation>
<info>
<name>temporary_measure</name>
<description/>
<extended_description/>
<trans_version/>
<trans_type>Normal</trans_type>
<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>
</slaveservers>
<clusterschemas>
</clusterschemas>
<created_user>-</created_user>
<created_date>2024/08/15 14:02:51.713</created_date>
<modified_user>-</modified_user>
<modified_date>2024/08/15 14:02:51.713</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.subpoena</name>
<server>subpoena-dbhost</server>
<type>POSTGRESQL</type>
<access>Native</access>
<database>subpoena-dbname</database>
<port>5555</port>
<username>subpoena-dbuser</username>
<password>Encrypted 2beebdaaa1ac8978aaa54aa72ce93bcc9</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>5555</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</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
</order>
<step>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>postgres.subpoena</connection>
<sql>SELECT
rd.subpoena_id,
rd.vk_id AS recruitment_id,
s.recruit_id,
rds.name AS status_measure, -- статус временной меры
rd.recruitment_name, -- наименоване ВК
rdi.cancel_date, -- дата, с которой отменена временная мера
rn.name AS restriction_name, -- наименование ограничения (тип временной меры)
CASE
WHEN rd.type='CREATE' THEN 'Применение временной меры'
WHEN rd.type='CANCEL' THEN 'Отмена временной меры'
END AS type, -- тип документа ограничения
CASE
WHEN rd.type='CREATE' THEN rd.decision_number
ELSE NULL
END AS decision_number_create, -- номер решения о применении временной меры
CASE
WHEN rd.type='CANCEL' THEN rd.decision_number
ELSE NULL
END AS decision_number_cancel, -- номер решения об отмене временной меры
CASE
WHEN rd.type='CREATE' THEN rd.decision_date
ELSE NULL
END AS decision_date_create, -- дата решения о применении временной меры
CASE
WHEN rd.type='CANCEL' THEN rd.decision_date
ELSE NULL
END AS decision_date_cancel, -- дата решения об отмене временной меры
CASE
WHEN rdi.applied_fact = 'true' THEN 'Временная мера применена'
WHEN rdi.applied_fact = 'false' THEN 'Временная мера не применена'
ELSE 'Нет информации'
END AS applied_fact -- факт применения временной меры
FROM public.restriction_document AS rd
LEFT JOIN public.restriction_document_item AS rdi
ON rdi.restriction_document_create_id = rd.id
LEFT JOIN public.restriction AS rn
ON rn.id = rdi.restriction_id
LEFT JOIN public.restriction_document_status AS rds
ON rds.code = rd.status
LEFT JOIN public.subpoena AS s
ON s.id = rd.subpoena_id</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>208</xloc>
<yloc>208</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Table output</name>
<type>TableOutput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<schema>ervu_dashboard</schema>
<table>temporary_measures</table>
<commit>1000</commit>
<truncate>N</truncate>
<ignore_errors>N</ignore_errors>
<use_batch>Y</use_batch>
<specify_fields>N</specify_fields>
<partitioning_enabled>N</partitioning_enabled>
<partitioning_field/>
<partitioning_daily>N</partitioning_daily>
<partitioning_monthly>Y</partitioning_monthly>
<tablename_in_field>N</tablename_in_field>
<tablename_field/>
<tablename_in_table>Y</tablename_in_table>
<return_keys>N</return_keys>
<return_field/>
<fields>
</fields>
<attributes/>
<cluster_schema/>
<remotesteps>
<input>
</input>
<output>
</output>
</remotesteps>
<GUI>
<xloc>416</xloc>
<yloc>208</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

@ -785,18 +785,77 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>WITH recruit_data AS (
<sql>WITH extracted_children AS (
SELECT
ri.recruit_id,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
AND r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NOT NULL AND '${VK_ARRAY}' != ''
AND r.target_recruitment_id = ANY (
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN ARRAY[]::uuid[]
ELSE string_to_array(trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ',')::uuid[]
END
)
)
),
children_birth_dates AS (
SELECT
recruit_id,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'den')::int AS day,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'mesyacz')::int AS month,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'god')::int AS year
FROM extracted_children
),
children_count AS (
SELECT
recruit_id,
COUNT(*) AS children_under_16
FROM children_birth_dates
WHERE AGE(make_date(year, month, day)) &lt; interval '16 years'
GROUP BY recruit_id
),
recruit_data AS (
SELECT
COUNT(*) AS total_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count
FROM public.recruits r
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
COUNT(*) FILTER (
WHERE (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 70
AND gender = 'MALE')
OR (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 45
AND gender = 'FEMALE')
AND (conscription IS NULL OR conscription = false)
AND COALESCE(cc.children_under_16, 0) &lt; 5
) AS mobilization_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 30
AND gender = 'MALE'
AND (conscription IS NULL OR conscription = false)
) AS volunteer_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 50
AND gender = 'MALE'
AND (conscription IS NULL OR conscription = false)
AND ri.info->'svedSudim'->>'prOtsSvedSudim' = '1'
) AS contract_criterion
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
LEFT JOIN children_count AS cc
ON r.id = cc.recruit_id
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
'${VK_ARRAY}' IS NOT NULL AND '${VK_ARRAY}' != ''
AND r.target_recruitment_id = ANY (
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN ARRAY[]::uuid[]
ELSE string_to_array(trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ',')::uuid[]
@ -805,26 +864,27 @@
)
)
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE rd.total_count
END AS total_count,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE rd.male_count
END AS male_count,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE rd.female_count
END AS female_count,
'${REG_ID}' 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 recruit_data rd;</sql>
COALESCE(rd.total_count, 0) AS total_count,
COALESCE(rd.male_count, 0) AS male_count,
COALESCE(rd.female_count, 0) AS female_count,
COALESCE(rd.mobilization_criterion, 0) AS mobilization_criterion,
COALESCE(rd.volunteer_criterion, 0) AS volunteer_criterion,
COALESCE(rd.contract_criterion, 0) AS contract_criterion,
CASE
WHEN rd.total_count > 0 THEN ROUND(rd.mobilization_criterion::NUMERIC / rd.total_count * 100, 2)
ELSE 0
END AS mobilization_criterion_percent,
CASE
WHEN rd.total_count > 0 THEN ROUND(rd.volunteer_criterion::NUMERIC / rd.total_count * 100, 2)
ELSE 0
END AS volunteer_criterion_percent,
CASE
WHEN rd.total_count > 0 THEN ROUND(rd.contract_criterion::NUMERIC / rd.total_count * 100, 2)
ELSE 0
END AS contract_criterion_percent
FROM recruit_data AS rd;
</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>

View file

@ -696,6 +696,11 @@
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>waiting_registration_percent</name>
<rename>waiting_percent</rename>
<update>Y</update>
</value>
</lookup>
<attributes/>
<cluster_schema/>
@ -785,30 +790,113 @@
<schema_name/>
</partitioning>
<connection>postgres.person_registry</connection>
<sql>SELECT
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COUNT(*) END AS waiting_count,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COUNT(*) FILTER (WHERE gender = 'MALE') END AS male_count,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE COUNT(*) FILTER (WHERE gender = 'FEMALE') END AS female_count,
'${REG_ID}' 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,
CASE WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0 ELSE ROUND(COALESCE((COUNT(*)::DECIMAL / NULLIF((SELECT COUNT(*) FROM public.recruits), 0) * 100), 0), 2) END AS waiting_percent
FROM public.recruits r
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'false'
<sql>WITH extracted_children AS (
SELECT
ri.recruit_id,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
AND r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
'${VK_ARRAY}' IS NOT NULL AND '${VK_ARRAY}' != ''
AND r.target_recruitment_id = ANY (
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN ARRAY[]::uuid[]
ELSE string_to_array(trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ',')::uuid[]
END
)
);</sql>
)
),
children_birth_dates AS (
SELECT
recruit_id,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'den')::int AS day,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'mesyacz')::int AS month,
(child::jsonb->'svedFLBS'->'dataRozhdDok'->>'god')::int AS year
FROM extracted_children
),
children_count AS (
SELECT
recruit_id,
COUNT(*) AS children_under_16
FROM children_birth_dates
WHERE AGE(make_date(year, month, day)) &lt; interval '16 years'
GROUP BY recruit_id
),
recruit_data AS (
SELECT
COUNT(*) AS waiting_count,
COUNT(*) FILTER (WHERE gender = 'MALE') AS male_count,
COUNT(*) FILTER (WHERE gender = 'FEMALE') AS female_count,
COUNT(*) FILTER (
WHERE (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 70 AND gender = 'MALE')
OR (EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 45 AND gender = 'FEMALE')
AND (conscription IS NULL OR conscription = false)
AND COALESCE(cc.children_under_16, 0) &lt; 5
) AS mobilization_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 30
AND gender = 'MALE'
AND (conscription IS NULL OR conscription = false)
) AS volunteer_criterion,
COUNT(*) FILTER (
WHERE EXTRACT(YEAR FROM AGE(NOW(), birth_date)) BETWEEN 18 AND 50
AND gender = 'MALE'
AND (conscription IS NULL OR conscription = false)
AND ri.info->'svedSudim'->>'prOtsSvedSudim' = '1'
) AS contract_criterion
FROM public.recruits AS r
JOIN public.recruits_info AS ri
ON ri.recruit_id = r.id
LEFT JOIN children_count AS cc
ON r.id = cc.recruit_id
WHERE r.vu_current_info ->> 'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NOT NULL AND '${VK_ARRAY}' != ''
AND r.target_recruitment_id = ANY (
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN ARRAY[]::uuid[]
ELSE string_to_array(trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ',')::uuid[]
END
)
)
)
SELECT
'${REG_ID}' AS recruitment_id,
COALESCE(rd.waiting_count, 0) AS waiting_count,
COALESCE(rd.male_count, 0) AS male_count,
COALESCE(rd.female_count, 0) AS female_count,
COALESCE(rd.mobilization_criterion, 0) AS mobilization_criterion,
COALESCE(rd.volunteer_criterion, 0) AS volunteer_criterion,
COALESCE(rd.contract_criterion, 0) AS contract_criterion,
CASE
WHEN rd.waiting_count > 0 THEN ROUND(rd.mobilization_criterion::NUMERIC / rd.waiting_count * 100, 2)
ELSE 0
END AS mobilization_criterion_percent,
CASE
WHEN rd.waiting_count > 0 THEN ROUND(rd.volunteer_criterion::NUMERIC / rd.waiting_count * 100, 2)
ELSE 0
END AS volunteer_criterion_percent,
CASE
WHEN rd.waiting_count > 0 THEN ROUND(rd.contract_criterion::NUMERIC / rd.waiting_count * 100, 2)
ELSE 0
END AS contract_criterion_percent,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE ROUND(
COALESCE(
(rd.waiting_count::DECIMAL / NULLIF(
(SELECT COUNT(*) FROM public.recruits WHERE vu_current_info ->> 'isMilitaryRegistered' = 'true'), 0) * 100
), 0
), 2
)
END AS waiting_percent
FROM recruit_data AS rd;</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>

File diff suppressed because it is too large Load diff