abstractor 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWNjMjEzMjY1NWFjNjAyNjZjNjU1ZmJhYmNkMWIyZTQ3ZTQ3NmYwNg==
4
+ ODBhMTRkNmJjOTM0NDhkZjc1ZGE0MDAxYjVkZTY5YmQyZGJjMDUxNQ==
5
5
  data.tar.gz: !binary |-
6
- NGI5ZmRjOGRjZmM5NDAyYmNkMDYwZmNlMWI1MTNiYjcyZjY2NDNiOA==
6
+ YWMwNGY5MjM1ZjQ2YzY4YWRiYjg1Yzg4ZDU1MGE5M2ZmMzYzNTU3YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGM5NWQ3ZWVmYmMzNGM3YTJkN2MzMjE1MTNiMmFiM2Q5MWU3NDMzMzNlYTRh
10
- ZTRmNDk5NjA4NGQ0MDE1ZTk3Njc2YzNmODIyYzlmM2VlMDYzZmExOTgzNTBh
11
- MzA4N2Y1MjFkYjllMGIyM2UwODc2ODk0Mjk2NzFhYjE4NDA3NzY=
9
+ ZjRkOGRhZTNiMjQxNTMxNzk5MGRlZmE2MjRjNTczMDA1MDI4MmY1NDVjMTI1
10
+ YTg1NGNkYzg3ZmE0MmRlYzA1Y2Y4MzE2NTBjMjU2YzljMGU4M2JkNDBiYzZk
11
+ MWQ2Y2Q3ZmEwYjgzMjQ0MDQwNjQ2MDZmMGZiNjMwNTliNGViMmQ=
12
12
  data.tar.gz: !binary |-
13
- ZDNhMjg5NTYxNzI4NjhjMjFkMDQyZDhlMzMzZGRmMzA0MzRiM2YzODA0NTUy
14
- ZmE1NGUzYTZhNTk5YjA3MTYxNzNmOTYyNGE5ZmRjZDliZjM1NGRhYmM0YmJj
15
- MjM5OTFiOGE2ZjM2NWFhZGFkOWY4NTUyMGU3Y2M3ZTE3YWI0NTU=
13
+ ZTgwYzJmZmRhYjA5YTc2YjVkNTkyYzYwMDVkNjQwMjU4Y2M0Y2E2ZWMxNjZm
14
+ YjEzOThmNWU2NDBkNTk4NWY4ZjY5YjY4NzdiMTA5ODYyYTI3MTY4MDY2MzIx
15
+ MzlmNmI1MDdjYWEyNWE0ZjIxZDg5OGJhMTg5ZjJiNTA0OWI1OGY=
data/README.md CHANGED
@@ -46,6 +46,10 @@ Add abstractor to your Gemfile:
46
46
 
47
47
  gem 'abstractor'
48
48
 
49
+ Also add the paper\_trail gem to your Gemfile (if it is not already there):
50
+
51
+ gem 'paper_trail'
52
+
49
53
  Bundle, install, and migrate:
50
54
 
51
55
  * bundle install
@@ -1,3 +1,3 @@
1
1
  module Abstractor
2
- VERSION = '1.0.9'
2
+ VERSION = '1.0.10'
3
3
  end
@@ -9,6 +9,7 @@ module Abstractor
9
9
  class_option "customize-helpers", :type => :boolean
10
10
  class_option "customize-layout", :type => :boolean
11
11
  class_option "current-user-helper", :type => :string
12
+ class_option "install-stanford-core-nlp", :type => :boolean
12
13
 
13
14
  def self.source_paths
14
15
  paths = self.superclass.source_paths
@@ -52,6 +53,21 @@ module Abstractor
52
53
  end
53
54
  end
54
55
 
56
+ def setup_stanford_core_nlp
57
+ unless options["install-stanford-core-nlp"]
58
+ puts "Running rake abstractor:setup:stanford_core_nlp"
59
+ puts 'Please be patient...this could take a while'
60
+ `rake abstractor:setup:stanford_core_nlp`
61
+
62
+ insert_into_file("#{Rails.root}/config/environments/development.rb", :after => /::Application.configure do\n/) do
63
+ ' StanfordCoreNLP.use :english
64
+ StanfordCoreNLP.jar_path = "#{Rails.root}/lib/stanford-core-nlp/"
65
+ StanfordCoreNLP.model_path = "#{Rails.root}/lib/stanford-core-nlp/"
66
+ '
67
+ end
68
+ end
69
+ end
70
+
55
71
  def make_customizable
