Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

init

  • Loading branch information...
commit 280b251b1bb9830798d021171eb6f8f4fa0bffff 0 parents
Tobias Schmidt authored October 08, 2009
2  .gitignore
... ...
@@ -0,0 +1,2 @@
  1
+.DS_Store
  2
+config.yml
5  TODO
... ...
@@ -0,0 +1,5 @@
  1
+* Datenreinigung Herr und Frau ...
  2
+
  3
+* Ähnlichkeit Vergleich Referenzdaten
  4
+* vornamen matching (Ä. <=> Ämil)
  5
+* hausnummern range
39  clean.rb
... ...
@@ -0,0 +1,39 @@
  1
+class Clean
  2
+
  3
+  def self.insert(values)
  4
+    query = 'INSERT INTO "kunden" ("origid","origtable","anrede","titel","vorname","mittelname","nachname","strasse","hausnummervon","hausnummerbis","postfach","postleitzahl","ort","ortzusatz","vorwahl","telefonnummer","geburtsdatum") VALUES (' + values.join('),(') + ")\n\n"
  5
+    ActiveRecord::Base.connection.execute(query)
  6
+  end
  7
+
  8
+  def self.process
  9
+    %w(Versand).each do |klass|
  10
+      puts klass
  11
+
  12
+      i = 0
  13
+      values = []
  14
+
  15
+      klass.constantize.all().each do |object|
  16
+          i += 1
  17
+
  18
+          attributes = [object.id, klass, object.anrede, object.titel, object.vorname, object.mittelname, object.nachname, object.strasse, object.hausnummervon, object.hausnummerbis, object.postfach, object.postleitzahl, object.ort, object.ortzusatz, object.vorwahl, object.telefonnummer, object.geburtsdatum]
  19
+          values << attributes.map do |attribute|
  20
+            case attribute.class.to_s
  21
+            when "String" then "'#{ActiveRecord::Base.connection.quote_string(attribute)}'"
  22
+            when "Date" then "'#{attribute}'"
  23
+            when "NilClass" then "null"
  24
+            else attribute
  25
+            end
  26
+          end.join(", ")
  27
+
  28
+          if i % 5000 == 0
  29
+            puts "Processed #{i} tupel"
  30
+            insert(values)
  31
+            values = []
  32
+          end
  33
+      end
  34
+
  35
+      insert(values) unless values.empty?
  36
+    end
  37
+  end
  38
+  
  39
+end
244  cleaner.rb
... ...
@@ -0,0 +1,244 @@
  1
+module Cleaner
  2
+  
  3
+  def id
  4
+    self[:id].to_i
  5
+  end
  6
+  
  7
+  def anrede
  8
+    process_name unless @processed_name
  9
+    @anrede
  10
+  end
  11
+  
  12
+  def titel
  13
+    process_name unless @processed_name
  14
+    @titel
  15
+  end
  16
+  
  17
+  def vorname
  18
+    process_name unless @processed_name
  19
+    @vorname
  20
+  end
  21
+  
  22
+  def mittelname
  23
+    process_name unless @processed_name
  24
+    @mittelname
  25
+  end
  26
+  
  27
+  def nachname
  28
+    process_name unless @processed_name
  29
+    @nachname
  30
+  end
  31
+  
  32
+  def strasse
  33
+    unless self[:strasse].blank?
  34
+      @strasse = self[:strasse].strip
  35
+      case self[:strasse]
  36
+      when /Postfach (\d+)/
  37
+        @strasse = nil
  38
+        @postfach = $1
  39
+      when /(.*?) *(\d+[a-zA-Z]*)/
  40
+        @strasse = $1
  41
+        self[:hausnummer] = $2
  42
+      end
  43
+      @strasse = @strasse.sub(/ Str.$/, 'str.') unless @strasse.blank?
  44
+      @strasse
  45
+    end
  46
+  end
  47
+  
  48
+  def hausnummervon
  49
+    process_hausnummer unless @processed_hausnummer
  50
+    @hausnummervon
  51
+  end
  52
+  
  53
+  def hausnummerbis
  54
+    process_hausnummer unless @processed_hausnummer
  55
+    @hausnummerbis
  56
+  end
  57
+  
  58
+  def postleitzahl
  59
+    unless self[:postleitzahl].blank?
  60
+      self[:postleitzahl].sub("D-", "")
  61
+    end
  62
+  end
  63
+  
  64
+  def postfach
  65
+    result = @postfach || self[:postfach]
  66
