Module: Qrda::Export::Helper::DateHelper
Instance Method Summary collapse
- #active_date_time ⇒ Object
- #author_effective_time ⇒ Object
- #author_time ⇒ Object
- #birth_date_time ⇒ Object
- #completed_prevalence_period ⇒ Object
- #current_time ⇒ Object
- #expired_date_time ⇒ Object
- #facility_period ⇒ Object
- #incision_datetime ⇒ Object
- #medication_duration_author_effective_time ⇒ Object
- #medication_duration_effective_time ⇒ Object
- #medication_supply_request_period ⇒ Object
- #participation_period ⇒ Object
- #performance_period_end ⇒ Object
- #performance_period_start ⇒ Object
- #prevalence_period ⇒ Object
- #received_date_time ⇒ Object
- #relevant_date_period_or_null_flavor ⇒ Object
- #relevant_date_time_value ⇒ Object
- #relevant_period ⇒ Object
- #result_date_time ⇒ Object
- #result_date_time? ⇒ Boolean
- #sent_date_time ⇒ Object
- #value_or_null_flavor(time) ⇒ Object
Instance Method Details
#active_date_time ⇒ Object
34 35 36 |
# File 'lib/qrda-export/helper/date_helper.rb', line 34 def active_date_time "<effectiveTime #{value_or_null_flavor(self['activeDatetime'])}/>" end |
#author_effective_time ⇒ Object
42 43 44 |
# File 'lib/qrda-export/helper/date_helper.rb', line 42 def "<effectiveTime #{value_or_null_flavor(self['authorDatetime'])}/>" end |
#author_time ⇒ Object
38 39 40 |
# File 'lib/qrda-export/helper/date_helper.rb', line 38 def "<time #{value_or_null_flavor(self['authorDatetime'])}/>" end |
#birth_date_time ⇒ Object
46 47 48 |
# File 'lib/qrda-export/helper/date_helper.rb', line 46 def birth_date_time "<birthTime #{value_or_null_flavor(self['birthDatetime'])}/>" end |
#completed_prevalence_period ⇒ Object
125 126 127 |
# File 'lib/qrda-export/helper/date_helper.rb', line 125 def completed_prevalence_period self['prevalencePeriod']['high'] ? true : false end |
#current_time ⇒ Object
22 23 24 |
# File 'lib/qrda-export/helper/date_helper.rb', line 22 def current_time Time.now.utc.to_formatted_s(:number) end |
#expired_date_time ⇒ Object
58 59 60 61 62 |
# File 'lib/qrda-export/helper/date_helper.rb', line 58 def expired_date_time "<effectiveTime>"\ "<low #{value_or_null_flavor(self['expiredDatetime'])}/>"\ "</effectiveTime>" end |
#facility_period ⇒ Object
116 117 118 119 |
# File 'lib/qrda-export/helper/date_helper.rb', line 116 def facility_period "<low #{value_or_null_flavor(self['locationPeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['locationPeriod']['high'])}/>" end |
#incision_datetime ⇒ Object
121 122 123 |
# File 'lib/qrda-export/helper/date_helper.rb', line 121 def incision_datetime "<effectiveTime #{value_or_null_flavor(self['incisionDatetime'])}/>" end |
#medication_duration_author_effective_time ⇒ Object
71 72 73 74 75 76 |
# File 'lib/qrda-export/helper/date_helper.rb', line 71 def "<effectiveTime xsi:type='IVL_TS'>"\ "<low #{value_or_null_flavor(self['authorDatetime'])}/>"\ "<high nullFlavor='UNK'/>"\ "</effectiveTime>" end |
#medication_duration_effective_time ⇒ Object
109 110 111 112 113 114 |
# File 'lib/qrda-export/helper/date_helper.rb', line 109 def medication_duration_effective_time "<effectiveTime xsi:type=\"IVL_TS\">"\ "<low #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['relevantPeriod']['high'])}/>"\ "</effectiveTime>" end |
#medication_supply_request_period ⇒ Object
64 65 66 67 68 69 |
# File 'lib/qrda-export/helper/date_helper.rb', line 64 def medication_supply_request_period "<effectiveTime xsi:type='IVL_TS'>"\ "<low #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['relevantPeriod']['high'])}/>"\ "</effectiveTime>" end |
#participation_period ⇒ Object
92 93 94 95 96 97 |
# File 'lib/qrda-export/helper/date_helper.rb', line 92 def participation_period "<effectiveTime>"\ "<low #{value_or_null_flavor(self['participationPeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['participationPeriod']['high'])}/>"\ "</effectiveTime>" end |
#performance_period_end ⇒ Object
18 19 20 |
# File 'lib/qrda-export/helper/date_helper.rb', line 18 def performance_period_end @performance_period_end.to_formatted_s(:number) end |
#performance_period_start ⇒ Object
14 15 16 |
# File 'lib/qrda-export/helper/date_helper.rb', line 14 def performance_period_start @performance_period_start.to_formatted_s(:number) end |
#prevalence_period ⇒ Object
78 79 80 81 82 83 |
# File 'lib/qrda-export/helper/date_helper.rb', line 78 def prevalence_period "<effectiveTime>"\ "<low #{value_or_null_flavor(self['prevalencePeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['prevalencePeriod']['high'])}/>"\ "</effectiveTime>" end |
#received_date_time ⇒ Object
30 31 32 |
# File 'lib/qrda-export/helper/date_helper.rb', line 30 def received_date_time "<high #{value_or_null_flavor(self['receivedDatetime'])}/>" end |
#relevant_date_period_or_null_flavor ⇒ Object
103 104 105 106 107 |
# File 'lib/qrda-export/helper/date_helper.rb', line 103 def relevant_date_period_or_null_flavor return relevant_period if self['relevantPeriod'] && (self['relevantPeriod']['low'] || self['relevantPeriod']['high']) return relevant_date_time_value if self['relevantDatetime'] "<effectiveTime nullFlavor='UNK'/>" end |
#relevant_date_time_value ⇒ Object
99 100 101 |
# File 'lib/qrda-export/helper/date_helper.rb', line 99 def relevant_date_time_value "<effectiveTime #{value_or_null_flavor(self['relevantDatetime'])}/>" end |
#relevant_period ⇒ Object
85 86 87 88 89 90 |
# File 'lib/qrda-export/helper/date_helper.rb', line 85 def relevant_period "<effectiveTime>"\ "<low #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"\ "<high #{value_or_null_flavor(self['relevantPeriod']['high'])}/>"\ "</effectiveTime>" end |
#result_date_time ⇒ Object
54 55 56 |
# File 'lib/qrda-export/helper/date_helper.rb', line 54 def result_date_time "<effectiveTime #{value_or_null_flavor(self['resultDatetime'])}/>" end |
#result_date_time? ⇒ Boolean
50 51 52 |
# File 'lib/qrda-export/helper/date_helper.rb', line 50 def result_date_time? !self['resultDatetime'].nil? end |
#sent_date_time ⇒ Object
26 27 28 |
# File 'lib/qrda-export/helper/date_helper.rb', line 26 def sent_date_time "<low #{value_or_null_flavor(self['sentDatetime'])}/>" end |
#value_or_null_flavor(time) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/qrda-export/helper/date_helper.rb', line 5 def value_or_null_flavor(time) # this is a bit of a hack for a defineded undefined date if time && DateTime.parse(time).year < 3000 "value='#{DateTime.parse(time).utc.to_formatted_s(:number)}'" else "nullFlavor='UNK'" end end |