linkage 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,8 +17,8 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.name = "linkage"
18
18
  gem.homepage = "http://github.com/coupler/linkage"
19
19
  gem.license = "MIT"
20
- gem.summary = %Q{Sequel-based record linkage}
21
- gem.description = %Q{Wraps Sequel to perform record linkage between one or two datasets}
20
+ gem.summary = %Q{Record linkage library}
21
+ gem.description = %Q{Performs record linkage between one or two datasets, using Sequel on the backend}
22
22
  gem.email = "jeremy.f.stephens@vanderbilt.edu"
23
23
  gem.authors = ["Jeremy Stephens"]
24
24
  # dependencies defined in Gemfile
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -1,6 +1,28 @@
1
1
  module Linkage
2
2
  class Configuration
3
3
  class DSL
4
+
5
+ # Class for visually comparing matched records
6
+ class VisualComparisonWrapper
7
+ attr_reader :dsl, :lhs, :rhs
8
+
9
+ def initialize(dsl, lhs, rhs)
10
+ @dsl = dsl
11
+ @lhs = lhs
12
+ @rhs = rhs
13
+
14
+ if @lhs.is_a?(DataWrapper) && @rhs.is_a?(DataWrapper)
15
+ if @lhs.side == @rhs.side
16
+ raise ArgumentError, "Can't visually compare two data sources on the same side"
17
+ end
18
+ else
19
+ raise ArgumentError, "Must supply two data sources for visual comparison"
20
+ end
21
+
22
+ @dsl.add_visual_comparison(self)
23
+ end
24
+ end
25
+
4
26
  class ExpectationWrapper
5
27
  VALID_OPERATORS = [:==, :>, :<, :>=, :<=]
