health-data-standards 3.5.3 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -3
  3. data/README.md +10 -2
  4. data/lib/health-data-standards.rb +5 -28
  5. data/lib/health-data-standards/export/cat_1.rb +3 -2
  6. data/lib/health-data-standards/export/cat_1_r2.rb +11 -0
  7. data/lib/health-data-standards/ext/node.rb +1 -2
  8. data/lib/health-data-standards/import/bulk_record_importer.rb +4 -4
  9. data/lib/health-data-standards/import/bundle/importer.rb +62 -0
  10. data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +10 -8
  11. data/lib/health-data-standards/import/cat1/patient_importer.rb +3 -3
  12. data/lib/health-data-standards/import/cat1/procedure_importer.rb +42 -0
  13. data/lib/health-data-standards/import/cda/medication_importer.rb +11 -11
  14. data/lib/health-data-standards/import/cda/section_importer.rb +13 -7
  15. data/lib/health-data-standards/models/cqm/aggregate_objects.rb +5 -1
  16. data/lib/health-data-standards/models/cqm/bundle.rb +5 -3
  17. data/lib/health-data-standards/models/cqm/measure.rb +1 -1
  18. data/lib/health-data-standards/models/entry.rb +5 -1
  19. data/lib/health-data-standards/models/record.rb +10 -0
  20. data/lib/health-data-standards/models/reference.rb +23 -0
  21. data/lib/health-data-standards/models/svs/value_set.rb +4 -3
  22. data/lib/health-data-standards/railtie.rb +1 -1
  23. data/lib/health-data-standards/tasks.rb +1 -0
  24. data/lib/health-data-standards/tasks/bundle.rake +84 -2
  25. data/lib/health-data-standards/util/vs_api.rb +40 -7
  26. data/lib/health-data-standards/validate/base_validator.rb +23 -0
  27. data/lib/health-data-standards/validate/data_validator.rb +85 -0
  28. data/lib/health-data-standards/validate/measure_validator.rb +127 -0
  29. data/lib/health-data-standards/validate/performance_rate_validator.rb +94 -0
  30. data/lib/health-data-standards/validate/reported_result_extractor.rb +170 -0
  31. data/lib/health-data-standards/validate/schema_validator.rb +24 -0
  32. data/lib/health-data-standards/validate/schematron/c_processor.rb +28 -0
  33. data/lib/health-data-standards/validate/schematron/java_processor.rb +93 -0
  34. data/lib/health-data-standards/validate/schematron_validator.rb +34 -0
  35. data/lib/health-data-standards/validate/validation_error.rb +10 -0
  36. data/lib/health-data-standards/validate/validators.rb +80 -0
  37. data/lib/hqmf-generator/fulfills.xml.erb +7 -0
  38. data/lib/hqmf-generator/hqmf-generator.rb +8 -3
  39. data/lib/hqmf-model/data_criteria.rb +3 -0
  40. data/lib/hqmf-model/types.rb +29 -0
  41. data/lib/hqmf-parser/2.0/data_criteria.rb +7 -0
  42. data/lib/hqmf-parser/2.0/types.rb +24 -0
  43. data/resources/schema/infrastructure/cda/CDA_SDTC.xsd +44 -0
  44. data/resources/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd +1500 -0
  45. data/resources/schema/infrastructure/cda/SDTC.xsd +210 -0
  46. data/resources/schema/processable/coreschemas/NarrativeBlock.xsd +557 -0
  47. data/resources/schema/processable/coreschemas/datatypes-base_SDTC.xsd +1850 -0
  48. data/resources/schema/processable/coreschemas/datatypes.xsd +1375 -0
  49. data/resources/schema/processable/coreschemas/infrastructureRoot.xsd +27 -0
  50. data/resources/schema/processable/coreschemas/voc.xsd +2124 -0
  51. data/resources/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl +75 -0
  52. data/resources/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl +77 -0
  53. data/resources/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl +297 -0
  54. data/resources/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl +1509 -0
  55. data/resources/schematron/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  56. data/resources/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1844 -0
  57. data/resources/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +605 -0
  58. data/resources/schematron/iso-schematron-xslt1/readme.txt +101 -0
  59. data/resources/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm +723 -0
  60. data/resources/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +75 -0
  61. data/resources/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +77 -0
  62. data/resources/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl +297 -0
  63. data/resources/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl +1508 -0
  64. data/resources/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl +55 -0
  65. data/resources/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl +2299 -0
  66. data/resources/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl +684 -0
  67. data/resources/schematron/iso-schematron-xslt2/readme.txt +100 -0
  68. data/resources/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml +56 -0
  69. data/resources/schematron/iso-schematron-xslt2/sch-messages-de.xhtml +57 -0
  70. data/resources/schematron/iso-schematron-xslt2/sch-messages-en.xhtml +57 -0
  71. data/resources/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml +54 -0
  72. data/resources/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml +58 -0
  73. data/resources/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm +723 -0
  74. data/resources/schematron/qrda/cat_1/CDAR2_QRDA_I_R1_D3_2015MAY_Schematron.sch +4676 -0
  75. data/resources/schematron/qrda/cat_1/voc.xml +1177 -0
  76. data/resources/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +4069 -0
  77. data/resources/schematron/qrda/cat_1_r2/voc.xml +1065 -0
  78. data/resources/schematron/qrda/cat_3/QRDA Category III.sch +675 -0
  79. data/resources/schematron/qrda/cat_3/voc.xml +21 -0
  80. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.26.cat1.erb +18 -0
  81. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +4 -0
  82. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +5 -1
  83. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +1 -0
  84. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +20 -0
  85. data/templates/cat1/_fulfills.cat1.erb +14 -0
  86. data/templates/cat1/_organization.cat1.erb +2 -1
  87. data/templates/cat1/_patient_data.cat1.erb +1 -1
  88. data/templates/cat1/show.cat1.erb +5 -4
  89. data/templates/cat3/_performance_rate.cat3.erb +5 -1
  90. data/templates/cat3/show.cat3.erb +1 -1
  91. metadata +128 -109
  92. data/lib/health-data-standards/export/ccr.rb +0 -417
  93. data/lib/health-data-standards/export/green_c32/entry.rb +0 -18
  94. data/lib/health-data-standards/export/green_c32/export_generator.rb +0 -23
  95. data/lib/health-data-standards/export/green_c32/record.rb +0 -18
  96. data/lib/health-data-standards/export/helper/gc32_view_helper.rb +0 -39
  97. data/lib/health-data-standards/import/ccr/patient_importer.rb +0 -238
  98. data/lib/health-data-standards/import/ccr/product_importer.rb +0 -60
  99. data/lib/health-data-standards/import/ccr/provider_importer.rb +0 -49
  100. data/lib/health-data-standards/import/ccr/result_importer.rb +0 -49
  101. data/lib/health-data-standards/import/ccr/section_importer.rb +0 -135
  102. data/lib/health-data-standards/import/ccr/simple_importer.rb +0 -30
  103. data/lib/health-data-standards/import/green_c32/advance_directive_importer.rb +0 -14
  104. data/lib/health-data-standards/import/green_c32/allergy_importer.rb +0 -20
  105. data/lib/health-data-standards/import/green_c32/care_goal_importer.rb +0 -26
  106. data/lib/health-data-standards/import/green_c32/condition_importer.rb +0 -38
  107. data/lib/health-data-standards/import/green_c32/encounter_importer.rb +0 -33
  108. data/lib/health-data-standards/import/green_c32/immunization_importer.rb +0 -23
  109. data/lib/health-data-standards/import/green_c32/medical_equipment_importer.rb +0 -24
  110. data/lib/health-data-standards/import/green_c32/medication_importer.rb +0 -68
  111. data/lib/health-data-standards/import/green_c32/patient_importer.rb +0 -14
  112. data/lib/health-data-standards/import/green_c32/procedure_importer.rb +0 -27
  113. data/lib/health-data-standards/import/green_c32/result_importer.rb +0 -43
  114. data/lib/health-data-standards/import/green_c32/section_importer.rb +0 -186
  115. data/lib/health-data-standards/import/green_c32/social_history_importer.rb +0 -13
  116. data/lib/health-data-standards/import/green_c32/support_importer.rb +0 -22
  117. data/lib/health-data-standards/import/green_c32/vital_sign_importer.rb +0 -21
  118. data/templates/gc32/_address.gc32.erb +0 -9
  119. data/templates/gc32/_advance_directive.gc32.erb +0 -5
  120. data/templates/gc32/_allergy.gc32.erb +0 -12
  121. data/templates/gc32/_care_goal.gc32.erb +0 -8
  122. data/templates/gc32/_condition.gc32.erb +0 -10
  123. data/templates/gc32/_encounter.gc32.erb +0 -28
  124. data/templates/gc32/_entry.gc32.erb +0 -3
  125. data/templates/gc32/_entry_attributes.gc32.erb +0 -10
  126. data/templates/gc32/_immunization.gc32.erb +0 -9
  127. data/templates/gc32/_insurance_provider.gc32.erb +0 -28
  128. data/templates/gc32/_medical_equipment.gc32.erb +0 -6
  129. data/templates/gc32/_medication.gc32.erb +0 -91
  130. data/templates/gc32/_name.gc32.erb +0 -11
  131. data/templates/gc32/_organization.gc32.erb +0 -10
  132. data/templates/gc32/_person_attributes.gc32.erb +0 -7
  133. data/templates/gc32/_procedure.gc32.erb +0 -9
  134. data/templates/gc32/_provider.gc32.erb +0 -9
  135. data/templates/gc32/_result.gc32.erb +0 -12
  136. data/templates/gc32/_social_history.gc32.erb +0 -6
  137. data/templates/gc32/_support.gc32.erb +0 -15
  138. data/templates/gc32/_telecom.gc32.erb +0 -1
  139. data/templates/gc32/_vital_sign.gc32.erb +0 -4
  140. data/templates/gc32/record.gc32.erb +0 -97
