Commits

tbrugz committed d8d6173 Draft

transf: tse_unidade_eleitoral: adicionado esfera_ue (mun,est,fed)

Comments (0)

Files changed (3)

 x tse_secao_comparecimento [origem_BWEB] [-> tse_detalhe_secao]
 x tse_tipos_bens [origem_CANDBEM]
 ... tse_unidades_eleitorais [origem_CEFT] [-> tse_municipios]
--> tse_unidade_eleitoral: add campo: ESFERA (fed,est,mun)
+x tse_unidade_eleitoral: add campo: ESFERA_UE (fed,est,mun)
 - esquema refactoring: tse_partidos -> tse_partidos_ue
 x add tse_unidade_eleitoral (BR, estados, municipios)
   - FK para (de?) tse_partidos(_ue)(coligacoes?)
 x coluna 'invalido' na tabela tse_candidatos
 ~ candidatos invalidos: carregar ue e uf
 - refactoring: tse_candidato -> tse_votavel ?
-  - separar candidato de votavel (?) ; tse_candidato_cons (politicos)
+  -> separar candidato de votavel (?) ; nova tabela/fato(?): tse_candidato_cons (politicos)
 
 
 modulo municipal

kettle/repositorio-de-dados-eleitorais/origem_LISTACAND_ue.ktr

     <parameters>
         <parameter>
             <name>dadostse.carga.anoeleicao</name>
-            <default_value>2008</default_value>
+            <default_value>2012</default_value>
             <description/>
         </parameter>
         <parameter>
       <bordercolorblue>100</bordercolorblue>
       <drawshadow>Y</drawshadow>
     </notepad>
+    <notepad>
+      <note>add unique rows (hashset)?</note>
+      <xloc>577</xloc>
+      <yloc>330</yloc>
+      <width>145</width>
+      <heigth>22</heigth>
+      <fontname>Microsoft Sans Serif</fontname>
+      <fontsize>8</fontsize>
+      <fontbold>N</fontbold>
+      <fontitalic>N</fontitalic>
+      <fontcolorred>0</fontcolorred>
+      <fontcolorgreen>0</fontcolorgreen>
+      <fontcolorblue>0</fontcolorblue>
+      <backgroundcolorred>255</backgroundcolorred>
+      <backgroundcolorgreen>165</backgroundcolorgreen>
+      <backgroundcolorblue>0</backgroundcolorblue>
+      <bordercolorred>100</bordercolorred>
+      <bordercolorgreen>100</bordercolorgreen>
+      <bordercolorblue>100</bordercolorblue>
+      <drawshadow>Y</drawshadow>
+    </notepad>
   </notepads>
   <connection>
     <name>dw_pgsql_tse</name>
     </attributes>
   </connection>
   <order>
-  <hop> <from>CSV - lista cand</from><to>renames</to><enabled>Y</enabled> </hop>  <hop> <from>Filter rows</from><to>Dummy (do nothing)</to><enabled>Y</enabled> </hop>  <hop> <from>renames</from><to>Database lookup</to><enabled>Y</enabled> </hop>  <hop> <from>Database lookup</from><to>Filter rows</to><enabled>Y</enabled> </hop>  <hop> <from>Filter rows</from><to>id_partido &#47; id_candidato</to><enabled>Y</enabled> </hop>  <hop> <from>id_partido &#47; id_candidato</from><to>Select values</to><enabled>Y</enabled> </hop>  <hop> <from>Select values</from><to>select ue</to><enabled>Y</enabled> </hop>  <hop> <from>select ue</from><to>i&#47;u - tse_unidade_eleitoral</to><enabled>Y</enabled> </hop>  <hop> <from>Dummy (do nothing)</from><to>id_partido &#47; id_candidato</to><enabled>Y</enabled> </hop>  </order>
+  <hop> <from>CSV - lista cand</from><to>renames</to><enabled>Y</enabled> </hop>  <hop> <from>Filter rows</from><to>Dummy (do nothing)</to><enabled>Y</enabled> </hop>  <hop> <from>renames</from><to>Database lookup</to><enabled>Y</enabled> </hop>  <hop> <from>Database lookup</from><to>Filter rows</to><enabled>Y</enabled> </hop>  <hop> <from>Filter rows</from><to>id_partido &#47; id_candidato &#47; esfera</to><enabled>Y</enabled> </hop>  <hop> <from>id_partido &#47; id_candidato &#47; esfera</from><to>Select values</to><enabled>Y</enabled> </hop>  <hop> <from>Select values</from><to>select ue</to><enabled>Y</enabled> </hop>  <hop> <from>select ue</from><to>i&#47;u - tse_unidade_eleitoral</to><enabled>Y</enabled> </hop>  <hop> <from>Dummy (do nothing)</from><to>id_partido &#47; id_candidato &#47; esfera</to><enabled>Y</enabled> </hop>  </order>
   <step>
     <name>CSV - lista cand</name>
     <type>CsvInput</type>
            <method>none</method>
            <schema_name/>
            </partitioning>
