Commits

Marko Samastur committed 82bcf16

Buggy skript za parsanje povezav oseba<->stranka vkljucno z vhodnimi podatki

  • Participants
  • Parent commits 2f49e98

Comments (0)

Files changed (2)

File csv_fixtures/poslanci2.csv

+"1992-1996","TONE ANDERLIČ","LDS"
+"1992-1996","MAG. FRANC AVBERŠEK","ZL"
+"1992-1996","ROBERTO BATTELLI","POSLANEC ITALIJANSKE NARODNE SKUPNOSTI"
+"1992-1996","DUŠAN BAVDEK","ZL"
+"1992-1996","IGOR BAVČAR","D, LDS"
+"1992-1996","GABRIJEL BERLIČ","LDS"
+"1992-1996","LJERKA BIZILJ","LDS, SAMOSTOJNA POSLANKA"
+"1992-1996","DR. RADO BOHINC*","ZL"
+"1992-1996","DR. FRANCE BUČAR","D->DS"
+"1992-1996","DR. VIDA ČADONIČ ŠPELIČ*","SKD"
+"1992-1996","FRANC ČERNELIČ","SKD"
+"1992-1996","MAG. DRAGAN ČERNETIČ","LDS"
+"1992-1996","POLONCA DOBRAJC","SNS"
+"1992-1996","DR. JANEZ DRNOVŠEK*","LDS"
+"1992-1996","GEZA DŽUBAN","LDS"
+"1992-1996","BRANE ERŽEN","SNS, SSP, SAMOSTOJNI POSLANEC"
+"1992-1996","STANE FRIM","SKD"
+"1992-1996","MIROSLAV GERŽINA","SKD"
+"1992-1996","BENJAMIN HENIGMAN","SKD"
+"1992-1996","FRANC (FERI) HORVAT","ZL"
+"1992-1996","IVO HVALICA","SDSS->SDS"
+"1992-1996","JOŽE JAGODNIK","ZL"
+"1992-1996","BRANKO JANC","LDS"
+"1992-1996","JANEZ JANČAR","LDS"
+"1992-1996","JANEZ JANŠA*","SDSS->SDS"
+"1992-1996","ZMAGO JELINČIČ","SNS"
+"1992-1996","MIRAN JERIČ","LDS"
+"1992-1996","MAG. JANEZ JUG","LDS, SAMOSTOJNI POSLANEC"
+"1992-1996","METKA KARNER LUKAČ","SLS"
+"1992-1996","MAG. JANEZ KOCIJANČIČ","ZL"
+"1992-1996","ŠTEFAN KOCIPER","SKD"
+"1992-1996","JOŽEF KOCUVAN","SKD"
+"1992-1996","MAG. JANEZ KOPAČ","LDS"
+"1992-1996","JOŽEF KOPŠE","SNS,SSP"
+"1992-1996","BOJAN KOROŠEC","ZELENI->ZELENI-ESS->ZELENI/LDS"
+"1992-1996","DR. MATEJA KOŽUN NOVAK","ZL"
+"1992-1996","DR. DAVORIN KRAČUN*","LDS"
+"1992-1996","DR. LEV KREFT","ZL"
+"1992-1996","RAFAEL KUŽNIK","SNS"
+"1992-1996","SAŠO LAP","SNS, SSP, SND"
+"1992-1996","MAKSIMILJAN LAVRINC","LDS"
+"1992-1996","ANDREJ LENARČIČ","SNS, D->DS, SSP"
+"1992-1996","JOŽE LENIČ","LDS"
+"1992-1996","FRANC LIPOGLAVŠEK","ZL"
+"1992-1996","MIHAELA LOGAR","SLS"
+"1992-1996","ZORAN MADON","SLS"
+"1992-1996","JURIJ MALOVRH","SKD"
+"1992-1996","ŠTEFAN MATUŠ","SNS,SSP, SLS"
+"1992-1996","ALOJZ METELKO","SLS"
+"1992-1996","RUDOLF MOGE","LDS"
+"1992-1996","MIROSLAV MOZETIČ","SKD"
+"1992-1996","IRENA OMAN","SNS, SSP, SLS"
+"1992-1996","IVAN OMAN","SKD"
+"1992-1996","MAG. IGOR OMERZA","D, LDS"
+"1992-1996","BORUT PAHOR","ZL"
+"1992-1996","TONE PARTLJIČ","LDS"
+"1992-1996","MILOŠ PAVLICA","ZL"
+"1992-1996","BREDA PEČAN","ZL"
+"1992-1996","ANTON PERŠAK","D->DS"
+"1992-1996","MATJAŽ PESKAR*","LDS"
+"1992-1996","ALOJZ PETERLE","SKD"
+"1992-1996","PETER PETROVIČ","LDS"
+"1992-1996","JANEZ PODOBNIK","SLS"
+"1992-1996","MARJAN PODOBNIK","SLS"
+"1992-1996","IGNAC POLAJNAR","SKD"
+"1992-1996","MARIJAN POLJŠAK","SNS, SSP, SND, SSP"
+"1992-1996","FRANC POTOČNIK","SLS"
+"1992-1996","VIKA POTOČNIK","LDS"
+"1992-1996","MIRAN POTRČ","ZL"
+"1992-1996","MARIA POZSONEC","POSLANKA MADŽARSKE NARODNE SKUPNOSTI"
+"1992-1996","JANKO PREDAN","ZELENI->ZELENI-ESS->ZELENI/LDS"
+"1992-1996","ŽARKO PREGELJ","SLS"
+"1992-1996","JANA PRIMOŽIČ","SKD"
+"1992-1996","MAG. JOŽE PROTNER","LDS"
+"1992-1996","CIRIL PUCKO*","SKD"
+"1992-1996","DR. JOŽE PUČNIK","SDSS->SDS"
+"1992-1996","VITODRAG PUKL","SDSS->SDS"
+"1992-1996","JOŽEF RAJŠP","SKD"
+"1992-1996","IZIDOR REJC","SKD"
+"1992-1996","DR. CIRIL RIBIČIČ","ZL"
+"1992-1996","MAG. HERMAN RIGELNIK","LDS"
+"1992-1996","DR. DIMITRIJ RUPEL*","D, LDS"
+"1992-1996","DANICA SIMŠIČ","D->DS"
+"1992-1996","IVAN SISINGER","ZL"
+"1992-1996","NADA SKUK","SKD"
+"1992-1996","MARJAN STANIČ","SNS, SSP, SND"
+"1992-1996","MAKS SUŠEK","LDS"
+"1992-1996","DR. LEO ŠEŠERKO","ZELENI->ZELENI-ESS->ZELENI/LDS"
+"1992-1996","DR. MARJAN ŠETINC","LDS"
+"1992-1996","DRAGO ŠIFTAR","SDSS->SDS"
+"1992-1996","JOŽEF ŠKOLČ","LDS"
+"1992-1996","JADRANKA ŠTURM KOCJAN","LDS"
+"1992-1996","DR. PETER TANCING","ZELENI->ZELENI-ESS->ZELENI/LDS"
+"1992-1996","ZORAN THALER","LDS"
+"1992-1996","DR. LUDVIK TOPLAK*","SLS"
+"1992-1996","VLADIMIR TOPLER","ZELENI->ZELENI-ESS->ZELENI/LDS"
+"1992-1996","IVAN VERZOLAK","SNS, SSP, SND"
+"1992-1996","JANEZ VINDIŠ","SLS, SKD"
+"1992-1996","DR. FRANC ZAGOŽEN","SLS"
+"1992-1996","JAŠA ZLOBEC L.*","LDS"
+"1992-1996","DR. JANEZ ZUPANEC","LDS"
+"1996-2000","ANTON ANDERLIČ","LDS"
+"1996-2000","JOŽE AVŠIČ","LDS"
+"1996-2000","JOSIP BAJC","SLS, SLS+SKD"
+"1996-2000","ROBERTO BATTELLI","POSLANEC ITALIJANSKE NARODNE SKUPNOSTI"
+"1996-2000","IGOR BAVČAR*","LDS"
+"1996-2000","MAG. ANTON BERGAUER*","SLS, SLS+SKD"
+"1996-2000","RICHARD BEUERMANN","LDS"
+"1996-2000","SAMO BEVK","ZLSD"
+"1996-2000","IVAN BOŽIČ","SKD, SLS+SKD"
+"1996-2000","STANISLAV BRENČIČ","SLS, SLS+SKD"
+"1996-2000","MAG. FRANC BUT*","SLS, SLS+SKD"
+"1996-2000","JANEZ CIMPERMAN*","SDS"
+"1996-2000","DR. VIDA ČADONIČ ŠPELIČ*","SKD, SLS+SKD"
+"1996-2000","FRANC ČEBULJ","SDS"
+"1996-2000","VLADIMIR ČELIGOJ","SDS"
+"1996-2000","ANTON DELAK","DeSUS"
+"1996-2000","VINCENCIJ DEMŠAR","SKD, SLS+SKD"
+"1996-2000","POLONCA DOBRAJC","SNS, SAMOSTOJNA POSLANKA"
+"1996-2000","METOD DRAGONJA*","LDS"
+"1996-2000","DR. JANEZ DRNOVŠEK*","LDS"
+"1996-2000","GEZA DŽUBAN","LDS"
+"1996-2000","ANDREJ FABJAN","SLS, SLS+SKD"
+"1996-2000","DR. SLAVKO GABER*","LDS"
+"1996-2000","MARIO GASPARINI","LDS"
+"1996-2000","ANDREJ GERENČER","LDS"
+"1996-2000","LEON GOSTIŠA*","SLS, SLS+SKD"
+"1996-2000","BENJAMIN HENIGMAN","SKD, SLS+SKD"
+"1996-2000","FRANC (FERI) HORVAT","ZLSD"
+"1996-2000","PETER HRASTELJ","SLS, SLS+SKD"
+"1996-2000","DR. HELENE HREN VENCELJ","SKD, SLS+SKD"
+"1996-2000","IVO HVALICA","SDS"
+"1996-2000","JOŽEF JAGODNIK*","ZLSD"
+"1996-2000","ROMAN JAKIČ*","LDS"
+"1996-2000","BRANKO JANC","LDS"
+"1996-2000","JANEZ JANŠA*","SDS"
+"1996-2000","FRANC JAZBEC","SDS"
+"1996-2000","ZMAGO JELINČIČ","SNS"
+"1996-2000","MIRAN JERIČ","LDS"
+"1996-2000","JOŽEF JEROVŠEK","SDS"
+"1996-2000","AURELIO JURI","ZLSD"
+"1996-2000","JELKO KACIN","LDS"
+"1996-2000","FRANC KANGLER","SLS, SLS+SKD"
+"1996-2000","MIRKO KAPLJA*","LDS"
+"1996-2000","IVAN KEBRIČ","DeSUS"
+"1996-2000","BRANKO KELEMINA","SDS"
+"1996-2000","ŠTEFAN KLINC","SLS+SKD"
+"1996-2000","BOJAN KONTIČ","ZLSD"
+"1996-2000","MAG. JANEZ KOPAČ","LDS"
+"1996-2000","JOŽEF KOŠIR","LDS"
+"1996-2000","ALOJZ KOVŠE*","LDS"
+"1996-2000","JANEZ KRAMBERGER","SLS, SLS+SKD"
+"1996-2000","MAJDA ANA KREGELJ ZBAČNIK","SDS"
+"1996-2000","RAFAEL KUŽNIK","SNS"
+"1996-2000","MAKSIMILJAN LAVRINC*","LDS"
+"1996-2000","DARJA LAVTIŽAR BEBLER","LDS"
+"1996-2000","JOŽE LENIČ*","LDS"
+"1996-2000","PETER LEŠNIK*","SNS"
+"1996-2000","ZORAN LEŠNIK","DeSUS"
+"1996-2000","MIROSLAV LUCI","SDS"
+"1996-2000","JURIJ MALOVRH","SKD, SLS+SKD"
+"1996-2000","ALEKSANDER MERLO","LDS"
+"1996-2000","JANEZ MEŽAN","SDS"
+"1996-2000","RUDOLF MOGE","LDS"
+"1996-2000","MIROSLAV MOZETIČ*","SKD, SLS+SKD"
+"1996-2000","JOŽE MOŽGAN","SLS, SLS+SKD"
+"1996-2000","DARINKA MRAVLJAK","SLS, SLS+SKD"
+"1996-2000","EDA OKRETIČ SALMIČ","DeSUS, SAMOSTOJNA POSLANKA"
+"1996-2000","BORUT PAHOR","ZLSD"
+"1996-2000","ANTON PARTLJIČ","LDS"
+"1996-2000","SAŠO PEČE*","SNS"
+"1996-2000","JANEZ PER*","SLS+SKD"
+"1996-2000","RUDOLF PETAN","SDS"
+"1996-2000","ALOJZ PETERLE*","SKD, SLS+SKD"
+"1996-2000","PETER PETROVIČ*","LDS"
+"1996-2000","JANEZ PODOBNIK","SLS, SLS+SKD"
+"1996-2000","MARJAN PODOBNIK*","SLS, SLS+SKD"
+"1996-2000","FRANC POTOČNIK","SLS, SLS+SKD"
+"1996-2000","MIRAN POTRČ","ZLSD"
+"1996-2000","MARIA POZSONEC","POSLANKA MADŽARSKE NARODNE SKUPNOSTI"
+"1996-2000","JAKOB PRESEĆNIK","SLS, SLS+SKD"
+"1996-2000","CIRIL PUCKO","SKD, SAMOSTOJNI POSLANEC"
+"1996-2000","FRANC PUKŠIČ","SDS"
+"1996-2000","CIRIL METOD PUNGARTNIK*","LDS"
+"1996-2000","IZIDOR REJC","SKD, SLS+SKD"
+"1996-2000","DR. CIRIL RIBIČIČ","ZLSD"
+"1996-2000","FRANCI ROKAVEC","SLS, SLS+SKD"
+"1996-2000","NIKOLAJ ROŽIČ*","LDS"
+"1996-2000","PAVEL RUPAR","SDS"
+"1996-2000","MAG. MARIJAN SCHIFFRER","SKD, SLS+SKD"
+"1996-2000","NADA SKUK*","SKD, SLS+SKD"
+"1996-2000","CIRIL SMRKOLJ*","SLS, SLS+SKD"
+"1996-2000","BORIS SOVIČ*","ZLSD"
+"1996-2000","STANA STOPAR*","LDS"
+"1996-2000","JOŽEF ŠKOLČ*","LDS"
+"1996-2000","BOGOMIR ŠPILETIČ","SDS"
+"1996-2000","JOŽEF ŠPINDLER","LDS"
+"1996-2000","DAVORIN TERČON","LDS"
+"1996-2000","ZORAN THALER*","LDS"
+"1996-2000","BRANKO TOMAŽIČ","SLS, SLS+SKD"
+"1996-2000","HERMAN TOMAŽIČ","LDS"
+"1996-2000","VILI TROFENIK","SLS, SLS+SKD"
+"1996-2000","JANKO VEBER","ZLSD"
+"1996-2000","ALOJZ VESENJAK","SLS, SLS+SKD"
+"1996-2000","IRENA VIRANT*","SDS"
+"1996-2000","DR. FRANC ZAGOŽEN","SLS, SLS+SKD"
+"1996-2000","DR. JOŽE ZAGOŽEN*","SDS"
+"1996-2000","BOGOMIR ZAMERNIK","SDS"
+"1996-2000","JOŽEF ZIMŠEK","LDS"
+"1996-2000","MAG. FRANC ŽNIDARŠIČ","DeSUS"
+"2000-2004","ANTON ANDERLIČ","LDS"
+"2000-2004","SONJA AREH LAVRIČ","SNS"
+"2000-2004","JOŽE AVŠIČ","LDS"
+"2000-2004","DR. ANDREJ BAJUK","Nsi"
+"2000-2004","BOGDAN BAROVIČ","SNS"
+"2000-2004","ROBERTO BATTELLI","POSLANEC ITALIJANSKE NARODNE SKUPNOSTI"
+"2000-2004","IGOR BAVČAR*","LDS"
+"2000-2004","DR. JOŽEF BERNIK","Nsi"
+"2000-2004","RICHARD BEUERMANN*","LDS"
+"2000-2004","SAMO BEVK","ZLSD"
+"2000-2004","DR. RADO BOHINC*","ZLSD"
+"2000-2004","IVAN BOŽIČ","SLS, SLS+SKD"
+"2000-2004","DR. MIHAEL BREJC*","SDS"
+"2000-2004","STANISLAV BRENČIČ","SLS, SLS+SKD"
+"2000-2004","ANTON BUTOLEN*","LDS"
+"2000-2004","JANEZ CIMPERMAN","SDS"
+"2000-2004","FRANCE CUKJATI","SDS"
+"2000-2004","FRANC ČEBULJ","SDS, SAMOSTOJNI POSLANEC, SLS"
+"2000-2004","VOJKO ČELIGOJ","DeSUS"
+"2000-2004","DR. LUCIJA ČOK*","LDS"
+"2000-2004","SILVA ČERNUGELJ","ZLSD"
+"2000-2004","ANTON DELAK*","DeSUS"
+"2000-2004","MAG. MARKO DIACI","SMS, SAMOSTOJNI POSLANEC"
+"2000-2004","DR. JANEZ DRNOVŠEK*","LDS"
+"2000-2004","MAG. JANEZ DROBNIČ","Nsi"
+"2000-2004","GEZA DŽUBAN","LDS"
+"2000-2004","ANDREJ FABJAN","SLS, SLS+SKD"
+"2000-2004","MATJAŽ FALKNER*","Nsi"
+"2000-2004","DR. SLAVKO GABER*","LDS"
+"2000-2004","MAG. MITJA GASPARI*","LDS"
+"2000-2004","MARIO GASPARINI*","LDS"
+"2000-2004","ANDREJ GERENČER*","LDS"
+"2000-2004","LJUBO GERMIČ","LDS"
+"2000-2004","SINIŠA GERMOVŠEK*","SDS"
+"2000-2004","MAG. ZORAN GRAČNER","LDS"
+"2000-2004","LEOPOLD GROŠELJ","ZLSD"
+"2000-2004","FRANC (FERI) HORVAT","ZLSD"
+"2000-2004","ROMAN JAKIČ*","LDS"
+"2000-2004","BRANKO JANC","LDS"
+"2000-2004","IVAN (JANEZ) JANŠA","SDS"
+"2000-2004","ZMAGO JELINČIČ PLEMENITI","SNS"
+"2000-2004","MIRAN JERIČ","LDS"
+"2000-2004","JOŽEF JEROVŠEK","SDS"
+"2000-2004","AURELIO JURI","ZLSD"
+"2000-2004","JELKO KACIN*","LDS"
+"2000-2004","FRANC KANGLER","SLS, SLS+SKD"
+"2000-2004","BLAŽ KAVČIČ","LDS"
+"2000-2004","JOŽE (JOŽEF) KAVTIČNIK","LDS"
+"2000-2004","IVAN KEBRIČ","DeSUS"
+"2000-2004","BRANKO KELEMINA","SDS"
+"2000-2004","JANEZ KOMLJANEC*","LDS"
+"2000-2004","BOJAN KONTIČ","ZLSD"
+"2000-2004","MAG. JANEZ KOPAČ*","LDS"
+"2000-2004","MILAN KOPUŠAR","LDS"
+"2000-2004","MAG. JANEZ KRAMBERGER","SLS, SLS+SKD"
+"2000-2004","LEOPOLD (LEO) KREMŽAR","LDS"
+"2000-2004","MAKSIMILJAN LAVRINC","LDS"
+"2000-2004","DARJA LAVTIŽAR BEBLER*","LDS"
+"2000-2004","FRANC LENKO*","DeSUS"
+"2000-2004","PETER LEVIČ","SMS, SAMOSTOJNI POSLANEC"
+"2000-2004","LIDIJA MAJNIK","LDS"
+"2000-2004","JURIJ MALOVRH","SLS, SLS+SKD"
+"2000-2004","IVAN MAMIĆ","Nsi"
+"2000-2004","DORIJAN MARŠIČ","LDS"
+"2000-2004","JERICA MRZEL*","ZLSD"
+"2000-2004","ALEKSANDER MERLO*","LDS"
+"2000-2004","RUDOLF MOGE","LDS"
+"2000-2004","BORUT PAHOR*","ZLSD"
+"2000-2004","ANTON (TONE) PARTLJIČ","LDS"
+"2000-2004","IRMA PAVLINIČ KREBS","LDS"
+"2000-2004","BREDA PEČAN*","ZLSD"
+"2000-2004","SAŠO PEČE","SNS"
+"2000-2004","RUDOLF PETAN","SDS"
+"2000-2004","ALOJZ PETERLE*","Nsi"
+"2000-2004","JANEZ PODOBNIK","SLS, SLS+SKD"
+"2000-2004","VALENTIN POHOREC","DeSUS"
+"2000-2004","MAG. MAJDA POTRATA","ZLSD"
+"2000-2004","MIRAN POTRČ","ZLSD"
+"2000-2004","MARIA POZSONEC","POSLANKA MADŽARSKE NARODNE SKUPNOSTI"
+"2000-2004","CIRIL PUCKO","LDS"
+"2000-2004","FRANC PUKŠIČ","SDS"
+"2000-2004","FRANCI ROKAVEC","SLS, SLS+SKD"
+"2000-2004","MAG. ANTON ROP*","LDS"
+"2000-2004","PAVEL RUPAR","SDS"
+"2000-2004","DR. DIMITRIJ RUPEL*","LDS, SAMOSTOJNI POSLANEC, SDS"
+"2000-2004","DANICA SIMŠIČ*","ZLSD"
+"2000-2004","ALOJZ SOK","Nsi"
+"2000-2004","STANISLAVA STOPAR*","LDS"
+"2000-2004","FRANC SUŠNIK","SDS"
+"2000-2004","MAJDA ŠIRCA","LDS"
+"2000-2004","JOŽEF ŠKOLČ*","LDS"
+"2000-2004","JOŽEF ŠPINDLER","LDS"
+"2000-2004","IGOR ŠTEMBERGER","SMS, SAMOSTOJNI POSLANEC"
+"2000-2004","BORUT ŠUKLJE*","LDS"
+"2000-2004","MATJAŽ ŠVAGAN","LDS"
+"2000-2004","JOŽE TANKO","SDS"
+"2000-2004","DAVORIN TERČON","LDS"
+"2000-2004","MARIJA ANA TISOVIC","Nsi"
+"2000-2004","VILI TROFENIK","SLS, SLS+SKD"
+"2000-2004","JANKO VEBER","ZLSD"
+"2000-2004","MAG. ANDREJ VIZJAK","SDS"
+"2000-2004","BOGOMIR VNUČEC","SMS, SDS"
+"2000-2004","DUŠAN VUČKO","LDS"
+"2000-2004","CVETA ZALOKAR ORAŽEM","LDS"
+"2000-2004","BOGOMIR ZAMERNIK","SDS"
+"2000-2004","JAŠA ZLOBEC LUKIČ*","LDS"
+"2000-2004","MAJDA ZUPAN","Nsi"
+"2004-2008","ANTON ANDERLIČ","LDS"
+"2004-2008","JOSIP BAJC","SLS"
+"2004-2008","DR. ANDREJ BAJUK*","Nsi"
+"2004-2008","BOGDAN BAROVIČ","SNS"
+"2004-2008","ROBERTO BATTELLI","POSLANEC ITALIJANSKE NARODNE SKUPNOSTI"
+"2004-2008","SAMO BEVK","SD"
+"2004-2008","STANISLAV BRENČIČ","SLS"
+"2004-2008","MAG. ANDREJ BRUČAN*","SDS"
+"2004-2008","MAG. FRANC CAPUDER","Nsi"
+"2004-2008","FRANCE CUKJATI","SDS"
+"2004-2008","MAG. MILAN M. CVIKL","LDS, SD"
+"2004-2008","ZVONKO ČERNAČ","SDS"
+"2004-2008","POLONCA DOBRAJC","SDS"
+"2004-2008","MAG. JANEZ DROBNIČ*","Nsi"
+"2004-2008","MARJAN DROFENIK*","SLS"
+"2004-2008","GEZA DŽUBAN","LDS"
+"2004-2008","JOŽEF FICKO*","SDS"
+"2004-2008","DR. SLAVKO GABER","LDS, NEPOVEZANI POSLANEC"
+"2004-2008","DR. PAVEL GANTAR","LDS, NP"
+"2004-2008","LJUBO GERMIČ","LDS"
+"2004-2008","IVAN GRILL","SDS"
+"2004-2008","MAG. BRANKO GRIMS","SDS"
+"2004-2008","ALEŠ GULIČ","LDS"
+"2004-2008","MATJAŽ HAN","SD"
+"2004-2008","BOJAN HOMAN*","SDS"
+"2004-2008","FRANC (FERI) HORVAT","SD"
+"2004-2008","JOŽEF HORVAT","Nsi"
+"2004-2008","SREČKO HVAUC","SDS"
+"2004-2008","EVA IRGL","SDS"
+"2004-2008","KRISTIJAN JANC","SLS"
+"2004-2008","JANEZ JANŠA*","SDS"
+"2004-2008","FRANC JAZBEC","SDS"
+"2004-2008","IVAN JELEN","DeSUS"
+"2004-2008","ZMAGO JELINČIČ PLEMENITI","SNS"
+"2004-2008","ALENKA JERAJ","SDS"
+"2004-2008","MIRAN JERIČ","LDS"
+"2004-2008","JOŽEF JEROVŠEK","SDS"
+"2004-2008","AURELIO JURI","SD"
+"2004-2008","FRANC KANGLER*","SLS"
+"2004-2008","MAG. VASJA KLAVORA","DeSUS"
+"2004-2008","ANTON KOKALJ","Nsi"
+"2004-2008","BOJAN KONTIČ","SD"
+"2004-2008","DRAGO KOREN","Nsi"
+"2004-2008","DIMITRIJ KOVAČIČ","SDS"
+"2004-2008","MAG. JANEZ KRAMBERGER","SLS"
+"2004-2008","DANIJEL KRIVEC","SDS"
+"2004-2008","MOJCA KUCLER DOLINAR","Nsi"
+"2004-2008","DUŠAN KUMER","SD"
+"2004-2008","DR. MATEJ LAHOVNIK","LDS, NEPOVEZANI POSLANEC, NP"
+"2004-2008","MITJA LJUBELJŠEK","SDS"
+"2004-2008","MIROSLAV LUCI*","SDS"
+"2004-2008","DARJA LAVTIŽAR BEBLER","LDS, SD"
+"2004-2008","BRANKO MARINIČ","SDS"
+"2004-2008","MARTIN MIKOLIČ","Nsi"
+"2004-2008","RUDOLF MOGE","LDS"
+"2004-2008","STANE PAJK","SDS"
+"2004-2008","DR. MARKO PAVLIHA","LDS, SD"
+"2004-2008","BREDA PEČAN","SD"
+"2004-2008","SAŠO PEČE","SNS"
+"2004-2008","RUDOLF PETAN","SDS"
+"2004-2008","MILAN PETEK","LDS"
+"2004-2008","MIRO PETEK","SDS"
+"2004-2008","MARIJAN POJBIČ*","SDS"
+"2004-2008","ALOJZ POSEDEL","LDS, NP"
+"2004-2008","MAG. MAJDA POTRATA","SD"
+"2004-2008","MIRAN POTRČ","SD"
+"2004-2008","MARIA POZSONEC","POSLANKA MADŽARSKE NARODNE SKUPNOSTI"
+"2004-2008","JAKOB PRESEĆNIK","SLS"
+"2004-2008","MIHAEL PREVC","SLS"
+"2004-2008","SREČKO PRIJATELJ","SNS"
+"2004-2008","FRANC PUKŠIČ*","SDS"
+"2004-2008","VILI REZMAN","DeSUS"
+"2004-2008","MAG. ANTON ROP","LDS, SD"
+"2004-2008","BOJAN RUGELJ","SDS"
+"2004-2008","PAVEL RUPAR*","SDS"
+"2004-2008","MAG. BORUT SAJOVIC","LDS"
+"2004-2008","DR. MITJA SLAVINEC","LDS"
+"2004-2008","ALOJZ SOK","Nsi"
+"2004-2008","BOJAN STARMAN","SDS"
+"2004-2008","FRANC SUŠNIK","SDS"
+"2004-2008","MAJDA ŠIRCA","LDS, NP"
+"2004-2008","CIRIL TESTEN","Nsi"
+"2004-2008","VILI TROFENIK","LDS, NP"
+"2004-2008","MARJETKA UHAN","Nsi"
+"2004-2008","JANKO VEBER","SD"
+"2004-2008","RUDI VERŠNIK","SDS"
+"2004-2008","MAG. ANDREJ VIZJAK*","SDS"
+"2004-2008","BOŠTJAN ZAGORAC","SNS"
+"2004-2008","CVETA ZALOKAR ORAŽEM","LDS, NP"
+"2004-2008","BOGOMIR ZAMERNIK","SDS"
+"2004-2008","MILENKO ZIHERL","SDS"
+"2004-2008","DR. MILAN ZVER*","SDS"
+"2004-2008","BARBARA ŽGAJNER TAVŠ","SNS"
+"2004-2008","MAG. FRANC ŽNIDARŠIČ","DeSUS"