56
72
  if options["customize-all"] || options["customize-controllers"]
57
73
  path = "#{Rails.root}/app/controllers/abstractor"
@@ -1,22 +1,38 @@
1
- # desc "Explaining what the task does"
2
- # task :abstractor do
3
- # # Task goes here
4
- # end
1
+ require 'open-uri'
2
+ require 'zip'
5
3
 
6
4
  namespace :abstractor do
7
5
  namespace :setup do
8
- desc 'Load abstraction schemas (specify file to parse with FILE=myfile.yml) '
9
- task :abstraction_schemas => :environment do
10
- file = ENV["FILE"]
11
- raise "File name has to be provided" if file.blank?
12
- raise "File does not exist: #{file}" unless FileTest.exists?(file)
13
- puts 'Little my says not done yet! Get to work!'
14
- end
15
-
16
- desc 'Load '
6
+ desc 'Load abstractor system tables'
17
7
  task :system => :environment do
18
- # raise "File does not exist: #{file}" unless FileTest.exists?(file)
19
8
  Abstractor::Setup.system
20
9
  end
10
+
11
+ desc "Setup Stanford CoreNLP library in lib/stanford-core-nlp directory"
12
+ task :stanford_core_nlp => :environment do
13
+ directory = "#{Rails.root}/lib/stanford-core-nlp/"
14
+ Dir.mkdir(directory) unless File.exists?(directory)
15
+ puts 'Please be patient...This could take a while.'
16
+ file = "#{Rails.root}/lib/stanford-core-nlp/stanford-core-nlp-minimal.zip"
17
+ open(file, 'wb') do |fo|
18
+ fo.print open('http://louismullie.com/treat/stanford-core-nlp-minimal.zip').read
19
+ end
20
+
21
+ file = "#{Rails.root}/lib/stanford-core-nlp/stanford-core-nlp-minimal.zip"
22
+ destination = "#{Rails.root}/lib/stanford-core-nlp/"
23
+ puts 'Unzipping...'
24
+ unzip_file(file, destination)
25
+ end
21
26
  end
27
+
28
+ private
29
+ def unzip_file (file, destination)
30
+ Zip::File.open(file) { |zip_file|
31
+ zip_file.each { |f|
32
+ f_path=File.join(destination, f.name)
33
+ FileUtils.mkdir_p(File.dirname(f_path))
34
+ zip_file.extract(f, f_path) unless File.exist?(f_path)
35
+ }
36
+ }
37
+ end
22
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gurley, Yulia Bushmanova
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -144,6 +144,20 @@ dependencies:
144
144
  - - ! '>='
145
145
  - !ruby/object:Gem::Version
146
146
  version: 0.5.1
147
+ - !ruby/object:Gem::Dependency
148
+ name: rubyzip
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ type: :runtime
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
147
161
  - !ruby/object:Gem::Dependency
148
162
  name: sqlite3
149
163
  requirement: !ruby/object:Gem::Requirement
@@ -385,8 +399,8 @@ dependencies:
385
399
  - !ruby/object:Gem::Version
386
400
  version: 3.1.1
387
401
  description: A Rails engine gem for deriving discrete data points from narrative text
388
- via natural language processing. The gem includes a user interface to present the
389
- abstracted data points for confirmation/revision by curator.
402
+ via natural language processing (NLP). The gem includes a user interface to present
403
+ the abstracted data points for confirmation/revision by curator.
390
404
  email:
391
405
  - michaeljamesgurley@gmail.com, y.bushmanova@gmail.com
392
406
  executables: []
@@ -521,7 +535,6 @@ files:
521
535
  - lib/generators/abstractor/install/templates/controllers/abstractor_abstraction_groups_controller.rb
522
536
  - lib/generators/abstractor/install/templates/controllers/abstractor_abstractions_controller.rb
523
537
  - lib/generators/abstractor/install/templates/controllers/abstractor_suggestions_controller.rb
524
- - lib/generators/abstractor/install/templates/dictionaries.yml
525
538
  - lib/generators/abstractor/install/templates/helpers/abstractions_helper.rb
526
539
  - lib/generators/abstractor/install/templates/models/abstractor_abstraction.rb
527
540
  - lib/generators/abstractor/install/templates/models/abstractor_abstraction_group.rb
