lib/health-data-standards/models/entry.rb in health-data-standards-0.8.1 vs lib/health-data-standards/models/entry.rb in health-data-standards-1.0.0
- old
+ new
@@ -12,10 +12,12 @@
field :start_time, type: Integer
field :end_time, type: Integer
field :status, type: String
field :codes, type: Hash, default: {}
field :value, type: Hash, default: {}
+ field :free_text, type: String
+ field :mood_code, type: String, default: "EVN"
attr_protected :version
attr_protected :_id
attr_protected :created_at
attr_protected :updated_at
@@ -55,35 +57,35 @@
tx_codes - [preferred_code(preferred_code_sets)]
end
def times_to_s
if start_time.present? || end_time.present?
- start_string = start_time ? Time.at(start_time).to_formatted_s(:long_ordinal) : 'UNK'
- end_string = end_time ? Time.at(end_time).to_formatted_s(:long_ordinal) : 'UNK'
+ start_string = start_time ? Time.at(start_time).utc.to_formatted_s(:long_ordinal) : 'UNK'
+ end_string = end_time ? Time.at(end_time).utc.to_formatted_s(:long_ordinal) : 'UNK'
"#{start_string} - #{end_string}"
elsif time.present?
- Time.at(time).to_formatted_s(:long_ordinal)
+ Time.at(time).utc.to_formatted_s(:long_ordinal)
end
end
- def to_effective_time(xml)
- if time.present?
- xml.effectiveTime("value" => Time.at(time).utc.to_formatted_s(:number))
- else
- xml.effectiveTime do
- if start_time.present?
- xml.low("value" => Time.at(start_time).utc.to_formatted_s(:number))
- else
- xml.low("nullFlavor" => "UNK")
- end
- if end_time.present?
- xml.high("value" => Time.at(end_time).utc.to_formatted_s(:number))
- else
- xml.high("nullFlavor" => "UNK")
- end
- end
- end
- end
+ # def to_effective_time(xml)
+ # if time.present?
+ # xml.effectiveTime("value" => Time.at(time).utc.to_formatted_s(:number))
+ # else
+ # xml.effectiveTime do
+ # if start_time.present?
+ # xml.low("value" => Time.at(start_time).utc.to_formatted_s(:number))
+ # else
+ # xml.low("nullFlavor" => "UNK")
+ # end
+ # if end_time.present?
+ # xml.high("value" => Time.at(end_time).utc.to_formatted_s(:number))
+ # else
+ # xml.high("nullFlavor" => "UNK")
+ # end
+ # end
+ # end
+ # end
def self.from_event_hash(event)
entry = Entry.new
if event['code']
entry.add_code(event['code'], event['code_set'])
\ No newline at end of file