lib/sdp/importers/phin_vads_importer.rb
# Import the codes for a phinvads valueset/version into a ResponseSet
# The codes will be added to the responseSet if the number of vads codes
# are less then or equal to the max_vs_length field in the parameters used
# too create the importer.  the default is 100 which covers ~1350 out of ~1550
# valuesets.  If the codes are not imported the ResponseSet will still be
# added to the systems just no codes will be contained in it
Import the codes for a phinvads valueset/version into a ResponseSet
The codes will be added to the responseSet if the number of vads codes
are less then or equal to the max_vs_length field in the parameters used
too create the importer.  the default is 100 which covers ~1350 out of ~1550
valuesets.  If the codes are not imported the ResponseSet will still be
added to the systems just no codes will be contained in it
Import the codes for a phinvads valueset / version into a ResponseSet The codes will be added to the responseSet if the number of vads codes are less then or equal to the max_vs_length field in the parameters used too create the importer . the default is 100 which covers ~1350 out of ~1550 valuesets . If the codes are not imported the ResponseSet will still be added to the systems just no codes will be contained in it
def import_valueset_codes(rset, version_id)
        start = Time.now
        count = 0
        page = 0
        limit = params[:limit] < params[:max_vs_length] ? params[:max_vs_length] : params[:limit]
        loop do
          dto = vads_client.getValueSetConceptsByValueSetVersionId(version_id, (page += 1), limit)
          if dto.getTotalResults > params[:max_vs_length]
            puts 'Valueset has greater than 100 values'
          end
          length = dto.getValueSetConcepts ? dto.getValueSetConcepts.length : 0
          logger.debug "getting vs codes #{count} to #{count + length} of #{dto.getTotalResults} "
          count += length
          dto.getValueSetConcepts.each do |code|
            rset.responses << Response.new(value: code.conceptCode.delete("\u0000"),
                                           code_system: code.codeSystemOid.delete("\u0000"),
                                           display_name: (code.codeSystemConceptName || '').force_encoding('ISO-8859-1').encode('UTF-8').delete("\u0000"))
          end
          break if count >= dto.getTotalResults
        end
        logger.debug "Took #{Time.now - start}"
      end
def import_valueset_codes ( rset , version_id ) start = Time . now count = 0 page = 0 limit = params [ :limit ] < params [ :max_vs_length ] ? params [ :max_vs_length ] : params [ :limit ] loop do dto = vads_client . getValueSetConceptsByValueSetVersionId ( version_id , ( page += 1 ) , limit ) if dto . getTotalResults > params [ :max_vs_length ] puts 'Valueset has greater than 100 values' end length = dto . getValueSetConcepts ? dto . getValueSetConcepts . length : 0 logger . debug "getting vs codes #{count} to #{count + length} of #{dto.getTotalResults} " count += length dto . getValueSetConcepts . each do | code | rset . responses << Response . new ( value : code . conceptCode . delete ( "\u0000" ) , code_system : code . codeSystemOid . delete ( "\u0000" ) , display_name : ( code . codeSystemConceptName || '' ) . force_encoding ( 'ISO-8859-1' ) . encode ( 'UTF-8' ) . delete ( "\u0000" ) ) end break if count >= dto . getTotalResults end logger . debug "Took #{Time.now - start}" end
Import the codes for a phinvads valueset/version into a ResponseSet
The codes will be added to the responseSet if the number of vads codes
are less then or equal to the max_vs_length field in the parameters used
too create the importer.
Import the codes for a phinvads valueset / version into a ResponseSet The codes will be added to the responseSet if the number of vads codes are less then or equal to the max_vs_length field in the parameters used too create the importer .
rset
version_id