lib/generator/codes_to_json.rb in hqmf2js-1.2.1 vs lib/generator/codes_to_json.rb in hqmf2js-1.3.0
- old
+ new
@@ -1,24 +1,24 @@
module HQMF2JS
module Generator
class CodesToJson
+
def self.hash_to_js(hash)
hash.to_json.gsub(/\"/, "'")
end
def self.from_value_sets(value_sets)
# make sure we have a string keyed hash
- value_sets = JSON.parse(value_sets.to_json)
translation = {}
value_sets.each do |value_set|
code_sets = {}
- value_set["concepts"].each do |code_set|
- code_sets[code_set["code_system_name"]] ||= []
- code_sets[code_set["code_system_name"]].concat(code_set["code"].to_a)
+ value_set.concepts.each do |code_set|
+ code_sets[code_set.code_system_name] ||= []
+ code_sets[code_set.code_system_name].concat(code_set.code.to_a)
end
- translation[value_set["oid"]] = code_sets
+ translation[value_set.oid] = code_sets
end
translation
end