+    result.blank? || result == 0 ? nil : result.to_s.gsub(/[^0-9]/, '').to_i
  67
+  end
  68
+  
  69
+  def ort
  70
+    process_ort unless @processed_ort
  71
+    @ort
  72
+  end
  73
+  
  74
+  def ortzusatz
  75
+    process_ort unless @processed_ort
  76
+    @ortzusatz
  77
+  end
  78
+  
  79
+  def vorwahl
  80
+    parse_telefon unless @parsed_telefon
  81
+    @vorwahl
  82
+  end
  83
+  
  84
+  def telefonnummer
  85
+    parse_telefon unless @parsed_telefon
  86
+    @telefonnummer
  87
+  end
  88
+  
  89
+  def geburtsdatum
  90
+    date = nil
  91
+    
  92
+    unless self[:geburtsdatum].blank?
  93
+      case self[:geburtsdatum]
  94
+      when /(\d{2})\.(\d{2})\.(\d{4})/
  95
+        day = $1.to_i
  96
+        month = $2.to_i
  97
+        year = $3.to_i
  98
+      when /(\d{4})(\d{2})(\d{2})/
  99
+        day = $3.to_i
  100
+        month = $2.to_i
  101
+        year = $1.to_i
  102
+      when /(\d{2})\/(\d{2})\/(\d{2})/
  103
+        day = $1.to_i
  104
+        month = $2.to_i
  105
+        year = "19#{$3}".to_i
  106
+      end
  107
+      
  108
+      if month > 12
  109
+        day, month = month, day
  110
+      end
  111
+      
  112
+      # create date objects
  113
+      tries = 0
  114
+      begin
  115
+        date = Date.parse("#{year}-#{month}-#{day}")
  116
+      rescue ArgumentError
  117
+        if tries < 1 
  118
+          tries += 1
  119
+          # correct days
  120
+          if day > 31 || (month == 2 && day > 28) || (month % 2 == 0 && day > 30)
  121
+            day -= 1
  122
+          end
  123
+          retry
  124
+        end
  125
+        date = nil
  126
+      end
  127
+      
  128
+      # correct dates in the future
  129
+      date -= 100.years if date && date > Date.today
  130
+    end
  131
+    
  132
+    date
  133
+  end
  134
+  
  135
+  private
  136
+  
  137
+  def parse_telefon
  138
+    unless  self[:telefon].blank?        
  139
+      tel = self[:telefon].strip.gsub(/\+49|\(|\)/, '')
  140
+      if tel =~ /\d+(\.|\/)\d+(\.|\/)\d+/
  141
+        self.geburtsdatum = self.telefon
  142
+        self[:telefon] = nil
  143
+      else
  144
+        parts = tel.split("/")
  145
+        if parts.size == 2
  146
+          @vorwahl = parts[0]
  147
+          @telefonnummer = parts[1].to_i
  148
+        else
  149
+          @telefonnummer = parts.join.to_i
  150
+        end
  151
+      end
  152
+    end
  153
+    @telefonnummer = nil if @telefonnummer == 0
  154
+    @parsed_telefon = true
  155
+  end
  156
+  
  157
+  def process_name
  158
+    process_nachname
  159
+    process_vorname
  160
+    process_anrede
  161
+    process_titel
  162
+    @processed_name = true
  163
+  end
  164
+  
  165
+  def process_nachname
  166
+    @nachname = self[:nachname].strip
  167
+    @nachname = nil if @nachname.blank?
  168
+    
  169
+    if @nachname =~ /(Frau und Herr|Herr und Frau|Herr|Frau)($| )(.*)/
  170
+      @anrede = $1
  171
+      @nachname = $3
  172
+    end
  173
+    if @nachname =~ /(Dipl\. Ing\.|Dr\.|Prof\.|Dr\. Prof\.|Prof\. Dr\.)* *(.*)/
  174
+      @titel = $1
  175
+      @nachname = $2
  176
+    end
  177
+    
  178
+    @nachname = @nachname.gsub(/  +/, ' ') unless @nachname.blank?
  179
+  end
  180
+  
  181
+  def process_vorname
  182
+    @vorname = self[:vorname].strip
  183
+    @vorname = nil if @vorname.blank?
  184
+    
  185
+    if @vorname =~ /(Frau und Herr|Herr und Frau|Herr|Frau)($| )(.*)/
  186
+      @anrede = $1
  187
+      @vorname = $3
  188
+    end
  189
