snils inn fix
This commit is contained in:
parent
f51a4d9ec8
commit
3a41351297
8 changed files with 865 additions and 838 deletions
|
|
@ -21,50 +21,50 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<from>inn_create_job</from>
|
||||
<to>inn_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>inn_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<from>inn_output</from>
|
||||
<to>inn_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>inn_input</from>
|
||||
<to>inn_output</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>inn_output</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Table output inn</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output inn</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output inn</from>
|
||||
<from>inn_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output inn</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Abort</name>
|
||||
|
|
@ -83,104 +83,7 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1632</xloc>
|
||||
<yloc>160</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>320</yloc>
|
||||
<yloc>752</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -196,8 +99,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1632</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>640</xloc>
|
||||
<yloc>352</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -229,11 +132,11 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<send_true_to>inn_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>160</yloc>
|
||||
<yloc>128</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -250,12 +153,77 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>352</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<name>inn_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>752</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -267,44 +235,48 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') as cleaned_akt_inn,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') as cleaned_pred_inn
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
)
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
cleaned_akt_inn AS inn,
|
||||
true as actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
WHERE LENGTH(cleaned_akt_inn) = 12
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'predINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
cleaned_pred_inn AS inn,
|
||||
false as actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
|
||||
WHERE LENGTH(cleaned_pred_inn) = 12</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>496</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>640</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table output inn</name>
|
||||
<name>inn_output</name>
|
||||
<type>TableOutput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -314,7 +286,7 @@ WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn',
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>1000</commit>
|
||||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -354,13 +326,45 @@ WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn',
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>320</yloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>640</xloc>
|
||||
<yloc>128</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Table output inn</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>inn_output</source_transform>
|
||||
<target_transform>inn_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -21,48 +21,48 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<from>inn_create_job</from>
|
||||
<to>inn_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>inn_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update inn</to>
|
||||
<from>inn_insert_or_update</from>
|
||||
<to>inn_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<from>inn_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>inn_insert_or_update</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>inn_input</from>
|
||||
<to>inn_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
|
|
@ -83,105 +83,7 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1328</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_ERROR',
|
||||
error_description = ?
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_SUCCESS'
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>64</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>UPDATE etl.job_execution
|
||||
SET
|
||||
status = 'DELTA_PROCESSING',
|
||||
execution_datetime = DEFAULT,
|
||||
error_description = NULL
|
||||
where job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>336</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>544</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -197,8 +99,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>224</yloc>
|
||||
<xloc>544</xloc>
|
||||
<yloc>176</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -230,11 +132,11 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<send_true_to>inn_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>64</yloc>
|
||||
<yloc>0</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -251,12 +153,152 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>816</xloc>
|
||||
<yloc>224</yloc>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>176</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update inn</name>
|
||||
<name>inn_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>UPDATE etl.job_execution
|
||||
SET
|
||||
status = 'DELTA_PROCESSING',
|
||||
execution_datetime = DEFAULT,
|
||||
error_description = NULL
|
||||
where job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>336</xloc>
|
||||
<yloc>368</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_ERROR',
|
||||
error_description = ?
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>544</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'aktINN' AS akt_inn,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'predINN' AS pred_inn,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved' AS akt_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS akt_inn_cleaned,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved' AS pred_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS pred_inn_cleaned
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
),
|
||||
inn_data AS (
|
||||
SELECT
|
||||
recruit_id,
|
||||
akt_inn->>'id' AS source_id,
|
||||
to_date(akt_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
akt_inn_cleaned AS inn,
|
||||
true AS actual,
|
||||
'aktINN' AS inn_type
|
||||
FROM base
|
||||
WHERE
|
||||
akt_data_sved IS NOT NULL
|
||||
AND to_date(akt_data_sved, 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(akt_inn_cleaned) = 12
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
pred_inn->>'id' AS source_id,
|
||||
to_date(pred_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
pred_inn_cleaned AS inn,
|
||||
false AS actual,
|
||||
'predINN' AS inn_type
|
||||
FROM base
|
||||
WHERE
|
||||
pred_data_sved IS NOT NULL
|
||||
AND to_date(pred_data_sved, 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(pred_inn_cleaned) = 12
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_id,
|
||||
source_update_date,
|
||||
inn,
|
||||
actual
|
||||
FROM inn_data;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>544</xloc>
|
||||
<yloc>368</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>inn_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -306,94 +348,44 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>368</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<type>TableInput</type>
|
||||
<name>inn_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'aktINN' AS akt_inn,
|
||||
ri.info->'svedFL'->'svedBS'->'inn'->'predINN' AS pred_inn
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
AND (
|
||||
(
|
||||
(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved') IS NOT NULL
|
||||
AND to_date(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
)
|
||||
OR
|
||||
(
|
||||
(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved') IS NOT NULL
|
||||
AND to_date(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
)
|
||||
)
|
||||
),
|
||||
inn_data AS (
|
||||
SELECT
|
||||
recruit_id,
|
||||
akt_inn->>'id' AS source_id,
|
||||
to_date(akt_inn->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(akt_inn->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
true AS actual,
|
||||
'aktINN' AS inn_type
|
||||
FROM base
|
||||
WHERE
|
||||
(akt_inn->>'dataSved') IS NOT NULL
|
||||
AND to_date(akt_inn->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(akt_inn->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_SUCCESS'
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
pred_inn->>'id' AS source_id,
|
||||
to_date(pred_inn->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(pred_inn->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
false AS actual,
|
||||
'predINN' AS inn_type
|
||||
FROM base
|
||||
WHERE
|
||||
(pred_inn->>'dataSved') IS NOT NULL
|
||||
AND to_date(pred_inn->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(pred_inn->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_id,
|
||||
source_update_date,
|
||||
inn,
|
||||
actual
|
||||
FROM inn_data;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>544</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>0</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update inn</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>inn_insert_or_update</source_transform>
|
||||
<target_transform>inn_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -21,48 +21,48 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<from>inn_create_job</from>
|
||||
<to>inn_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>inn_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>inn_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update inn</to>
|
||||
<from>inn_insert_or_update</from>
|
||||
<to>inn_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<from>inn_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update inn</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>inn_input</from>
|
||||
<to>inn_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>inn_insert_or_update</from>
|
||||
<to>Identify last row in a stream </to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream </from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
|
|
@ -83,12 +83,12 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1296</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<type>ExecSql</type>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -97,33 +97,51 @@
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>160</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Filter rows</name>
|
||||
<type>FilterRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<compare>
|
||||
<condition>
|
||||
<conditions>
|
||||
</conditions>
|
||||
<function>=</function>
|
||||
<leftvalue>last_row</leftvalue>
|
||||
<negated>N</negated>
|
||||
<operator>-</operator>
|
||||
<value>
|
||||
<isnull>N</isnull>
|
||||
<length>-1</length>
|
||||
<name>constant</name>
|
||||
<precision>-1</precision>
|
||||
<text>Y</text>
|
||||
<type>Boolean</type>
|
||||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>inn_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>16</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<type>ExecSql</type>
|
||||
<name>Identify last row in a stream </name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -132,28 +150,15 @@ and recruitment_id = '${IDM_ID}';
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS'
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1440</xloc>
|
||||
<yloc>48</yloc>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>160</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<name>inn_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -196,12 +201,12 @@ DO UPDATE SET
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>272</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<name>inn_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -210,68 +215,85 @@ DO UPDATE SET
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1440</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Filter rows</name>
|
||||
<type>FilterRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<compare>
|
||||
<condition>
|
||||
<conditions>
|
||||
</conditions>
|
||||
<function>=</function>
|
||||
<leftvalue>last_row</leftvalue>
|
||||
<negated>N</negated>
|
||||
<operator>-</operator>
|
||||
<value>
|
||||
<isnull>N</isnull>
|
||||
<length>-1</length>
|
||||
<name>constant</name>
|
||||
<precision>-1</precision>
|
||||
<text>Y</text>
|
||||
<type>Boolean</type>
|
||||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>48</yloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream</name>
|
||||
<type>DetectLastRow</type>
|
||||
<name>inn_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<resultfieldname>last_row</resultfieldname>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') as cleaned_akt_inn,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') as cleaned_pred_inn
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
)
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
cleaned_akt_inn AS inn,
|
||||
true as actual
|
||||
FROM base
|
||||
WHERE LENGTH(cleaned_akt_inn) = 12
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'predINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
cleaned_pred_inn AS inn,
|
||||
false as actual
|
||||
FROM base
|
||||
WHERE LENGTH(cleaned_pred_inn) = 12</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>672</xloc>
|
||||
<yloc>208</yloc>
|
||||
<xloc>480</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update inn</name>
|
||||
<name>inn_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -288,7 +310,6 @@ DO UPDATE SET
|
|||
<condition>=</condition>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>inn</table>
|
||||
|
|
@ -322,61 +343,44 @@ DO UPDATE SET
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<type>TableInput</type>
|
||||
<name>inn_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
true as actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn', '[^0-9]', '', 'g')) = 12
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS'
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'inn'->'predINN'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g') AS inn,
|
||||
false as actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'inn'->'predINN'->>'inn', '[^0-9]', '', 'g')) = 12</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>16</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update inn</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>inn_insert_or_update</source_transform>
|
||||
<target_transform>inn_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -21,48 +21,48 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<from>snils_create_job</from>
|
||||
<to>snils_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>snils_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<from>snils_output</from>
|
||||
<to>snils_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Table output</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output</from>
|
||||
<from>snils_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>snils_output</from>
|
||||
<to>Identify last row in a stream </to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream </from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>snils_input</from>
|
||||
<to>snils_output</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
|
|
@ -83,104 +83,7 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1632</xloc>
|
||||
<yloc>160</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>320</yloc>
|
||||
<yloc>640</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -196,8 +99,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1632</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>496</xloc>
|
||||
<yloc>240</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -229,15 +132,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<send_true_to>snils_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>160</yloc>
|
||||
<yloc>64</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream</name>
|
||||
<name>Identify last row in a stream </name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -250,12 +153,77 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>752</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>240</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<name>snils_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<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>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>snils_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>640</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>snils_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -267,44 +235,52 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'id' AS akt_source_id,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved' AS akt_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS akt_snils_cleaned,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'id' AS pred_source_id,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved' AS pred_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS pred_snils_cleaned
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
akt_source_id AS source_id,
|
||||
to_date(akt_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
akt_snils_cleaned AS snils,
|
||||
true AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
WHERE LENGTH(akt_snils_cleaned) = 11
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
pred_source_id AS source_id,
|
||||
to_date(pred_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
pred_snils_cleaned AS snils,
|
||||
false AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11</sql>
|
||||
WHERE LENGTH(pred_snils_cleaned) = 11</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>496</xloc>
|
||||
<yloc>320</yloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table output</name>
|
||||
<name>snils_output</name>
|
||||
<type>TableOutput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -314,7 +290,7 @@ WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'sn
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>1000</commit>
|
||||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -354,13 +330,45 @@ WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'sn
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>320</yloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>snils_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>496</xloc>
|
||||
<yloc>64</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Table output</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>snils_output</source_transform>
|
||||
<target_transform>snils_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -21,50 +21,50 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<from>snils_create_job</from>
|
||||
<to>snils_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>snils_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<from>snils_insert_or_update</from>
|
||||
<to>snils_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>snils_insert_or_update</from>
|
||||
<to>Identify last row in a stream 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream 2</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<from>snils_input</from>
|
||||
<to>snils_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>snils_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update snils</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Abort</name>
|
||||
|
|
@ -83,11 +83,11 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1328</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>608</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<name>snils_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -103,8 +103,11 @@
|
|||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -116,14 +119,15 @@ WHERE job_name = '${JOB_NAME}'
|
|||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>608</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<name>snils_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -136,8 +140,11 @@ and recruitment_id = '${IDM_ID}';
|
|||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -148,14 +155,15 @@ WHERE job_name = '${JOB_NAME}'
|
|||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1408</xloc>
|
||||
<xloc>544</xloc>
|
||||
<yloc>64</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<name>snils_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -168,8 +176,11 @@ and recruitment_id = '${IDM_ID}';
|
|||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -180,10 +191,11 @@ SET
|
|||
error_description = NULL
|
||||
where job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>336</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>432</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -199,8 +211,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>224</yloc>
|
||||
<xloc>544</xloc>
|
||||
<yloc>288</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -232,7 +244,7 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<send_true_to>snils_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
|
|
@ -240,7 +252,7 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream</name>
|
||||
<name>Identify last row in a stream 2</name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -253,12 +265,12 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>816</xloc>
|
||||
<yloc>224</yloc>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>240</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update snils</name>
|
||||
<name>snils_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -275,6 +287,7 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<condition>=</condition>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>snils</table>
|
||||
|
|
@ -308,11 +321,11 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1104</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>432</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<name>snils_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -324,60 +337,51 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS' AS akt_snils,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS' AS pred_snils
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS' AS pred_snils,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved' AS akt_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS akt_snils_cleaned,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved' AS pred_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS pred_snils_cleaned
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
AND
|
||||
(
|
||||
(
|
||||
(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved') IS NOT NULL
|
||||
AND to_date(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
)
|
||||
OR
|
||||
(
|
||||
(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved') IS NOT NULL
|
||||
AND to_date(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
)
|
||||
)
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
),
|
||||
snils_data AS (
|
||||
SELECT
|
||||
recruit_id,
|
||||
akt_snils->>'id' AS source_id,
|
||||
to_date(akt_snils->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(akt_snils->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
to_date(akt_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
akt_snils_cleaned AS snils,
|
||||
true AS actual,
|
||||
'aktsnils' AS snils_type
|
||||
'aktSNILS' AS snils_type
|
||||
FROM base
|
||||
WHERE
|
||||
(akt_snils->>'dataSved') IS NOT NULL
|
||||
AND to_date(akt_snils->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(akt_snils->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
akt_data_sved IS NOT NULL
|
||||
AND to_date(akt_data_sved, 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(akt_snils_cleaned) = 11
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
pred_snils->>'id' AS source_id,
|
||||
to_date(pred_snils->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(pred_snils->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
to_date(pred_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
pred_snils_cleaned AS snils,
|
||||
false AS actual,
|
||||
'predsnils' AS snils_type
|
||||
'predSNILS' AS snils_type
|
||||
FROM base
|
||||
WHERE
|
||||
(pred_snils->>'dataSved') IS NOT NULL
|
||||
AND to_date(pred_snils->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(REGEXP_REPLACE(pred_snils->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
pred_data_sved IS NOT NULL
|
||||
AND to_date(pred_data_sved, 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
AND LENGTH(pred_snils_cleaned) = 11
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
|
|
@ -390,13 +394,13 @@ FROM snils_data;</sql>
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>544</xloc>
|
||||
<yloc>224</yloc>
|
||||
<yloc>432</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update snils</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>snils_insert_or_update</source_transform>
|
||||
<target_transform>snils_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -21,48 +21,48 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<from>snils_create_job</from>
|
||||
<to>snils_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>snils_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>snils_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<to>Filter rows</to>
|
||||
<from>snils_insert_or_update</from>
|
||||
<to>snils_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<from>snils_input</from>
|
||||
<to>snils_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>snils_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update snils</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>snils_insert_or_update</from>
|
||||
<to>Identify last row in a stream </to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update snils</to>
|
||||
<from>Identify last row in a stream </from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
|
|
@ -83,11 +83,11 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1296</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>592</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<name>snils_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -103,8 +103,11 @@
|
|||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -116,14 +119,15 @@ WHERE job_name = '${JOB_NAME}'
|
|||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>400</yloc>
|
||||
<yloc>592</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<name>snils_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -136,8 +140,11 @@ and recruitment_id = '${IDM_ID}';
|
|||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -148,14 +155,86 @@ WHERE job_name = '${JOB_NAME}'
|
|||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1440</xloc>
|
||||
<xloc>480</xloc>
|
||||
<yloc>48</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Filter rows</name>
|
||||
<type>FilterRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<compare>
|
||||
<condition>
|
||||
<conditions>
|
||||
</conditions>
|
||||
<function>=</function>
|
||||
<leftvalue>last_row</leftvalue>
|
||||
<negated>N</negated>
|
||||
<operator>-</operator>
|
||||
<value>
|
||||
<isnull>N</isnull>
|
||||
<length>-1</length>
|
||||
<name>constant</name>
|
||||
<precision>-1</precision>
|
||||
<text>Y</text>
|
||||
<type>Boolean</type>
|
||||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>snils_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>48</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream </name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>224</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>snils_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -198,82 +277,67 @@ DO UPDATE SET
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>272</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<name>snils_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'id' AS akt_source_id,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved' AS akt_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS akt_snils_cleaned,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'id' AS pred_source_id,
|
||||
ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved' AS pred_data_sved,
|
||||
REGEXP_REPLACE(ri.info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS pred_snils_cleaned
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
|
||||
WHERE
|
||||
'${IDM_ID}' != ''
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
akt_source_id AS source_id,
|
||||
to_date(akt_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
akt_snils_cleaned AS snils,
|
||||
true AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(akt_snils_cleaned) = 11
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
pred_source_id AS source_id,
|
||||
to_date(pred_data_sved, 'YYYY-MM-DD') AS source_update_date,
|
||||
pred_snils_cleaned AS snils,
|
||||
false AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(pred_snils_cleaned) = 11</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1440</xloc>
|
||||
<yloc>208</yloc>
|
||||
<xloc>480</xloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Filter rows</name>
|
||||
<type>FilterRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<compare>
|
||||
<condition>
|
||||
<conditions>
|
||||
</conditions>
|
||||
<function>=</function>
|
||||
<leftvalue>last_row</leftvalue>
|
||||
<negated>N</negated>
|
||||
<operator>-</operator>
|
||||
<value>
|
||||
<isnull>N</isnull>
|
||||
<length>-1</length>
|
||||
<name>constant</name>
|
||||
<precision>-1</precision>
|
||||
<text>Y</text>
|
||||
<type>Boolean</type>
|
||||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>48</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream</name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>736</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update snils</name>
|
||||
<name>snils_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -290,7 +354,6 @@ DO UPDATE SET
|
|||
<condition>=</condition>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>snils</table>
|
||||
|
|
@ -324,61 +387,13 @@ DO UPDATE SET
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
true AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils', '[^0-9]', '', 'g')) = 11
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'id' AS source_id,
|
||||
to_date(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g') AS snils,
|
||||
false AS actual
|
||||
FROM base
|
||||
WHERE LENGTH(REGEXP_REPLACE(info->'svedFL'->'svedBS'->'snils'->'predSNILS'->>'snils', '[^0-9]', '', 'g')) = 11</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>480</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>400</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update snils</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>snils_insert_or_update</source_transform>
|
||||
<target_transform>snils_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<limit/>
|
||||
<sql>SELECT
|
||||
r.idm_id as recruitment_id
|
||||
FROM ervu_dashboard.recruitment r
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<limit/>
|
||||
<sql>SELECT
|
||||
idm_id AS recruitment
|
||||
FROM ervu_dashboard.recruitment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue