health-data-standards 0.8.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/health-data-standards/export/ccr.rb +1 -1
- data/lib/health-data-standards/export/csv.rb +6 -1
- data/lib/health-data-standards/export/green_c32/entry.rb +1 -1
- data/lib/health-data-standards/export/green_c32/record.rb +15 -0
- data/lib/health-data-standards/export/template_helper.rb +0 -2
- data/lib/health-data-standards/export/view_helper.rb +28 -2
- data/lib/health-data-standards/import/c32/allergy_importer.rb +12 -8
- data/lib/health-data-standards/import/c32/care_goal_importer.rb +39 -0
- data/lib/health-data-standards/import/c32/condition_importer.rb +10 -4
- data/lib/health-data-standards/import/c32/encounter_importer.rb +16 -10
- data/lib/health-data-standards/import/c32/immunization_importer.rb +2 -2
- data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +42 -0
- data/lib/health-data-standards/import/c32/medical_equipment_importer.rb +45 -0
- data/lib/health-data-standards/import/c32/medication_importer.rb +35 -48
- data/lib/health-data-standards/import/c32/organization_importer.rb +1 -1
- data/lib/health-data-standards/import/c32/patient_importer.rb +3 -3
- data/lib/health-data-standards/import/c32/procedure_importer.rb +12 -8
- data/lib/health-data-standards/import/c32/result_importer.rb +11 -14
- data/lib/health-data-standards/import/c32/section_importer.rb +60 -29
- data/lib/health-data-standards/import/ccda/allergy_importer.rb +20 -0
- data/lib/health-data-standards/import/ccda/care_goal_importer.rb +13 -0
- data/lib/health-data-standards/import/ccda/condition_importer.rb +20 -0
- data/lib/health-data-standards/import/ccda/encounter_importer.rb +18 -0
- data/lib/health-data-standards/import/ccda/immunization_importer.rb +16 -0
- data/lib/health-data-standards/import/ccda/insurance_provider_importer.rb +14 -0
- data/lib/health-data-standards/import/ccda/medical_equipment_importer.rb +16 -0
- data/lib/health-data-standards/import/ccda/medication_importer.rb +19 -0
- data/lib/health-data-standards/import/ccda/patient_importer.rb +29 -0
- data/lib/health-data-standards/import/ccda/procedure_importer.rb +17 -0
- data/lib/health-data-standards/import/ccda/result_importer.rb +13 -0
- data/lib/health-data-standards/import/ccda/vital_sign_importer.rb +12 -0
- data/lib/health-data-standards/import/ccr/patient_importer.rb +16 -3
- data/lib/health-data-standards/import/green_c32/advance_directive_importer.rb +14 -0
- data/lib/health-data-standards/import/green_c32/allergy_importer.rb +1 -1
- data/lib/health-data-standards/import/green_c32/care_goal_importer.rb +26 -0
- data/lib/health-data-standards/import/green_c32/condition_importer.rb +0 -6
- data/lib/health-data-standards/import/green_c32/encounter_importer.rb +1 -6
- data/lib/health-data-standards/import/green_c32/immunization_importer.rb +1 -1
- data/lib/health-data-standards/import/green_c32/medical_equipment_importer.rb +24 -0
- data/lib/health-data-standards/import/green_c32/medication_importer.rb +1 -1
- data/lib/health-data-standards/import/green_c32/procedure_importer.rb +2 -10
- data/lib/health-data-standards/import/green_c32/section_importer.rb +36 -5
- data/lib/health-data-standards/import/green_c32/social_history_importer.rb +1 -6
- data/lib/health-data-standards/import/green_c32/support_importer.rb +22 -0
- data/lib/health-data-standards/models/allergy.rb +1 -1
- data/lib/health-data-standards/models/condition.rb +3 -1
- data/lib/health-data-standards/models/encounter.rb +1 -3
- data/lib/health-data-standards/models/entry.rb +23 -21
- data/lib/health-data-standards/models/guarantor.rb +10 -0
- data/lib/health-data-standards/models/insurance_provider.rb +17 -0
- data/lib/health-data-standards/models/medical_equipment.rb +5 -0
- data/lib/health-data-standards/models/medication.rb +0 -2
- data/lib/health-data-standards/models/person.rb +4 -0
- data/lib/health-data-standards/models/personable.rb +13 -0
- data/lib/health-data-standards/models/procedure.rb +0 -2
- data/lib/health-data-standards/models/provider.rb +1 -6
- data/lib/health-data-standards/models/record.rb +11 -5
- data/lib/health-data-standards/models/support.rb +18 -0
- data/lib/health-data-standards.rb +28 -2
- data/templates/_advance_directive.gc32.erb +8 -0
- data/templates/_allergy.gc32.erb +17 -7
- data/templates/_care_goal.gc32.erb +8 -0
- data/templates/_condition.gc32.erb +4 -6
- data/templates/_conditions.c32.erb +3 -0
- data/templates/_encounter.gc32.erb +1 -7
- data/templates/_entry.gc32.erb +14 -0
- data/templates/_immunization.gc32.erb +4 -2
- data/templates/_insurance_provider.gc32.erb +0 -0
- data/templates/_medical_equipment.c32.erb +6 -0
- data/templates/_medical_equipment.gc32.erb +7 -0
- data/templates/_medication.gc32.erb +26 -14
- data/templates/_medications_no_current.c32.erb +26 -6
- data/templates/_name.gc32.erb +11 -0
- data/templates/_narrative_block.c32.erb +1 -1
- data/templates/_procedure.gc32.erb +6 -4
- data/templates/_result.gc32.erb +2 -8
- data/templates/_results.c32.erb +8 -2
- data/templates/_social_history.gc32.erb +3 -1
- data/templates/_support.gc32.erb +14 -0
- data/templates/_vital_sign.gc32.erb +2 -7
- data/templates/_vital_signs.c32.erb +8 -2
- data/templates/record.gc32.erb +81 -0
- data/templates/show.c32.erb +1 -1
- metadata +48 -16
- data/lib/health-data-standards/models/comment.rb +0 -2
- data/lib/health-data-standards/models/social_history.rb +0 -3
@@ -5,12 +5,7 @@ module HealthDataStandards
|
|
5
5
|
include Singleton
|
6
6
|
|
7
7
|
def import(sh_xml)
|
8
|
-
sh_xml
|
9
|
-
sh_element = sh_xml.at_xpath("./gc32:socialHistory")
|
10
|
-
sh = SocialHistory.new
|
11
|
-
extract_entry(sh_element, sh)
|
12
|
-
extract_code(sh_element, sh, "./gc32:type", :type)
|
13
|
-
sh
|
8
|
+
generic_import(sh_xml, "socialHistory")
|
14
9
|
end
|
15
10
|
end
|
16
11
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module GreenC32
|
4
|
+
class SupportImporter < SectionImporter
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
def import(support_doc)
|
8
|
+
support_doc.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
9
|
+
support_element = support_doc.at_xpath("./gc32:support")
|
10
|
+
support = Support.new(type: support_element.at_xpath("./gc32:type").try(:content),
|
11
|
+
relationship: support_element.at_xpath("./gc32:relationship").try(:text))
|
12
|
+
extract_name(support_element, support)
|
13
|
+
support.address = extract_address(support_element.at_xpath("./gc32:address"))
|
14
|
+
support.telecom = extract_telecom(support_element.at_xpath("./gc32:telecom"))
|
15
|
+
support.mothers_maiden_name = support_element.at_xpath("./gc32:mothersMaidenName").try(:text)
|
16
|
+
support
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
class Condition < Entry
|
2
2
|
field :type, type: String
|
3
3
|
field :causeOfDeath, type: Boolean
|
4
|
+
field :priority, type: Integer
|
4
5
|
field :name, type: String
|
5
|
-
|
6
|
+
field :ordinality, type: String
|
7
|
+
|
6
8
|
embeds_many :treating_provider, class_name: "Provider"
|
7
9
|
|
8
10
|
alias :cause_of_death :causeOfDeath
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class Encounter < Entry
|
2
2
|
field :admitType, type: Hash
|
3
3
|
field :dischargeDisposition, type: Hash
|
4
|
-
field :free_text, type: String
|
5
4
|
|
6
5
|
embeds_one :facility, class_name: "Organization"
|
7
6
|
embeds_one :reason, class_name: "Entry"
|
@@ -12,6 +11,5 @@ class Encounter < Entry
|
|
12
11
|
alias :admit_type= :admitType=
|
13
12
|
alias :discharge_disposition :dischargeDisposition
|
14
13
|
alias :discharge_disposition= :dischargeDisposition=
|
15
|
-
|
16
|
-
alias :freeText= :free_text=
|
14
|
+
|
17
15
|
end
|
@@ -14,6 +14,8 @@ class Entry
|
|
14
14
|
field :status, type: String
|
15
15
|
field :codes, type: Hash, default: {}
|
16
16
|
field :value, type: Hash, default: {}
|
17
|
+
field :free_text, type: String
|
18
|
+
field :mood_code, type: String, default: "EVN"
|
17
19
|
|
18
20
|
attr_protected :version
|
19
21
|
attr_protected :_id
|
@@ -57,32 +59,32 @@ class Entry
|
|
57
59
|
|
58
60
|
def times_to_s
|
59
61
|
if start_time.present? || end_time.present?
|
60
|
-
start_string = start_time ? Time.at(start_time).to_formatted_s(:long_ordinal) : 'UNK'
|
61
|
-
end_string = end_time ? Time.at(end_time).to_formatted_s(:long_ordinal) : 'UNK'
|
62
|
+
start_string = start_time ? Time.at(start_time).utc.to_formatted_s(:long_ordinal) : 'UNK'
|
63
|
+
end_string = end_time ? Time.at(end_time).utc.to_formatted_s(:long_ordinal) : 'UNK'
|
62
64
|
"#{start_string} - #{end_string}"
|
63
65
|
elsif time.present?
|
64
|
-
Time.at(time).to_formatted_s(:long_ordinal)
|
66
|
+
Time.at(time).utc.to_formatted_s(:long_ordinal)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
def to_effective_time(xml)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
70
|
+
# def to_effective_time(xml)
|
71
|
+
# if time.present?
|
72
|
+
# xml.effectiveTime("value" => Time.at(time).utc.to_formatted_s(:number))
|
73
|
+
# else
|
74
|
+
# xml.effectiveTime do
|
75
|
+
# if start_time.present?
|
76
|
+
# xml.low("value" => Time.at(start_time).utc.to_formatted_s(:number))
|
77
|
+
# else
|
78
|
+
# xml.low("nullFlavor" => "UNK")
|
79
|
+
# end
|
80
|
+
# if end_time.present?
|
81
|
+
# xml.high("value" => Time.at(end_time).utc.to_formatted_s(:number))
|
82
|
+
# else
|
83
|
+
# xml.high("nullFlavor" => "UNK")
|
84
|
+
# end
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
# end
|
86
88
|
|
87
89
|
def self.from_event_hash(event)
|
88
90
|
entry = Entry.new
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class InsuranceProvider
|
2
|
+
include Mongoid::Document
|
3
|
+
|
4
|
+
embeds_one :payer, class_name: "Organization"
|
5
|
+
embeds_many :guarantors, class_name: "Guarantor"
|
6
|
+
embeds_one :subscriber, class_name: "Person"
|
7
|
+
|
8
|
+
field :type, type: String
|
9
|
+
field :time, type: Integer
|
10
|
+
field :start_time, type: Integer
|
11
|
+
field :end_time, type: Integer
|
12
|
+
field :member_id, type: String
|
13
|
+
field :relationship, type: Hash
|
14
|
+
field :financial_responsibility_type, type: Hash
|
15
|
+
field :name, type: String
|
16
|
+
|
17
|
+
end
|
@@ -21,8 +21,6 @@ class Medication < Entry
|
|
21
21
|
|
22
22
|
alias :administration_timing :administrationTiming
|
23
23
|
alias :administration_timing= :administrationTiming=
|
24
|
-
alias :free_text_sig :freeTextSig
|
25
|
-
alias :free_text_sig= :freeTextSig=
|
26
24
|
alias :type_of_medication :typeOfMedication
|
27
25
|
alias :type_of_medication= :typeOfMedication=
|
28
26
|
alias :status_of_medication :statusOfMedication
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Personable
|
2
|
+
|
3
|
+
def self.included(receiver)
|
4
|
+
receiver.send(:include, Mongoid::Document)
|
5
|
+
|
6
|
+
receiver.field :title , type: String
|
7
|
+
receiver.field :given_name , type: String
|
8
|
+
receiver.field :family_name , type: String
|
9
|
+
|
10
|
+
receiver.embeds_many :addresses, as: :locatable
|
11
|
+
receiver.embeds_many :telecoms, as: :contactable
|
12
|
+
end
|
13
|
+
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
class Provider
|
2
|
-
include
|
2
|
+
include Personable
|
3
3
|
|
4
|
-
field :title , type: String
|
5
|
-
field :given_name , type: String
|
6
|
-
field :family_name , type: String
|
7
4
|
field :npi , type: String
|
8
5
|
field :tin , type: String
|
9
6
|
field :specialty , type: String
|
@@ -12,8 +9,6 @@ class Provider
|
|
12
9
|
|
13
10
|
validates_uniqueness_of :npi, allow_blank: true
|
14
11
|
|
15
|
-
embeds_many :addresses, as: :locatable
|
16
|
-
embeds_many :telecoms, as: :contactable
|
17
12
|
embeds_one :organization
|
18
13
|
|
19
14
|
|
@@ -1,32 +1,38 @@
|
|
1
1
|
class Record
|
2
2
|
include Mongoid::Document
|
3
3
|
|
4
|
+
field :title, type: String # TODO
|
4
5
|
field :first, type: String
|
5
6
|
field :last, type: String
|
6
7
|
field :gender, type: String
|
7
8
|
field :birthdate, type: Integer
|
8
|
-
field :deathdate, type: Integer
|
9
|
+
field :deathdate, type: Integer # TODO
|
10
|
+
field :religious_affilication, type: Hash # TODO
|
9
11
|
field :effective_time, type: Integer
|
10
12
|
field :race, type: Hash
|
11
13
|
field :ethnicity, type: Hash
|
12
14
|
field :languages, type: Array
|
13
15
|
field :test_id, type: BSON::ObjectId
|
16
|
+
field :marital_status, type: Hash # TODO
|
14
17
|
field :medical_record_number, type: String
|
15
18
|
|
16
19
|
embeds_many :allergies
|
17
|
-
embeds_many :care_goals, class_name: "Entry"
|
20
|
+
embeds_many :care_goals, class_name: "Entry" # This can be any number of different entry types
|
18
21
|
embeds_many :conditions
|
19
22
|
embeds_many :encounters
|
20
23
|
embeds_many :immunizations
|
21
|
-
embeds_many :medical_equipment
|
24
|
+
embeds_many :medical_equipment
|
22
25
|
embeds_many :medications
|
23
26
|
embeds_many :procedures
|
24
27
|
embeds_many :results, class_name: "LabResult"
|
25
|
-
embeds_many :social_history
|
28
|
+
embeds_many :social_history, class_name: "Entry"
|
26
29
|
embeds_many :vital_signs
|
30
|
+
embeds_many :support
|
31
|
+
embeds_many :advance_directives, class_name: "Entry"
|
32
|
+
embeds_many :insurance_providers
|
27
33
|
|
28
34
|
Sections = [:allergies, :care_goals, :conditions, :encounters, :immunizations, :medical_equipment,
|
29
|
-
:medications, :procedures, :results, :social_history, :vital_signs]
|
35
|
+
:medications, :procedures, :results, :social_history, :vital_signs, :support, :advanced_directives]
|
30
36
|
|
31
37
|
embeds_many :provider_performances
|
32
38
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Support < Entry
|
2
|
+
include Mongoid::Document
|
3
|
+
|
4
|
+
Types = ["Guardian", "Next of Kin", "Caregiver", "Emergency Contact"]
|
5
|
+
|
6
|
+
embeds_one :address
|
7
|
+
embeds_one :telecom
|
8
|
+
|
9
|
+
field :title, type: String
|
10
|
+
field :given_name, type: String
|
11
|
+
field :family_name, type: String
|
12
|
+
field :mothers_maiden_name, type: String
|
13
|
+
field :type, type: String
|
14
|
+
field :relationship, type: String
|
15
|
+
|
16
|
+
# validates_inclusion_of :type, :in => Types
|
17
|
+
|
18
|
+
end
|
@@ -22,6 +22,7 @@ require_relative 'health-data-standards/export/csv'
|
|
22
22
|
require_relative 'health-data-standards/export/html'
|
23
23
|
require_relative 'health-data-standards/export/hdata/metadata'
|
24
24
|
|
25
|
+
require_relative 'health-data-standards/export/green_c32/record'
|
25
26
|
require_relative 'health-data-standards/export/green_c32/entry'
|
26
27
|
require_relative 'health-data-standards/export/green_c32/export_generator'
|
27
28
|
|
@@ -38,11 +39,16 @@ require_relative 'health-data-standards/models/order_information'
|
|
38
39
|
require_relative 'health-data-standards/models/medication'
|
39
40
|
require_relative 'health-data-standards/models/procedure'
|
40
41
|
require_relative 'health-data-standards/models/lab_result'
|
42
|
+
require_relative 'health-data-standards/models/medical_equipment'
|
41
43
|
require_relative 'health-data-standards/models/record'
|
44
|
+
require_relative 'health-data-standards/models/personable'
|
42
45
|
require_relative 'health-data-standards/models/provider'
|
43
46
|
require_relative 'health-data-standards/models/provider_performance'
|
44
|
-
require_relative 'health-data-standards/models/
|
47
|
+
require_relative 'health-data-standards/models/support'
|
45
48
|
require_relative 'health-data-standards/models/vital_sign'
|
49
|
+
require_relative 'health-data-standards/models/insurance_provider'
|
50
|
+
require_relative 'health-data-standards/models/guarantor'
|
51
|
+
require_relative 'health-data-standards/models/person'
|
46
52
|
require_relative 'health-data-standards/models/organization'
|
47
53
|
require_relative 'health-data-standards/models/address'
|
48
54
|
require_relative 'health-data-standards/models/telecom'
|
@@ -64,6 +70,9 @@ require_relative 'health-data-standards/import/c32/vital_sign_importer'
|
|
64
70
|
require_relative 'health-data-standards/import/c32/patient_importer'
|
65
71
|
require_relative 'health-data-standards/import/c32/provider_importer'
|
66
72
|
require_relative 'health-data-standards/import/c32/organization_importer'
|
73
|
+
require_relative 'health-data-standards/import/c32/medical_equipment_importer'
|
74
|
+
require_relative 'health-data-standards/import/c32/insurance_provider_importer'
|
75
|
+
require_relative 'health-data-standards/import/c32/care_goal_importer'
|
67
76
|
|
68
77
|
require_relative 'health-data-standards/import/ccr/patient_importer'
|
69
78
|
require_relative 'health-data-standards/import/ccr/provider_importer'
|
@@ -72,6 +81,19 @@ require_relative 'health-data-standards/import/ccr/result_importer'
|
|
72
81
|
require_relative 'health-data-standards/import/ccr/simple_importer'
|
73
82
|
require_relative 'health-data-standards/import/ccr/product_importer'
|
74
83
|
|
84
|
+
require_relative 'health-data-standards/import/ccda/patient_importer'
|
85
|
+
require_relative 'health-data-standards/import/ccda/allergy_importer'
|
86
|
+
require_relative 'health-data-standards/import/ccda/condition_importer'
|
87
|
+
require_relative 'health-data-standards/import/ccda/encounter_importer'
|
88
|
+
require_relative 'health-data-standards/import/ccda/immunization_importer'
|
89
|
+
require_relative 'health-data-standards/import/ccda/procedure_importer'
|
90
|
+
require_relative 'health-data-standards/import/ccda/result_importer'
|
91
|
+
require_relative 'health-data-standards/import/ccda/vital_sign_importer'
|
92
|
+
require_relative 'health-data-standards/import/ccda/medication_importer'
|
93
|
+
require_relative 'health-data-standards/import/ccda/care_goal_importer'
|
94
|
+
require_relative 'health-data-standards/import/ccda/medical_equipment_importer'
|
95
|
+
require_relative 'health-data-standards/import/ccda/insurance_provider_importer'
|
96
|
+
|
75
97
|
require_relative 'health-data-standards/import/green_c32/section_importer'
|
76
98
|
require_relative 'health-data-standards/import/green_c32/result_importer'
|
77
99
|
require_relative 'health-data-standards/import/green_c32/condition_importer'
|
@@ -81,4 +103,8 @@ require_relative 'health-data-standards/import/green_c32/encounter_importer'
|
|
81
103
|
require_relative 'health-data-standards/import/green_c32/medication_importer'
|
82
104
|
require_relative 'health-data-standards/import/green_c32/allergy_importer'
|
83
105
|
require_relative 'health-data-standards/import/green_c32/social_history_importer'
|
84
|
-
require_relative 'health-data-standards/import/green_c32/immunization_importer'
|
106
|
+
require_relative 'health-data-standards/import/green_c32/immunization_importer'
|
107
|
+
require_relative 'health-data-standards/import/green_c32/support_importer'
|
108
|
+
require_relative 'health-data-standards/import/green_c32/advance_directive_importer'
|
109
|
+
require_relative 'health-data-standards/import/green_c32/medical_equipment_importer'
|
110
|
+
require_relative 'health-data-standards/import/green_c32/care_goal_importer'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<advanceDirective xmlns="urn:hl7-org:greencda:c32">
|
2
|
+
<%== code_display advance_directive, 'preferred_code_sets' => ['SNOMED-CT'] %>
|
3
|
+
<effectiveTime>
|
4
|
+
<start><%= time_if_not_nil(advance_directive.start_time, advance_directive.time) %></start>
|
5
|
+
<end><%= time_if_not_nil(advance_directive.end_time) %></end>
|
6
|
+
</effectiveTime>
|
7
|
+
<freeText><%= advance_directive.free_text %></freeText>
|
8
|
+
</advanceDirective>
|
data/templates/_allergy.gc32.erb
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
<allergy xmlns="urn:hl7-org:greencda:c32">
|
2
2
|
<id><%= allergy.id%></id>
|
3
|
-
<status><%= allergy.status%></status>
|
4
3
|
<%== code_display allergy, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "RxNorm", "FDA"] %>
|
5
|
-
<
|
4
|
+
<status><%= allergy.status%></status>
|
5
|
+
<freeText><%= allergy.free_text %></freeText>
|
6
6
|
<effectiveTime>
|
7
|
-
|
7
|
+
<% if allergy.start_time || allergy.end_time %>
|
8
|
+
<start><%= time_if_not_nil(allergy.start_time) %></start>
|
8
9
|
<end><%= time_if_not_nil(allergy.end_time) %></end>
|
10
|
+
<% else %>
|
11
|
+
<%= time_if_not_nil(allergy.time) %>
|
12
|
+
<% end %>
|
9
13
|
</effectiveTime>
|
10
|
-
|
11
|
-
<%== code_display allergy, "tag_name" => "
|
12
|
-
|
13
|
-
|
14
|
+
<% if allergy.type %>
|
15
|
+
<%== code_display allergy, "tag_name" => "type", "attribute" => "type", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
16
|
+
<% end %>
|
17
|
+
<% if allergy.reaction %>
|
18
|
+
<%== code_display allergy, "tag_name" => "reaction", "attribute" => "reaction", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
19
|
+
<% end %>
|
20
|
+
<% if allergy.severity%>
|
21
|
+
<%== code_display allergy, "tag_name" => "severity", "attribute" => "severity", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
22
|
+
<% end %>
|
23
|
+
</allergy>
|
@@ -1,11 +1,9 @@
|
|
1
1
|
<condition <% unless condition.cause_of_death.nil? %>causeOfDeath="<%= condition.cause_of_death %>"<% end %> xmlns="urn:hl7-org:greencda:c32">
|
2
2
|
<id><%= condition.id %></id>
|
3
3
|
<%== code_display condition, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
|
4
|
-
|
5
|
-
|
4
|
+
<%== gc32_effective_time(condition)%>
|
5
|
+
<% if condition.priority %>
|
6
|
+
<priority><%= condition.priority %></priority>
|
6
7
|
<% end %>
|
7
|
-
<
|
8
|
-
<start><%= time_if_not_nil(condition.start_time, condition.time) %></start>
|
9
|
-
<end><%= time_if_not_nil(condition.end_time) %></end>
|
10
|
-
</effectiveTime>
|
8
|
+
<type><%= condition.type %></type>
|
11
9
|
</condition>
|
@@ -40,6 +40,9 @@
|
|
40
40
|
<effectiveTime>
|
41
41
|
<low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
|
42
42
|
</effectiveTime>
|
43
|
+
<% if entry.ordinality -%>
|
44
|
+
<priorityCode code="8319008" codeSystem="2.16.840.1.113883.6.96" displayName="Principal diagnosis" />
|
45
|
+
<% end -%>
|
43
46
|
<%== code_display(entry, {'tag_name' => 'value', 'extra_content' => 'xsi:type="CD"', 'preferred_code_sets' => ['SNOMED-CT']}) %>
|
44
47
|
<% if entry.status -%>
|
45
48
|
<entryRelationship typeCode="REFR">
|
@@ -1,16 +1,10 @@
|
|
1
1
|
<encounter xmlns="urn:hl7-org:greencda:c32">
|
2
2
|
<id><%= encounter.id %></id>
|
3
|
-
<code />
|
4
3
|
<%== code_display encounter, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
|
5
4
|
<% if encounter.status %>
|
6
5
|
<status code="completed"/>
|
7
6
|
<% end %>
|
8
|
-
|
9
|
-
<start><%= Time.at(encounter.start_time) %></start>
|
10
|
-
<% if encounter.end_time %>
|
11
|
-
<end><%= Time.at(encounter.end_time) %></end>
|
12
|
-
<% end %>
|
13
|
-
</effectiveTime>
|
7
|
+
<%== gc32_effective_time(encounter)%>
|
14
8
|
<%== code_display encounter, "tag_name" => "dishcargeDisposition", 'attribute' => "discharge_disposition" %>
|
15
9
|
<%== code_display encounter, "tag_name" => "admissionType", 'attribute' => "admit_type" %>
|
16
10
|
<% if provider %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<entry xmlns="urn:hl7-org:greencda:c32">
|
2
|
+
<id><%= entry.id %></id>
|
3
|
+
<%== code_display entry, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "LOINC"] %>
|
4
|
+
<status><%= entry.status%></status>
|
5
|
+
<freeText><%=entry.free_text %></freeText>
|
6
|
+
<effectiveTime>
|
7
|
+
<% if entry.start_time || entry.end_time %>
|
8
|
+
<start><%= time_if_not_nil(entry.start_time) %></start>
|
9
|
+
<end><%= time_if_not_nil(entry.end_time) %></end>
|
10
|
+
<% else %>
|
11
|
+
<%= time_if_not_nil(entry.time) %>
|
12
|
+
<% end %>
|
13
|
+
</effectiveTime>
|
14
|
+
</entry>
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<immunization <% if refused %> refused="true" <% end %> xmlns="urn:hl7-org:greencda:c32">
|
2
2
|
<id><%= immunization.id %></id>
|
3
|
-
<%== code_display immunization, "preferred_code_sets" => ["RxNorm", "
|
4
|
-
|
3
|
+
<%== code_display immunization, "preferred_code_sets" => ["RxNorm", "CVX"] %>
|
4
|
+
<%== gc32_effective_time(immunization)%>
|
5
5
|
<% if immunization.series_number %>
|
6
6
|
<seriesNumber><%= immunization.series_number %></seriesNumber>
|
7
7
|
<% end %>
|
8
|
+
<% if immunization.refusal_reason %>
|
8
9
|
<%== code_display immunization, "tag_name" => "refusalReason", "attribute" => "refusal_reason", "preferred_code_sets" => ["SNOMED-CT"] %>
|
10
|
+
<% end %>
|
9
11
|
</immunization>
|
File without changes
|
@@ -25,6 +25,12 @@
|
|
25
25
|
<playingDevice>
|
26
26
|
<%== code_display(entry, {:preferred_code_sets => ['SNOMED-CT']}) %>
|
27
27
|
</playingDevice>
|
28
|
+
<% if entry.manufacturer %>
|
29
|
+
<scopingEntity>
|
30
|
+
<id root="<%= UUID.generate %>"/>
|
31
|
+
<desc><%= entry.manufacturer %></desc>
|
32
|
+
</scopingEntity>
|
33
|
+
<% end %>
|
28
34
|
</participantRole>
|
29
35
|
</participant>
|
30
36
|
</supply>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<medicalEquipment xmlns="urn:hl7-org:greencda:c32">
|
2
|
+
<id><%= medical_equipment.id %></id>
|
3
|
+
<%== code_display medical_equipment, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "LOINC"] %>
|
4
|
+
<status><%= medical_equipment.status%></status>
|
5
|
+
<freeText><%=medical_equipment.free_text %></freeText>
|
6
|
+
<%== gc32_effective_time(medical_equipment)%>
|
7
|
+
</medicalEquipment>
|
@@ -1,35 +1,47 @@
|
|
1
1
|
<medication>
|
2
2
|
<id><%= medication.id%></id>
|
3
|
-
|
4
|
-
<
|
3
|
+
<%== code_display medication, "preferred_code_sets" => ["RxNorm", "CVX"] %>
|
4
|
+
<freeText><%= medication.free_text%></freeText>
|
5
|
+
<%== gc32_effective_time(medication)%>
|
6
|
+
<% if medication.administration_timing %>
|
7
|
+
<administrationTiming institutionSpecified="<%= medication.administration_timing[:insitution_specified] %>">
|
8
|
+
<%== quantity_display medication.administration_timing["period"], :period %>
|
9
|
+
</administrationTiming>
|
10
|
+
<% end %>
|
11
|
+
<% if medication.route %>
|
5
12
|
<%== code_display medication, "tag_name" => "route", "attribute" => "route", "preferred_code_sets" => ["NCI Thesaurus"] %>
|
13
|
+
<% end %>
|
14
|
+
<% if medication.site %>
|
15
|
+
<%== code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
|
16
|
+
<% end %>
|
6
17
|
<%== quantity_display medication.dose, :dose %>
|
7
18
|
<% if medication.dose_indicator %>
|
8
19
|
<doseIndication><%medication.dose_indicator%></doseIndication>
|
9
20
|
<% end %>
|
10
|
-
|
11
|
-
<%== code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
|
12
21
|
<% if medication.dose_restriction %>
|
13
22
|
<doseRestriction>
|
14
23
|
<numerator><%= medication.dose_restriction["numerator"]%></numerator>
|
15
24
|
<denominator><%= medication.dose_restriction["denominator"]%></denominator>
|
16
25
|
</doseRestriction>
|
17
26
|
<% end %>
|
18
|
-
<% if medication.
|
19
|
-
<administrationTiming institutionSpecified="<%= medication.administration_timing[:insitution_specified] %>">
|
20
|
-
<start><%= Time.at(medication.start_time) %></start>
|
21
|
-
<end><%= Time.at(medication.end_time)%></end>
|
22
|
-
<%== quantity_display medication.administration_timing["period"], :period %>
|
23
|
-
</administrationTiming>
|
24
|
-
<% end %>
|
27
|
+
<% if medication.product_form %>
|
25
28
|
<%== code_display medication, "tag_name" => "productForm", "attribute" => "product_form", "preferred_code_sets" => ["NCI Thesaurus"] %>
|
29
|
+
<% end %>
|
26
30
|
<% if medication.delivery_method %>
|
27
31
|
<%== code_display medication, "tag_name" => "deliveryMethod", "attribute" => "delivery_method", "preferred_code_sets" => medication.delivery_method.keys %>
|
28
32
|
<% end %>
|
33
|
+
<% if medication.type_of_medication%>
|
29
34
|
<%== code_display medication, "tag_name" => "type", "attribute" => "type_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
35
|
+
<% end %>
|
36
|
+
<% if medication.status_of_medication%>
|
30
37
|
<%== code_display medication, "tag_name" => "statusOfMedication", "attribute" => "status_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
38
|
+
<% end %>
|
39
|
+
<%if medication.indication%>
|
31
40
|
<%== code_display medication, "tag_name" => "indication", "attribute" => "indication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
41
|
+
<% end %>
|
42
|
+
<% if medication.vehicle %>
|
32
43
|
<%== code_display medication, "tag_name" => "vehicle", "attribute" => "vehicle", "preferred_code_sets" => ["SNOMED-CT"] %>
|
44
|
+
<% end%>
|
33
45
|
|
34
46
|
<% if medication.dose_indicator %>
|
35
47
|
<doseIndicator><%= medication.dose_indicator %></doseIndicator>
|
@@ -46,15 +58,15 @@
|
|
46
58
|
<fulfillmentHistory <%if (fh.fill_status) %> fillStatus="<%=fh.fill_status%>" <% end %>
|
47
59
|
<% if fh.fill_number %> fillNumber="<%=fh.fill_number%>" <% end %>>
|
48
60
|
<prescriptionNumber><%=fh.prescription_number%></prescriptionNumber>
|
49
|
-
<dispenseDate><%= Time.at(fh.dispense_date)%></dispenseDate>
|
61
|
+
<dispenseDate><%= Time.at(fh.dispense_date).utc%></dispenseDate>
|
50
62
|
<%== quantity_display fh.quantity_dispensed, :quantityDispensed %>
|
51
63
|
</fulfillmentHistory>
|
52
64
|
<% end %>
|
53
65
|
<% medication.order_information.each do |oi| %>
|
54
66
|
<orderInformation <% if oi.order_number %><%= "orderNumber=\"#{oi.order_number}\"" %> <% end %> <% if oi.fills %> <%= "fills=\"#{oi.fills}\"" %> <% end %>>
|
55
67
|
<%== quantity_display oi.quantity_ordered, "quantityOrdered" %>
|
56
|
-
<orderDateTime><%= Time.at(oi.order_date_time)%></orderDateTime>
|
57
|
-
<expirationDateTime><%= Time.at(oi.order_expiration_date_time)%></expirationDateTime>
|
68
|
+
<orderDateTime><%= Time.at(oi.order_date_time).utc%></orderDateTime>
|
69
|
+
<expirationDateTime><%= Time.at(oi.order_expiration_date_time).utc%></expirationDateTime>
|
58
70
|
</orderInformation>
|
59
71
|
<% end %>
|
60
72
|
</medication>
|