+    if @vorname =~ /(Dipl\. Ing\.|Dr\.|Prof\.|Dr\. Prof\.|Prof\. Dr\.)* *(.*)/
  190
+      @titel = $1
  191
+      @vorname = $2
  192
+    end
  193
+    
  194
+    unless @vorname.nil? || @anrede == "Herr und Frau"
  195
+      parts = @vorname.split(" ")
  196
+      if parts.size > 1 && !%w(und u. +).include?(parts[1])
  197
+        @vorname = parts.shift
  198
+        @mittelname = parts.join(" ")
  199
+      end
  200
+    end
  201
+    
  202
+    # rechange first chars
  203
+    if !@vorname.blank? && @vorname =~ /([a-zäöü])([A-ZÄÖÜ])(.*)/u
  204
+      @vorname = $2+$1+$3
  205
+    end
  206
+  end
  207
+  
  208
+  def process_hausnummer
  209
+    unless self[:hausnummer].blank?
  210
+      self[:hausnummer] = self[:hausnummer].strip.upcase
  211
+      parts = self[:hausnummer].split('-')
  212
+      if parts.size == 2
  213
+        @hausnummervon = parts[0]
  214
+        @hausnummerbis = parts[1] =~ /^[A-Z]+$/ ? "#{parts[0].to_i}#{parts[1]}" : parts[1]
  215
+      else
  216
+        @hausnummervon = self[:hausnummer]
  217
+        @hausnummerbis = self[:hausnummer]
  218
+      end
  219
+    end
  220
+    @processed_hausnummer = true
  221
+  end
  222
+  
  223
+  def process_anrede
  224
+    @anrede
  225
+  end
  226
+  
  227
+  def process_titel
  228
+    @titel
  229
+  end
  230
+  
  231
+  def process_ort
  232
+    unless self[:ort].blank?
  233
+      self[:ort] = self[:ort].strip
  234
+      if self[:ort] =~ /(.*?) *, *(.*)/
  235
+        @ort = $1
  236
+        @ortzusatz = $2
  237
+      else
  238
+        @ort = self[:ort]
  239
+      end
  240
+    end
  241
+    @processed_ort = true
  242
+  end
  243
+  
  244
+end
16  config.example.yml
... ...
@@ -0,0 +1,16 @@
  1
+database:
  2
+  adapter: "postgresql"
  3
+  
  4
+  postgresql:
  5
+    host:     "localhost"
  6
+    username: "postgres"
  7
+    database: "datenreinigung"
  8
+  
  9
+  mysql:
  10
+    host:     "localhost"
  11
+    username: "root"
  12
+    database: "datenreinigung"
  13
+
  14
+detector:
  15
+  save: true
  16
+  keys: ["nachvorstrasse"]
15  config.rb
... ...
@@ -0,0 +1,15 @@
  1
+module Datenreinigung
  2
+  class Config
  3
+    @@config = nil
  4
+
  5
+    def self.reload
  6
+      @@config = YAML.load(File.open(File.join(File.dirname(__FILE__),"config.yml")))
  7
+    end
  8
+
  9
+    def self.[](attribute)
  10
+      @@config[attribute.to_s]
  11
+    end
  12
+
  13
+    reload
  14
+  end
  15
+end
59  detector.rb
... ...
@@ -0,0 +1,59 @@
  1
+class Detector
  2
+  
  3
+  WINDOWSIZE = 20
  4
+  THRESHOLD = 0.3
  5
+  STEPSIZE = 10000
  6
+  
  7
+  def initialize(key, save = false)
  8
+    @key = key
  9
+    @save = save
  10
+  end
  11
+  
  12
+  def output(results)
  13
+    values = []
  14
+    results.sort_by { |r| r[:distance] }.each do |result|
  15
+      if @save
  16
+        minid, maxid = result[:k1].origid > result[:k2].origid ? [result[:k2].origid, result[:k1].origid] : [result[:k1].origid, result[:k2].origid]
  17
+        values << [minid, maxid, "'#{@key}'", result[:distance]].join(",")
  18
+      else
  19
+        puts "#{result[:distance]}: #{result[:k1]} ---- #{result[:k2]}"
  20
+      end
  21
+    end
  22
+    
  23
+    if @save
  24
+      query = 'INSERT INTO "matches" ("kunde1_id","kunde2_id","key","distance") VALUES (' + values.join('),(') + ")\n\n"
  25
+      ActiveRecord::Base.connection.execute(query)
  26
+    end
  27
+  end
  28
