class HealthDataStandards::Util::VSApiV2
Constants
- DEFAULT_PROFILE
This default profile is used when the include_draft option is true without a profile specified. The VSAC V2 API needs a profile to be specified when using includeDraft. Future work on this class could include a function to fetch the list of profiles from the vsac.nlm.nih.gov/vsac/profiles call.
Public Class Methods
new(ticket_url, api_url, username, password, ticket_granting_ticket = nil)
click to toggle source
Calls superclass method
HealthDataStandards::Util::VSApi::new
# File lib/health-data-standards/util/vs_api.rb, line 62 def initialize(ticket_url, api_url, username, password, ticket_granting_ticket = nil) super(ticket_url, api_url, username, password, ticket_granting_ticket) end
Public Instance Methods
get_valueset(oid, options = {}) { |oid, vs| ... }
click to toggle source
# File lib/health-data-standards/util/vs_api.rb, line 66 def get_valueset(oid, options = {}, &block) version = options.fetch(:version, nil) include_draft = options.fetch(:include_draft, false) profile = options.fetch(:profile, nil) effective_date = options.fetch(:effective_date, nil) program_name = options.fetch(:program, nil) params = { id: oid, ticket: get_ticket } params[:version] = version if version params[:includeDraft] = 'yes' if profile && include_draft params[:profile] = profile if profile params[:effectiveDate] = effective_date if effective_date params[:programType] = program_name if program_name begin vs = RestClient.get(api_url, :params=>params) rescue RestClient::ResourceNotFound raise VSNotFoundError, "No ValueSet found for oid '#{oid}'" end yield oid, vs if block_given? vs end
process_valuesets(oids, options = {}) { |oid, vs| ... }
click to toggle source
# File lib/health-data-standards/util/vs_api.rb, line 87 def process_valuesets(oids, options = {}, &block) version = options.fetch(:version, nil) include_draft = options.fetch(:include_draft, false) oids.each do |oid| vs = get_valueset(oid, version: version, include_draft: include_draft) yield oid, vs end end