File misc_scripts/poslanci2.py

+#!/usr/bin/env python
+
+import sys
+sys.path.append("..")
+
+from django.template.defaultfilters import slugify
+
+from delajozate.dz.models import Oseba, Stranka, ClanStranke
+from delajozate.temporal import END_OF_TIME
+
+import csv
+import re
+from datetime import date
+from pprint import pprint
+
+start = {
+	'1992-1996': date(1992, 12, 23),
+	'1996-2000': date(1996, 11, 27),
+	'2000-2004': date(2000, 10, 22),
+	'2004-2008': date(2004, 10, 22)
+}
+
+end = {
+	'1992-1996': date(1996, 11, 27),
+	'1996-2000': date(2000, 10, 22),
+	'2000-2004': date(2004, 10, 22),
+	'2004-2008': date(2008, 10, 15)
+}
+
+mandates = {
+	'1992-1996': 1,
+	'1996-2000': 2,
+	'2000-2004': 3,
+	'2004-2008': 4,
+	'2008-2011': 5,
+}
+
+stranke = {
+	1: (date(1993, 5, 29), date(2005, 4, 2)),
+	2: (date(2005, 4, 2), date(9999, 12, 31)),
+	3: (date(1991, 3, 17), date(9999, 12, 31)),
+	4: (date(2000, 8, 4), date(9999, 12, 31)),
+	5: (date(2007, 10, 6), date(9999, 12, 31)),
+	6: (date(1994, 3, 12), date(9999, 12, 31)),
+	7: (date(1992, 6, 27), date(2000, 4, 15)),
+	8: (date(1989, 11, 4), date(2000, 4, 15)),
+	9: (date(2000, 4, 15), date(2002, 1, 31)),
+	10: (date(2002, 1, 31), date(9999, 12, 31)),
+	11: (date(1991, 5, 30), date(9999, 12, 31)),
+	12: (date(1994, 4, 12), date(2000, 3, 16)),
+	13: (date(1993, 3, 23), date(1994, 3, 12)),
+	14: (date(2002, 2, 28), date(9999, 12, 31)),
+	15: (date(1989, 2, 16), date(1990, 2, 24)),
+	16: (date(1990, 2, 24), date(1996, 3, 23)),
+	17: (date(2003, 9, 13), date(9999, 12, 31)),
+	18: (None, date(1994, 4, 6)),
+	19: (date(1994, 4, 6), None),
+	20: (date(2000, 8, 8), date(2009, 7, 4)),
+	21: (date(2009, 7, 4), date(9999, 12, 31)),
+	22: (date(2004, 5, 8), date(2008, 1, 10)),
+	23: (date(1994, 3, 12), date(9999, 12, 31)),
+	24: (date(1991, 10, 13), date(1994, 3, 12)),
+	25: (date(1989, 6, 11), date(9999, 12, 31)),
+	26: (date(2000, 3, 16), date(2002, 2, 28)),
+	27: (date(1996, 3, 23), date(2003, 9, 13)),
+}
+
+# 19 missing because of ID conflict; really belongs to 18; This means
+# D->DS transitions are broken (probably missing second part)
+stranke_id = {
+	'as': [22],
+	'd': [18],
+	'desus': [11],
+	'ds': [24, 23],
+	'lds': [6],
+	'nsi': [4],
+	'sd': [2],
+	'sds': [27, 17],
+	'sdss': [16],
+	'sdzs': [15],
+	'skd': [8],
+	'sls': [7, 10],
+	'slsskd': [9],
+	'sms': [20],
+	'sms-zeleni': [21],
+	'snd': [12],
+	'sns': [3],
+	'ssn': [26, 14],
+	'zares': [5],
+	'zeleni': [25],
+	'zeleni-ess': [13],
+	'zlsd': [1]
+}
+
+name_changes = {
+	24: { 'to': 23, 'when': date(1994, 3, 12) },
+	27: { 'to': 17, 'when': date(2003, 9, 13) }
+}
+
+pos_exceptions = {
+	'tone-anderlic': 'anton-anderlic',
+	'zmago-jelincic': 'zmago-jelincic-plemeniti',
+	'anton-tone-partljic': 'tone-partljic',
+	'ivan-janez-jansa': 'janez-jansa',
+	'jasa-zlobec-l': 'jasa-zlobec-lukic',
+	'majda-sirca': 'majda-sirca-ravnikar'
+}
+
+# Members are not members of a party
+party_exceptions = set([
+	"ssp",
+	"samostojna-poslanka",
+	"samostojni-poslanec",
+	"nepovezani-poslanec",
+	"np"
+])
+
+special = set([
+	"poslanec-italijanske-narodne-skupnosti",
+	"poslanka-madzarske-narodne-skupnosti"
+])
+
+
+name_re = re.compile('^((?:dr|mag)\.)?\s*(\S+)\s*(.+?)(\*)?$', re.I)
+
+
+def find_person(name_slug):
+	if name_slug in pos_exceptions:
+		name_slug = pos_exceptions[name_slug]
+	try:
+		return Oseba.objects.get(slug=name_slug)
+	except:
+		return None
+
+def get_slug(value):
+	'''
+	Get slug for a person without titles
+	'''
+	name = value.strip()
+	if name.lower()[:3] == "dr.":
+		name = name[3:].strip()
+	if name.lower()[:4] == "mag.":
+		name = name[4:].strip()
+	name_slug = slugify(name)
+	if name_slug in pos_exceptions:
+		name_slug = pos_exceptions[name_slug]
+	return name_slug
+
+
+def get_period_membership(raw_string, period):
+	'''
+	Parse party membership in a given period
+
+	Returns a list of membership dicts:
+		- from (when membership started)
+		- to (when ended)
+		- party (party ID)
+
+	Note: party can also be:
+		- 0 (not a member of any)
+		- -1 (minority representative)
+		- -2 (unknown)
+	'''
+	period_start = start[period]
+	period_end = end[period]
+	known_date = period_start
+	memberships = []
+
+	# First parse -> (we have exact dates)
+	# Then parse rest by , (put None)
+	# Note: party can change name (gets new ID)
+	party = None
+	parts = [ x.strip() for x in raw_string.strip().lower().split("->") ]
+	for part in parts:
+		if party: # From previous iteration. Set to the one that changed name
+			if party in stranke_id:
+				for pid in stranke_id[party]:
+					pp = stranke[pid]
+					if (not pp[0] or pp[0] < known_date) and pp[1] > known_date: # Found it, already added though
+						known_date = pp[1]
+						memberships[-1]['to'] = known_date
+						memberships[-1]['party'] = pid
+			else: # Unaccounted coalitions (ZL, Zeleni/LDS)
+				pass
+
+		parties = [ slugify(x.strip()) for x in part.split(",") ]
+		for p in parties:
+			if party: # Name change: new name
+				if p in stranke_id:
+					for pid in stranke_id[p]:
+						pp = stranke[pid]
+						if pp[0] == known_date and (not pp[1] or pp[1] > known_date): # Found it
+							memberships.append({
+								'party': pid,
+								'from': known_date,
+								'to': None
+							})
+				else: # Unaccounted coalitions (ZL, Zeleni/LDS)
+					pass
+				party = None
+			else:
+				if p in stranke_id:
+					memberships.append({
+						'party': stranke_id[p][0],
+						'from': None,
+						'to': None
+					})
+				elif p in special: # Minority
+					memberships.append({ 'party': -1,
+						'from': period_start,
+						'to': period_end
+					})
+				elif p in party_exceptions:
+					# Not a party member in this period; still add marker
+					memberships.append({ 'party': 0, 'from': None, 'to': None })
+				else: # Coalitions: ZL or Zeleni/LDS; Don't know how to handle yet
+					memberships.append({ 'party': -2, 'from': None, 'to': None })
+		party = p
+	if len(memberships):
+		if not memberships[0]['from']:
+			memberships[0]['from'] = period_start
+		if not memberships[-1]['to']:
+			memberships[-1]['to'] = period_end
+	return memberships
+
+def create_time_helper(members, s, e):
+	# Set 'to' and 'from' for helpers for easier handling of time
+	helpers = []
+	for it in members:
+		item = it.copy()
+		if not item['from']:
+			item['from'] = s
+		else:
+			s = item['from']
+		if item['to']:
+			s = item['to']
+		helpers.append(item)
+	helpers.reverse()
+	for item in helpers:
+		if not item['to']:
+			item['to'] = e
+		else:
+			e = item['to']
+	return helpers
+
+def fix_party_name_change(memberships):
+	fixed = []
+	period_start = None
+	period_end = None
+	period = None
+	party = None
+	helpers = []
+	rmemberships = memberships[:]
+
+	# Set 'to' and 'from' for helpers for easier handling of time
+	helpers = create_time_helper(memberships, start['1992-1996'], end['2004-2008'])
+
+	# Now get to it
+	rmemberships.reverse()
+	while rmemberships:
+		period = rmemberships.pop()
+		helper = helpers.pop()
+
+		if period['party'] > 0 and period['party'] in name_changes: # possible candidate for name change
+			pid = period['party']
+			change_date = name_changes[pid]['when']
+			if helper['from'] > change_date:
+				period['party'] = name_changes[pid]['to']
+				fixed.append(period)
+			else:
+				if helper['to'] > change_date: # ...and helper['from'] < change_date => split
+					new_period = {
+						'party': name_changes[pid]['to'],
+						'from': name_changes[pid]['when'],
+						'to': helper['to']
+					}
+					period['to'] = name_changes[pid]['when']
+					fixed.append(period)
+					fixed.append(new_period)
+				else: # Before change
+					fixed.append(period)
+		else:
+			fixed.append(period)
+	fixed.reverse()
+	return fixed
+
+def clean_membership(memberships):
+	'''
+	Merge overlapping intervals
+	'''
+	clean = []
+	period = None
+	rmemberships = memberships[:]
+
+	while rmemberships:
+		new_period = rmemberships.pop()
+		if not period:
+			period = new_period
+			continue
+
+		if period['party'] == new_period['party'] and period['to'] == new_period['from']:
+			period['to'] = new_period['to']
+		else:
+			clean.append(period)
+			period = new_period
+
+	clean.append(period)
+	return clean
+
+def save_membership(name_slug, memberships):
+	'''
+	Save memberships. Return True if person exists and False otherwise.
+	'''
+	person = find_person(name_slug)
+
+	if person:
+		for m in memberships:
+			party_id = m['party'] if m['party'] > 0 else None
+			# TODO: Change database so it can handle null 'from'
+			ClanStranke.objects.create(oseba=person, stranka_id=party_id, od=m['from'], do=m['to'])
+		return True
+	return False
+
+def run(filepath):
+	rdr = csv.reader(open(filepath))
+	poslanci = {}
+	today = date.today()
+
+	for rec in rdr:
+		name_slug = get_slug(rec[1])
+		poslanci.setdefault(name_slug, [])
+		poslanci[name_slug] += get_period_membership(rec[2], rec[0])
+
+	for pos in poslanci:
+		if poslanci[pos][-1]['to'] > today:
+			poslanci[pos][-1]['to'] = END_OF_TIME
+		poslanci[pos] = fix_party_name_change(poslanci[pos])
+		poslanci[pos] = clean_membership(poslanci[pos])
+		# save_membership(pos, poslanci[pos])
+
+	# Test cases
+	print 'roberto-battelli'
+	pprint(poslanci['roberto-battelli'])
+	print 'anton-anderlic'
+	pprint(poslanci['anton-anderlic'])
+	print
+	print 'janez-jansa'
+	pprint(poslanci['janez-jansa'])
+	print
+	print 'ljerka-bizilj'
+	pprint(poslanci['ljerka-bizilj'])
+	print 'stefan-matus'
+	pprint(poslanci['stefan-matus'])
+	print 'france-bucar'
+	pprint(poslanci['france-bucar'])
+
+
+if __name__ == '__main__':
+	run(sys.argv[1])