+  
  29
+  def process
  30
+    count = Kunde.count
  31
+    steps = (count / STEPSIZE) + 1
  32
+    
  33
+    (0..steps).each do |step|
  34
+      retrieve = Time.now
  35
+      kunden = Kunde.all(:conditions => "kunden_keys.keyname = '#{@key}'", :joins => :key, :order => 'value ASC', :offset => [step*STEPSIZE - WINDOWSIZE, 0].max, :limit => (step+1)*STEPSIZE)
  36
+      
  37
+      detect = Time.now
  38
+      result = []
  39
+      kunden.each_with_index do |kunde, i|
  40
+        (0..([i, WINDOWSIZE].min-1)).each do |k|
  41
+          other = kunden[i-k-1]
  42
+          distance = kunde.distance_to(other)
  43
+          result << {:distance => distance, :k1 => kunde, :k2 => other} if distance < THRESHOLD
  44
+        end
  45
+      end
  46
+      
  47
+      insert = Time.now
  48
+      output(result)
  49
+      
  50
+      finish = Time.now
  51
+      puts "processed #{kunden.size} objects and found #{result.size} duplicates in #{time_format(finish-retrieve)} minutes (select: #{time_format(detect-retrieve)}, detect: #{time_format(insert-detect)}, insert: #{time_format(finish-insert)})"
  52
+    end
  53
+  end
  54
+  
  55
+  def time_format(seconds)
  56
+    "#{(seconds / 60).to_i}:#{"%.1f" % (seconds % 60)}"
  57
+  end
  58
+  
  59
+end
22  distance.rb
... ...
@@ -0,0 +1,22 @@
  1
+require 'amatch'
  2
+
  3
+module Distance
  4
+  include Amatch
  5
+  
  6
+  def self.edit_distance(s1, s2)
  7
+    s1,s2 = s1.to_s.downcase,s2.to_s.downcase
  8
+    Levenshtein.new(s1).match(s2).to_f / [s1.size, s2.size].max
  9
+  end
  10
+  
  11
+  def self.edit_distance_initial(s1, s2)
  12
+    s1,s2 = s1.downcase, s2.downcase
  13
+    if s1 =~ /^[a-zäöüÄÖÜ]\./ || s2 =~ /^[a-zäöüÄÖÜ]\./
  14
+      i1 = s1 =~ /^[äöüÄÖÜ]/ ? s1[0,2] : s1[0,1]
  15
+      i2 = s2 =~ /^[äöüÄÖÜ]/ ? s2[0,2] : s2[0,1]
  16
+      i1 == i2 ? 0 : 1
  17
+    else
  18
+      edit_distance(s1,s2)
  19
+    end
  20
+  end
  21
+  
  22
+end
34  export.rb
... ...
@@ -0,0 +1,34 @@
  1
+# dependencies
  2
+require "rubygems"
  3
+require "activerecord"
  4
+
  5
+require "cleaner"
  6
+require "kunde"
  7
+require "versand"
  8
+require "marketing"
  9
+require "webshop"
  10
+require "key"
  11
+require "match"
  12
+
  13
+
  14
+ActiveRecord::Base.establish_connection(Datenreinigung::Config['database']["postgresql"].merge(:adapter => "postgresql"))
  15
+
  16
+classes = [Kunde, Marketing, Versand, Webshop, Key, Match]
  17
+classes.each do |klass|
  18
+  klass.table_name
  19
+  klass.columns
  20
+end
  21
+
  22
+ActiveRecord::Base.establish_connection(Datenreinigung::Config['database']["mysql"].merge(:adapter => "mysql"))
  23
+
  24
+classes.each do |klass|
  25
+  # drop table
  26
+  ActiveRecord::Migration.drop_table klass.table_name rescue ActiveRecord::StatementInvalid
  27
+  # create table
  28
+  ActiveRecord::Migration.create_table klass.table_name, :options => 'engine=MyISAM DEFAULT CHARSET=utf8' do |table|
  29
+    klass.columns.each do |column|
  30
+      next if column.name == "id"
  31
+      table.column column.name, column.sql_type == 'bigint' ? column.sql_type : column.type
  32
+    end
  33
+  end
  34
+end
3  key.rb
... ...
@@ -0,0 +1,3 @@
  1
+class Key < ActiveRecord::Base
  2
+  set_table_name "kunden_keys"
  3
+end
146  kunde.rb
... ...
@@ -0,0 +1,146 @@
  1
+class Kunde < ActiveRecord::Base
  2
