Module: OpenehrRails::Fhir::CapabilityStatement
- Defined in:
- lib/openehr_rails/fhir/capability_statement.rb
Overview
Builds a minimal HL7 FHIR R5 CapabilityStatement from the registered resources, served at GET /fhir/metadata.
Constant Summary collapse
- FHIR_VERSION =
'5.0.0'
Class Method Summary collapse
Class Method Details
.build(base_url: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/openehr_rails/fhir/capability_statement.rb', line 12 def build(base_url: nil) { resourceType: 'CapabilityStatement', status: 'active', date: Time.now.utc.iso8601, kind: 'instance', fhirVersion: FHIR_VERSION, format: %w[application/fhir+json], software: { name: 'openehr-rails' }, implementation: ({ description: 'openEHR-Rails FHIR facade', url: base_url }.compact), rest: [{ mode: 'server', resource: resource_components }] } end |
.resource_components ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/openehr_rails/fhir/capability_statement.rb', line 29 def resource_components ResourceRegistry.entries.group_by(&:resource_type).map do |resource_type, entries| { type: resource_type, profile: nil, supportedProfile: entries.map { |e| "urn:openehr:#{e.archetype_id}" }, interaction: [ { code: 'read' }, { code: 'search-type' }, { code: 'create' } ], searchParam: [ { name: 'code', type: 'token' }, { name: 'subject', type: 'reference' } ] }.compact end end |