@@ -1,417 +0,0 @@
1
- module HealthDataStandards
2
- module Export
3
- module CCR
4
- # Builds a CCR XML document representing the patient.
5
- #
6
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
7
- def export(patient)
8
- xml = Builder::XmlMarkup.new(:indent => 2)
9
- xml.ContinuityOfCareRecord("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
10
- "xsi:schemaLocation" => "urn:astm-org:CCR CCR_20051109.xsd http://www.w3.org/2001/XMLSchema xmldsig-core-schema.xsd",
11
- "xmlns" => "urn:astm-org:CCR") do
12
- xml.CCRDocumentObjectID(patient.id)
13
- xml.Language do
14
- xml.Text("English")
15
- end
16
- xml.Version("V1.0")
17
- xml.DateTime do
18
- #TODO: Need to fix this and not be a hard-coded value
19
- xml.ExactDateTime(Time.now.xmlschema)
20
- end
21
- xml.Patient do
22
- xml.ActorID(patient.id)
23
- end
24
- xml.From do
25
- xml.ActorLink do
26
- xml.ActorID("AA0002")
27
- end
28
- end
29
- to_ccr_purpose(xml)
30
- xml.Body do
31
-
32
- to_ccr_problems(xml, patient)
33
- to_ccr_socialhistory(xml, patient)
34
- to_ccr_allergies(xml, patient)
35
-
36
- to_ccr_medications(xml, patient)
37
- to_ccr_immunizations(xml, patient)
38
- to_ccr_vitals(xml, patient)
39
- to_ccr_results(xml, patient)
40
- to_ccr_procedures(xml, patient)
41
- to_ccr_encounters(xml, patient)
42
- end
43
- to_ccr_actors(xml, patient)
44
- end
45
- end
46
-
47
- extend self
48
-
49
- private
50
-
51
- def code_section(xml, codes)
52
- if codes.present?
53
- codes.each_pair do |code_set, coded_values|
54
- coded_values.each do |coded_value|
55
- xml.Code do
56
- xml.Value(coded_value)
57
- xml.CodingSystem(code_set)
58
- #TODO: Need to fix this and not be a hard-coded value
59
- xml.Version("2005")
60
- end
61
- end
62
- end
63
- end
64
- end
65
-
66
- def active_status_and_source(xml, patient)
67
- xml.Status do
68
- xml.Text("Active")
69
- end
70
- xml.Source do
71
- xml.Actor do
72
- xml.ActorID(patient.id)
73
- end
74
- end
75
- end
76
-
77
-
78
- # Builds the XML snippet for the problems section inside the CCR standard
79
- #
80
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
81
- def to_ccr_problems(xml, patient)
82
- if patient.conditions.present?
83
- xml.Problems do
84
- patient.conditions.each_with_index do |condition, index|
85
- xml.Problem do
86
- xml.CCRDataObjectID("PR000#{index + 1}")
87
- to_ccr_date(xml, condition.as_point_in_time, "Start date")
88
- xml.Type do
89
- #TODO: Need to fix this and not be a hard-coded value
90
- xml.Text("Diagnosis")
91
- end
92
- xml.Description do
93
- xml.Text(condition.description)
94
- code_section(xml, condition.codes)
95
- end
96
- active_status_and_source(xml, patient)
97
- end
98
- end
99
- end
100
- end
101
- end
102
-
103
- # Builds the XML snippet for the encounters section inside the CCR standard
104
- #
105
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
106
- def to_ccr_encounters(xml, patient)
107
- if patient.encounters.present?
108
- xml.Encounters do
109
- patient.encounters.each_with_index do |encounter, index|
110
- xml.Encounter do
111
- xml.CCRDataObjectID("EN000#{index + 1}")
112
- to_ccr_date(xml, encounter.as_point_in_time, "Encounter Date")
113
- xml.Description do
114
- xml.Text(encounter.description)
115
- code_section(xml, encounter.codes)
116
- end
117
- active_status_and_source(xml, patient)
118
- end
119
- end
120
- end
121
- end
122
- end
123
-
124
- # Builds the XML snippet for the vitals section inside the CCR standard
125
- #
126
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
127
- def to_ccr_vitals(xml, patient)
128
- if patient.vital_signs.present?
129
- xml.VitalSigns do
130
- patient.vital_signs.each_with_index do |vital_sign, index|
131
- to_result(xml,vital_sign,"VT000#{index + 1}")
132
- end
133
- end
134
- end
135
- end
136
-
137
-
138
- # Builds the XML snippet for the lab section inside the CCR standard
139
- #
140
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
141
- def to_ccr_results(xml, patient)
142
- if patient.results.present?
143
- xml.Results do
144
- patient.results.each_with_index do |lab_result, index|
145
- to_result(xml,lab_result,"LB000#{index + 1}")
146
- end
147
- end
148
- end
149
- end
150
-
151
-
152
- def to_result(xml, res, ccr_id )
153
- xml.Result do
154
- xml.CCRDataObjectID(ccr_id)
155
- to_ccr_date(xml, res.as_point_in_time, "Start date")
156
- xml.Source
157
- xml.Test do
158
- xml.CCRDataObjectID("#{ccr_id}TestResult")
159
- xml.Description do
160
- xml.Text(res.description)
161
- code_section(xml, res.codes)
162
- end
163
-
164
- xml.Source
165
- xml.TestResult do
166
- rv = res.values.first
167
- if rv.present? && rv.respond_to?(:scalar)
168
- xml.Value(rv.scalar)
169
- xml.Unit do
170
- xml.Unit(rv.units)
171
- end
172
- else
173
-
174
- end
175
- end
176
- end
177
- end
178
- end
179
-
180
- # Builds the XML snippet for the medications section inside the CCR standard
181
- #
182
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
183
- def to_ccr_medications(xml, patient)
184
- if patient.medications.present?
185
- xml.Medications do
186
- patient.medications.each_with_index do |medication, index|
187
- xml.Medication do
188
- xml.CCRDataObjectID("MD000#{index + 1}")
189
- to_ccr_date(xml, medication.as_point_in_time, "Prescription Date")
190
- xml.Type do
191
- xml.Text("Medication")
192
- end
193
- active_status_and_source(xml, patient)
194
- xml.Product do
195
- xml.ProductName do
196
- xml.Text(medication.description)
197
- end
198
- xml.BrandName do
199
- xml.Text(medication.description)
200
- code_section(xml, medication.codes)
201
- end
202
- end
203
- end
204
- end
205
- end
206
- end
207
- end
208
-
209
- # Builds the XML snippet for the medications section inside the CCR standard
210
- #
211
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
212
- def to_ccr_immunizations(xml, patient)
213
- if patient.immunizations.present?
214
- xml.Immunizations do
215
- patient.immunizations.each_with_index do |immunization, index|
216
- xml.Immunization do
217
- xml.CCRDataObjectID("IM000#{index + 1}")
218
- to_ccr_date(xml, immunization.as_point_in_time, "Prescription Date")
219
- xml.Type do
220
- xml.Text("Immunization")
221
- end
222
- active_status_and_source(xml, patient)
223
- xml.Product do
224
- xml.ProductName do
225
- xml.Text(immunization.description)
226
- end
227
- xml.BrandName do
228
- xml.Text(immunization.description)
229
- code_section(xml, immunization.codes)
230
- end
231
- end
232
- end
233
- end
234
- end
235
- end
236
- end
237
-
238
-
239
-
240
- # Builds the XML snippet for the procedures section inside the CCR standard
241
- #
242
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
243
- def to_ccr_procedures(xml, patient)
244
- if patient.procedures.present?
245
- xml.Procedures do
246
- patient.procedures.each_with_index do |procedure, index|
247
- xml.Procedure do
248
- xml.CCRDataObjectID("PR000#{index + 1}")
249
- to_ccr_date(xml, procedure.as_point_in_time, "Service date")
250
- xml.Description do
251
- xml.Text(procedure.description)
252
- code_section(xml, procedure.codes)
253
- end
254
- xml.Status do
255
- xml.Text("Active")
256
- end
257
- xml.Source
258
- end
259
- end
260
- end
261
- end
262
- end
263
-
264
- def to_ccr_allergies(xml, patient)
265
- if patient.allergies.present?
266
- xml.Alerts do
267
- patient.allergies.each_with_index do |allergy, index|
268
- xml.Alert do
269
- xml.CCRDataObjectID("AL000#{index + 1}")
270
- to_ccr_date(xml, allergy.as_point_in_time, "Initial Occurrence")
271
- xml.Type do
272
- xml.Text("Allergy")
273
- end
274
- xml.Description do
275
- xml.Text(allergy.description)
276
- code_section(xml, allergy.codes)
277
- end
278
- xml.Status do
279
- xml.Text("Current")
280
- end
281
- xml.Source
282
- end
283
- end
284
- end
285
- end
286
- end
287
-
288
- # Builds the XML snippet for the social history section inside the CCR standard
289
- #
290
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
291
- def to_ccr_socialhistory(xml, patient)
292
- if patient.social_history.present?
293
- xml.SocialHistory do
294
- patient.social_history.each_with_index do |history, index|
295
- xml.SocialHistoryElement do
296
- xml.CCRDataObjectID("SH000#{index + 1}")
297
-
298
-
299
- xml.Description do
300
- xml.Text(history.description)
301
- code_section(xml, history.codes)
302
- end
303
-
304
- xml.Source
305
- end
306
- end
307
-
308
- if patient.race
309
- xml.SocialHistoryElement do
310
- xml.CCRDataObjectID("SH000RACE")
311
- xml.Type do
312
- xml.Text("Race")
313
- end
314
- xml.Description do
315
-
316
- code_section(xml, {"2.16.840.1.113883.6.238"=>[patient.race["code"]]})
317
- end
318
- xml.Source
319
- end
320
- end
321
-
322
- if patient.ethnicity
323
- xml.SocialHistoryElement do
324
- xml.CCRDataObjectID("SH000ETHICITY")
325
- xml.Type do
326
- xml.Text("Ethnicity")
327
- end
328
- xml.Description do
329
-
330
- code_section(xml, {"2.16.840.1.113883.6.238" => [patient.ethnicity["code"]]})
331
- end
332
- xml.Source
333
- end
334
- end
335
-
336
- end
337
- end
338
- end
339
-
340
- # Builds the XML snippet for a actors section inside the CCR standard
341
- #
342
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
343
- def to_ccr_actors(xml, patient)
344
- xml.Actors do
345
- xml.Actor do
346
- xml.ActorObjectID(patient.id)
347
- xml.Person do
348
- xml.Name do
349
- xml.CurrentName do
350
- xml.Given(patient.first)
351
- xml.Family(patient.last)
352
- end
353
- end
354
- xml.DateOfBirth do
355
- xml.ExactDateTime(convert_to_ccr_time_string(patient.birthdate))
356
- end
357
-
358
- if (patient.gender)
359
- xml.Gender do
360
- if (patient.gender.upcase == "M")
361
- xml.Text("Male")
362
- elsif (patient.gender.upcase == "F")
363
- xml.Text("Female")
364
- else
365
- xml.Text("Undifferentiated")
366
- end
367
- end
368
- end
369
- end
370
- xml.Source
371
- end
372
- end
373
- end
374
-
375
- # Builds the XML snippet for a purpose section inside the CCR standard
376
- #
377
- # @return [Builder::XmlMarkup] CCR XML representation of patient data
378
- def to_ccr_purpose(xml)
379
- xml.Purpose do
380
- xml.Description do
381
- xml.Text("Cypress Test Patient CCR XML Record")
382
- end
383
- xml.Indications do
384
- xml.Indication do
385
- xml.Source do
386
- xml.Actor do
387
- xml.ActorID("AA0002")
388
- end
389
- end
390
- xml.InternalCCRLink do
391
- xml.LinkID
392
- end
393
- end
394
- end
395
- end
396
- end
397
-
398
- def convert_to_ccr_time_string(time)
399
- converted_time = Time.at(time).utc
400
- converted_time.strftime("%Y-%m-%dT%H:%M:%SZ")
401
- end
402
-
403
- def to_ccr_date(xml, time, type)
404
- if time
405
- xml.DateTime do
406
- xml.Type do
407
- xml.Text(type)
408
- end
409
- #time
410
- xml.ExactDateTime(convert_to_ccr_time_string(time))
411
- end
412
- end
413
- end
414
-
415
- end
416
- end
417
- end
@@ -1,18 +0,0 @@
1
- module HealthDataStandards
2
- module Export
3
- module GreenC32
4
- class Entry
5
- def initialize
6
- template_helper = TemplateHelper.new('gc32', 'gc32')
7
- @rendering_context = RenderingContext.new
8
- @rendering_context.template_helper = template_helper
9
- @rendering_context.extensions = [HealthDataStandards::Export::Helper::GC32ViewHelper]
10
- end
11
-
12
- def export(object, object_type)
13
- @rendering_context.render(partial: object_type, locals: {object_type => object, type: object_type})
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- module HealthDataStandards
2
- module Export
3
- module GreenC32
4
- # Module that will create objects that can be used to export GreenCDA sections
5
- module ExportGenerator
6
- # Creates an object that can be used to export objects into GreenCDA.
7
- # @example Creating an results exporter
8
- # exporter = ExportGenerator.create_exporter_for(:result)
9
- # exporter.export(result) # => Returns GreenCDA XML in a String
10
- # @param [Symbol] section the section to create the exporter for
11
- # @return [Object] that has an export method
12
- def create_exporter_for(section)
13
- object = Object.new
14
- object.define_singleton_method(:export) do |section_instance|
15
- HealthDataStandards::Export::GreenC32::Entry.new.export(section_instance, section)
16
- end
17
- object
18
- end
19
- extend self
20
- end
21
- end
22
- end
23
- end