+  set_table_name "kunden"
  3
+  has_one :key, :foreign_key => 'kunden_id'
  4
+  
  5
+  def telefon
  6
+    "#{self.vorwahl}#{self.telefonnummer}"
  7
+  end
  8
+  
  9
+  def hausnummer
  10
+    self.hausnummervon
  11
+  end
  12
+  
  13
+  def to_s
  14
+    # "#{vorname} #{nachname} #{strasse} #{ort} #{geburtsdatum.to_s}"
  15
+    "#{vorname} #{nachname}, #{strasse} #{hausnummer}, #{postleitzahl} #{ort}" 
  16
+  end
  17
+  
  18
+  def distance_to(other)
  19
+    distance = 0
  20
+    weights = 0
  21
+    [:vorname, :nachname, :strasse, :ort, :postleitzahl, :postfach, :telefonnummer, :geburtsdatum].each do |criterion|
  22
+      weight = Kunde.send("weight_#{criterion}", self, other)
  23
+      if weight > 0
  24
+        weights += weight
  25
+        distance += Kunde.send("distance_#{criterion}", self, other) * weight
  26
+      end
  27
+    end
  28
+    
  29
+    weights == 0 ? 1 : distance / weights
  30
+  end
  31
+  
  32
+  ### Weights ###
  33
+  
  34
+  def self.weight_vorname(k1, k2)
  35
+    k1.vorname && k2.vorname ? 5 : 0
  36
+  end
  37
+  
  38
+  def self.weight_nachname(k1, k2)
  39
+    k1.nachname && k2.nachname ? 10 : 0
  40
+  end
  41
+  
  42
+  def self.weight_strasse(k1, k2)
  43
+    k1.strasse && k2.strasse ? 5 : 0
  44
+  end
  45
+  
  46
+  def self.weight_hausnummer(k1, k2)
  47
+    k1.hausnummer && k2.hausnummer ? 3 : 0
  48
+  end
  49
+  
  50
+  def self.weight_ort(k1, k2)
  51
+    k1.ort && k2.ort ? 5 : 0
  52
+  end
  53
+  
  54
+  def self.weight_postleitzahl(k1, k2)
  55
+    k1.postleitzahl && k2.postleitzahl ? 3 : 0
  56
+  end
  57
+  
  58
+  def self.weight_postfach(k1, k2)
  59
+    k1.postfach && k2.postfach ? 3 : 0
  60
+  end
  61
+  
  62
+  def self.weight_telefonnummer(k1, k2)
  63
+    k1.telefonnummer && k2.telefonnummer ? 3 : 0
  64
+  end
  65
+  
  66
+  def self.weight_geburtsdatum(k1, k2)
  67
+    k1.geburtsdatum && k2.geburtsdatum ? 3 : 0
  68
+  end
  69
+  
  70
+  #### Distances ####
  71
+  
  72
+  def self.distance_vorname(k1, k2)
  73
+    Distance.edit_distance_initial(k1.vorname, k2.vorname)
  74
+  end
  75
+  
  76
+  def self.distance_nachname(k1, k2)
  77
+    Distance.edit_distance(k1.nachname, k2.nachname)
  78
+  end
  79
+  
  80
+  def self.distance_strasse(k1, k2)
  81
+    Distance.edit_distance(k1.strasse, k2.strasse)
  82
+  end
  83
+  
  84
+  def self.distance_hausnummer(k1, k2)
  85
+    if k1.hausnummer == k2.hausnummer || k1.hausnummervon.to_i == k2.hausnummerbis.to_i || k1.hausnummerbis.to_i == k2.hausnummervon.to_i
  86
+      0
  87
+    else
  88
+      1
  89
+    end
  90
+  end
  91
+  
  92
+  def self.distance_ort(k1, k2)
  93
+    Distance.edit_distance(k1.ort, k2.ort)
  94
+  end
  95
+  
  96
+  def self.distance_postleitzahl(k1, k2)
  97
+    if k1.postleitzahl == k2.postleitzahl
  98
+      0
  99
+    elsif k1.postleitzahl.size == k2.postleitzahl.size && k1.postleitzahl.size == 5
  100
+      Distance.edit_distance(k1.postleitzahl, k2.postleitzahl)
  101
+    else
  102
+      min = [k1.postleitzahl.size, k2.postleitzahl.size].min
  103
+      k1.postleitzahl[0,min] == k2.postleitzahl[0,min] ? 0.3 : 1
  104
