Module: FHIR::Sections::Operations
- Included in:
- Client
- Defined in:
- lib/fhir_client/sections/operations.rb
Instance Method Summary collapse
-
#closure_table_maintenance(params = {}, format = @default_format) ⇒ Object
ConceptMap Closure Table Maintenance.
-
#code_system_lookup(params = {}, format = @default_format) ⇒ Object
Concept Look Up [base]/CodeSystem/$lookup.
-
#concept_map_translate(params = {}, format = @default_format) ⇒ Object
ConceptMap Translation.
- #fetch_encounter_record(id = nil, method = 'GET', format = nil) ⇒ Object
-
#fetch_patient_record(id = nil, startTime = nil, endTime = nil, method = 'GET', format = nil) ⇒ Object
Fetch Patient Record [base]/Patient/$everything | [base]/Patient//$everything hl7.org/implement/standards/FHIR-Develop/patient-operations.html#everything Fetches resources for a given patient record, scoped by a start and end time, and returns a Bundle of results.
- #fetch_record(id = nil, time = [nil, nil], method = 'GET', klass = versioned_resource_class('Patient'), format = nil) ⇒ Object
- #match(resource, options = {}, format = @default_format) ⇒ Object
- #terminology_operation(params = {}, format = @default_format) ⇒ Object
-
#validate(resource, options = {}, format = @default_format) ⇒ Object
Validate resource payload.
- #validate_existing(resource, id, options = {}, format = @default_format) ⇒ Object
-
#value_set_code_validation(params = {}, format = @default_format) ⇒ Object
Value Set based Validation [base]/ValueSet/$validate | [base]/ValueSet//$validate hl7.org/implement/standards/FHIR-Develop/valueset-operations.html#validate Validate that a coded value is in the set of codes allowed by a value set.
-
#value_set_expansion(params = {}, format = @default_format) ⇒ Object
Value Set Expansion [base]/ValueSet/$expand | [base]/ValueSet//$expand hl7.org/implement/standards/FHIR-Develop/valueset-operations.html#expand The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation.
Instance Method Details
#closure_table_maintenance(params = {}, format = @default_format) ⇒ Object
ConceptMap Closure Table Maintenance
94 95 96 97 98 |
# File 'lib/fhir_client/sections/operations.rb', line 94 def closure_table_maintenance(params = {}, format = @default_format) = { operation: { name: :closure_table_maintenance } } .deep_merge!(params) terminology_operation(, format) end |
#code_system_lookup(params = {}, format = @default_format) ⇒ Object
Concept Look Up [base]/CodeSystem/$lookup
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fhir_client/sections/operations.rb', line 75 def code_system_lookup(params = {}, format = @default_format) klass = if @fhir_version == :dstu2 FHIR::DSTU2::ValueSet else self.versioned_resource_class(:CodeSystem) end = { resource: klass, operation: { name: :code_system_lookup } } .deep_merge!(params) terminology_operation(, format) end |
#concept_map_translate(params = {}, format = @default_format) ⇒ Object
ConceptMap Translation
87 88 89 90 91 |
# File 'lib/fhir_client/sections/operations.rb', line 87 def concept_map_translate(params = {}, format = @default_format) = { resource: versioned_resource_class('ConceptMap'), operation: { name: :concept_map_translate } } .deep_merge!(params) terminology_operation(, format) end |
#fetch_encounter_record(id = nil, method = 'GET', format = nil) ⇒ Object
17 18 19 |
# File 'lib/fhir_client/sections/operations.rb', line 17 def fetch_encounter_record(id = nil, method = 'GET', format = nil) fetch_record(id, [nil, nil], method, versioned_resource_class('Encounter'), format) end |
#fetch_patient_record(id = nil, startTime = nil, endTime = nil, method = 'GET', format = nil) ⇒ Object
Fetch Patient Record [base]/Patient/$everything | [base]/Patient//$everything hl7.org/implement/standards/FHIR-Develop/patient-operations.html#everything Fetches resources for a given patient record, scoped by a start and end time, and returns a Bundle of results
13 14 15 |
# File 'lib/fhir_client/sections/operations.rb', line 13 def fetch_patient_record(id = nil, startTime = nil, endTime = nil, method = 'GET', format = nil) fetch_record(id, [startTime, endTime], method, versioned_resource_class('Patient'), format) end |
#fetch_record(id = nil, time = [nil, nil], method = 'GET', klass = versioned_resource_class('Patient'), format = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fhir_client/sections/operations.rb', line 21 def fetch_record(id = nil, time = [nil, nil], method = 'GET', klass = versioned_resource_class('Patient'), format = nil) headers = {} headers[:accept] = "#{format}" if format format ||= @default_format headers[:content_type] = format = { resource: klass, format: format, operation: { name: :fetch_patient_record, method: method } } .deep_merge!(id: id) unless id.nil? [:operation][:parameters] = {} if [:operation][:parameters].nil? [:operation][:parameters][:start] = { type: 'Date', value: time.first } unless time.first.nil? [:operation][:parameters][:end] = { type: 'Date', value: time.last } unless time.last.nil? if [:operation][:method] == 'GET' reply = get resource_url(), fhir_headers else # create Parameters body if [:operation] && [:operation][:parameters] p = versioned_resource_class('Parameters').new [:operation][:parameters].each do |key, value| parameter = versioned_resource_class('Parameters::Parameter').new.from_hash(name: key.to_s) parameter.method("value#{value[:type]}=").call(value[:value]) p.parameter << parameter end end reply = post resource_url(), p, fhir_headers(headers) end reply.resource = parse_reply(versioned_resource_class('Bundle'), format, reply) reply.resource_class = [:resource] reply end |
#match(resource, options = {}, format = @default_format) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/fhir_client/sections/operations.rb', line 129 def match(resource, = {}, format = @default_format) .merge!(resource: resource.class, match: true, format: format) params = versioned_resource_class('Parameters').new add_resource_parameter(params, 'resource', resource) add_parameter(params, 'onlyCertainMatches', 'Boolean', [:onlyCertainMatches]) unless [:onlyCertainMatches].nil? add_parameter(params, 'count', 'Integer', [:matchCount]) if [:matchCount].is_a?(Integer) post( resource_url(), params, fhir_headers({content_type: "#{format || @default_format}", accept: "#{format || @default_format}"}) ).tap { |reply| set_client_on_resource(reply.resource) } end |
#terminology_operation(params = {}, format = @default_format) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/fhir_client/sections/operations.rb', line 100 def terminology_operation(params = {}, format = @default_format) = { format: format } headers = {} headers[:accept] = "#{format}" if format format ||= @default_format # params = [id, code, system, version, display, coding, codeableConcept, date, abstract] .deep_merge!(params) if [:operation][:method] == 'GET' reply = get resource_url(), fhir_headers(headers) else # create Parameters body if [:operation] && [:operation][:parameters] p = versioned_resource_class('Parameters').new [:operation][:parameters].each do |key, value| parameter = versioned_resource_class('Parameters::Parameter').new.from_hash(name: key.to_s) parameter.method("value#{value[:type]}=").call(value[:value]) p.parameter << parameter end end headers[:content_type] = "#{format}" reply = post resource_url(), p, fhir_headers(headers) end reply.resource = parse_reply([:resource], format, reply) reply.resource_class = [:resource] reply end |
#validate(resource, options = {}, format = @default_format) ⇒ Object
Validate resource payload.
public <T extends Resource> AtomEntry<OperationOutcome> validate(Class<T> resourceClass, T resource, String id);
152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/fhir_client/sections/operations.rb', line 152 def validate(resource, = {}, format = @default_format) .merge!(resource: resource.class, validate: true, format: format) headers = {} headers[:accept] = "#{format}" if format headers[:content_type] = "#{format}" params = versioned_resource_class('Parameters').new add_resource_parameter(params, 'resource', resource) add_parameter(params, 'profile', 'Uri', [:profile_uri]) unless [:profile_uri].nil? post(resource_url(), params, fhir_headers(headers)) .tap { |reply| set_client_on_resource(reply.resource) } end |
#validate_existing(resource, id, options = {}, format = @default_format) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/fhir_client/sections/operations.rb', line 164 def validate_existing(resource, id, = {}, format = @default_format) .merge!(resource: resource.class, id: id, validate: true, format: format) headers = {} headers[:accept] = "#{format}" if format headers[:content_type] = "#{format}" params = versioned_resource_class('Parameters').new add_resource_parameter(params, 'resource', resource) add_parameter(params, 'profile', 'Uri', [:profile_uri]) unless [:profile_uri].nil? post(resource_url(), params, fhir_headers(headers)) .tap { |reply| set_client_on_resource(reply.resource) } end |
#value_set_code_validation(params = {}, format = @default_format) ⇒ Object
Value Set based Validation [base]/ValueSet/$validate | [base]/ValueSet//$validate hl7.org/implement/standards/FHIR-Develop/valueset-operations.html#validate Validate that a coded value is in the set of codes allowed by a value set.
68 69 70 71 72 |
# File 'lib/fhir_client/sections/operations.rb', line 68 def value_set_code_validation(params = {}, format = @default_format) = { resource: versioned_resource_class('ValueSet'), operation: { name: :value_set_based_validation } } .deep_merge!(params) terminology_operation(, format) end |
#value_set_expansion(params = {}, format = @default_format) ⇒ Object
Value Set Expansion [base]/ValueSet/$expand | [base]/ValueSet//$expand hl7.org/implement/standards/FHIR-Develop/valueset-operations.html#expand The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation.
59 60 61 62 63 |
# File 'lib/fhir_client/sections/operations.rb', line 59 def value_set_expansion(params = {}, format = @default_format) = { resource: versioned_resource_class('ValueSet'), operation: { name: :value_set_expansion } } .deep_merge!(params) terminology_operation(, format) end |