rx_nav 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/rx_nav.rb +5 -5
- data/lib/rx_nav/concept.rb +5 -2
- data/lib/rx_nav/rx_norm.rb +24 -6
- data/lib/rx_nav/version.rb +1 -1
- data/rx_nav.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28775ac88a7af9bdf70f04d10dd3d7f35848f2b7
|
4
|
+
data.tar.gz: 38f2c0a2c804905b4438cbcb160a5490ff70a969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5273bc556ad65e44a1a406d992a17ad239e5ecd9a20e55a4f3ad24db9697cbf7fa00ec4f64d9bbecfad82123bf23b4449d041c66ff632d89ceeac9cf2c3bdc6
|
7
|
+
data.tar.gz: 9143f1a3ead0607d154cadde8bd71179c1955ad3fbaf6355e8338b6deaaad7b0266e88b83ee84e9ccce0e880f5a272dbb2c773d031ba9bcf8fbf0e1ecf8d5244
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# RxNav
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rx_nav.png)](http://badge.fury.io/rb/rx_nav) [![Code Climate](https://codeclimate.com/github/jbender/rx_nav_ruby.png)](https://codeclimate.com/github/jbender/rx_nav_ruby)
|
4
|
+
|
5
|
+
This gem makes it easier to work with the RxNav REST APIs, as enumerated on [this page](http://rxnav.nlm.nih.gov/APIsOverview.html).
|
6
|
+
|
7
|
+
Currently, there are wrappers for the [RxNorm](http://rxnav.nlm.nih.gov/RxNormAPIREST.html), [NDF-RT](http://rxnav.nlm.nih.gov/NdfrtAPIREST.html), and [RxTerms](http://rxnav.nlm.nih.gov/RxTermsAPIREST.html) APIs. Not all end points are covered, so be sure to check out the code to make sure the endpoint you're looking for is available in the wrapper. If it isn't, please feel free to fork, add it, and send a pull request.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
data/lib/rx_nav.rb
CHANGED
@@ -4,13 +4,13 @@ require 'nokogiri'
|
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
# Core of the API responses
|
7
|
-
|
8
|
-
|
7
|
+
require_relative 'rx_nav/concept'
|
8
|
+
require_relative 'rx_nav/interaction'
|
9
9
|
|
10
10
|
# Individual APIs
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
require_relative 'rx_nav/ndfrt'
|
12
|
+
require_relative 'rx_nav/rx_norm'
|
13
|
+
require_relative 'rx_nav/rx_terms'
|
14
14
|
|
15
15
|
module RxNav
|
16
16
|
|
data/lib/rx_nav/concept.rb
CHANGED
@@ -4,7 +4,10 @@ module RxNav
|
|
4
4
|
class Concept < OpenStruct
|
5
5
|
|
6
6
|
def name
|
7
|
-
name = self.
|
7
|
+
name = self.display_name ||
|
8
|
+
self.full_name ||
|
9
|
+
self.full_generic_name ||
|
10
|
+
self.concept_name
|
8
11
|
name ? name.capitalize : nil
|
9
12
|
end
|
10
13
|
|
@@ -14,7 +17,7 @@ module RxNav
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def to_s
|
17
|
-
|
20
|
+
name
|
18
21
|
end
|
19
22
|
|
20
23
|
def get_terms_info
|
data/lib/rx_nav/rx_norm.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
module RxNav
|
2
2
|
class RxNorm
|
3
3
|
class << self
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
|
5
|
+
def search_by_name name, options = {}
|
6
|
+
options = {max_results: 20, options: 0}.merge(options)
|
7
|
+
|
8
|
+
query = %Q(/approximateTerm?term=#{name}&maxEntries=#{options[:max_results]}&options=#{options[:options]})
|
9
|
+
|
10
|
+
# Get the data we care about in the right form
|
9
11
|
data = get_response_hash(query)[:approximate_group][:candidate]
|
10
12
|
data = [data] if (data && !data.is_a?(Array))
|
11
|
-
|
13
|
+
|
14
|
+
# If we didn't get anything, say so
|
15
|
+
return nil if data.nil?
|
16
|
+
|
17
|
+
return data.map { |c| RxNav::Concept.new(c) }
|
12
18
|
end
|
13
19
|
|
14
20
|
def find_rxcui_by_id type, id
|
@@ -23,6 +29,18 @@ module RxNav
|
|
23
29
|
return extract_rxcui query
|
24
30
|
end
|
25
31
|
|
32
|
+
def spelling_suggestions name
|
33
|
+
query = "/spellingsuggestions?name=#{name}"
|
34
|
+
get_response_hash(query)[:suggestion_group][:suggestion_list][:suggestion]
|
35
|
+
end
|
36
|
+
|
37
|
+
def status id
|
38
|
+
query = "/rxcui/#{id}/status"
|
39
|
+
status = OpenStruct.new get_response_hash(query)[:rxcui_status]
|
40
|
+
status.send("active?=", status.status == 'Active')
|
41
|
+
return status
|
42
|
+
end
|
43
|
+
|
26
44
|
def properties id
|
27
45
|
query = "/rxcui/#{id}/properties"
|
28
46
|
return OpenStruct.new get_response_hash(query)[:properties]
|
data/lib/rx_nav/version.rb
CHANGED
data/rx_nav.gemspec
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rx_nav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Bender
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: httparty
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: nori
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|