@@ -737,7 +750,7 @@ files:
737
750
  - lib/setup/data/site_site_categories.txt
738
751
  - lib/tasks/abstractor_tasks.rake
739
752
  - lib/tasks/cucumber.rake
740
- homepage:
753
+ homepage: http://github.com/nubic/abstractor
741
754
  licenses:
742
755
  - MIT
743
756
  metadata: {}
@@ -761,6 +774,6 @@ rubygems_version: 2.2.2
761
774
  signing_key:
762
775
  specification_version: 4
763
776
  summary: A Rails engine gem for deriving discrete data points from narrative text
764
- via natural language processing. The gem includes a user interface to present the
765
- abstracted data points for confirmation/revision by curator.
777
+ via natural language processing (NLP). The gem includes a user interface to present
778
+ the abstracted data points for confirmation/revision by curator.
766
779
  test_files: []
@@ -1,235 +0,0 @@
1
- # ---- General structure:
2
- # :dictionaries:
3
- # - :name: string # has to be unique within not-deleted dictionaries
4
- # :parameter_categories:
5
- # - :name: string # has to be unique within the dictionary
6
- # :parameters:
7
- # - :name: string # used for display
8
- # :unique_identifier: # has to be unique within the dictionary
9
- # :export:
10
- # :model # name of the model to be used for exporting
11
- # :method # name of the model method to be used for exporting
12
- # :search: # parameter search model and method combination has to be unique within the category
13
- # :model: string # name of the model to be used for searching
14
- # :method: string # name of the model method to be used for searching
15
- # :parameter_type: numeric/date/list/combobox/text/string # used to define applicable operators/display options. does not have to be restricted to the given list, but additional parameters will require adding operators to match
16
- # :parameter_value_categories_source: # used to define parameter value categories
17
- # :model: string # source model to be used to load parameter value categiories
18
- # :method: string # method in the source model that returns parameter_value_categories in a form of [{:name => 'string, :unique_identifier => 'adventure', :display_order => 1, :collapse => true}]
19
- # :parameter_value_categories: # used to define parameter value categories
20
- # - :name: string
21
- # :unique_identifier: string # has to be unique within parameter
22
- # :collapse: boolean # used to define if parameter category should be collapsed in the list and its values hidden from the view
23
- # :display_order: integer
24
- # :parameter_values: # needs to be defined for list/combobox parameters unless parameter values come from the model, see ':source'
25
- # - :name: string # used for display, if not provided, 'search_value' will be used instead
26
- # :search_value: string # has to be unique within parameter, intendend to be used as a database value while searching
27
- # :parameter_value_category: string # used to define category for parameter value, should match one of parameter_value_categories unique_identifiers listed above
28
- # :source:
29
- # :model: string # source model to be used to load parameter values
30
- # :method: string # method/method in the source model to be used to load parameter values
31
-
32
- ---
33
- :dictionaries:
34
- - :name: Sample dictionary
35
- :parameter_categories:
36
- - :name: Demographic criteria
37
- :parameters:
38
- - :name: Age at case collection date
39
- :unique_identifier: age_at_case_collect
40
- :search:
41
- :model: Patient
42
- :method: age_at_case_collect
43
- :parameter_type: numeric
44
-
45
- - :name: Age based on current date
46
- :unique_identifier: age_based_on_current_date
47
- :export:
48
- :model: Patient
49
- :method: age_based_on_current_date
50
-
51
- - :name: Date of birth
52
- :unique_identifier: birth_dt_tm
53
- :search:
54
- :model: Patient
55
- :method: birth_dt_tm
56
- :parameter_type: date
57
- :export:
58
- :model: Patient
59
- :method: age_based_on_current_date
60
-
61
- - :name: Ethnic group
62
- :unique_identifier: ethnic_grp
63
- :search:
64
- :model: Patient
65
- :method: ethnic_grp
66
- :parameter_type: combobox
67
- :parameter_values:
68
- - :name: Hispanic or Latino
69
- :search_value: hisp_or_latino
70
- - :name: NOT Hispanic or Latino
71
- :search_value: not_hisp_or_latino
72
- - :name: Unable to answer
73
- :search_value: unknown
74
- - :name: Declined to answer
75
- :search_value: declined
76
-
77
- - :name: Consented
78
- :unique_identifier: surg_inpatient_mortality
79
- :search:
80
- :model: Surgery
81
- :method: consented
82
- :parameter_type: list
83
- :parameter_values:
84
- - :search_value: yes
85
- - :search_value: no
86
-
87
- - :name: Gender
88
- :unique_identifier: sex
89
- :search:
90
- :model: Patient
91
- :method: sex
92
- :parameter_type: list
93
- :parameter_values:
94
- - :name: Male
95
- :search_value: male
96
- - :name: Female
97
- :search_value: female
98
- - :name: Indeterminent
99
- :search_value: indeterminent
100
- - :name: Unknown
101
- :search_value: unknown
102
- - :name: Unspecified
103
- :search_value: uncpecified
104
- :export:
105
- :model: Patient
106
- :method: gender
107
-
108
- - :name: Race
109
- :exclusive: false
110
- :unique_identifier: race
111
- :search:
112
- :model: Patient
113
- :method: race
114
- :parameter_type: combobox
115
- :parameter_values:
116
- - :search_value: American Indian or Alaska Native
117
- - :search_value: Asian
118
- - :search_value: Black or African American
119
- - :search_value: Hispanic or Latino
120
- - :search_value: Native Hawaiian or Other Pacific Islander
121
- - :search_value: White or Caucasian
122
- - :search_value: Other
123
- - :search_value: Declined to answer
124
- - :search_value: Unable to answer
125
- :export:
126
- :model: Patient
127
- :method: race
128
-
129
- - :name: Case criteria
130
- :parameters:
131
- - :name: Accession date
132
- :unique_identifier: accessioned_dt_tm
133
- :search:
134
- :model: Case
135
- :method: accessioned_dt_tm
136
- :parameter_type: date
137
-
138
- - :name: Text search diagnosis
139
- :exclusive: false
140
- :unique_identifier: case_specimen_diagnosis
141
- :search:
142
- :model: Case
143
- :method: case_specimen_diagnosis
144
- :parameter_type: text
145
-
146
- - :name: Librarian dictionary
147
- :parameter_categories:
148
- - :name: By author
149
- :parameters:
150
- - :name: "Last name"
151
- :unique_identifier: autor_last_name
152
- :search:
153
- :model: Author
154
- :method: autor_last_name
155
- :parameter_type: string
156
-
157
- - :name: "First name"
158
- :unique_identifier: autor_first_name
159
- :search:
160
- :model: Author
161
- :method: autor_first_name
162
- :parameter_type: text
163
-
164
- - :name: "Country"
165
- :unique_identifier: country
166
- :search:
167
- :model: Author
168
- :method: country
169
- :parameter_type: text
170
-
171
- - :name: "Type"
172
- :unique_identifier: author_type
173
- :search:
174
- :model: Book
175
- :method: type
176
- :parameter_type: list
177
- :parameter_values:
178
- - :search_value: author
179
- - :search_value: co-author
180
- - :search_value: reviewer
181
- - :name: Book criteria
182
- :parameters:
183
- - :name: "Type"
184
- :unique_identifier: book_type
185
- :search:
186
- :model: Book
187
- :method: type
188
- :parameter_type: combobox
189
- :parameter_values:
190
- - :search_value: book
191
- - :search_value: journal
192
- - :search_value: article
193
- - :search_value: electronic journal
194
-
195
- - :name: "Genre"
196
- :unique_identifier: book_genre
197
- :search:
198
- :model: Book
199
- :method: Genre
200
- :parameter_type: combobox
201
- :parameter_value_categories:
202
- - :name: Adventure
203
- :unique_identifier: adventure
204
- :collapse: true
205
- :display_order: 1
206
- - :name: Comic novel
207
- :unique_identifier: comic
208
- - :name: Historical
209
- :unique_identifier: historical
210
- :parameter_values:
211
- - :search_value: "Robinsonade"
212
- :parameter_value_category: adventure
213
- - :search_value: "Black comedy"
214
- :parameter_value_category: comic
215
- - :search_value: "Parody"
216
- :parameter_value_category: comic
217
- - :search_value: "Lost World"
218
- :parameter_value_category: adventure
219
- - :search_value: "Brit lit"
220
- - :search_value: "Pulp fiction"
221
-
222
- - :name: "Title"
223
- :unique_identifier: title
224
- :search:
225
- :model: Book
226
- :method: title
227
- :parameter_type: text
228
-
229
- - :name: "Keyword"
230
- :unique_identifier: text
231
- :search:
232
- :model: Book
233
- :method: text
234
- :parameter_type: text
235
-