fhir_models 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30a705b5b19b229fe1f37c1dc339f7a31863b022
4
- data.tar.gz: a637bdc71583c3b102636116a0ad31002a942ec3
3
+ metadata.gz: 0f63fd1e45f00d9ddd763c8bd87074dcbea16bcd
4
+ data.tar.gz: 40402e2767b979c0ba0895f85caf54b1f76710c7
5
5
  SHA512:
6
- metadata.gz: f43f4e9508da975ad7840aa94b44780c78dbdb3d1bb9199ba3bf4d5d3f350d1a628ec6e9e9abf9f06f9ed9a4eb1df9851cae8b95ebbf91d34b666f7f4825d9eb
7
- data.tar.gz: 50fca8364a0c477b524a1e8ee81fe1a4840d9db4a891bd950bef28d48d3fabc46b39ad22bb5aebf651eb61993ff9ee360f6541ffe3186fc12b2a396de13c03fd
6
+ metadata.gz: 69fbd6289a072777c08576b9e0dcccf7a4ff473b6c69ffb4f5446bab55e86e578b772372de00ca2f96d5fc9a31e2c917ecb202411ddcb1433d758c8fa72d4742
7
+ data.tar.gz: 89589dc0288b88ecec29d4a458d0144b531b42b5a75b96754da9c0f09f28da5d40cc5f6aa7a70d751f1c62e573fc536d79ef0b612a3ed4accdbdd22e55b50c61
data/bin/console CHANGED
@@ -7,8 +7,8 @@ require 'fhir_models'
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- require 'pry'
11
- Pry.start
10
+ # require "pry"
11
+ # Pry.start
12
12
 
13
- # require 'irb'
14
- # IRB.start
13
+ require 'irb'
14
+ IRB.start
@@ -211,6 +211,32 @@ module FHIR
211
211
  codes
212
212
  end
213
213
 
214
+ # Get the "display" (human-readable title) for a given code in a code system (uri)
215
+ # If one can't be found, return nil
216
+ def self.get_display(uri, code)
217
+ return nil if uri.nil? || code.nil?
218
+ load_expansions
219
+ valuesets = @@expansions.select { |x| x['compose']['include'].detect {|i| i['system'] == uri } }
220
+ valuesets += @@valuesets.select { |x| x['url'] == uri }
221
+ code_hash = nil
222
+ valuesets.each do |valueset|
223
+ if !valueset['expansion'].nil? && !valueset['expansion']['contains'].nil?
224
+ code_hash = valueset['expansion']['contains'].select { |x| x['system'] == uri && x['code'] == code}.first
225
+ elsif !valueset['compose'].nil? && !valueset['compose']['include'].nil?
226
+ included_systems = valueset['compose']['include'].map { |x| x['system'] }.uniq
227
+ systems = @@valuesets.select { |x| x['resourceType'] == 'CodeSystem' && included_systems.include?(x['url']) }
228
+ systems.each do |x|
229
+ code_hash = x['concept'].select { |con| con['url'] == uri && con['code'] == code }.first if x['concept']
230
+ break if code_hash
231
+ end
232
+ elsif valueset['concept']
233
+ code_hash = valueset['concept'].select { |v| v['code'] == code }.first
234
+ end
235
+ break if code_hash
236
+ end
237
+ code_hash['display'] if code_hash
238
+ end
239
+
214
240
  # ----------------------------------------------------------------
215
241
  # Search Params
216
242
  # ----------------------------------------------------------------
@@ -1,5 +1,5 @@
1
1
  module FHIR
2
2
  module Models
3
- VERSION = '1.8.1'.freeze
3
+ VERSION = '1.8.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Walonoski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-12-09 00:00:00.000000000 Z
13
+ date: 2017-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri