Class: OpenehrRails::Rm::EhrSerializer
- Inherits:
-
Object
- Object
- OpenehrRails::Rm::EhrSerializer
- Defined in:
- lib/openehr_rails/rm/ehr_serializer.rb
Overview
Serializes an Rm::Ehr row into canonical openEHR EHR / EHR_STATUS JSON (openEHR REST API shape), the counterpart to CanonicalSerializer for compositions.
Instance Method Summary collapse
- #call ⇒ Object
- #ehr_status ⇒ Object
-
#initialize(ehr) ⇒ EhrSerializer
constructor
A new instance of EhrSerializer.
Constructor Details
#initialize(ehr) ⇒ EhrSerializer
Returns a new instance of EhrSerializer.
9 10 11 |
# File 'lib/openehr_rails/rm/ehr_serializer.rb', line 9 def initialize(ehr) @ehr = ehr end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/openehr_rails/rm/ehr_serializer.rb', line 13 def call { '_type' => 'EHR', 'system_id' => { '_type' => 'HIER_OBJECT_ID', 'value' => @ehr.system_id }, 'ehr_id' => { '_type' => 'HIER_OBJECT_ID', 'value' => @ehr.ehr_id }, 'time_created' => { '_type' => 'DV_DATE_TIME', 'value' => @ehr.time_created&.iso8601 }, 'ehr_status' => ehr_status } end |
#ehr_status ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/openehr_rails/rm/ehr_serializer.rb', line 23 def ehr_status { '_type' => 'EHR_STATUS', 'archetype_node_id' => 'openEHR-EHR-EHR_STATUS.generic.v1', 'name' => { '_type' => 'DV_TEXT', 'value' => 'EHR Status' }, 'subject' => { '_type' => 'PARTY_SELF', 'external_ref' => subject_ref }, 'is_queryable' => @ehr.is_queryable, 'is_modifiable' => @ehr.is_modifiable, 'other_details' => @ehr.other_details }.compact end |