<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
  <info>
    <name>citizenship_flags</name>
    <name_sync_with_filename>Y</name_sync_with_filename>
    <description/>
    <extended_description/>
    <pipeline_version/>
    <pipeline_type>Normal</pipeline_type>
    <parameters>
    </parameters>
    <capture_transform_performance>N</capture_transform_performance>
    <transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
    <transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
    <created_user>-</created_user>
    <created_date>2025/04/25 13:12:27.341</created_date>
    <modified_user>-</modified_user>
    <modified_date>2025/04/25 13:12:27.341</modified_date>
  </info>
  <notepads>
  </notepads>
  <order>
    <hop>
      <from>citizenship_flag_output</from>
      <to>Update_citizenship_flag</to>
      <enabled>Y</enabled>
    </hop>
  </order>
  <transform>
    <name>Update_citizenship_flag</name>
    <type>Update</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <commit>1000</commit>
    <connection>ervu-dashboard</connection>
    <error_ignored>Y</error_ignored>
    <lookup>
      <key>
        <condition>=</condition>
        <field>recruit_id</field>
        <name>recruit_id</name>
      </key>
      <schema>ervu_dashboard</schema>
      <table>citizen</table>
      <value>
        <name>has_russian_citizenship</name>
        <rename>has_russian_citizenship</rename>
      </value>
      <value>
        <name>has_foreign_citizenship</name>
        <rename>has_foreign_citizenship</rename>
      </value>
    </lookup>
    <skip_lookup>N</skip_lookup>
    <use_batch>Y</use_batch>
    <attributes/>
    <GUI>
      <xloc>720</xloc>
      <yloc>208</yloc>
    </GUI>
  </transform>
  <transform>
    <name>citizenship_flag_output</name>
    <type>TableInput</type>
    <description/>
    <distribute>Y</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>0</limit>
    <sql>with foreign_citizenship as (
    select recruit_id, true as has_foreign_citizenship
    from citizenship_foreign
)
select
    citizenship.recruit_id,
    true as has_russian_citizenship,
    coalesce(has_foreign_citizenship, false) as has_foreign_citizenship
    from citizenship
    left join foreign_citizenship
    on foreign_citizenship.recruit_id = citizenship.recruit_id
where renunciation_number is null;</sql>
    <variables_active>N</variables_active>
    <attributes/>
    <GUI>
      <xloc>544</xloc>
      <yloc>208</yloc>
    </GUI>
  </transform>
  <transform_error_handling>
  </transform_error_handling>
  <attributes/>
</pipeline>
