diff --git a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow.hpl b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow.hpl
index 23f11b2..84f7c73 100644
--- a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow.hpl
+++ b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow.hpl
@@ -80,6 +80,16 @@
spouse_success_job_status
Y
+
+ spouse_sort_rows
+ spouse_update_flags
+ Y
+
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
Abort
@@ -101,83 +111,6 @@
192
-
- spouse_error_job_status
- ExecSql
-
- Y
-
- 1
-
- none
-
-
-
-
- error_description
-
-
- ervu-dashboard
-
- Y
-
- N
-
- Y
- Y
- N
- UPDATE etl.job_execution
-SET status = 'ERROR',
- error_description = ?,
- execution_end_datetime = current_timestamp
-WHERE job_name = '${JOB_NAME}'
-and recruitment_id = '${IDM_ID}';
-
-
-
-
-
- 800
- 192
-
-
-
- spouse_success_job_status
- ExecSql
-
- Y
-
- 1
-
- none
-
-
-
-
- ervu-dashboard
-
- Y
-
- N
-
- Y
- N
- N
- UPDATE etl.job_execution
-SET status = 'SUCCESS',
- execution_end_datetime = current_timestamp
-WHERE job_name = '${JOB_NAME}'
-and recruitment_id = '${IDM_ID}'
-and status = 'PROCESSING';
-
-
-
-
-
- 592
- 720
-
-
Create job execution record
ExecSql
@@ -207,23 +140,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
576
-
- spouse_detect_empty_stream
- DetectEmptyStream
-
- Y
-
- 1
-
- none
-
-
-
-
- 352
- 720
-
-
Filter rows
FilterRows
@@ -261,8 +177,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
- spouse_sort_rows
- SortRows
+ Unique rows
+ Unique
Y
@@ -271,94 +187,18 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
none
- ${java.io.tmpdir}
- out
- 100000
-
- N
-
- Y
+ N
+ N
recruit_id
- Y
- N
- N
- 0
- N
+ N
- 352
- 192
-
-
-
- spouse_input
- TableInput
-
- N
-
- 1
-
- none
-
-
- ervu-dashboard
- N
-
- WITH spouse_data AS (
- SELECT
- ri.recruit_id AS recruit_id,
- (supr->>'id')::uuid AS spouse_external_id,
- NULLIF(supr->>'idERN', '') AS spouse_id_ern,
- NULLIF(supr->>'rodstvSvyazSuprug', '')::int AS kinship_type,
- supr->'svedFLBS'->'fio'->>'familiya' AS last_name,
- supr->'svedFLBS'->'fio'->>'imya' AS first_name,
- supr->'svedFLBS'->'fio'->>'otchestvo' AS middle_name,
- CONCAT_WS(' ',
- supr->'svedFLBS'->'fio'->>'familiya',
- supr->'svedFLBS'->'fio'->>'imya',
- supr->'svedFLBS'->'fio'->>'otchestvo'
- ) AS full_name,
- MAKE_DATE(
- NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
- NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz', '')::int,
- NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den', '')::int
- ) AS birth_date,
- (supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
- supr->'svedSmert'->>'nomerZapis' AS death_az_number,
- ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
- (ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend')::date AS marriage_date,
- ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
- (ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend')::date AS divorce_date,
- CASE
- WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
- ELSE false
- END AS information_excluded,
- ri.ctid as source_ctid
- FROM ervu_dashboard.recruits_info ri
- JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
- CROSS JOIN LATERAL (
- SELECT supri
- FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
- WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
- ) AS supr(supr)
- WHERE
- '${IDM_ID}' != ''
- AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
-)
-SELECT
- *,
- source_ctid = (SELECT MAX(source_ctid) FROM spouse_data) as last_row
-FROM spouse_data;
-
- Y
-
-
- 352
- 576
+ 592
+ 912
@@ -428,14 +268,11 @@ FROM spouse_data;
N
N
N
-
Y
-
N
ervu_dashboard
Y
-
N
Y
N
@@ -485,27 +322,24 @@ FROM spouse_data;
N
N
N
-
Y
-
N
ervu_dashboard
Y
-
N
Y
N
Y
- 544
+ 576
192
- Unique rows
- Unique
+ spouse_detect_empty_stream
+ DetectEmptyStream
Y
@@ -514,18 +348,223 @@ FROM spouse_data;
none
- N
+
+
+ 352
+ 720
+
+
+
+ spouse_error_job_status
+ ExecSql
+
+ Y
+
+ 1
+
+ none
+
+
+
+
+ error_description
+
+
+ ervu-dashboard
+ Y
+ N
+ Y
+ Y
+ N
+ UPDATE etl.job_execution
+SET status = 'ERROR',
+ error_description = ?,
+ execution_end_datetime = current_timestamp
+WHERE job_name = '${JOB_NAME}'
+and recruitment_id = '${IDM_ID}';
+
+
+
+
+ 800
+ 192
+
+
+
+ spouse_input
+ TableInput
+
+ N
+
+ 1
+
+ none
+
+
+ ervu-dashboard
+ N
+ WITH spouse_data AS (
+ SELECT
+ ri.recruit_id AS recruit_id,
+ (supr->>'id')::uuid AS spouse_external_id,
+ NULLIF(supr->>'idERN', '') AS spouse_id_ern,
+ NULLIF(supr->>'rodstvSvyazSuprug', '')::int AS kinship_type,
+ supr->'svedFLBS'->'fio'->>'familiya' AS last_name,
+ supr->'svedFLBS'->'fio'->>'imya' AS first_name,
+ supr->'svedFLBS'->'fio'->>'otchestvo' AS middle_name,
+ CONCAT_WS(' ',
+ supr->'svedFLBS'->'fio'->>'familiya',
+ supr->'svedFLBS'->'fio'->>'imya',
+ supr->'svedFLBS'->'fio'->>'otchestvo'
+ ) AS full_name,
+ MAKE_DATE(
+ NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
+ NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'mesyacz', '')::int,
+ NULLIF(supr->'svedFLBS'->'dataRozhdDok'->>'den', '')::int
+ ) AS birth_date,
+ (supr->'svedSmert'->'extend'->>'dataSmert')::date AS death_date,
+ supr->'svedSmert'->>'nomerZapis' AS death_az_number,
+ ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'nomerZapis' AS marriage_az_number,
+ (ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend')::date AS marriage_date,
+ ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
+ (ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend')::date AS divorce_date,
+ NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status,
+ CASE
+ WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
+ ELSE false
+ END AS information_excluded,
+ ri.ctid as source_ctid
+ FROM ervu_dashboard.recruits_info ri
+ JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
+ CROSS JOIN LATERAL (
+ SELECT supri
+ FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
+ WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
+ ) AS supr(supr)
+ WHERE
+ '${IDM_ID}' != ''
+ AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
+)
+SELECT
+ *,
+ source_ctid = (SELECT MAX(source_ctid) FROM spouse_data) as last_row
+FROM spouse_data;
+
+ Y
+
+
+ 352
+ 576
+
+
+
+ spouse_sort_rows
+ SortRows
+
+ N
+
+ 1
+
+ none
+
+
+ ${java.io.tmpdir}
+ out
+ 100000
+
+ N
+
+ Y
- N
recruit_id
+ Y
+ N
+ N
+ 0
+ N
- N
+
+
+ 352
+ 192
+
+
+
+ spouse_success_job_status
+ ExecSql
+
+ Y
+
+ 1
+
+ none
+
+
+
+
+ ervu-dashboard
+ Y
+ N
+ Y
+ N
+ N
+ UPDATE etl.job_execution
+SET status = 'SUCCESS',
+ execution_end_datetime = current_timestamp
+WHERE job_name = '${JOB_NAME}'
+and recruitment_id = '${IDM_ID}'
+and status = 'PROCESSING';
+
+
592
- 912
+ 720
+
+
+
+ spouse_update_flags
+ Update
+
+ Y
+
+ 1
+
+ none
+
+
+ 10000
+ ervu-dashboard
+ Y
+
+
+
+ =
+ recruit_id
+ recruit_id
+
+
+
+ <>
+ marital_status
+ marital_status
+
+
+ ervu_dashboard
+
+
+ marital_status
+ marital_status
+
+
+ N
+ Y
+
+
+ 576
+ 32
@@ -553,6 +592,18 @@ FROM spouse_data;
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
+ error_description
+
+
+
+
+
+
diff --git a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_delta.hpl
index e288ad6..7ffae33 100644
--- a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_delta.hpl
+++ b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_delta.hpl
@@ -80,6 +80,16 @@
spouse_success_job_status
Y
+
+ Sort rows
+ spouse_update_flags
+ Y
+
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
Abort
@@ -189,7 +199,7 @@ and recruitment_id = '${IDM_ID}';
Sort rows
SortRows
- Y
+ N
1
@@ -350,6 +360,7 @@ and recruitment_id = '${IDM_ID}';
ervu-dashboard
N
+
WITH spouse_data AS (
SELECT
ri.recruit_id AS recruit_id,
@@ -375,6 +386,7 @@ and recruitment_id = '${IDM_ID}';
(ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend')::date AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
(ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend')::date AS divorce_date,
+ NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status,
CASE
WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
ELSE false
@@ -437,6 +449,46 @@ WHERE job_name = '${JOB_NAME}'
688
+
+ spouse_update_flags
+ Update
+
+ Y
+
+ 1
+
+ none
+
+
+ 10000
+ ervu-dashboard
+ Y
+
+
+ =
+ recruit_id
+ recruit_id
+
+
+ <>
+ marital_status
+ marital_status
+
+ ervu_dashboard
+
+
+ marital_status
+ marital_status
+
+
+ N
+ Y
+
+
+ 624
+ 320
+
+
spouse_update_or_insert
InsertUpdate
@@ -544,6 +596,18 @@ WHERE job_name = '${JOB_NAME}'
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
+ error_description
+
+
+
+
+
+
spouse_update_or_insert
spouse_error_job_status
diff --git a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_repeat.hpl
index 95a0ae9..f917e7f 100644
--- a/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_repeat.hpl
+++ b/mappings/info_recruits/citizen_tables/citizen_spouse/parallel/citizen_spouse_flow_repeat.hpl
@@ -107,6 +107,16 @@ M_R_CR_DATE
spouse_success_job_status
Y
+
+ Sort rows
+ spouse_update_flags
+ Y
+
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
Abort
@@ -231,7 +241,7 @@ DO UPDATE SET
Sort rows
SortRows
- Y
+ N
1
@@ -417,6 +427,7 @@ and recruitment_id = '${IDM_ID}';
(ri.info->'svedFL'->'svedSemPolozh'->'svedAZBrak'->>'dataBrakKalend')::date AS marriage_date,
ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'nomerZapis' AS divorce_az_number,
(ri.info->'svedFL'->'svedSemPolozh'->'svedAZRazvod'->>'dataRastBrakKalend')::date AS divorce_date,
+ NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status,
CASE
WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
ELSE false
@@ -498,13 +509,11 @@ and status = 'PROCESSING';
=
recruit_id
recruit_id
-
=
spouse_external_id
spouse_external_id
-
ervu_dashboard
@@ -576,6 +585,46 @@ and status = 'PROCESSING';
528
+
+ spouse_update_flags
+ Update
+
+ Y
+
+ 1
+
+ none
+
+
+ 10000
+ ervu-dashboard
+ Y
+
+
+ =
+ recruit_id
+ recruit_id
+
+
+ <>
+ marital_status
+ marital_status
+
+ ervu_dashboard
+
+
+ marital_status
+ marital_status
+
+
+ N
+ Y
+
+
+ 512
+ 368
+
+
marriage_registry_update_or_insert
@@ -601,6 +650,18 @@ and status = 'PROCESSING';
+
+ spouse_update_flags
+ spouse_error_job_status
+ Y
+
+ error_description
+
+
+
+
+
+