+    end
  105
+  end
  106
+  
  107
+  def self.distance_postfach(k1, k2)
  108
+    if k1.postfach == k2.postfach
  109
+      0
  110
+    elsif k1.postfach.size == k2.postfach.size && k1.postfach.size > 2
  111
+      Distance.edit_distance(k1.postfach, k2.postfach)
  112
+    else
  113
+      min = [k1.postfach.size, k2.postfach.size].min
  114
+      k1.postfach[0,min] == k2.postfach[0,min] ? 0.3 : 1
  115
+    end
  116
+  end
  117
+  
  118
+  def self.distance_telefonnummer(k1, k2)
  119
+    if k1.telefon == k2.telefon || k1.telefonnummer == k2.telefonnummer
  120
+      0
  121
+    else
  122
+      Distance.edit_distance(k1.telefon, k2.telefon)
  123
+    end
  124
+  end
  125
+  
  126
+  def self.distance_geburtsdatum(k1, k2)
  127
+    if k1.geburtsdatum == k2.geburtsdatum
  128
+      0
  129
+    else
  130
+      day = k1.geburtsdatum.day == k2.geburtsdatum.day ? 1 : 0
  131
+      month = k1.geburtsdatum.month == k2.geburtsdatum.month ? 2 : 0
  132
+      year = k1.geburtsdatum.year == k2.geburtsdatum.year ? 4 : 0
  133
+      sum = day + month + year
  134
+      case sum
  135
+      when 6 then 0.2
  136
+      when 5 then 0.3
  137
+      when 4 then 0.6
  138
+      when 3 then 0.3
  139
+      when 2 then 0.8
  140
+      when 1 then 0.8
  141
+      when 0 then 1
  142
+      end
  143
+    end
  144
+  end
  145
+  
  146
+end
17  marketing.rb
... ...
@@ -0,0 +1,17 @@
  1
+class Marketing < ActiveRecord::Base
  2
+  set_table_name "marketing"
  3
+  include Cleaner
  4
+  
  5
+  def anrede
  6
+    self[:anrede] = self[:anrede].strip
  7
+    
  8
+    if self[:anrede] =~ /(Herr|Frau)* *(Dipl\. Ing\.|Dr\.|Prof\.|Dr\. Prof\.|Prof\. Dr\.)*/
  9
+      @anrede = $1 || @anrede
  10
+      @titel = $2 || @titel
  11
+      self[:anrede] = nil
  12
+    end
  13
+    
  14
+    @anrede || self[:anrede] || super
  15
+  end
  16
+  
  17
+end
2  match.rb
... ...
@@ -0,0 +1,2 @@
  1
+class Match < ActiveRecord::Base
  2
+end
15  versand.rb
... ...
@@ -0,0 +1,15 @@
  1
+class Versand < ActiveRecord::Base
  2
+  set_table_name "versand"
  3
+  include Cleaner
  4
+  
  5
+  def anrede
  6
+    self[:anrede] = self[:anrede].strip
  7
+    self[:anrede].blank? ? super : self[:anrede]
  8
+  end
  9
+  
  10
+  def titel
  11
+    self[:titel] = self[:titel].strip
  12
+    self[:titel].blank? ? super : self[:titel]
  13
+  end
  14
+  
  15
+end
5  webshop.rb
... ...
@@ -0,0 +1,5 @@
  1
+class Webshop < ActiveRecord::Base
  2
+  set_table_name "webshop"
  3
+  include Cleaner
  4
+  
  5
+end
23  workshop.rb
... ...
@@ -0,0 +1,23 @@
  1
+# dependencies
  2
+require "rubygems"
  3
+require "activerecord"
  4
+
  5
+# classes
  6
+require "config"
  7
+require "cleaner"
  8
+require "distance"
  9
+require "kunde"
  10
+require "versand"
  11
+require "marketing"
  12
+require "webshop"
  13
+require "key"
  14
+
  15
+# steps
  16
+require 'clean'
  17
+require 'detector'
  18
+
  19
+# ActiveRecord::Base.logger = Logger.new(STDOUT)
  20
+ActiveRecord::Base.establish_connection(Datenreinigung::Config['database'][Datenreinigung::Config['database']['adapter']].merge(:adapter => Datenreinigung::Config['database']['adapter']))
  21
+
  22
+# Clean.process
  23
+# Detector.new("nachvorstrasse", true).process

0 notes on commit 280b251

Please sign in to comment.
Something went wrong with that request. Please try again.