6
28
  OPERATOR_OPPOSITES = {
@@ -111,11 +133,19 @@ module Linkage
111
133
  class DataWrapper
112
134
  attr_reader :side, :dataset
113
135
 
136
+ def initialize
137
+ raise NotImplementedError
138
+ end
139
+
114
140
  [:must, :must_not].each do |type|
115
141
  define_method(type) do
116
142
  ExpectationWrapper.new(@dsl, type, self)
117
143
  end
118
144
  end
145
+
146
+ def compare_with(other)
147
+ VisualComparisonWrapper.new(@dsl, self, other)
148
+ end
119
149
  end
120
150
 
121
151
  class FieldWrapper < DataWrapper
@@ -256,6 +286,10 @@ module Linkage
256
286
  end
257
287
  end
258
288
 
289
+ def add_visual_comparison(visual_comparison)
290
+ @config.visual_comparisons << visual_comparison
291
+ end
292
+
259
293
  # For handling functions
260
294
  def method_missing(name, *args, &block)
261
295
  klass = Function[name.to_s]
@@ -267,13 +301,14 @@ module Linkage
267
301
  end
268
302
  end
269
303
 
270
- attr_reader :dataset_1, :dataset_2, :expectations
304
+ attr_reader :dataset_1, :dataset_2, :expectations, :visual_comparisons
271
305
  attr_accessor :linkage_type, :results_uri, :results_uri_options
272
306
 
273
307
  def initialize(dataset_1, dataset_2)
274
308
  @dataset_1 = dataset_1
275
309
  @dataset_2 = dataset_2
276
310
  @expectations = []
311
+ @visual_comparisons = []
277
312
  @linkage_type = dataset_1 == dataset_2 ? :self : :dual
278
313
  end
279
314
 
data/linkage.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "linkage"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremy Stephens"]
12
- s.date = "2012-02-28"
13
- s.description = "Wraps Sequel to perform record linkage between one or two datasets"
12
+ s.date = "2012-03-20"
13
+ s.description = "Performs record linkage between one or two datasets, using Sequel on the backend"
14
14
  s.email = "jeremy.f.stephens@vanderbilt.edu"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
@@ -67,7 +67,7 @@ Gem::Specification.new do |s|
67
67
  s.licenses = ["MIT"]
68
68
  s.require_paths = ["lib"]
69
69
  s.rubygems_version = "1.3.9.4"
70
- s.summary = "Sequel-based record linkage"
70
+ s.summary = "Record linkage library"
71
71
 
72
72
  if s.respond_to? :specification_version then
73
73
  s.specification_version = 3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-28 00:00:00.000000000 -06:00
12
+ date: 2012-03-20 00:00:00.000000000 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sequel
17
- requirement: &13934860 !ruby/object:Gem::Requirement
17
+ requirement: &6839080 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *13934860
25
+ version_requirements: *6839080
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: bundler
28
- requirement: &13932740 !ruby/object:Gem::Requirement
28
+ requirement: &6837220 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *13932740
36
+ version_requirements: *6837220
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: jeweler
39
- requirement: &13929520 !ruby/object:Gem::Requirement
39
+ requirement: &6848560 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.6.4
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *13929520
47
+ version_requirements: *6848560
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: test-unit
50
- requirement: &13266740 !ruby/object:Gem::Requirement
50
+ requirement: &6843960 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - =
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.3.2
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *13266740
58
+ version_requirements: *6843960
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: mocha
61
- requirement: &13265420 !ruby/object:Gem::Requirement
61
+ requirement: &7697360 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *13265420
69
+ version_requirements: *7697360
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sqlite3
72
- requirement: &13264380 !ruby/object:Gem::Requirement
72
+ requirement: &7735360 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *13264380
80
+ version_requirements: *7735360
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: yard
83
- requirement: &13262200 !ruby/object:Gem::Requirement
83
+ requirement: &7747140 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *13262200
91
+ version_requirements: *7747140
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rake
94
- requirement: &13276680 !ruby/object:Gem::Requirement
94
+ requirement: &7744260 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *13276680
102
+ version_requirements: *7744260
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: versionomy
105
- requirement: &14225280 !ruby/object:Gem::Requirement
105
+ requirement: &7756060 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *14225280
113
+ version_requirements: *7756060
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: mysql2
116
- requirement: &14222420 !ruby/object:Gem::Requirement
116
+ requirement: &7754660 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *14222420
124
+ version_requirements: *7754660
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
- requirement: &14220220 !ruby/object:Gem::Requirement
127
+ requirement: &7752840 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *14220220
135
+ version_requirements: *7752840
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rdiscount
138
- requirement: &14218900 !ruby/object:Gem::Requirement
138
+ requirement: &7749720 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: '0'
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *14218900
146
+ version_requirements: *7749720
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: guard-test
149
- requirement: &14217760 !ruby/object:Gem::Requirement
149
+ requirement: &7764320 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: '0'
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *14217760
157
+ version_requirements: *7764320
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: guard-yard
160
- requirement: &14230100 !ruby/object:Gem::Requirement
160
+ requirement: &7760020 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ! '>='
@@ -165,8 +165,9 @@ dependencies:
165
165
  version: '0'
166
166
  type: :development
167
167
  prerelease: false
168
- version_requirements: *14230100
169
- description: Wraps Sequel to perform record linkage between one or two datasets
168
+ version_requirements: *7760020
169
+ description: Performs record linkage between one or two datasets, using Sequel on
170
+ the backend
170
171
  email: jeremy.f.stephens@vanderbilt.edu
171
172
  executables: []
172
173
  extensions: []
@@ -235,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
236
  version: '0'
236
237
  segments:
237
238
  - 0
238
- hash: 3554989941562530888
239
+ hash: 3920524836542711484
239
240
  required_rubygems_version: !ruby/object:Gem::Requirement
240
241
  none: false
241
242
  requirements:
@@ -247,5 +248,5 @@ rubyforge_project:
247
248
  rubygems_version: 1.3.9.4
248
249
  signing_key:
249
250
  specification_version: 3
250
- summary: Sequel-based record linkage
251
+ summary: Record linkage library
251
252
  test_files: []