Sha256: 0acf12ed6e0510cab9ee078e8be4bdaf9dd9b8d6a4ba87c8d167d94b00ba10dc

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

module HealthDataStandards
  module SVS
    class ValueSet

    	include Mongoid::Document
      field :oid, type: String
      field :display_name, type: String
      field :version, type: String

      embeds_many :concepts
      scope :by_oid, ->(oid){where(:oid => oid)}

      def self.load_from_xml(doc)
      	  doc.root.add_namespace_definition("vs","urn:ihe:iti:svs:2008")
      	 	vs_element = doc.at_xpath("/vs:RetrieveValueSetResponse/vs:ValueSet")
      	 	if vs_element
      	 		vs = ValueSet.new(oid: vs_element["ID"], display_name: vs_element["displayName"], version: vs_element["version"])
      	 		concepts = vs_element.xpath("//vs:Concept").collect do |con|
      	 				Concept.new(code: con["code"], 
      	 					code_system_name: con["codeSystemName"], 
      	 					code_system_version: con["code_system_version"],
      	 				  display_name: con["displayName"],code_system: con["codeSystem"])
      	 		   end
                vs.concepts = concepts
      	 		return vs
      	 	end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
health-data-standards-2.1.4 lib/health-data-standards/models/svs/value_set.rb
health-data-standards-2.1.3 lib/health-data-standards/models/svs/value_set.rb
health-data-standards-2.1.2 lib/health-data-standards/models/svs/value_set.rb
health-data-standards-2.1.1 lib/health-data-standards/models/svs/value_set.rb
health-data-standards-2.1.0 lib/health-data-standards/models/svs/value_set.rb