-<send_true_to>id_partido &#47; id_candidato</send_true_to>
+<send_true_to>id_partido &#47; id_candidato &#47; esfera</send_true_to>
 <send_false_to>Dummy (do nothing)</send_false_to>
     <compare>
 <condition>
         <rename/>
         <length>-2</length>
         <precision>-2</precision>
+      </field>      <field>        <name>ESFERA_UE</name>
+        <rename/>
+        <length>-2</length>
+        <precision>-2</precision>
       </field>        <select_unspecified>N</select_unspecified>
     </fields>     <cluster_schema/>
  <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
         <rename>ID_UE</rename>
         <update>N</update>
       </value>
+      <value>
+        <name>ESFERA_UE</name>
+        <rename>ESFERA_UE</rename>
+        <update>Y</update>
+      </value>
     </lookup>
      <cluster_schema/>
  <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
     </step>
 
   <step>
-    <name>id_partido &#47; id_candidato</name>
+    <name>id_partido &#47; id_candidato &#47; esfera</name>
     <type>ScriptValueMod</type>
     <description/>
     <distribute>Y</distribute>
            <schema_name/>
            </partitioning>
     <compatible>N</compatible>
+    <optimizationLevel>9</optimizationLevel>
     <jsScripts>      <jsScript>        <jsScript_type>0</jsScript_type>
         <jsScript_name>Script 1</jsScript_name>
         <jsScript_script>&#47;&#47;Script here
 
 var ID_UE = &apos;&apos;
 	+ANO_ELEICAO
-	+SIGLA_UE</jsScript_script>
+	+SIGLA_UE
+
+var ESFERA_UE = null;
+
+if(SIGLA_UE==&apos;BR&apos;) { ESFERA_UE = &apos;FED&apos;; }
+else if(isNum(SIGLA_UE)) { ESFERA_UE = &apos;MUN&apos;; }
+else { ESFERA_UE = &apos;EST&apos;; }
+</jsScript_script>
       </jsScript>    </jsScripts>    <fields>      <field>        <name>ID_PARTIDO</name>
         <rename>ID_PARTIDO</rename>
         <type>String</type>
         <length>10</length>
         <precision>-1</precision>
         <replace>N</replace>
+      </field>      <field>        <name>ESFERA_UE</name>
+        <rename>ESFERA_UE</rename>
+        <type>String</type>
+        <length>2</length>
+        <precision>-1</precision>
+        <replace>N</replace>
       </field>    </fields>     <cluster_schema/>
  <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
       <xloc>340</xloc>
         <rename/>
         <length>-2</length>
         <precision>-2</precision>
+      </field>      <field>        <name>ESFERA_UE</name>
+        <rename/>
+        <length>-2</length>
+        <precision>-2</precision>
       </field>        <select_unspecified>N</select_unspecified>
     </fields>     <cluster_schema/>
  <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>

modelo/TABLEs.sql

 	sigla_uf varchar(2),
 	sigla_ue varchar(5) not null,
 	descricao_ue varchar(30),
+	esfera_ue varchar(3),
 	constraint unidade_eleitoral_pk primary key (id_ue)
 );