medattrib 0.0.4
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 +15 -0
- data/LICENSE +176 -0
- data/README.md +85 -0
- data/bin/medattrib +25 -0
- data/lib/list_tagger.rb +36 -0
- data/lib/list_taggers/dose_form_tagger.rb +93 -0
- data/lib/list_taggers/frequency_tagger.rb +91 -0
- data/lib/list_taggers/route_tagger.rb +185 -0
- data/lib/medattrib.rb +80 -0
- data/lib/run_medattrib.rb +23 -0
- data/lib/run_medattrib.rb~ +9 -0
- data/lib/tagger.rb +91 -0
- data/lib/taggers/dispense_quantity_tagger.rb +37 -0
- data/lib/taggers/dose_amount_tagger.rb +68 -0
- data/lib/taggers/duration_tagger.rb +28 -0
- data/lib/taggers/indication_tagger.rb +30 -0
- data/lib/taggers/refill_tagger.rb +58 -0
- data/lib/taggers/strength_tagger.rb +38 -0
- data/lib/taggers/strength_unit_tagger.rb +37 -0
- data/lib/taggers/substitution_tagger.rb +44 -0
- data/lib/taggers/timing_tagger.rb +40 -0
- metadata +82 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright 2015 The MITRE Corporation
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
=end
|
|
16
|
+
|
|
17
|
+
class StrengthUnitTagger < Tagger
|
|
18
|
+
def initialize
|
|
19
|
+
@numberSearch2 =
|
|
20
|
+
/(?:(?:(?:\d+\/)?\d+(?:\.\d+)?)?|one|two)
|
|
21
|
+
(?:\shundred|\sthousand)?(?:(?:-|\s+to\s+)
|
|
22
|
+
(?:\d+(?:\.\d+)?|one|two)
|
|
23
|
+
(?:\shundred|\sthousand)?)?/i
|
|
24
|
+
@numberSearch3 =
|
|
25
|
+
/(?:(?:\d+))/
|
|
26
|
+
@default_precondition = /\s(#{@@number_complete_search})\s+#{@@unit_search_global || (raise Exception.new("unit search regex not found"))}/i
|
|
27
|
+
@default_search = /(#{@@unit_search_global})/i
|
|
28
|
+
@content_group = 1
|
|
29
|
+
@name = 'strength_unit'
|
|
30
|
+
end
|
|
31
|
+
def parse_text(text, precondition, search, content_group)
|
|
32
|
+
tags = []
|
|
33
|
+
local_precondition = /#{@shared_search}/i
|
|
34
|
+
tags += super text, local_precondition, @default_search
|
|
35
|
+
return tags
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright 2015 The MITRE Corporation
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
=end
|
|
16
|
+
|
|
17
|
+
class SubstitutionTagger < Tagger
|
|
18
|
+
def initialize
|
|
19
|
+
@default_precondition = /(?x)(?:no\s+(substitutes?|substitutions?)|dispense\s+as\s+written|may
|
|
20
|
+
\s+not\s+substitutes?|substitutions?\s+(?:$be\s+)?not\s+
|
|
21
|
+
(?:permitted|permissible|allowed))/i
|
|
22
|
+
@default_search = /(?x)(no\s+(substitutes?|substitutions?)|dispense\s+as\s+written|may
|
|
23
|
+
\s+not\s+(substitutes?|substitutions?)\s+(?:$be\s+)?not\s+
|
|
24
|
+
(?:permitted|permissible|allowed))/i
|
|
25
|
+
@content_group = 1
|
|
26
|
+
@name = 'sub_status'
|
|
27
|
+
end
|
|
28
|
+
def parse_text(text, precondition, search, content_group)
|
|
29
|
+
tags_1a = super text, @default_precondition, @default_search
|
|
30
|
+
local_precondition = /(?x)(?:may\s+substitute|substitutions?\s+(?:$be\s+)?
|
|
31
|
+
(?:permitted|permissible|allowed))/i
|
|
32
|
+
local_search = /(may\s+substitute|substitutions?\s+(?:$be\s+)?(?x)
|
|
33
|
+
(?:permitted|permissible|allowed))/i
|
|
34
|
+
tags_1b = super text, local_precondition, local_search
|
|
35
|
+
local_precondition = /(brand)|(generic)/i
|
|
36
|
+
local_search = /((brand)|(generic))/i
|
|
37
|
+
tags_1c = super text, local_precondition, local_search
|
|
38
|
+
tags = tags_1a
|
|
39
|
+
tags += tags_1b
|
|
40
|
+
tags += tags_1c
|
|
41
|
+
|
|
42
|
+
return tags
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright 2015 The MITRE Corporation
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
=end
|
|
16
|
+
|
|
17
|
+
class TimingTagger < Tagger
|
|
18
|
+
def initialize
|
|
19
|
+
@name = 'timing'
|
|
20
|
+
|
|
21
|
+
durat1 = /(?x)(?:\d+|one|two|three|four|five|six|seven|eight|nine|
|
|
22
|
+
ten|fifteen|twenty|thirty|sixty|half\s+an|one\s+half)\s+
|
|
23
|
+
(?:min(?:utes?)?|hours?)/i
|
|
24
|
+
instruct1 = /(?x)(?:(?:(?:(?:immediately|just|right|#{durat1})\s+)?
|
|
25
|
+
(?:after|at|before|prior\s+to)\s+
|
|
26
|
+
(?:breakfast|dinner|food|lunch|
|
|
27
|
+
(?:(?:first|each|every|q\.?)\s+)?
|
|
28
|
+
meals?|milk|supper|eating|bedtime|going\s+to\s+bed|
|
|
29
|
+
retiring))|\ba\.?c\.?\b|\bp\.?c\.?\b)/i
|
|
30
|
+
|
|
31
|
+
instruct2 = /(?x)(?:(?:(?:with|at|in)\s+(?:breakfast|dinner|food|
|
|
32
|
+
lunch|(?:(?:first|each|every)\s+)?meals?|milk|supper|
|
|
33
|
+
water|OJ|orange\s+juice)))/i
|
|
34
|
+
|
|
35
|
+
instruct3 = /(?:on\s+)?(?:an\s+)?empty\s+stomach/i
|
|
36
|
+
|
|
37
|
+
@default_search = @default_precondition = /(#{instruct1}|#{instruct2}|#{instruct3})/i
|
|
38
|
+
@content_group = 1
|
|
39
|
+
end
|
|
40
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: medattrib
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Cheryl Clark
|
|
8
|
+
- David Tresner-Kirsch
|
|
9
|
+
- Dan Noar
|
|
10
|
+
- M. Jasper Phillips
|
|
11
|
+
- Matt Coarr
|
|
12
|
+
autorequire:
|
|
13
|
+
bindir: bin
|
|
14
|
+
cert_chain: []
|
|
15
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
|
16
|
+
dependencies:
|
|
17
|
+
- !ruby/object:Gem::Dependency
|
|
18
|
+
name: standoff
|
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
|
20
|
+
requirements:
|
|
21
|
+
- - ! '>='
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 0.0.5
|
|
24
|
+
type: :runtime
|
|
25
|
+
prerelease: false
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - ! '>='
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: 0.0.5
|
|
31
|
+
description: A text tagger that annotates prescription concepts
|
|
32
|
+
email: davidtk@mitre.org
|
|
33
|
+
executables:
|
|
34
|
+
- medattrib
|
|
35
|
+
extensions: []
|
|
36
|
+
extra_rdoc_files: []
|
|
37
|
+
files:
|
|
38
|
+
- LICENSE
|
|
39
|
+
- README.md
|
|
40
|
+
- bin/medattrib
|
|
41
|
+
- lib/list_tagger.rb
|
|
42
|
+
- lib/list_taggers/dose_form_tagger.rb
|
|
43
|
+
- lib/list_taggers/frequency_tagger.rb
|
|
44
|
+
- lib/list_taggers/route_tagger.rb
|
|
45
|
+
- lib/medattrib.rb
|
|
46
|
+
- lib/run_medattrib.rb
|
|
47
|
+
- lib/run_medattrib.rb~
|
|
48
|
+
- lib/tagger.rb
|
|
49
|
+
- lib/taggers/dispense_quantity_tagger.rb
|
|
50
|
+
- lib/taggers/dose_amount_tagger.rb
|
|
51
|
+
- lib/taggers/duration_tagger.rb
|
|
52
|
+
- lib/taggers/indication_tagger.rb
|
|
53
|
+
- lib/taggers/refill_tagger.rb
|
|
54
|
+
- lib/taggers/strength_tagger.rb
|
|
55
|
+
- lib/taggers/strength_unit_tagger.rb
|
|
56
|
+
- lib/taggers/substitution_tagger.rb
|
|
57
|
+
- lib/taggers/timing_tagger.rb
|
|
58
|
+
homepage:
|
|
59
|
+
licenses:
|
|
60
|
+
- Apache 2.0
|
|
61
|
+
metadata: {}
|
|
62
|
+
post_install_message:
|
|
63
|
+
rdoc_options: []
|
|
64
|
+
require_paths:
|
|
65
|
+
- lib
|
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ! '>='
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: '0'
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ! '>='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
requirements: []
|
|
77
|
+
rubyforge_project:
|
|
78
|
+
rubygems_version: 2.4.3
|
|
79
|
+
signing_key:
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: MedAttrib!
|
|
82
|
+
test_files: []
|