@kno2/bluebutton 0.6.8 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,32 +11,31 @@
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ 97:
15
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14
+ /***/ 376
15
+ (module, __unused_webpack_exports, __webpack_require__) {
16
16
 
17
17
  "use strict";
18
18
 
19
- /*
20
- * ...
21
- */
22
-
23
- var Core = __webpack_require__(1);
24
19
 
25
- var Documents = __webpack_require__(452);
26
-
27
- var Generators = __webpack_require__(409);
20
+ /*
21
+ * ...
22
+ */
23
+ var Core = __webpack_require__(211);
24
+ var Documents = __webpack_require__(856);
25
+ var Generators = __webpack_require__(238);
26
+ var Parsers = __webpack_require__(298);
28
27
 
29
- var Parsers = __webpack_require__(46);
30
28
  /* exported BlueButton */
31
-
32
-
33
29
  module.exports = function (source, opts) {
34
- var type, parsedData, parsedDocument; // Look for options
30
+ var type, parsedData, parsedDocument;
35
31
 
36
- if (!opts) opts = {}; // Detect and parse the source data
32
+ // Look for options
33
+ if (!opts) opts = {};
37
34
 
38
- parsedData = Core.parseData(source); // Detect and parse the document
35
+ // Detect and parse the source data
36
+ parsedData = Core.parseData(source);
39
37
 
38
+ // Detect and parse the document
40
39
  if (opts.parser) {
41
40
  // TODO: parse the document with provided custom parser
42
41
  parsedDocument = opts.parser();
@@ -44,36 +43,31 @@ module.exports = function (source, opts) {
44
43
  var documents = new Documents();
45
44
  type = documents.detect(parsedData);
46
45
  var parsers = new Parsers(documents);
47
-
48
46
  switch (type) {
49
47
  case 'c32':
50
48
  parsedData = documents.C32.process(parsedData);
51
49
  parsedDocument = parsers.C32.run(parsedData);
52
50
  break;
53
-
54
51
  case 'ccda':
55
52
  parsedData = documents.CCDA.process(parsedData);
56
53
  parsedDocument = parsers.CCDA.run(parsedData);
57
54
  break;
58
-
59
55
  case 'ccdar2':
60
56
  parsedData = documents.CCDAR2.process(parsedData);
61
57
  parsedDocument = parsers.CCDAR2.run(parsedData);
62
58
  break;
63
-
64
59
  case 'ccd':
65
60
  parsedData = documents.CCD.process(parsedData);
66
61
  parsedDocument = parsers.CCD.run(parsedData);
67
62
  break;
68
-
69
63
  case 'json':
70
- /* Expects a call like:
71
- * BlueButton(json string, {
72
- * generatorType: 'ccda',
73
- * template: < EJS file contents >
74
- * })
75
- * The returned "type" will be the requested type (not "json")
76
- * and the XML will be turned as a string in the 'data' key
64
+ /* Expects a call like:
65
+ * BlueButton(json string, {
66
+ * generatorType: 'ccda',
67
+ * template: < EJS file contents >
68
+ * })
69
+ * The returned "type" will be the requested type (not "json")
70
+ * and the XML will be turned as a string in the 'data' key
77
71
  */
78
72
  switch (opts.generatorType) {
79
73
  // only the unit tests ever need to worry about this testingMode argument
@@ -81,16 +75,13 @@ module.exports = function (source, opts) {
81
75
  type = 'c32';
82
76
  parsedDocument = Generators.C32.run(parsedData, opts.template, opts.testingMode);
83
77
  break;
84
-
85
78
  case 'ccda':
86
79
  type = 'ccda';
87
80
  parsedDocument = Generators.CCDA.run(parsedData, opts.template, opts.testingMode);
88
81
  break;
89
82
  }
90
-
91
83
  }
92
84
  }
93
-
94
85
  return {
95
86
  type: type,
96
87
  data: parsedDocument,
@@ -98,23 +89,21 @@ module.exports = function (source, opts) {
98
89
  };
99
90
  };
100
91
 
101
- /***/ }),
92
+ /***/ },
102
93
 
103
- /***/ 1:
104
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
94
+ /***/ 211
95
+ (module, __unused_webpack_exports, __webpack_require__) {
105
96
 
106
- /*
107
- * ...
97
+ /*
98
+ * ...
108
99
  */
109
- var Codes = __webpack_require__(259);
110
100
 
111
- var XML = __webpack_require__(58);
101
+ var Codes = __webpack_require__(714);
102
+ var XML = __webpack_require__(805);
103
+ var _require = __webpack_require__(767),
104
+ stripWhitespace = _require.stripWhitespace;
112
105
 
113
- var _require = __webpack_require__(895),
114
- stripWhitespace = _require.stripWhitespace;
115
106
  /* exported Core */
116
-
117
-
118
107
  module.exports = {
119
108
  parseData: parseData,
120
109
  stripWhitespace: stripWhitespace,
@@ -123,13 +112,11 @@ module.exports = {
123
112
  Codes: Codes,
124
113
  XML: XML
125
114
  };
126
- /*
127
- * ...
115
+ /*
116
+ * ...
128
117
  */
129
-
130
118
  function parseData(source) {
131
119
  source = stripWhitespace(source);
132
-
133
120
  if (source.charAt(0) === '<') {
134
121
  try {
135
122
  return XML.parse(source);
@@ -139,55 +126,50 @@ function parseData(source) {
139
126
  }
140
127
  }
141
128
  }
142
-
143
129
  try {
144
130
  return JSON.parse(source);
145
131
  } catch (e) {
146
132
  if (console.error) {
147
133
  console.error("Error: Cannot parse this file. BB.js only accepts valid XML " + "(for parsing) or JSON (for generation). If you are attempting to provide " + "XML or JSON, please run your data through a validator to see if it is malformed.\n");
148
134
  }
149
-
150
135
  throw e;
151
136
  }
152
137
  }
153
-
154
138
  ;
155
- /*
156
- * A wrapper around JSON.stringify which allows us to produce customized JSON.
157
- *
158
- * See https://developer.mozilla.org/en-US/docs/Web/
159
- * JavaScript/Guide/Using_native_JSON#The_replacer_parameter
160
- * for documentation on the replacerFn.
161
- */
162
139
 
140
+ /*
141
+ * A wrapper around JSON.stringify which allows us to produce customized JSON.
142
+ *
143
+ * See https://developer.mozilla.org/en-US/docs/Web/
144
+ * JavaScript/Guide/Using_native_JSON#The_replacer_parameter
145
+ * for documentation on the replacerFn.
146
+ */
163
147
  function json() {
164
148
  var datePad = function datePad(number) {
165
149
  if (number < 10) {
166
150
  return '0' + number;
167
151
  }
168
-
169
152
  return number;
170
153
  };
171
-
172
154
  var replacerFn = function replacerFn(key, value) {
173
- /* By default, Dates are output as ISO Strings like "2014-01-03T08:00:00.000Z." This is
174
- * tricky when all we have is a date (not a datetime); JS sadly ignores that distinction.
175
- *
176
- * To paper over this JS wart, we use two different JSON formats for dates and datetimes.
177
- * This is a little ugly but makes sure that the dates/datetimes mostly just parse
178
- * correclty for clients:
179
- *
180
- * 1. Datetimes are rendered as standard ISO strings, without the misleading millisecond
181
- * precision (misleading because we don't have it): YYYY-MM-DDTHH:mm:ssZ
182
- * 2. Dates are rendered as MM/DD/YYYY. This ensures they are parsed as midnight local-time,
183
- * no matter what local time is, and therefore ensures the date is always correct.
184
- * Outputting "YYYY-MM-DD" would lead most browsers/node to assume midnight UTC, which
185
- * means "2014-04-27" suddenly turns into "04/26/2014 at 5PM" or just "04/26/2014"
186
- * if you format it as a date...
187
- *
188
- * See http://stackoverflow.com/questions/2587345/javascript-date-parse and
189
- * http://blog.dygraphs.com/2012/03/javascript-and-dates-what-mess.html
190
- * for more on this issue.
155
+ /* By default, Dates are output as ISO Strings like "2014-01-03T08:00:00.000Z." This is
156
+ * tricky when all we have is a date (not a datetime); JS sadly ignores that distinction.
157
+ *
158
+ * To paper over this JS wart, we use two different JSON formats for dates and datetimes.
159
+ * This is a little ugly but makes sure that the dates/datetimes mostly just parse
160
+ * correclty for clients:
161
+ *
162
+ * 1. Datetimes are rendered as standard ISO strings, without the misleading millisecond
163
+ * precision (misleading because we don't have it): YYYY-MM-DDTHH:mm:ssZ
164
+ * 2. Dates are rendered as MM/DD/YYYY. This ensures they are parsed as midnight local-time,
165
+ * no matter what local time is, and therefore ensures the date is always correct.
166
+ * Outputting "YYYY-MM-DD" would lead most browsers/node to assume midnight UTC, which
167
+ * means "2014-04-27" suddenly turns into "04/26/2014 at 5PM" or just "04/26/2014"
168
+ * if you format it as a date...
169
+ *
170
+ * See http://stackoverflow.com/questions/2587345/javascript-date-parse and
171
+ * http://blog.dygraphs.com/2012/03/javascript-and-dates-what-mess.html
172
+ * for more on this issue.
191
173
  */
192
174
  var originalValue = this[key]; // a Date
193
175
 
@@ -198,68 +180,61 @@ function json() {
198
180
  // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/
199
181
  // Reference/Global_Objects/Date/toISOString
200
182
  return originalValue.getUTCFullYear() + '-' + datePad(originalValue.getUTCMonth() + 1) + '-' + datePad(originalValue.getUTCDate()) + 'T' + datePad(originalValue.getUTCHours()) + ':' + datePad(originalValue.getUTCMinutes()) + ':' + datePad(originalValue.getUTCSeconds()) + 'Z';
201
- } // We just have a pure date
202
-
183
+ }
203
184
 
185
+ // We just have a pure date
204
186
  return datePad(originalValue.getMonth() + 1) + '/' + datePad(originalValue.getDate()) + '/' + originalValue.getFullYear();
205
187
  }
206
-
207
188
  return value;
208
189
  };
209
-
210
190
  return JSON.stringify(this, replacerFn, 2);
211
191
  }
212
-
213
192
  ;
214
- /*
215
- * Removes all `null` properties from an object.
216
- */
217
193
 
194
+ /*
195
+ * Removes all `null` properties from an object.
196
+ */
218
197
  function trim(o) {
219
198
  var y;
220
-
221
199
  for (var x in o) {
222
200
  if (o.hasOwnProperty(x)) {
223
- y = o[x]; // if (y === null || (y instanceof Object && Object.keys(y).length == 0)) {
224
-
201
+ y = o[x];
202
+ // if (y === null || (y instanceof Object && Object.keys(y).length == 0)) {
225
203
  if (y === null) {
226
204
  delete o[x];
227
205
  }
228
-
229
206
  if (y instanceof Object) y = trim(y);
230
207
  }
231
208
  }
232
-
233
209
  return o;
234
210
  }
235
-
236
211
  ;
237
212
 
238
- /***/ }),
213
+ /***/ },
239
214
 
240
- /***/ 259:
241
- /***/ ((module) => {
215
+ /***/ 714
216
+ (module) {
242
217
 
243
- /*
244
- * ...
218
+ /*
219
+ * ...
245
220
  */
246
221
 
247
- /*
248
- * Administrative Gender (HL7 V3)
249
- * http://phinvads.cdc.gov/vads/ViewValueSet.action?id=8DE75E17-176B-DE11-9B52-0015173D1785
250
- * OID: 2.16.840.1.113883.1.11.1
222
+ /*
223
+ * Administrative Gender (HL7 V3)
224
+ * http://phinvads.cdc.gov/vads/ViewValueSet.action?id=8DE75E17-176B-DE11-9B52-0015173D1785
225
+ * OID: 2.16.840.1.113883.1.11.1
251
226
  */
252
227
  var GENDER_MAP = {
253
228
  'F': 'female',
254
229
  'M': 'male',
255
230
  'UN': 'undifferentiated'
256
231
  };
257
- /*
258
- * Marital Status (HL7)
259
- * http://phinvads.cdc.gov/vads/ViewValueSet.action?id=46D34BBC-617F-DD11-B38D-00188B398520
260
- * OID: 2.16.840.1.114222.4.11.809
261
- */
262
232
 
233
+ /*
234
+ * Marital Status (HL7)
235
+ * http://phinvads.cdc.gov/vads/ViewValueSet.action?id=46D34BBC-617F-DD11-B38D-00188B398520
236
+ * OID: 2.16.840.1.114222.4.11.809
237
+ */
263
238
  var MARITAL_STATUS_MAP = {
264
239
  'N': 'annulled',
265
240
  'C': 'common law',
@@ -278,12 +253,12 @@ var MARITAL_STATUS_MAP = {
278
253
  'T': 'unreported',
279
254
  'W': 'widowed'
280
255
  };
281
- /*
282
- * Religious Affiliation (HL7 V3)
283
- * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=6BFDBFB5-A277-DE11-9B52-0015173D1785
284
- * OID: 2.16.840.1.113883.5.1076
285
- */
286
256
 
257
+ /*
258
+ * Religious Affiliation (HL7 V3)
259
+ * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=6BFDBFB5-A277-DE11-9B52-0015173D1785
260
+ * OID: 2.16.840.1.113883.5.1076
261
+ */
287
262
  var RELIGION_MAP = {
288
263
  "1001": "adventist",
289
264
  "1002": "african religions",
@@ -368,16 +343,16 @@ var RELIGION_MAP = {
368
343
  "1059": "zen buddhism",
369
344
  "1060": "zoroastrianism"
370
345
  };
371
- /*
372
- * Race & Ethnicity (HL7 V3)
373
- * Full list at http://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.6.238
374
- * OID: 2.16.840.1.113883.6.238
375
- *
376
- * Abbreviated list closer to real usage at: (Race / Ethnicity)
377
- * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=67D34BBC-617F-DD11-B38D-00188B398520
378
- * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=35D34BBC-617F-DD11-B38D-00188B398520
379
- */
380
346
 
347
+ /*
348
+ * Race & Ethnicity (HL7 V3)
349
+ * Full list at http://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.6.238
350
+ * OID: 2.16.840.1.113883.6.238
351
+ *
352
+ * Abbreviated list closer to real usage at: (Race / Ethnicity)
353
+ * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=67D34BBC-617F-DD11-B38D-00188B398520
354
+ * https://phinvads.cdc.gov/vads/ViewValueSet.action?id=35D34BBC-617F-DD11-B38D-00188B398520
355
+ */
381
356
  var RACE_ETHNICITY_MAP = {
382
357
  '2028-9': 'asian',
383
358
  '2054-5': 'black or african american',
@@ -387,12 +362,12 @@ var RACE_ETHNICITY_MAP = {
387
362
  '2131-1': 'other',
388
363
  '2106-3': 'white'
389
364
  };
390
- /*
391
- * Role (HL7 V3)
392
- * https://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.5.111
393
- * OID: 2.16.840.1.113883.5.111
394
- */
395
365
 
366
+ /*
367
+ * Role (HL7 V3)
368
+ * https://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.5.111
369
+ * OID: 2.16.840.1.113883.5.111
370
+ */
396
371
  var ROLE_MAP = {
397
372
  "ACC": "accident site",
398
373
  "ACHFID": "accreditation location identifier",
@@ -715,37 +690,32 @@ var PROBLEM_STATUS_MAP = {
715
690
  "55561003": "active",
716
691
  "73425007": "inactive",
717
692
  "413322009": "resolved"
718
- }; // copied from _.invert to avoid making browser users include all of underscore
693
+ };
719
694
 
695
+ // copied from _.invert to avoid making browser users include all of underscore
720
696
  var invertKeys = function invertKeys(obj) {
721
697
  var result = {};
722
698
  var keys = Object.keys(obj);
723
-
724
699
  for (var i = 0, length = keys.length; i < length; i++) {
725
700
  result[obj[keys[i]]] = keys[i];
726
701
  }
727
-
728
702
  return result;
729
703
  };
730
-
731
704
  var lookupFnGenerator = function lookupFnGenerator(map) {
732
705
  return function (key) {
733
706
  return map[key] || null;
734
707
  };
735
708
  };
736
-
737
709
  var reverseLookupFnGenerator = function reverseLookupFnGenerator(map) {
738
710
  return function (key) {
739
711
  if (!key) {
740
712
  return null;
741
713
  }
742
-
743
714
  var invertedMap = invertKeys(map);
744
715
  key = key.toLowerCase();
745
716
  return invertedMap[key] || null;
746
717
  };
747
718
  };
748
-
749
719
  module.exports = {
750
720
  gender: lookupFnGenerator(GENDER_MAP),
751
721
  reverseGender: reverseLookupFnGenerator(GENDER_MAP),
@@ -761,44 +731,38 @@ module.exports = {
761
731
  reverseProblemStatus: reverseLookupFnGenerator(PROBLEM_STATUS_MAP)
762
732
  };
763
733
 
764
- /***/ }),
734
+ /***/ },
765
735
 
766
- /***/ 895:
767
- /***/ ((module) => {
736
+ /***/ 767
737
+ (module) {
768
738
 
769
739
  module.exports = {
770
740
  stripWhitespace: stripWhitespace
771
741
  };
772
-
773
742
  function stripWhitespace(str) {
774
743
  if (!str) {
775
744
  return str;
776
745
  }
777
-
778
746
  return str.trim();
779
747
  }
780
-
781
748
  ;
782
749
 
783
- /***/ }),
750
+ /***/ },
784
751
 
785
- /***/ 58:
786
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
752
+ /***/ 805
753
+ (module, __unused_webpack_exports, __webpack_require__) {
787
754
 
788
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
789
-
790
- /*
791
- * ...
755
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
756
+ /*
757
+ * ...
792
758
  */
793
- var _require = __webpack_require__(895),
794
- stripWhitespace = _require.stripWhitespace;
795
- /*
796
- * A function used to wrap DOM elements in an object so methods can be added
797
- * to the element object. IE8 does not allow methods to be added directly to
798
- * DOM objects.
759
+ var _require = __webpack_require__(767),
760
+ stripWhitespace = _require.stripWhitespace;
761
+ /*
762
+ * A function used to wrap DOM elements in an object so methods can be added
763
+ * to the element object. IE8 does not allow methods to be added directly to
764
+ * DOM objects.
799
765
  */
800
-
801
-
802
766
  var wrapElement = function wrapElement(el) {
803
767
  function wrapElementHelper(currentEl) {
804
768
  return {
@@ -813,263 +777,232 @@ var wrapElement = function wrapElement(el) {
813
777
  val: val,
814
778
  isEmpty: isEmpty
815
779
  };
816
- } // el is an array of elements
817
-
780
+ }
818
781
 
782
+ // el is an array of elements
819
783
  if (el.length) {
820
784
  var els = [];
821
-
822
785
  for (var i = 0; i < el.length; i++) {
823
786
  els.push(wrapElementHelper(el[i]));
824
787
  }
788
+ return els;
825
789
 
826
- return els; // el is a single element
790
+ // el is a single element
827
791
  } else {
828
792
  return wrapElementHelper(el);
829
793
  }
830
794
  };
831
- /*
832
- * Find element by tag name, then attribute value.
833
- */
834
-
835
795
 
796
+ /*
797
+ * Find element by tag name, then attribute value.
798
+ */
836
799
  var tagAttrVal = function tagAttrVal(el, tag, attr, value) {
837
800
  el = el.getElementsByTagName(tag);
838
-
839
801
  for (var i = 0; i < el.length; i++) {
840
802
  if (el[i].getAttribute(attr) === value) {
841
803
  return el[i];
842
804
  }
843
805
  }
844
806
  };
845
- /*
846
- * Search for a template ID, and return its parent element.
847
- * Example:
848
- * <templateId root="2.16.840.1.113883.10.20.22.2.17"/>
849
- * Can be found using:
850
- * el = dom.template('2.16.840.1.113883.10.20.22.2.17');
851
- */
852
-
853
807
 
808
+ /*
809
+ * Search for a template ID, and return its parent element.
810
+ * Example:
811
+ * <templateId root="2.16.840.1.113883.10.20.22.2.17"/>
812
+ * Can be found using:
813
+ * el = dom.template('2.16.840.1.113883.10.20.22.2.17');
814
+ */
854
815
  var template = function template(templateId) {
855
816
  var el = tagAttrVal(this.el, 'templateId', 'root', templateId);
856
-
857
817
  if (!el) {
858
818
  return emptyEl();
859
819
  } else {
860
820
  return wrapElement(el.parentNode);
861
821
  }
862
822
  };
863
- /*
864
- * Search for a content tag by "ID", and return it as an element.
865
- * These are used in the unstructured versions of each section but
866
- * referenced from the structured version sometimes.
867
- * Example:
868
- * <content ID="UniqueNameReferencedElsewhere"/>
869
- * Can be found using:
870
- * el = dom.content('UniqueNameReferencedElsewhere');
871
- *
872
- * We can't use `getElementById` because `ID` (the standard attribute name
873
- * in this context) is not the same attribute as `id` in XML, so there are no matches
874
- */
875
-
876
823
 
824
+ /*
825
+ * Search for a content tag by "ID", and return it as an element.
826
+ * These are used in the unstructured versions of each section but
827
+ * referenced from the structured version sometimes.
828
+ * Example:
829
+ * <content ID="UniqueNameReferencedElsewhere"/>
830
+ * Can be found using:
831
+ * el = dom.content('UniqueNameReferencedElsewhere');
832
+ *
833
+ * We can't use `getElementById` because `ID` (the standard attribute name
834
+ * in this context) is not the same attribute as `id` in XML, so there are no matches
835
+ */
877
836
  var content = function content(contentId) {
878
837
  var el = tagAttrVal(this.el, 'content', 'ID', contentId);
879
-
880
838
  if (!el) {
881
839
  // check the <td> tag too, which isn't really correct but
882
840
  // will inevitably be used sometimes because it looks like very
883
841
  // normal HTML to put the data directly in a <td>
884
842
  el = tagAttrVal(this.el, 'td', 'ID', contentId);
885
843
  }
886
-
887
844
  if (!el) {
888
845
  // Ugh, Epic uses really non-standard locations.
889
846
  el = tagAttrVal(this.el, 'caption', 'ID', contentId) || tagAttrVal(this.el, 'paragraph', 'ID', contentId) || tagAttrVal(this.el, 'tr', 'ID', contentId) || tagAttrVal(this.el, 'item', 'ID', contentId);
890
847
  }
891
-
892
848
  if (!el) {
893
849
  return emptyEl();
894
850
  } else {
895
851
  return wrapElement(el);
896
852
  }
897
853
  };
898
- /*
899
- * Search for the first occurrence of an element by tag name.
900
- */
901
-
902
854
 
855
+ /*
856
+ * Search for the first occurrence of an element by tag name.
857
+ */
903
858
  var tag = function tag(_tag) {
904
859
  var el = this.el.getElementsByTagName(_tag)[0];
905
-
906
860
  if (!el) {
907
861
  return emptyEl();
908
862
  } else {
909
863
  return wrapElement(el);
910
864
  }
911
865
  };
912
- /*
913
- * Like `tag`, except it will only count a tag that is an immediate child of `this`.
914
- * This is useful for tags like "text" which A. may not be present for a given location
915
- * in every document and B. have a very different meaning depending on their positioning
916
- *
917
- * <parent>
918
- * <target></target>
919
- * </parent>
920
- * vs.
921
- * <parent>
922
- * <intermediate>
923
- * <target></target>
924
- * </intermediate>
925
- * </parent>
926
- * parent.immediateChildTag('target') will have a result in the first case but not in the second.
927
- */
928
-
929
866
 
867
+ /*
868
+ * Like `tag`, except it will only count a tag that is an immediate child of `this`.
869
+ * This is useful for tags like "text" which A. may not be present for a given location
870
+ * in every document and B. have a very different meaning depending on their positioning
871
+ *
872
+ * <parent>
873
+ * <target></target>
874
+ * </parent>
875
+ * vs.
876
+ * <parent>
877
+ * <intermediate>
878
+ * <target></target>
879
+ * </intermediate>
880
+ * </parent>
881
+ * parent.immediateChildTag('target') will have a result in the first case but not in the second.
882
+ */
930
883
  var immediateChildTag = function immediateChildTag(tag) {
931
884
  var els = this.el.getElementsByTagName(tag);
932
-
933
885
  if (!els) {
934
886
  return null;
935
887
  }
936
-
937
888
  for (var i = 0; i < els.length; i++) {
938
889
  if (els[i].parentNode === this.el) {
939
890
  return wrapElement(els[i]);
940
891
  }
941
892
  }
942
-
943
893
  return emptyEl();
944
894
  };
945
- /*
946
- * Search for all elements by tag name.
947
- */
948
-
949
895
 
896
+ /*
897
+ * Search for all elements by tag name.
898
+ */
950
899
  var elsByTag = function elsByTag(tag) {
951
900
  return wrapElement(this.el.getElementsByTagName(tag));
952
901
  };
953
-
954
902
  var unescapeSpecialChars = function unescapeSpecialChars(s) {
955
903
  if (!s) {
956
904
  return s;
957
905
  }
958
-
959
906
  return s.replace(/\&lt;/g, '<').replace(/\&gt;/g, '>').replace(/\&quot;/g, '"').replace(/\&apos;/g, "'").replace(/\&amp;/g, '&');
960
907
  };
961
- /*
962
- * Retrieve the element's attribute value. Example:
963
- * value = el.attr('displayName');
964
- *
965
- * The browser and jsdom return "null" for empty attributes;
966
- * xmldom (which we now use because it's faster / can be explicitly
967
- * told to parse malformed XML as XML anyways), return the empty
968
- * string instead, so we fix that here.
969
- */
970
-
971
908
 
909
+ /*
910
+ * Retrieve the element's attribute value. Example:
911
+ * value = el.attr('displayName');
912
+ *
913
+ * The browser and jsdom return "null" for empty attributes;
914
+ * xmldom (which we now use because it's faster / can be explicitly
915
+ * told to parse malformed XML as XML anyways), return the empty
916
+ * string instead, so we fix that here.
917
+ */
972
918
  var attr = function attr(attrName) {
973
919
  if (!this.el) {
974
920
  return null;
975
921
  }
976
-
977
922
  var attrVal = this.el.getAttribute(attrName);
978
-
979
923
  if (attrVal) {
980
924
  return unescapeSpecialChars(attrVal);
981
925
  }
982
-
983
926
  return null;
984
927
  };
985
- /*
986
- * Wrapper for attr() for retrieving boolean attributes;
987
- * a raw call attr() will return Strings, which can be unexpected,
988
- * since the string 'false' will by truthy
989
- */
990
-
991
928
 
929
+ /*
930
+ * Wrapper for attr() for retrieving boolean attributes;
931
+ * a raw call attr() will return Strings, which can be unexpected,
932
+ * since the string 'false' will by truthy
933
+ */
992
934
  var boolAttr = function boolAttr(attrName) {
993
935
  var rawAttr = this.attr(attrName);
994
-
995
936
  if (rawAttr === 'true' || rawAttr === '1') {
996
937
  return true;
997
938
  }
998
-
999
939
  return false;
1000
940
  };
1001
- /*
1002
- * Retrieve the element's value. For example, if the element is:
1003
- * <city>Madison</city>
1004
- * Use:
1005
- * value = el.tag('city').val();
1006
- *
1007
- * This function also knows how to retrieve the value of <reference> tags,
1008
- * which can store their content in a <content> tag in a totally different
1009
- * part of the document.
1010
- */
1011
-
1012
941
 
942
+ /*
943
+ * Retrieve the element's value. For example, if the element is:
944
+ * <city>Madison</city>
945
+ * Use:
946
+ * value = el.tag('city').val();
947
+ *
948
+ * This function also knows how to retrieve the value of <reference> tags,
949
+ * which can store their content in a <content> tag in a totally different
950
+ * part of the document.
951
+ */
1013
952
  var val = function val(html) {
1014
953
  if (!this.el) {
1015
954
  return null;
1016
955
  }
1017
-
1018
956
  if (!this.el.childNodes || !this.el.childNodes.length) {
1019
957
  return null;
1020
958
  }
1021
-
1022
959
  var textContent;
1023
-
1024
960
  if (html) {
1025
961
  textContent = this.el.innerHTML;
1026
962
  if (!textContent && root.XMLSerializer) textContent = new XMLSerializer().serializeToString(this.el);
1027
963
  } else {
1028
964
  textContent = this.el.textContent;
1029
- } // if there's no text value here and the only thing inside is a
965
+ }
966
+
967
+ // if there's no text value here and the only thing inside is a
1030
968
  // <reference> tag, see if there's a linked <content> tag we can
1031
969
  // get something out of
1032
-
1033
-
1034
970
  if (!stripWhitespace(textContent)) {
1035
- var contentId; // "no text value" might mean there's just a reference tag
1036
-
971
+ var contentId;
972
+ // "no text value" might mean there's just a reference tag
1037
973
  if (this.el.childNodes.length === 1 && this.el.childNodes[0].tagName === 'reference') {
1038
- contentId = this.el.childNodes[0].getAttribute('value'); // or maybe a newlines on top/above the reference tag
974
+ contentId = this.el.childNodes[0].getAttribute('value');
975
+
976
+ // or maybe a newlines on top/above the reference tag
1039
977
  } else if (this.el.childNodes.length === 3 && this.el.childNodes[1].tagName === 'reference') {
1040
978
  contentId = this.el.childNodes[1].getAttribute('value');
1041
979
  } else {
1042
980
  return unescapeSpecialChars(textContent);
1043
981
  }
1044
-
1045
982
  if (contentId && contentId[0] === '#') {
1046
983
  contentId = contentId.slice(1); // get rid of the '#'
1047
-
1048
984
  var docRoot = wrapElement(this.el.ownerDocument);
1049
985
  var contentTag = docRoot.content(contentId);
1050
986
  return contentTag.val();
1051
987
  }
1052
988
  }
1053
-
1054
989
  return unescapeSpecialChars(textContent);
1055
990
  };
1056
- /*
1057
- * Creates and returns an empty DOM element with tag name "empty":
1058
- * <empty></empty>
1059
- */
1060
-
1061
991
 
992
+ /*
993
+ * Creates and returns an empty DOM element with tag name "empty":
994
+ * <empty></empty>
995
+ */
1062
996
  var emptyEl = function emptyEl() {
1063
997
  var el = doc.createElement('empty');
1064
998
  return wrapElement(el);
1065
999
  };
1066
- /*
1067
- * Determines if the element is empty, i.e.:
1068
- * <empty></empty>
1069
- * This element is created by function `emptyEL`.
1070
- */
1071
-
1072
1000
 
1001
+ /*
1002
+ * Determines if the element is empty, i.e.:
1003
+ * <empty></empty>
1004
+ * This element is created by function `emptyEL`.
1005
+ */
1073
1006
  var isEmpty = function isEmpty() {
1074
1007
  if (this.el.tagName.toLowerCase() === 'empty') {
1075
1008
  return true;
@@ -1077,28 +1010,31 @@ var isEmpty = function isEmpty() {
1077
1010
  return false;
1078
1011
  }
1079
1012
  };
1080
- /*
1081
- * Cross-browser XML parsing supporting IE8+ and Node.js.
1082
- */
1083
-
1084
1013
 
1014
+ /*
1015
+ * Cross-browser XML parsing supporting IE8+ and Node.js.
1016
+ */
1085
1017
  function parse(data) {
1086
1018
  // XML data must be a string
1087
1019
  if (!data || typeof data !== "string") {
1088
1020
  console.log("BB Error: XML data is not a string");
1089
1021
  return null;
1090
1022
  }
1023
+ var xml, parser;
1091
1024
 
1092
- var xml, parser; // Node
1093
-
1025
+ // Node
1094
1026
  if (isNode) {
1095
1027
  parser = new xmldom.DOMParser();
1096
- xml = parser.parseFromString(data, "text/xml"); // Browser
1028
+ xml = parser.parseFromString(data, "text/xml");
1029
+
1030
+ // Browser
1097
1031
  } else {
1098
1032
  // Standard parser
1099
1033
  if (window.DOMParser) {
1100
1034
  parser = new DOMParser();
1101
- xml = parser.parseFromString(data, "text/xml"); // IE
1035
+ xml = parser.parseFromString(data, "text/xml");
1036
+
1037
+ // IE
1102
1038
  } else {
1103
1039
  try {
1104
1040
  xml = new ActiveXObject("Microsoft.XMLDOM");
@@ -1109,49 +1045,42 @@ function parse(data) {
1109
1045
  }
1110
1046
  }
1111
1047
  }
1112
-
1113
1048
  if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
1114
1049
  console.log("BB Error: Could not parse XML");
1115
1050
  return null;
1116
1051
  }
1117
-
1118
1052
  return wrapElement(xml);
1119
1053
  }
1054
+ ;
1120
1055
 
1121
- ; // Establish the root object, `window` in the browser, or `global` in Node.
1122
-
1056
+ // Establish the root object, `window` in the browser, or `global` in Node.
1123
1057
  var root = window || __webpack_require__.g,
1124
- xmldom,
1125
- isNode = false,
1126
- doc = root.document; // Will be `undefined` if we're in Node
1127
- // Check if we're in Node. If so, pull in `xmldom` so we can simulate the DOM.
1058
+ xmldom,
1059
+ isNode = false,
1060
+ doc = root.document; // Will be `undefined` if we're in Node
1128
1061
 
1062
+ // Check if we're in Node. If so, pull in `xmldom` so we can simulate the DOM.
1129
1063
  if ((typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && Object.prototype.toString.call(process) === '[object process]') {
1130
1064
  isNode = true;
1131
- xmldom = __webpack_require__(992);
1065
+ xmldom = __webpack_require__(511);
1132
1066
  doc = new xmldom.DOMImplementation().createDocument();
1133
1067
  }
1134
-
1135
1068
  module.exports = {
1136
1069
  parse: parse
1137
1070
  };
1138
1071
 
1139
- /***/ }),
1072
+ /***/ },
1140
1073
 
1141
- /***/ 452:
1142
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1074
+ /***/ 856
1075
+ (module, __unused_webpack_exports, __webpack_require__) {
1143
1076
 
1144
- /*
1145
- * ...
1077
+ /*
1078
+ * ...
1146
1079
  */
1147
- var C32 = __webpack_require__(766);
1148
-
1149
- var CCD = __webpack_require__(626);
1150
-
1151
- var CCDA = __webpack_require__(539);
1152
-
1153
- var CCDAR2 = __webpack_require__(52);
1154
-
1080
+ var C32 = __webpack_require__(631);
1081
+ var CCD = __webpack_require__(589);
1082
+ var CCDA = __webpack_require__(946);
1083
+ var CCDAR2 = __webpack_require__(226);
1155
1084
  module.exports = function () {
1156
1085
  var self = this;
1157
1086
  self.detect = detect;
@@ -1164,18 +1093,14 @@ module.exports = function () {
1164
1093
  self.CCDA = new CCDA(getEntries);
1165
1094
  self.CCDAR2 = new CCDAR2(getEntries);
1166
1095
  };
1167
-
1168
1096
  function getEntries() {
1169
1097
  return entries;
1170
1098
  }
1171
-
1172
1099
  ;
1173
-
1174
1100
  function detect(data) {
1175
1101
  if (!data.template) {
1176
1102
  return 'json';
1177
1103
  }
1178
-
1179
1104
  if (!data.template('2.16.840.1.113883.3.88.11.32.1').isEmpty()) {
1180
1105
  return 'c32';
1181
1106
  } else if (!data.template('2.16.840.1.113883.10.20.22.1.1').isEmpty()) {
@@ -1186,104 +1111,95 @@ function detect(data) {
1186
1111
  return 'ccd';
1187
1112
  }
1188
1113
  }
1189
-
1190
1114
  ;
1191
- /*
1192
- * Get entries within an element (with tag name 'entry'), adds an `each` function
1193
- */
1194
1115
 
1116
+ /*
1117
+ * Get entries within an element (with tag name 'entry'), adds an `each` function
1118
+ */
1195
1119
  function entries() {
1196
1120
  var each = function each(callback) {
1197
1121
  for (var i = 0; i < this.length; i++) {
1198
1122
  callback(this[i]);
1199
1123
  }
1200
1124
  };
1201
-
1202
1125
  var els = this.elsByTag('entry');
1203
1126
  els.each = each;
1204
1127
  return els;
1205
1128
  }
1206
-
1207
1129
  ;
1208
- /*
1209
- * Parses an HL7 date in String form and creates a new Date object.
1210
- *
1211
- * TODO: CCDA dates can be in form:
1212
- * <effectiveTime value="20130703094812"/>
1213
- * ...or:
1214
- * <effectiveTime>
1215
- * <low value="19630617120000"/>
1216
- * <high value="20110207100000"/>
1217
- * </effectiveTime>
1218
- * For the latter, parseDate will not be given type `String`
1219
- * and will return `null`.
1220
- */
1221
1130
 
1131
+ /*
1132
+ * Parses an HL7 date in String form and creates a new Date object.
1133
+ *
1134
+ * TODO: CCDA dates can be in form:
1135
+ * <effectiveTime value="20130703094812"/>
1136
+ * ...or:
1137
+ * <effectiveTime>
1138
+ * <low value="19630617120000"/>
1139
+ * <high value="20110207100000"/>
1140
+ * </effectiveTime>
1141
+ * For the latter, parseDate will not be given type `String`
1142
+ * and will return `null`.
1143
+ */
1222
1144
  function parseDate(str) {
1223
1145
  if (!str || typeof str !== 'string') {
1224
1146
  return null;
1225
- } // Note: months start at 0 (so January is month 0)
1226
- // e.g., value="1999" translates to Jan 1, 1999
1147
+ }
1227
1148
 
1149
+ // Note: months start at 0 (so January is month 0)
1228
1150
 
1151
+ // e.g., value="1999" translates to Jan 1, 1999
1229
1152
  if (str.length === 4) {
1230
1153
  return new Date(str, 0, 1);
1231
1154
  }
1232
-
1233
- var year = str.substr(0, 4); // subtract 1 from the month since they're zero-indexed
1234
-
1235
- var month = parseInt(str.substr(4, 2), 10) - 1; // days are not zero-indexed. If we end up with the day 0 or '',
1155
+ var year = str.substr(0, 4);
1156
+ // subtract 1 from the month since they're zero-indexed
1157
+ var month = parseInt(str.substr(4, 2), 10) - 1;
1158
+ // days are not zero-indexed. If we end up with the day 0 or '',
1236
1159
  // that will be equivalent to the last day of the previous month
1160
+ var day = str.substr(6, 2) || 1;
1237
1161
 
1238
- var day = str.substr(6, 2) || 1; // check for time info (the presence of at least hours and mins after the date)
1239
-
1162
+ // check for time info (the presence of at least hours and mins after the date)
1240
1163
  if (str.length >= 12) {
1241
1164
  var hour = str.substr(8, 2);
1242
1165
  var min = str.substr(10, 2);
1243
- var secs = str.substr(12, 2); // check for timezone info (the presence of chars after the seconds place)
1166
+ var secs = str.substr(12, 2);
1244
1167
 
1168
+ // check for timezone info (the presence of chars after the seconds place)
1245
1169
  if (str.length > 14) {
1246
1170
  // _utcOffsetFromString will return 0 if there's no utc offset found.
1247
- var utcOffset = _utcOffsetFromString(str.substr(14)); // We subtract that offset from the local time to get back to UTC
1171
+ var utcOffset = _utcOffsetFromString(str.substr(14));
1172
+ // We subtract that offset from the local time to get back to UTC
1248
1173
  // (e.g., if we're -480 mins behind UTC, we add 480 mins to get back to UTC)
1249
-
1250
-
1251
1174
  min = _toInt(min) - utcOffset;
1252
1175
  }
1253
-
1254
- var date = new Date(Date.UTC(year, month, day, hour, min, secs)); // This flag lets us output datetime-precision in our JSON even if the time happens
1176
+ var date = new Date(Date.UTC(year, month, day, hour, min, secs));
1177
+ // This flag lets us output datetime-precision in our JSON even if the time happens
1255
1178
  // to translate to midnight local time. If we clone the date object, it is not
1256
1179
  // guaranteed to survive.
1257
-
1258
1180
  date._parsedWithTimeData = true;
1259
1181
  return date;
1260
1182
  }
1261
-
1262
1183
  return new Date(year, month, day);
1263
1184
  }
1185
+ ;
1264
1186
 
1265
- ; // These regexes and the two functions below are copied from moment.js
1187
+ // These regexes and the two functions below are copied from moment.js
1266
1188
  // http://momentjs.com/
1267
1189
  // https://github.com/moment/moment/blob/develop/LICENSE
1268
-
1269
1190
  var parseTimezoneChunker = /([\+\-]|\d\d)/gi;
1270
1191
  var parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
1271
-
1272
1192
  function _utcOffsetFromString(string) {
1273
1193
  string = string || '';
1274
-
1275
1194
  var possibleTzMatches = string.match(parseTokenTimezone) || [],
1276
- tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
1277
- parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
1278
- minutes = +(parts[1] * 60) + _toInt(parts[2]);
1279
-
1195
+ tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
1196
+ parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
1197
+ minutes = +(parts[1] * 60) + _toInt(parts[2]);
1280
1198
  return parts[0] === '+' ? minutes : -minutes;
1281
1199
  }
1282
-
1283
1200
  function _toInt(argumentForCoercion) {
1284
1201
  var coercedNumber = +argumentForCoercion,
1285
- value = 0;
1286
-
1202
+ value = 0;
1287
1203
  if (coercedNumber !== 0 && isFinite(coercedNumber)) {
1288
1204
  if (coercedNumber >= 0) {
1289
1205
  value = Math.floor(coercedNumber);
@@ -1291,27 +1207,22 @@ function _toInt(argumentForCoercion) {
1291
1207
  value = Math.ceil(coercedNumber);
1292
1208
  }
1293
1209
  }
1294
-
1295
1210
  return value;
1296
1211
  }
1297
- /*
1298
- * Parses an HL7 name (prefix / given [] / family)
1299
- */
1300
-
1301
1212
 
1213
+ /*
1214
+ * Parses an HL7 name (prefix / given [] / family)
1215
+ */
1302
1216
  function parseName(nameEl) {
1303
1217
  var prefix = nameEl.tag('prefix').val();
1304
1218
  var els = nameEl.elsByTag('given');
1305
1219
  var given = [];
1306
-
1307
1220
  for (var i = 0; i < els.length; i++) {
1308
1221
  var val = els[i].val();
1309
-
1310
1222
  if (val) {
1311
1223
  given.push(val);
1312
1224
  }
1313
1225
  }
1314
-
1315
1226
  var family = nameEl.tag('family').val();
1316
1227
  return {
1317
1228
  prefix: prefix,
@@ -1319,28 +1230,24 @@ function parseName(nameEl) {
1319
1230
  family: family
1320
1231
  };
1321
1232
  }
1322
-
1323
1233
  ;
1324
- /*
1325
- * Parses an HL7 address (streetAddressLine [], city, state, postalCode, country)
1326
- */
1327
1234
 
1235
+ /*
1236
+ * Parses an HL7 address (streetAddressLine [], city, state, postalCode, country)
1237
+ */
1328
1238
  function parseAddress(addrEl) {
1329
1239
  var els = addrEl.elsByTag('streetAddressLine');
1330
1240
  var street = [];
1331
-
1332
1241
  for (var i = 0; i < els.length; i++) {
1333
1242
  var val = els[i].val();
1334
-
1335
1243
  if (val) {
1336
1244
  street.push(val);
1337
1245
  }
1338
1246
  }
1339
-
1340
1247
  var city = addrEl.tag('city').val(),
1341
- state = addrEl.tag('state').val(),
1342
- zip = addrEl.tag('postalCode').val(),
1343
- country = addrEl.tag('country').val();
1248
+ state = addrEl.tag('state').val(),
1249
+ zip = addrEl.tag('postalCode').val(),
1250
+ country = addrEl.tag('country').val();
1344
1251
  return {
1345
1252
  street: street,
1346
1253
  city: city,
@@ -1349,624 +1256,539 @@ function parseAddress(addrEl) {
1349
1256
  country: country
1350
1257
  };
1351
1258
  }
1352
-
1353
1259
  ;
1354
1260
 
1355
- /***/ }),
1261
+ /***/ },
1356
1262
 
1357
- /***/ 766:
1358
- /***/ ((module) => {
1263
+ /***/ 631
1264
+ (module) {
1359
1265
 
1360
- /*
1361
- * ...
1266
+ /*
1267
+ * ...
1362
1268
  */
1269
+
1363
1270
  module.exports = function (getEntries) {
1364
1271
  var self = this;
1365
1272
  self.getEntries = getEntries;
1366
1273
  self.process = process;
1367
1274
  self.section = section;
1368
- /*
1369
- * Preprocesses the C32 document
1370
- */
1371
1275
 
1276
+ /*
1277
+ * Preprocesses the C32 document
1278
+ */
1372
1279
  function process(c32) {
1373
1280
  c32.section = section;
1374
1281
  return c32;
1375
1282
  }
1376
-
1377
1283
  ;
1378
- /*
1379
- * Finds the section of a C32 document
1380
- *
1381
- * Usually we check first for the HITSP section ID and then for the HL7-CCD ID.
1382
- */
1383
1284
 
1285
+ /*
1286
+ * Finds the section of a C32 document
1287
+ *
1288
+ * Usually we check first for the HITSP section ID and then for the HL7-CCD ID.
1289
+ */
1384
1290
  function section(name) {
1385
1291
  var el,
1386
- entries = self.getEntries();
1387
-
1292
+ entries = self.getEntries();
1388
1293
  switch (name) {
1389
1294
  case 'document':
1390
1295
  return this.template('2.16.840.1.113883.3.88.11.32.1');
1391
-
1392
1296
  case 'allergies':
1393
1297
  el = this.template('2.16.840.1.113883.3.88.11.83.102');
1394
-
1395
1298
  if (el.isEmpty()) {
1396
1299
  el = this.template('2.16.840.1.113883.10.20.1.2');
1397
1300
  }
1398
-
1399
1301
  el.entries = entries;
1400
1302
  return el;
1401
-
1402
1303
  case 'demographics':
1403
1304
  return this.template('2.16.840.1.113883.3.88.11.32.1');
1404
-
1405
1305
  case 'encounters':
1406
1306
  el = this.template('2.16.840.1.113883.3.88.11.83.127');
1407
-
1408
1307
  if (el.isEmpty()) {
1409
1308
  el = this.template('2.16.840.1.113883.10.20.1.3');
1410
1309
  }
1411
-
1412
1310
  el.entries = entries;
1413
1311
  return el;
1414
-
1415
1312
  case 'immunizations':
1416
1313
  el = this.template('2.16.840.1.113883.3.88.11.83.117');
1417
-
1418
1314
  if (el.isEmpty()) {
1419
1315
  el = this.template('2.16.840.1.113883.10.20.1.6');
1420
1316
  }
1421
-
1422
1317
  el.entries = entries;
1423
1318
  return el;
1424
-
1425
1319
  case 'results':
1426
1320
  el = this.template('2.16.840.1.113883.3.88.11.83.122');
1427
-
1428
1321
  if (el.isEmpty()) {
1429
1322
  el = this.template('2.16.840.1.113883.10.20.1.14');
1430
1323
  }
1431
-
1432
1324
  el.entries = entries;
1433
1325
  return el;
1434
-
1435
1326
  case 'medications':
1436
1327
  el = this.template('2.16.840.1.113883.3.88.11.83.112');
1437
-
1438
1328
  if (el.isEmpty()) {
1439
1329
  el = this.template('2.16.840.1.113883.10.20.1.8');
1440
1330
  }
1441
-
1442
1331
  el.entries = entries;
1443
1332
  return el;
1444
-
1445
1333
  case 'problems':
1446
1334
  el = this.template('2.16.840.1.113883.3.88.11.83.103');
1447
-
1448
1335
  if (el.isEmpty()) {
1449
1336
  el = this.template('2.16.840.1.113883.10.20.1.11');
1450
1337
  }
1451
-
1452
1338
  el.entries = entries;
1453
1339
  return el;
1454
-
1455
1340
  case 'procedures':
1456
1341
  el = this.template('2.16.840.1.113883.3.88.11.83.108');
1457
-
1458
1342
  if (el.isEmpty()) {
1459
1343
  el = this.template('2.16.840.1.113883.10.20.1.12');
1460
1344
  }
1461
-
1462
1345
  el.entries = entries;
1463
1346
  return el;
1464
-
1465
1347
  case 'vitals':
1466
1348
  el = this.template('2.16.840.1.113883.3.88.11.83.119');
1467
-
1468
1349
  if (el.isEmpty()) {
1469
1350
  el = this.template('2.16.840.1.113883.10.20.1.16');
1470
1351
  }
1471
-
1472
1352
  el.entries = entries;
1473
1353
  return el;
1474
1354
  }
1475
-
1476
1355
  return null;
1477
1356
  }
1478
-
1479
1357
  ;
1480
1358
  };
1481
1359
 
1482
- /***/ }),
1360
+ /***/ },
1483
1361
 
1484
- /***/ 626:
1485
- /***/ ((module) => {
1362
+ /***/ 589
1363
+ (module) {
1486
1364
 
1487
- /*
1488
- * ...
1365
+ /*
1366
+ * ...
1489
1367
  */
1368
+
1490
1369
  module.exports = function (getEntries) {
1491
1370
  var self = this;
1492
1371
  self.getEntries = getEntries;
1493
1372
  self.process = process;
1494
1373
  self.section = section;
1495
- /*
1496
- * Preprocesses the CCDAR2 document
1497
- */
1498
1374
 
1375
+ /*
1376
+ * Preprocesses the CCDAR2 document
1377
+ */
1499
1378
  function process(ccda) {
1500
1379
  ccda.section = section;
1501
1380
  return ccda;
1502
1381
  }
1503
-
1504
1382
  ;
1505
- /*
1506
- * Finds the section of a CCDA document
1507
- */
1508
1383
 
1384
+ /*
1385
+ * Finds the section of a CCDA document
1386
+ */
1509
1387
  function section(name) {
1510
1388
  var el,
1511
- entries = self.getEntries();
1512
-
1389
+ entries = self.getEntries();
1513
1390
  switch (name) {
1514
1391
  case 'document':
1515
1392
  return this.template('2.16.840.1.113883.10.20.22.1.2');
1516
-
1517
1393
  case 'demographics':
1518
1394
  return this.template('2.16.840.1.113883.10.20.22.1.2');
1519
-
1520
1395
  case 'health_concerns_document':
1521
1396
  el = this.template('2.16.840.1.113883.10.20.22.2.58');
1522
1397
  el.entries = entries;
1523
1398
  return el;
1524
-
1525
1399
  case 'goals':
1526
1400
  el = this.template('2.16.840.1.113883.10.20.22.2.60');
1527
1401
  el.entries = entries;
1528
1402
  return el;
1529
-
1530
1403
  case 'interventions':
1531
1404
  el = this.template('2.16.840.1.113883.10.20.21.2.3');
1532
1405
  el.entries = entries;
1533
1406
  return el;
1534
-
1535
1407
  case 'health_status_outcomes':
1536
1408
  el = this.template('2.16.840.1.113883.10.20.22.2.61');
1537
1409
  el.entries = entries;
1538
1410
  return el;
1539
1411
  }
1540
-
1541
1412
  return null;
1542
1413
  }
1543
-
1544
1414
  ;
1545
1415
  };
1546
1416
 
1547
- /***/ }),
1417
+ /***/ },
1548
1418
 
1549
- /***/ 539:
1550
- /***/ ((module) => {
1419
+ /***/ 946
1420
+ (module) {
1551
1421
 
1552
- /*
1553
- * ...
1422
+ /*
1423
+ * ...
1554
1424
  */
1425
+
1555
1426
  module.exports = function (getEntries) {
1556
1427
  var self = this;
1557
1428
  self.getEntries = getEntries;
1558
1429
  self.process = process;
1559
1430
  self.section = section;
1560
- /*
1561
- * Preprocesses the CCDA document
1562
- */
1563
1431
 
1432
+ /*
1433
+ * Preprocesses the CCDA document
1434
+ */
1564
1435
  function process(ccda) {
1565
1436
  ccda.section = section;
1566
1437
  return ccda;
1567
1438
  }
1568
-
1569
1439
  ;
1570
- /*
1571
- * Finds the section of a CCDA document
1572
- */
1573
1440
 
1441
+ /*
1442
+ * Finds the section of a CCDA document
1443
+ */
1574
1444
  function section(name) {
1575
1445
  var el,
1576
- entries = self.getEntries();
1577
-
1446
+ entries = self.getEntries();
1578
1447
  switch (name) {
1579
1448
  case 'document':
1580
1449
  return this.template('2.16.840.1.113883.10.20.22.1.1');
1581
-
1582
1450
  case 'allergies':
1583
1451
  el = this.template('2.16.840.1.113883.10.20.22.2.6.1');
1584
1452
  el.entries = entries;
1585
1453
  return el;
1586
-
1587
1454
  case 'care_plan':
1588
1455
  el = this.template('2.16.840.1.113883.10.20.22.2.10');
1589
1456
  el.entries = entries;
1590
1457
  return el;
1591
-
1592
1458
  case 'chief_complaint':
1593
1459
  el = this.template('2.16.840.1.113883.10.20.22.2.13');
1594
-
1595
1460
  if (el.isEmpty()) {
1596
1461
  el = this.template('1.3.6.1.4.1.19376.1.5.3.1.1.13.2.1');
1597
- } // no entries in Chief Complaint
1598
-
1599
-
1462
+ }
1463
+ // no entries in Chief Complaint
1600
1464
  return el;
1601
-
1602
1465
  case 'demographics':
1603
1466
  return this.template('2.16.840.1.113883.10.20.22.1.1');
1604
-
1605
1467
  case 'encounters':
1606
1468
  el = this.template('2.16.840.1.113883.10.20.22.2.22');
1607
-
1608
1469
  if (el.isEmpty()) {
1609
1470
  el = this.template('2.16.840.1.113883.10.20.22.2.22.1');
1610
1471
  }
1611
-
1612
1472
  el.entries = entries;
1613
1473
  return el;
1614
-
1615
1474
  case 'functional_statuses':
1616
1475
  el = this.template('2.16.840.1.113883.10.20.22.2.14');
1617
1476
  el.entries = entries;
1618
1477
  return el;
1619
-
1620
1478
  case 'immunizations':
1621
1479
  el = this.template('2.16.840.1.113883.10.20.22.2.2.1');
1622
-
1623
1480
  if (el.isEmpty()) {
1624
1481
  el = this.template('2.16.840.1.113883.10.20.22.2.2');
1625
1482
  }
1626
-
1627
1483
  el.entries = entries;
1628
1484
  return el;
1629
-
1630
1485
  case 'instructions':
1631
1486
  el = this.template('2.16.840.1.113883.10.20.22.2.45');
1632
1487
  el.entries = entries;
1633
1488
  return el;
1634
-
1635
1489
  case 'results':
1636
1490
  el = this.template('2.16.840.1.113883.10.20.22.2.3.1');
1637
-
1638
1491
  if (el.isEmpty()) {
1639
1492
  el = this.template('2.16.840.1.113883.10.20.22.2.3');
1640
1493
  }
1641
-
1642
1494
  el.entries = entries;
1643
1495
  return el;
1644
-
1645
1496
  case 'medications':
1646
1497
  el = this.template('2.16.840.1.113883.10.20.22.2.1.1');
1647
-
1648
1498
  if (el.isEmpty()) {
1649
1499
  el = this.template('2.16.840.1.113883.10.20.22.2.1');
1650
1500
  }
1651
-
1652
1501
  el.entries = entries;
1653
1502
  return el;
1654
-
1655
1503
  case 'problems':
1656
1504
  el = this.template('2.16.840.1.113883.10.20.22.2.5.1');
1657
-
1658
1505
  if (el.isEmpty()) {
1659
1506
  el = this.template('2.16.840.1.113883.10.20.22.2.5');
1660
1507
  }
1661
-
1662
1508
  el.entries = entries;
1663
1509
  return el;
1664
-
1665
1510
  case 'procedures':
1666
1511
  el = this.template('2.16.840.1.113883.10.20.22.2.7.1');
1667
-
1668
1512
  if (el.isEmpty()) {
1669
1513
  el = this.template('2.16.840.1.113883.10.20.22.2.7');
1670
1514
  }
1671
-
1672
1515
  el.entries = entries;
1673
1516
  return el;
1674
-
1675
1517
  case 'social_history':
1676
1518
  el = this.template('2.16.840.1.113883.10.20.22.2.17');
1677
1519
  el.entries = entries;
1678
1520
  return el;
1679
-
1680
1521
  case 'vitals':
1681
1522
  el = this.template('2.16.840.1.113883.10.20.22.2.4.1');
1682
-
1683
1523
  if (el.isEmpty()) {
1684
1524
  el = this.template('2.16.840.1.113883.10.20.22.2.4');
1685
1525
  }
1686
-
1687
1526
  el.entries = entries;
1688
1527
  return el;
1689
1528
  }
1690
-
1691
1529
  return null;
1692
1530
  }
1693
-
1694
1531
  ;
1695
1532
  };
1696
1533
 
1697
- /***/ }),
1534
+ /***/ },
1698
1535
 
1699
- /***/ 52:
1700
- /***/ ((module) => {
1536
+ /***/ 226
1537
+ (module) {
1701
1538
 
1702
- /*
1703
- * ...
1539
+ /*
1540
+ * ...
1704
1541
  */
1542
+
1705
1543
  module.exports = function (getEntries) {
1706
1544
  var self = this;
1707
1545
  self.getEntries = getEntries;
1708
1546
  self.process = process;
1709
1547
  self.section = section;
1710
- /*
1711
- * Preprocesses the CCDAR2 document
1712
- */
1713
1548
 
1549
+ /*
1550
+ * Preprocesses the CCDAR2 document
1551
+ */
1714
1552
  function process(ccda) {
1715
1553
  ccda.section = section;
1716
1554
  return ccda;
1717
1555
  }
1718
-
1719
1556
  ;
1720
- /*
1721
- * Finds the section of a CCDA document
1722
- */
1723
1557
 
1558
+ /*
1559
+ * Finds the section of a CCDA document
1560
+ */
1724
1561
  function section(name) {
1725
1562
  var el,
1726
- entries = self.getEntries();
1727
-
1563
+ entries = self.getEntries();
1728
1564
  switch (name) {
1729
1565
  case 'document':
1730
1566
  return this.template('2.16.840.1.113883.10.20.22.1.15');
1731
-
1732
1567
  case 'demographics':
1733
1568
  return this.template('2.16.840.1.113883.10.20.22.1.15');
1734
-
1735
1569
  case 'health_concerns_document':
1736
1570
  el = this.template('2.16.840.1.113883.10.20.22.2.58');
1737
1571
  el.entries = entries;
1738
1572
  return el;
1739
-
1740
1573
  case 'goals':
1741
1574
  el = this.template('2.16.840.1.113883.10.20.22.2.60');
1742
1575
  el.entries = entries;
1743
1576
  return el;
1744
-
1745
1577
  case 'interventions':
1746
1578
  el = this.template('2.16.840.1.113883.10.20.21.2.3');
1747
1579
  el.entries = entries;
1748
1580
  return el;
1749
-
1750
1581
  case 'health_status_outcomes':
1751
1582
  el = this.template('2.16.840.1.113883.10.20.22.2.61');
1752
1583
  el.entries = entries;
1753
1584
  return el;
1754
1585
  }
1755
-
1756
1586
  return null;
1757
1587
  }
1758
-
1759
1588
  ;
1760
1589
  };
1761
1590
 
1762
- /***/ }),
1591
+ /***/ },
1763
1592
 
1764
- /***/ 409:
1765
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1593
+ /***/ 238
1594
+ (module, __unused_webpack_exports, __webpack_require__) {
1766
1595
 
1767
- /*
1768
- * ...
1596
+ /*
1597
+ * ...
1769
1598
  */
1770
- var C32 = __webpack_require__(49);
1771
-
1772
- var CCDA = __webpack_require__(246);
1773
1599
 
1600
+ var C32 = __webpack_require__(237);
1601
+ var CCDA = __webpack_require__(608);
1774
1602
  var method = function method() {};
1775
- /* exported Generators */
1776
-
1777
1603
 
1604
+ /* exported Generators */
1778
1605
  module.exports = {
1779
1606
  method: method,
1780
1607
  C32: C32,
1781
1608
  CCDA: CCDA
1782
1609
  };
1783
- /* Import ejs if we're in Node. Then setup custom formatting filters
1610
+
1611
+ /* Import ejs if we're in Node. Then setup custom formatting filters
1784
1612
  */
1613
+ /*if (typeof exports !== 'undefined') {
1614
+ if (typeof module !== 'undefined' && module.exports) {
1615
+ ejs = require("ejs");
1616
+ }
1617
+ }
1618
+ if (typeof ejs !== 'undefined') {
1619
+ /* Filters are automatically available to ejs to be used like "... | hl7Date"
1620
+ * Helpers are functions that we'll manually pass in to ejs.
1621
+ * The intended distinction is that a helper gets called with regular function-call syntax
1622
+ */ /*
1623
+ var pad = function(number) {
1624
+ if (number < 10) {
1625
+ return '0' + number;
1626
+ }
1627
+ return String(number);
1628
+ };
1629
+ ejs.filters.hl7Date = function(obj) {
1630
+ try {
1631
+ if (obj === null || obj === undefined) { return 'nullFlavor="UNK"'; }
1632
+ var date = new Date(obj);
1633
+ if (isNaN(date.getTime())) { return obj; }
1634
+ var dateStr = null;
1635
+ if (date.getHours() || date.getMinutes() || date.getSeconds()) {
1636
+ // If there's a meaningful time, output a UTC datetime
1637
+ dateStr = date.getUTCFullYear() +
1638
+ pad( date.getUTCMonth() + 1 ) +
1639
+ pad( date.getUTCDate() );
1640
+ var timeStr = pad( date.getUTCHours() ) +
1641
+ pad( date.getUTCMinutes() ) +
1642
+ pad ( date.getUTCSeconds() ) +
1643
+ "+0000";
1644
+ return 'value="' + dateStr + timeStr + '"';
1645
+
1646
+ } else {
1647
+ // If there's no time, don't apply timezone tranformations: just output a date
1648
+ dateStr = String(date.getFullYear()) +
1649
+ pad( date.getMonth() + 1 ) +
1650
+ pad( date.getDate() );
1651
+ return 'value="' + dateStr + '"';
1652
+ }
1653
+ } catch (e) {
1654
+ return obj;
1655
+ }
1656
+ };
1657
+ var escapeSpecialChars = function(s) {
1658
+ return s.replace(/</g, '&lt;')
1659
+ .replace(/>/g, '&gt;')
1660
+ .replace(/&/g, '&amp;')
1661
+ .replace(/"/g, '&quot;')
1662
+ .replace(/'/g, '&apos;');
1663
+ };
1664
+ ejs.filters.hl7Code = function(obj) {
1665
+ if (!obj) { return ''; }
1666
+ var tag = '';
1667
+ var name = obj.name || '';
1668
+ if (obj.name) { tag += 'displayName="'+escapeSpecialChars(name)+'"'; }
1669
+ if (obj.code) {
1670
+ tag += ' code="'+obj.code+'"';
1671
+ if (obj.code_system) { tag += ' codeSystem="'+escapeSpecialChars(obj.code_system)+'"'; }
1672
+ if (obj.code_system_name) { tag += ' codeSystemName="' +
1673
+ escapeSpecialChars(obj.code_system_name)+'"'; }
1674
+ } else {
1675
+ tag += ' nullFlavor="UNK"';
1676
+ }
1677
+ if (!obj.name && ! obj.code) {
1678
+ return 'nullFlavor="UNK"';
1679
+ }
1680
+ return tag;
1681
+ };
1682
+ ejs.filters.emptyStringIfFalsy = function(obj) {
1683
+ if (!obj) { return ''; }
1684
+ return obj;
1685
+ };
1686
+ if (!ejs.helpers) ejs.helpers = {};
1687
+ ejs.helpers.simpleTag = function(tagName, value) {
1688
+ if (value) {
1689
+ return "<"+tagName+">"+value+"</"+tagName+">";
1690
+ } else {
1691
+ return "<"+tagName+" nullFlavor=\"UNK\" />";
1692
+ }
1693
+ };
1694
+ ejs.helpers.addressTags = function(addressDict) {
1695
+ if (!addressDict) {
1696
+ return '<streetAddressLine nullFlavor="NI" />\n' +
1697
+ '<city nullFlavor="NI" />\n' +
1698
+ '<state nullFlavor="NI" />\n' +
1699
+ '<postalCode nullFlavor="NI" />\n' +
1700
+ '<country nullFlavor="NI" />\n';
1701
+ }
1702
+ var tags = '';
1703
+ if (!addressDict.street.length) {
1704
+ tags += ejs.helpers.simpleTag('streetAddressLine', null) + '\n';
1705
+ } else {
1706
+ for (var i=0; i<addressDict.street.length; i++) {
1707
+ tags += ejs.helpers.simpleTag('streetAddressLine', addressDict.street[i]) + '\n';
1708
+ }
1709
+ }
1710
+ tags += ejs.helpers.simpleTag('city', addressDict.city) + '\n';
1711
+ tags += ejs.helpers.simpleTag('state', addressDict.state) + '\n';
1712
+ tags += ejs.helpers.simpleTag('postalCode', addressDict.zip) + '\n';
1713
+ tags += ejs.helpers.simpleTag('country', addressDict.country) + '\n';
1714
+ return tags;
1715
+ };
1716
+ ejs.helpers.nameTags = function(nameDict) {
1717
+ if (!nameDict) {
1718
+ return '<given nullFlavor="NI" />\n' +
1719
+ '<family nullFlavor="NI" />\n';
1720
+ }
1721
+ var tags = '';
1722
+ if (nameDict.prefix) {
1723
+ tags += ejs.helpers.simpleTag('prefix', nameDict.prefix) + '\n';
1724
+ }
1725
+ if (!nameDict.given.length) {
1726
+ tags += ejs.helpers.simpleTag('given', null) + '\n';
1727
+ } else {
1728
+ for (var i=0; i<nameDict.given.length; i++) {
1729
+ tags += ejs.helpers.simpleTag('given', nameDict.given[i]) + '\n';
1730
+ }
1731
+ }
1732
+ tags += ejs.helpers.simpleTag('family', nameDict.family) + '\n';
1733
+ if (nameDict.suffix) {
1734
+ tags += ejs.helpers.simpleTag('suffix', nameDict.suffix) + '\n';
1735
+ }
1736
+ return tags;
1737
+ };
1738
+ }*/
1785
1739
 
1786
- /*if (typeof exports !== 'undefined') {
1787
- if (typeof module !== 'undefined' && module.exports) {
1788
- ejs = require("ejs");
1789
- }
1790
- }
1791
- if (typeof ejs !== 'undefined') {
1792
- /* Filters are automatically available to ejs to be used like "... | hl7Date"
1793
- * Helpers are functions that we'll manually pass in to ejs.
1794
- * The intended distinction is that a helper gets called with regular function-call syntax
1795
- */
1740
+ /***/ },
1741
+
1742
+ /***/ 237
1743
+ (module) {
1796
1744
 
1797
- /*
1798
- var pad = function(number) {
1799
- if (number < 10) {
1800
- return '0' + number;
1801
- }
1802
- return String(number);
1803
- };
1804
- ejs.filters.hl7Date = function(obj) {
1805
- try {
1806
- if (obj === null || obj === undefined) { return 'nullFlavor="UNK"'; }
1807
- var date = new Date(obj);
1808
- if (isNaN(date.getTime())) { return obj; }
1809
- var dateStr = null;
1810
- if (date.getHours() || date.getMinutes() || date.getSeconds()) {
1811
- // If there's a meaningful time, output a UTC datetime
1812
- dateStr = date.getUTCFullYear() +
1813
- pad( date.getUTCMonth() + 1 ) +
1814
- pad( date.getUTCDate() );
1815
- var timeStr = pad( date.getUTCHours() ) +
1816
- pad( date.getUTCMinutes() ) +
1817
- pad ( date.getUTCSeconds() ) +
1818
- "+0000";
1819
- return 'value="' + dateStr + timeStr + '"';
1820
-
1821
- } else {
1822
- // If there's no time, don't apply timezone tranformations: just output a date
1823
- dateStr = String(date.getFullYear()) +
1824
- pad( date.getMonth() + 1 ) +
1825
- pad( date.getDate() );
1826
- return 'value="' + dateStr + '"';
1827
- }
1828
- } catch (e) {
1829
- return obj;
1830
- }
1831
- };
1832
- var escapeSpecialChars = function(s) {
1833
- return s.replace(/</g, '&lt;')
1834
- .replace(/>/g, '&gt;')
1835
- .replace(/&/g, '&amp;')
1836
- .replace(/"/g, '&quot;')
1837
- .replace(/'/g, '&apos;');
1838
- };
1839
- ejs.filters.hl7Code = function(obj) {
1840
- if (!obj) { return ''; }
1841
- var tag = '';
1842
- var name = obj.name || '';
1843
- if (obj.name) { tag += 'displayName="'+escapeSpecialChars(name)+'"'; }
1844
- if (obj.code) {
1845
- tag += ' code="'+obj.code+'"';
1846
- if (obj.code_system) { tag += ' codeSystem="'+escapeSpecialChars(obj.code_system)+'"'; }
1847
- if (obj.code_system_name) { tag += ' codeSystemName="' +
1848
- escapeSpecialChars(obj.code_system_name)+'"'; }
1849
- } else {
1850
- tag += ' nullFlavor="UNK"';
1851
- }
1852
- if (!obj.name && ! obj.code) {
1853
- return 'nullFlavor="UNK"';
1854
- }
1855
- return tag;
1856
- };
1857
- ejs.filters.emptyStringIfFalsy = function(obj) {
1858
- if (!obj) { return ''; }
1859
- return obj;
1860
- };
1861
- if (!ejs.helpers) ejs.helpers = {};
1862
- ejs.helpers.simpleTag = function(tagName, value) {
1863
- if (value) {
1864
- return "<"+tagName+">"+value+"</"+tagName+">";
1865
- } else {
1866
- return "<"+tagName+" nullFlavor=\"UNK\" />";
1867
- }
1868
- };
1869
- ejs.helpers.addressTags = function(addressDict) {
1870
- if (!addressDict) {
1871
- return '<streetAddressLine nullFlavor="NI" />\n' +
1872
- '<city nullFlavor="NI" />\n' +
1873
- '<state nullFlavor="NI" />\n' +
1874
- '<postalCode nullFlavor="NI" />\n' +
1875
- '<country nullFlavor="NI" />\n';
1876
- }
1877
- var tags = '';
1878
- if (!addressDict.street.length) {
1879
- tags += ejs.helpers.simpleTag('streetAddressLine', null) + '\n';
1880
- } else {
1881
- for (var i=0; i<addressDict.street.length; i++) {
1882
- tags += ejs.helpers.simpleTag('streetAddressLine', addressDict.street[i]) + '\n';
1883
- }
1884
- }
1885
- tags += ejs.helpers.simpleTag('city', addressDict.city) + '\n';
1886
- tags += ejs.helpers.simpleTag('state', addressDict.state) + '\n';
1887
- tags += ejs.helpers.simpleTag('postalCode', addressDict.zip) + '\n';
1888
- tags += ejs.helpers.simpleTag('country', addressDict.country) + '\n';
1889
- return tags;
1890
- };
1891
- ejs.helpers.nameTags = function(nameDict) {
1892
- if (!nameDict) {
1893
- return '<given nullFlavor="NI" />\n' +
1894
- '<family nullFlavor="NI" />\n';
1895
- }
1896
- var tags = '';
1897
- if (nameDict.prefix) {
1898
- tags += ejs.helpers.simpleTag('prefix', nameDict.prefix) + '\n';
1899
- }
1900
- if (!nameDict.given.length) {
1901
- tags += ejs.helpers.simpleTag('given', null) + '\n';
1902
- } else {
1903
- for (var i=0; i<nameDict.given.length; i++) {
1904
- tags += ejs.helpers.simpleTag('given', nameDict.given[i]) + '\n';
1905
- }
1906
- }
1907
- tags += ejs.helpers.simpleTag('family', nameDict.family) + '\n';
1908
- if (nameDict.suffix) {
1909
- tags += ejs.helpers.simpleTag('suffix', nameDict.suffix) + '\n';
1910
- }
1911
- return tags;
1912
- };
1913
- }*/
1914
-
1915
- /***/ }),
1916
-
1917
- /***/ 49:
1918
- /***/ ((module) => {
1919
-
1920
- /*
1921
- * ...
1745
+ /*
1746
+ * ...
1922
1747
  */
1748
+
1923
1749
  module.exports = {
1924
1750
  run: run
1925
1751
  };
1926
- /*
1927
- * Generates a C32 document
1928
- */
1929
1752
 
1753
+ /*
1754
+ * Generates a C32 document
1755
+ */
1930
1756
  function run(json, template, testingMode) {
1931
- /* jshint unused: false */
1932
- // only until this stub is actually implemented
1757
+ /* jshint unused: false */ // only until this stub is actually implemented
1933
1758
  console.log("C32 generation is not implemented yet");
1934
1759
  return null;
1935
1760
  }
1936
-
1937
1761
  ;
1938
1762
 
1939
- /***/ }),
1763
+ /***/ },
1940
1764
 
1941
- /***/ 246:
1942
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1765
+ /***/ 608
1766
+ (module, __unused_webpack_exports, __webpack_require__) {
1943
1767
 
1944
- /*
1945
- * ...
1768
+ /*
1769
+ * ...
1946
1770
  */
1947
- var _ = __webpack_require__(517);
1948
-
1771
+ var _ = __webpack_require__(825);
1949
1772
  module.exports = {
1950
1773
  run: run
1951
1774
  };
1952
- /*
1953
- * Generates a CCDA document
1954
- * A lot of the EJS setup happens in generators.js
1955
- *
1956
- * If `testingMode` is true, we'll set the "now" variable to a specific,
1957
- * fixed time, so that the expected XML doesn't change across runs
1958
- */
1959
1775
 
1776
+ /*
1777
+ * Generates a CCDA document
1778
+ * A lot of the EJS setup happens in generators.js
1779
+ *
1780
+ * If `testingMode` is true, we'll set the "now" variable to a specific,
1781
+ * fixed time, so that the expected XML doesn't change across runs
1782
+ */
1960
1783
  function run(json, template, testingMode) {
1961
1784
  if (!template) {
1962
1785
  console.log("Please provide a template EJS file for the Generator to use. " + "Load it via fs.readFileSync in Node or XHR in the browser.");
1963
1786
  return null;
1964
- } // `now` is actually now, unless we're running this for a test,
1965
- // in which case it's always Jan 1, 2000 at 12PM UTC
1966
-
1787
+ }
1967
1788
 
1789
+ // `now` is actually now, unless we're running this for a test,
1790
+ // in which case it's always Jan 1, 2000 at 12PM UTC
1968
1791
  var now = testingMode ? new Date('2000-01-01T12:00:00Z') : new Date();
1969
-
1970
1792
  var ccda = _.template(template, {
1971
1793
  filename: 'ccda.xml',
1972
1794
  bb: json,
@@ -1974,32 +1796,25 @@ function run(json, template, testingMode) {
1974
1796
  tagHelpers: ejs.helpers,
1975
1797
  codes: Core.Codes
1976
1798
  });
1977
-
1978
1799
  return ccda;
1979
1800
  }
1980
-
1981
1801
  ;
1982
1802
 
1983
- /***/ }),
1803
+ /***/ },
1984
1804
 
1985
- /***/ 46:
1986
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1805
+ /***/ 298
1806
+ (module, __unused_webpack_exports, __webpack_require__) {
1987
1807
 
1988
- /*
1989
- * ...
1808
+ /*
1809
+ * ...
1990
1810
  */
1991
- var C32 = __webpack_require__(583);
1992
-
1993
- var CCD = __webpack_require__(939);
1994
-
1995
- var CCDA = __webpack_require__(193);
1996
-
1997
- var CCDAR2 = __webpack_require__(767);
1998
-
1811
+ var C32 = __webpack_require__(513);
1812
+ var CCD = __webpack_require__(43);
1813
+ var CCDA = __webpack_require__(188);
1814
+ var CCDAR2 = __webpack_require__(236);
1999
1815
  var method = function method() {};
2000
- /* exported Parsers */
2001
-
2002
1816
 
1817
+ /* exported Parsers */
2003
1818
  module.exports = function (doc) {
2004
1819
  var self = this;
2005
1820
  self.doc = doc;
@@ -2010,38 +1825,27 @@ module.exports = function (doc) {
2010
1825
  self.CCDAR2 = new CCDAR2(self.doc);
2011
1826
  };
2012
1827
 
2013
- /***/ }),
1828
+ /***/ },
2014
1829
 
2015
- /***/ 583:
2016
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1830
+ /***/ 513
1831
+ (module, __unused_webpack_exports, __webpack_require__) {
2017
1832
 
2018
- /*
2019
- * Parser for the C32 document
1833
+ /*
1834
+ * Parser for the C32 document
2020
1835
  */
2021
- var Core = __webpack_require__(1);
2022
-
2023
- var AllergiesParser = __webpack_require__(946);
2024
-
2025
- var DemographicsParser = __webpack_require__(932);
2026
-
2027
- var DocumentParser = __webpack_require__(370);
2028
-
2029
- var EncountersParser = __webpack_require__(443);
2030
-
2031
- var ImmunizationsParser = __webpack_require__(554);
2032
-
2033
- var MedicationsParser = __webpack_require__(659);
2034
-
2035
- var ProblemsParser = __webpack_require__(119);
2036
-
2037
- var ProceduresParser = __webpack_require__(383);
2038
-
2039
- var ResultsParser = __webpack_require__(549);
2040
-
2041
- var VitalsParser = __webpack_require__(396);
2042
-
2043
- var ParseGenericInfo = __webpack_require__(711);
2044
1836
 
1837
+ var Core = __webpack_require__(211);
1838
+ var AllergiesParser = __webpack_require__(398);
1839
+ var DemographicsParser = __webpack_require__(774);
1840
+ var DocumentParser = __webpack_require__(129);
1841
+ var EncountersParser = __webpack_require__(978);
1842
+ var ImmunizationsParser = __webpack_require__(997);
1843
+ var MedicationsParser = __webpack_require__(838);
1844
+ var ProblemsParser = __webpack_require__(72);
1845
+ var ProceduresParser = __webpack_require__(354);
1846
+ var ResultsParser = __webpack_require__(624);
1847
+ var VitalsParser = __webpack_require__(619);
1848
+ var ParseGenericInfo = __webpack_require__(120);
2045
1849
  module.exports = function (doc) {
2046
1850
  var self = this;
2047
1851
  self.doc = doc;
@@ -2055,7 +1859,6 @@ module.exports = function (doc) {
2055
1859
  self.proceduresParser = new ProceduresParser(self.doc);
2056
1860
  self.resultsParser = new ResultsParser(self.doc);
2057
1861
  self.vitalsParser = new VitalsParser(self.doc);
2058
-
2059
1862
  self.run = function (c32) {
2060
1863
  var data = {};
2061
1864
  data.document = self.demographicsParser.parse(c32);
@@ -2081,9 +1884,10 @@ module.exports = function (doc) {
2081
1884
  data.medications.json = Core.json;
2082
1885
  data.problems.json = Core.json;
2083
1886
  data.procedures.json = Core.json;
2084
- data.vitals.json = Core.json; // Sections that are in CCDA but not C32... we want to keep the API
2085
- // consistent, even if the entries are always null
1887
+ data.vitals.json = Core.json;
2086
1888
 
1889
+ // Sections that are in CCDA but not C32... we want to keep the API
1890
+ // consistent, even if the entries are always null
2087
1891
  data.smoking_status = {
2088
1892
  date: null,
2089
1893
  name: null,
@@ -2101,35 +1905,35 @@ module.exports = function (doc) {
2101
1905
  data.instructions = [];
2102
1906
  data.instructions.json = Core.json;
2103
1907
  data.functional_statuses = [];
2104
- data.functional_statuses.json = Core.json; // Decorate each section with Title, templateId and text and adds missing sections
1908
+ data.functional_statuses.json = Core.json;
2105
1909
 
1910
+ // Decorate each section with Title, templateId and text and adds missing sections
2106
1911
  ParseGenericInfo(c32, data);
2107
1912
  return data;
2108
1913
  };
2109
1914
  };
2110
1915
 
2111
- /***/ }),
1916
+ /***/ },
2112
1917
 
2113
- /***/ 946:
2114
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1918
+ /***/ 398
1919
+ (module, __unused_webpack_exports, __webpack_require__) {
2115
1920
 
2116
- /*
2117
- * Parser for the C32 allergies section
1921
+ /*
1922
+ * Parser for the C32 allergies section
2118
1923
  */
2119
- var Core = __webpack_require__(1);
2120
1924
 
1925
+ var Core = __webpack_require__(211);
2121
1926
  module.exports = function (doc) {
2122
1927
  var self = this;
2123
1928
  self.doc = doc;
2124
1929
  self.parse = parse;
2125
-
2126
1930
  function parse(c32) {
2127
1931
  var parseDate = self.doc.parseDate;
2128
1932
  var parseName = self.doc.parseName;
2129
1933
  var parseAddress = self.doc.parseAddress;
2130
1934
  var allergies = c32.section('allergies');
2131
1935
  var data = {},
2132
- el;
1936
+ el;
2133
1937
  data.entries = [];
2134
1938
  data.displayName = "Allergies";
2135
1939
  data.templateId = allergies.tag('templateId').attr('root');
@@ -2137,59 +1941,60 @@ module.exports = function (doc) {
2137
1941
  allergies.entries().each(function (entry) {
2138
1942
  el = entry.tag('effectiveTime');
2139
1943
  var start_date = parseDate(el.tag('low').attr('value')),
2140
- end_date = parseDate(el.tag('high').attr('value'));
1944
+ end_date = parseDate(el.tag('high').attr('value'));
2141
1945
  el = entry.template('2.16.840.1.113883.3.88.11.83.6').tag('code');
2142
1946
  var name = el.attr('displayName'),
2143
- code = el.attr('code'),
2144
- code_system = el.attr('codeSystem'),
2145
- code_system_name = el.attr('codeSystemName'); // value => reaction_type
1947
+ code = el.attr('code'),
1948
+ code_system = el.attr('codeSystem'),
1949
+ code_system_name = el.attr('codeSystemName');
2146
1950
 
1951
+ // value => reaction_type
2147
1952
  el = entry.template('2.16.840.1.113883.3.88.11.83.6').tag('value');
2148
1953
  var reaction_type_name = el.attr('displayName'),
2149
- reaction_type_code = el.attr('code'),
2150
- reaction_type_code_system = el.attr('codeSystem'),
2151
- reaction_type_code_system_name = el.attr('codeSystemName'); // reaction
1954
+ reaction_type_code = el.attr('code'),
1955
+ reaction_type_code_system = el.attr('codeSystem'),
1956
+ reaction_type_code_system_name = el.attr('codeSystemName');
2152
1957
 
1958
+ // reaction
2153
1959
  el = entry.template('2.16.840.1.113883.10.20.1.54').tag('value');
2154
1960
  var reaction_name = el.attr('displayName'),
2155
- reaction_code = el.attr('code'),
2156
- reaction_code_system = el.attr('codeSystem'); // an irregularity seen in some c32s
1961
+ reaction_code = el.attr('code'),
1962
+ reaction_code_system = el.attr('codeSystem');
2157
1963
 
1964
+ // an irregularity seen in some c32s
2158
1965
  if (!reaction_name) {
2159
1966
  el = entry.template('2.16.840.1.113883.10.20.1.54').tag('text');
2160
-
2161
1967
  if (!el.isEmpty()) {
2162
1968
  reaction_name = Core.stripWhitespace(el.val());
2163
1969
  }
2164
- } // severity
2165
-
1970
+ }
2166
1971
 
1972
+ // severity
2167
1973
  el = entry.template('2.16.840.1.113883.10.20.1.55').tag('value');
2168
- var severity = el.attr('displayName'); // participant => allergen
1974
+ var severity = el.attr('displayName');
2169
1975
 
1976
+ // participant => allergen
2170
1977
  el = entry.tag('participant').tag('code');
2171
1978
  var allergen_name = el.attr('displayName'),
2172
- allergen_code = el.attr('code'),
2173
- allergen_code_system = el.attr('codeSystem'),
2174
- allergen_code_system_name = el.attr('codeSystemName'); // another irregularity seen in some c32s
1979
+ allergen_code = el.attr('code'),
1980
+ allergen_code_system = el.attr('codeSystem'),
1981
+ allergen_code_system_name = el.attr('codeSystemName');
2175
1982
 
1983
+ // another irregularity seen in some c32s
2176
1984
  if (!allergen_name) {
2177
1985
  el = entry.tag('participant').tag('name');
2178
-
2179
1986
  if (!el.isEmpty()) {
2180
1987
  allergen_name = el.val();
2181
1988
  }
2182
1989
  }
2183
-
2184
1990
  if (!allergen_name) {
2185
1991
  el = entry.template('2.16.840.1.113883.3.88.11.83.6').tag('originalText');
2186
-
2187
1992
  if (!el.isEmpty()) {
2188
1993
  allergen_name = Core.stripWhitespace(el.val());
2189
1994
  }
2190
- } // status
2191
-
1995
+ }
2192
1996
 
1997
+ // status
2193
1998
  el = entry.template('2.16.840.1.113883.10.20.1.39').tag('value');
2194
1999
  var status = el.attr('displayName');
2195
2000
  data.entries.push({
@@ -2226,60 +2031,59 @@ module.exports = function (doc) {
2226
2031
  }
2227
2032
  };
2228
2033
 
2229
- /***/ }),
2034
+ /***/ },
2230
2035
 
2231
- /***/ 932:
2232
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2036
+ /***/ 774
2037
+ (module, __unused_webpack_exports, __webpack_require__) {
2233
2038
 
2234
- /*
2235
- * Parser for the C32 demographics section
2039
+ /*
2040
+ * Parser for the C32 demographics section
2236
2041
  */
2237
- var Core = __webpack_require__(1);
2238
2042
 
2043
+ var Core = __webpack_require__(211);
2239
2044
  module.exports = function (doc) {
2240
2045
  var self = this;
2241
2046
  self.doc = doc;
2242
2047
  self.parse = parse;
2243
-
2244
2048
  function parse(c32) {
2245
2049
  var parseDate = self.doc.parseDate;
2246
2050
  var parseName = self.doc.parseName;
2247
2051
  var parseAddress = self.doc.parseAddress;
2248
2052
  var data = {},
2249
- el;
2053
+ el;
2250
2054
  var demographics = c32.section('demographics');
2251
2055
  var patient = demographics.tag('patientRole');
2252
2056
  el = patient.tag('patient').tag('name');
2253
2057
  var patient_name_dict = parseName(el);
2254
2058
  el = patient.tag('patient');
2255
2059
  var dob = parseDate(el.tag('birthTime').attr('value')),
2256
- gender = Core.Codes.gender(el.tag('administrativeGenderCode').attr('code')),
2257
- marital_status = Core.Codes.maritalStatus(el.tag('maritalStatusCode').attr('code'));
2060
+ gender = Core.Codes.gender(el.tag('administrativeGenderCode').attr('code')),
2061
+ marital_status = Core.Codes.maritalStatus(el.tag('maritalStatusCode').attr('code'));
2258
2062
  el = patient.tag('addr');
2259
2063
  var patient_address_dict = parseAddress(el);
2260
2064
  el = patient.tag('telecom');
2261
2065
  var home = el.attr('value'),
2262
- work = null,
2263
- mobile = null;
2066
+ work = null,
2067
+ mobile = null;
2264
2068
  var email = null;
2265
2069
  var language = patient.tag('languageCommunication').tag('languageCode').attr('code'),
2266
- race = patient.tag('raceCode').attr('displayName'),
2267
- ethnicity = patient.tag('ethnicGroupCode').attr('displayName'),
2268
- religion = patient.tag('religiousAffiliationCode').attr('displayName');
2070
+ race = patient.tag('raceCode').attr('displayName'),
2071
+ ethnicity = patient.tag('ethnicGroupCode').attr('displayName'),
2072
+ religion = patient.tag('religiousAffiliationCode').attr('displayName');
2269
2073
  el = patient.tag('birthplace');
2270
2074
  var birthplace_dict = parseAddress(el);
2271
2075
  el = patient.tag('guardian');
2272
2076
  var guardian_relationship = el.tag('code').attr('displayName'),
2273
- guardian_relationship_code = el.tag('code').attr('code'),
2274
- guardian_home = el.tag('telecom').attr('value');
2077
+ guardian_relationship_code = el.tag('code').attr('code'),
2078
+ guardian_home = el.tag('telecom').attr('value');
2275
2079
  el = el.tag('guardianPerson').tag('name');
2276
2080
  var guardian_name_dict = parseName(el);
2277
2081
  el = patient.tag('guardian').tag('addr');
2278
2082
  var guardian_address_dict = parseAddress(el);
2279
2083
  el = patient.tag('providerOrganization');
2280
2084
  var provider_organization = el.tag('name').val(),
2281
- provider_phone = el.tag('telecom').attr('value'),
2282
- provider_address_dict = parseAddress(el.tag('addr'));
2085
+ provider_phone = el.tag('telecom').attr('value'),
2086
+ provider_address_dict = parseAddress(el.tag('addr'));
2283
2087
  data = {
2284
2088
  name: patient_name_dict,
2285
2089
  dob: dob,
@@ -2321,33 +2125,32 @@ module.exports = function (doc) {
2321
2125
  };
2322
2126
  return data;
2323
2127
  }
2324
-
2325
2128
  ;
2326
2129
  };
2327
2130
 
2328
- /***/ }),
2131
+ /***/ },
2329
2132
 
2330
- /***/ 370:
2331
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2133
+ /***/ 129
2134
+ (module, __unused_webpack_exports, __webpack_require__) {
2332
2135
 
2333
- /*
2334
- * Parser for the C32 document section
2136
+ /*
2137
+ * Parser for the C32 document section
2335
2138
  */
2336
- var Core = __webpack_require__(1);
2337
2139
 
2140
+ var Core = __webpack_require__(211);
2338
2141
  module.exports = function (doc) {
2339
2142
  var self = this;
2340
2143
  self.doc = doc;
2341
2144
  self.parse = parse;
2342
-
2343
2145
  function parse(c32) {
2344
2146
  var parseDate = self.doc.parseDate;
2345
2147
  var parseName = self.doc.parseName;
2346
2148
  var parseAddress = self.doc.parseAddress;
2347
2149
  var data = {},
2348
- el;
2349
- var doc = c32.section('document'); // Parse Doc Type Info
2150
+ el;
2151
+ var doc = c32.section('document');
2350
2152
 
2153
+ // Parse Doc Type Info
2351
2154
  var templates = doc.elsByTag('templateId');
2352
2155
  var rootTemplate = templates[0].attr('root');
2353
2156
  var secondTemplate;
@@ -2365,7 +2168,6 @@ module.exports = function (doc) {
2365
2168
  rawText: "",
2366
2169
  reference: ""
2367
2170
  };
2368
-
2369
2171
  if (nonXmlNodes && nonXmlNodes.length > 0) {
2370
2172
  bodyType = "unstructured";
2371
2173
  var text = nonXml.tag('text');
@@ -2373,20 +2175,19 @@ module.exports = function (doc) {
2373
2175
  var representation = "";
2374
2176
  var rawText = "";
2375
2177
  var reference = "";
2376
- var type = ""; // We have an embedded doc
2178
+ var type = "";
2377
2179
 
2180
+ // We have an embedded doc
2378
2181
  if (text && text.attr('mediaType')) {
2379
2182
  mediaType = text.attr('mediaType');
2380
2183
  representation = text.attr('representation');
2381
2184
  rawText = text.val();
2382
2185
  type = "embedded";
2383
2186
  }
2384
-
2385
2187
  if (text && !mediaType) {
2386
2188
  reference = text.tag('reference').attr('value');
2387
2189
  type = "reference";
2388
2190
  }
2389
-
2390
2191
  nonXmlBody = {
2391
2192
  type: type,
2392
2193
  mediaType: mediaType,
@@ -2395,7 +2196,6 @@ module.exports = function (doc) {
2395
2196
  reference: reference
2396
2197
  };
2397
2198
  }
2398
-
2399
2199
  var docType = {
2400
2200
  type: "CCDAR2",
2401
2201
  rootTemplateId: rootTemplate,
@@ -2409,20 +2209,18 @@ module.exports = function (doc) {
2409
2209
  var title = Core.stripWhitespace(doc.tag('title').val());
2410
2210
  var author = doc.tag('author');
2411
2211
  el = author.tag('assignedPerson').tag('name');
2412
- var name_dict = parseName(el); // Sometimes C32s include names that are just like <name>String</name>
2212
+ var name_dict = parseName(el);
2213
+ // Sometimes C32s include names that are just like <name>String</name>
2413
2214
  // and we still want to get something out in that case
2414
-
2415
2215
  if (!name_dict.prefix && !name_dict.given.length && !name_dict.family) {
2416
2216
  name_dict.family = el.val();
2417
2217
  }
2418
-
2419
2218
  el = author.tag('addr');
2420
2219
  var address_dict = parseAddress(el);
2421
2220
  el = author.tag('telecom');
2422
2221
  var work_phone = el.attr('value');
2423
2222
  var documentation_of_list = [];
2424
2223
  var performers = doc.tag('documentationOf').elsByTag('performer');
2425
-
2426
2224
  for (var i = 0; i < performers.length; i++) {
2427
2225
  el = performers[i].tag('assignedPerson').tag('name');
2428
2226
  var performer_name_dict = parseName(el);
@@ -2436,17 +2234,14 @@ module.exports = function (doc) {
2436
2234
  address: performer_addr
2437
2235
  });
2438
2236
  }
2439
-
2440
2237
  el = doc.tag('encompassingEncounter');
2441
2238
  var location_name = Core.stripWhitespace(el.tag('name').val());
2442
2239
  var location_addr_dict = parseAddress(el.tag('addr'));
2443
2240
  var encounter_date = null;
2444
2241
  el = el.tag('effectiveTime');
2445
-
2446
2242
  if (!el.isEmpty()) {
2447
2243
  encounter_date = parseDate(el.attr('value'));
2448
2244
  }
2449
-
2450
2245
  data = {
2451
2246
  type: docType,
2452
2247
  date: date,
@@ -2467,68 +2262,68 @@ module.exports = function (doc) {
2467
2262
  };
2468
2263
  return data;
2469
2264
  }
2470
-
2471
2265
  ;
2472
2266
  };
2473
2267
 
2474
- /***/ }),
2268
+ /***/ },
2475
2269
 
2476
- /***/ 443:
2477
- /***/ ((module) => {
2270
+ /***/ 978
2271
+ (module) {
2478
2272
 
2479
- /*
2480
- * Parser for the C32 encounters section
2273
+ /*
2274
+ * Parser for the C32 encounters section
2481
2275
  */
2276
+
2482
2277
  module.exports = function (doc) {
2483
2278
  var self = this;
2484
2279
  self.doc = doc;
2485
2280
  self.parse = parse;
2486
-
2487
2281
  function parse(c32) {
2488
2282
  var parseDate = self.doc.parseDate;
2489
2283
  var parseName = self.doc.parseName;
2490
2284
  var parseAddress = self.doc.parseAddress;
2491
2285
  var encounters = c32.section('encounters');
2492
2286
  var data = {},
2493
- el;
2287
+ el;
2494
2288
  data.entries = [];
2495
2289
  data.displayName = "Encounters";
2496
2290
  data.templateId = encounters.tag('templateId').attr('root');
2497
2291
  data.text = encounters.tag('text').val(true);
2498
2292
  encounters.entries().each(function (entry) {
2499
2293
  var date = parseDate(entry.tag('effectiveTime').attr('value'));
2500
-
2501
2294
  if (!date) {
2502
2295
  date = parseDate(entry.tag('effectiveTime').tag('low').attr('value'));
2503
2296
  }
2504
-
2505
2297
  el = entry.tag('code');
2506
2298
  var name = el.attr('displayName'),
2507
- code = el.attr('code'),
2508
- code_system = el.attr('codeSystem'),
2509
- code_system_name = el.attr('codeSystemName'),
2510
- code_system_version = el.attr('codeSystemVersion'); // translation
2299
+ code = el.attr('code'),
2300
+ code_system = el.attr('codeSystem'),
2301
+ code_system_name = el.attr('codeSystemName'),
2302
+ code_system_version = el.attr('codeSystemVersion');
2511
2303
 
2304
+ // translation
2512
2305
  el = entry.tag('translation');
2513
2306
  var translation_name = el.attr('displayName'),
2514
- translation_code = el.attr('code'),
2515
- translation_code_system = el.attr('codeSystem'),
2516
- translation_code_system_name = el.attr('codeSystemName'); // performer
2307
+ translation_code = el.attr('code'),
2308
+ translation_code_system = el.attr('codeSystem'),
2309
+ translation_code_system_name = el.attr('codeSystemName');
2517
2310
 
2311
+ // performer
2518
2312
  el = entry.tag('performer');
2519
2313
  var performer_name = el.tag('name').val(),
2520
- performer_code = el.attr('code'),
2521
- performer_code_system = el.attr('codeSystem'),
2522
- performer_code_system_name = el.attr('codeSystemName'); // participant => location
2314
+ performer_code = el.attr('code'),
2315
+ performer_code_system = el.attr('codeSystem'),
2316
+ performer_code_system_name = el.attr('codeSystemName');
2523
2317
 
2318
+ // participant => location
2524
2319
  el = entry.tag('participant');
2525
2320
  var organization = el.tag('name').val(),
2526
- location_dict = parseAddress(el);
2527
- location_dict.organization = organization; // findings
2321
+ location_dict = parseAddress(el);
2322
+ location_dict.organization = organization;
2528
2323
 
2324
+ // findings
2529
2325
  var findings = [];
2530
2326
  var findingEls = entry.elsByTag('entryRelationship');
2531
-
2532
2327
  for (var i = 0; i < findingEls.length; i++) {
2533
2328
  el = findingEls[i].tag('value');
2534
2329
  findings.push({
@@ -2537,7 +2332,6 @@ module.exports = function (doc) {
2537
2332
  code_system: el.attr('codeSystem')
2538
2333
  });
2539
2334
  }
2540
-
2541
2335
  data.entries.push({
2542
2336
  date: date,
2543
2337
  name: name,
@@ -2563,33 +2357,30 @@ module.exports = function (doc) {
2563
2357
  });
2564
2358
  return data;
2565
2359
  }
2566
-
2567
2360
  ;
2568
2361
  };
2569
2362
 
2570
- /***/ }),
2363
+ /***/ },
2571
2364
 
2572
- /***/ 554:
2573
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2365
+ /***/ 997
2366
+ (module, __unused_webpack_exports, __webpack_require__) {
2574
2367
 
2575
- /*
2576
- * Parser for the C32 immunizations section
2368
+ /*
2369
+ * Parser for the C32 immunizations section
2577
2370
  */
2578
- var Core = __webpack_require__(1);
2579
-
2371
+ var Core = __webpack_require__(211);
2580
2372
  module.exports = function (doc) {
2581
2373
  var self = this;
2582
2374
  self.doc = doc;
2583
2375
  self.parse = parse;
2584
-
2585
2376
  function parse(c32) {
2586
2377
  var parseDate = self.doc.parseDate;
2587
2378
  var parseName = self.doc.parseName;
2588
2379
  var parseAddress = self.doc.parseAddress;
2589
2380
  var administeredData = {},
2590
- declinedData = {},
2591
- product,
2592
- el;
2381
+ declinedData = {},
2382
+ product,
2383
+ el;
2593
2384
  var immunizations = c32.section('immunizations');
2594
2385
  administeredData.entries = [];
2595
2386
  administeredData.displayName = "Immunizations";
@@ -2603,49 +2394,54 @@ module.exports = function (doc) {
2603
2394
  // date
2604
2395
  el = entry.tag('effectiveTime');
2605
2396
  var date = parseDate(el.attr('value'));
2606
-
2607
2397
  if (!date) {
2608
2398
  date = parseDate(el.tag('low').attr('value'));
2609
- } // if 'declined' is true, this is a record that this vaccine WASN'T administered
2610
-
2399
+ }
2611
2400
 
2401
+ // if 'declined' is true, this is a record that this vaccine WASN'T administered
2612
2402
  el = entry.tag('substanceAdministration');
2613
- var declined = el.boolAttr('negationInd'); // product
2403
+ var declined = el.boolAttr('negationInd');
2614
2404
 
2405
+ // product
2615
2406
  product = entry.template('2.16.840.1.113883.10.20.1.53');
2616
2407
  el = product.tag('code');
2617
2408
  var product_name = el.attr('displayName'),
2618
- product_code = el.attr('code'),
2619
- product_code_system = el.attr('codeSystem'),
2620
- product_code_system_name = el.attr('codeSystemName'); // translation
2409
+ product_code = el.attr('code'),
2410
+ product_code_system = el.attr('codeSystem'),
2411
+ product_code_system_name = el.attr('codeSystemName');
2621
2412
 
2413
+ // translation
2622
2414
  el = product.tag('translation');
2623
2415
  var translation_name = el.attr('displayName'),
2624
- translation_code = el.attr('code'),
2625
- translation_code_system = el.attr('codeSystem'),
2626
- translation_code_system_name = el.attr('codeSystemName'); // misc product details
2416
+ translation_code = el.attr('code'),
2417
+ translation_code_system = el.attr('codeSystem'),
2418
+ translation_code_system_name = el.attr('codeSystemName');
2627
2419
 
2420
+ // misc product details
2628
2421
  el = product.tag('lotNumberText');
2629
2422
  var lot_number = el.val();
2630
2423
  el = product.tag('manufacturerOrganization');
2631
- var manufacturer_name = el.tag('name').val(); // route
2424
+ var manufacturer_name = el.tag('name').val();
2632
2425
 
2426
+ // route
2633
2427
  el = entry.tag('routeCode');
2634
2428
  var route_name = el.attr('displayName'),
2635
- route_code = el.attr('code'),
2636
- route_code_system = el.attr('codeSystem'),
2637
- route_code_system_name = el.attr('codeSystemName'); // instructions
2429
+ route_code = el.attr('code'),
2430
+ route_code_system = el.attr('codeSystem'),
2431
+ route_code_system_name = el.attr('codeSystemName');
2638
2432
 
2433
+ // instructions
2639
2434
  el = entry.template('2.16.840.1.113883.10.20.1.49');
2640
2435
  var instructions_text = Core.stripWhitespace(el.tag('text').val());
2641
2436
  el = el.tag('code');
2642
2437
  var education_name = el.attr('displayName'),
2643
- education_code = el.attr('code'),
2644
- education_code_system = el.attr('codeSystem'); // dose
2438
+ education_code = el.attr('code'),
2439
+ education_code_system = el.attr('codeSystem');
2645
2440
 
2441
+ // dose
2646
2442
  el = entry.tag('doseQuantity');
2647
2443
  var dose_value = el.attr('value'),
2648
- dose_unit = el.attr('unit');
2444
+ dose_unit = el.attr('unit');
2649
2445
  var data = declined ? declinedData : administeredData;
2650
2446
  data.entries.push({
2651
2447
  date: date,
@@ -2686,31 +2482,28 @@ module.exports = function (doc) {
2686
2482
  declined: declinedData
2687
2483
  };
2688
2484
  }
2689
-
2690
2485
  ;
2691
2486
  };
2692
2487
 
2693
- /***/ }),
2694
-
2695
- /***/ 659:
2696
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2488
+ /***/ },
2697
2489
 
2698
- var Core = __webpack_require__(1);
2699
- /*
2700
- * Parser for the C32 medications section
2701
- */
2490
+ /***/ 838
2491
+ (module, __unused_webpack_exports, __webpack_require__) {
2702
2492
 
2493
+ var Core = __webpack_require__(211);
2703
2494
 
2495
+ /*
2496
+ * Parser for the C32 medications section
2497
+ */
2704
2498
  module.exports = function (doc) {
2705
2499
  var self = this;
2706
2500
  self.doc = doc;
2707
2501
  self.parse = parse;
2708
-
2709
2502
  function parse(c32) {
2710
2503
  var parseDate = self.doc.parseDate;
2711
2504
  var medications = c32.section('medications');
2712
2505
  var data = {},
2713
- el;
2506
+ el;
2714
2507
  data.entries = [];
2715
2508
  data.displayName = "Medications";
2716
2509
  data.templateId = medications.tag('templateId').attr('root');
@@ -2718,113 +2511,103 @@ module.exports = function (doc) {
2718
2511
  medications.entries().each(function (entry) {
2719
2512
  var text = null;
2720
2513
  el = entry.tag('substanceAdministration').immediateChildTag('text');
2721
-
2722
2514
  if (!el.isEmpty()) {
2723
2515
  // technically C32s don't use this, but C83s (another CCD) do,
2724
2516
  // and CCDAs do, so we may see it anyways
2725
2517
  text = Core.stripWhitespace(el.val());
2726
2518
  }
2727
-
2728
2519
  var effectiveTimes = entry.elsByTag('effectiveTime');
2729
2520
  el = effectiveTimes[0]; // the first effectiveTime is the med start date
2730
-
2731
2521
  var start_date = null,
2732
- end_date = null;
2733
-
2522
+ end_date = null;
2734
2523
  if (el) {
2735
2524
  start_date = parseDate(el.tag('low').attr('value'));
2736
2525
  end_date = parseDate(el.tag('high').attr('value'));
2737
- } // the second effectiveTime might the schedule period or it might just
2738
- // be a random effectiveTime from further in the entry... xsi:type should tell us
2739
-
2526
+ }
2740
2527
 
2528
+ // the second effectiveTime might the schedule period or it might just
2529
+ // be a random effectiveTime from further in the entry... xsi:type should tell us
2741
2530
  el = effectiveTimes[1];
2742
2531
  var schedule_type = null,
2743
- schedule_period_value = null,
2744
- schedule_period_unit = null;
2745
-
2532
+ schedule_period_value = null,
2533
+ schedule_period_unit = null;
2746
2534
  if (el && el.attr('xsi:type') === 'PIVL_TS') {
2747
2535
  var institutionSpecified = el.attr('institutionSpecified');
2748
-
2749
2536
  if (institutionSpecified === 'true') {
2750
2537
  schedule_type = 'frequency';
2751
2538
  } else if (institutionSpecified === 'false') {
2752
2539
  schedule_type = 'interval';
2753
2540
  }
2754
-
2755
2541
  el = el.tag('period');
2756
2542
  schedule_period_value = el.attr('value');
2757
2543
  schedule_period_unit = el.attr('unit');
2758
2544
  }
2759
-
2760
2545
  el = entry.tag('manufacturedProduct').tag('code');
2761
2546
  var product_name = el.attr('displayName'),
2762
- product_code = el.attr('code'),
2763
- product_code_system = el.attr('codeSystem');
2547
+ product_code = el.attr('code'),
2548
+ product_code_system = el.attr('codeSystem');
2764
2549
  var product_original_text = null;
2765
2550
  el = entry.tag('manufacturedProduct').tag('originalText');
2766
-
2767
2551
  if (!el.isEmpty()) {
2768
2552
  product_original_text = Core.stripWhitespace(el.val());
2769
- } // if we don't have a product name yet, try the originalText version
2770
-
2771
-
2553
+ }
2554
+ // if we don't have a product name yet, try the originalText version
2772
2555
  if (!product_name && product_original_text) {
2773
2556
  product_name = product_original_text;
2774
- } // irregularity in some c32s
2775
-
2557
+ }
2776
2558
 
2559
+ // irregularity in some c32s
2777
2560
  if (!product_name) {
2778
2561
  el = entry.tag('manufacturedProduct').tag('name');
2779
-
2780
2562
  if (!el.isEmpty()) {
2781
2563
  product_name = Core.stripWhitespace(el.val());
2782
2564
  }
2783
2565
  }
2784
-
2785
2566
  el = entry.tag('manufacturedProduct').tag('translation');
2786
2567
  var translation_name = el.attr('displayName'),
2787
- translation_code = el.attr('code'),
2788
- translation_code_system = el.attr('codeSystem'),
2789
- translation_code_system_name = el.attr('codeSystemName');
2568
+ translation_code = el.attr('code'),
2569
+ translation_code_system = el.attr('codeSystem'),
2570
+ translation_code_system_name = el.attr('codeSystemName');
2790
2571
  el = entry.tag('doseQuantity');
2791
2572
  var dose_value = el.attr('value'),
2792
- dose_unit = el.attr('unit');
2573
+ dose_unit = el.attr('unit');
2793
2574
  el = entry.tag('rateQuantity');
2794
2575
  var rate_quantity_value = el.attr('value'),
2795
- rate_quantity_unit = el.attr('unit');
2576
+ rate_quantity_unit = el.attr('unit');
2796
2577
  el = entry.tag('precondition').tag('value');
2797
2578
  var precondition_name = el.attr('displayName'),
2798
- precondition_code = el.attr('code'),
2799
- precondition_code_system = el.attr('codeSystem');
2579
+ precondition_code = el.attr('code'),
2580
+ precondition_code_system = el.attr('codeSystem');
2800
2581
  el = entry.template('2.16.840.1.113883.10.20.1.28').tag('value');
2801
2582
  var reason_name = el.attr('displayName'),
2802
- reason_code = el.attr('code'),
2803
- reason_code_system = el.attr('codeSystem');
2583
+ reason_code = el.attr('code'),
2584
+ reason_code_system = el.attr('codeSystem');
2804
2585
  el = entry.tag('routeCode');
2805
2586
  var route_name = el.attr('displayName'),
2806
- route_code = el.attr('code'),
2807
- route_code_system = el.attr('codeSystem'),
2808
- route_code_system_name = el.attr('codeSystemName'); // participant/playingEntity => vehicle
2587
+ route_code = el.attr('code'),
2588
+ route_code_system = el.attr('codeSystem'),
2589
+ route_code_system_name = el.attr('codeSystemName');
2809
2590
 
2591
+ // participant/playingEntity => vehicle
2810
2592
  el = entry.tag('participant').tag('playingEntity');
2811
2593
  var vehicle_name = el.tag('name').val();
2812
- el = el.tag('code'); // prefer the code vehicle_name but fall back to the non-coded one
2594
+ el = el.tag('code');
2595
+ // prefer the code vehicle_name but fall back to the non-coded one
2813
2596
  // (which for C32s is in fact the primary field for this info)
2814
-
2815
2597
  vehicle_name = el.attr('displayName') || vehicle_name;
2816
2598
  var vehicle_code = el.attr('code'),
2817
- vehicle_code_system = el.attr('codeSystem'),
2818
- vehicle_code_system_name = el.attr('codeSystemName');
2599
+ vehicle_code_system = el.attr('codeSystem'),
2600
+ vehicle_code_system_name = el.attr('codeSystemName');
2819
2601
  el = entry.tag('administrationUnitCode');
2820
2602
  var administration_name = el.attr('displayName'),
2821
- administration_code = el.attr('code'),
2822
- administration_code_system = el.attr('codeSystem'),
2823
- administration_code_system_name = el.attr('codeSystemName'); // performer => prescriber
2603
+ administration_code = el.attr('code'),
2604
+ administration_code_system = el.attr('codeSystem'),
2605
+ administration_code_system_name = el.attr('codeSystemName');
2824
2606
 
2607
+ // performer => prescriber
2825
2608
  el = entry.tag('performer');
2826
2609
  var prescriber_organization = el.tag('name').val(),
2827
- prescriber_person = null;
2610
+ prescriber_person = null;
2828
2611
  data.entries.push({
2829
2612
  date_range: {
2830
2613
  start: start_date,
@@ -2892,33 +2675,30 @@ module.exports = function (doc) {
2892
2675
  });
2893
2676
  return data;
2894
2677
  }
2895
-
2896
2678
  ;
2897
2679
  };
2898
2680
 
2899
- /***/ }),
2900
-
2901
- /***/ 119:
2902
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2681
+ /***/ },
2903
2682
 
2904
- var Core = __webpack_require__(1);
2905
- /*
2906
- * Parser for the C32 problems section
2907
- */
2683
+ /***/ 72
2684
+ (module, __unused_webpack_exports, __webpack_require__) {
2908
2685
 
2686
+ var Core = __webpack_require__(211);
2909
2687
 
2688
+ /*
2689
+ * Parser for the C32 problems section
2690
+ */
2910
2691
  module.exports = function (doc) {
2911
2692
  var self = this;
2912
2693
  self.doc = doc;
2913
2694
  self.parse = parse;
2914
-
2915
2695
  function parse(c32) {
2916
2696
  var parseDate = self.doc.parseDate;
2917
2697
  var parseName = self.doc.parseName;
2918
2698
  var parseAddress = self.doc.parseAddress;
2919
2699
  var problems = c32.section('problems');
2920
2700
  var data = {},
2921
- el;
2701
+ el;
2922
2702
  data.entries = [];
2923
2703
  data.displayName = "Problems";
2924
2704
  data.templateId = problems.tag('templateId').attr('root');
@@ -2926,36 +2706,33 @@ module.exports = function (doc) {
2926
2706
  problems.entries().each(function (entry) {
2927
2707
  el = entry.tag('effectiveTime');
2928
2708
  var start_date = parseDate(el.tag('low').attr('value')),
2929
- end_date = parseDate(el.tag('high').attr('value'));
2709
+ end_date = parseDate(el.tag('high').attr('value'));
2930
2710
  el = entry.template('2.16.840.1.113883.10.20.1.28').tag('value');
2931
2711
  var name = el.attr('displayName'),
2932
- code = el.attr('code'),
2933
- code_system = el.attr('codeSystem'),
2934
- code_system_name = el.attr('codeSystemName'); // Pre-C32 CCDs put the problem name in this "originalText" field, and some vendors
2935
- // continue doing this with their C32, even though it's not technically correct
2712
+ code = el.attr('code'),
2713
+ code_system = el.attr('codeSystem'),
2714
+ code_system_name = el.attr('codeSystemName');
2936
2715
 
2716
+ // Pre-C32 CCDs put the problem name in this "originalText" field, and some vendors
2717
+ // continue doing this with their C32, even though it's not technically correct
2937
2718
  if (!name) {
2938
2719
  el = entry.template('2.16.840.1.113883.10.20.1.28').tag('originalText');
2939
-
2940
2720
  if (!el.isEmpty()) {
2941
2721
  name = Core.stripWhitespace(el.val());
2942
2722
  }
2943
2723
  }
2944
-
2945
2724
  el = entry.template('2.16.840.1.113883.10.20.1.28').tag('translation');
2946
2725
  var translation_name = el.attr('displayName'),
2947
- translation_code = el.attr('code'),
2948
- translation_code_system = el.attr('codeSystem'),
2949
- translation_code_system_name = el.attr('codeSystemName');
2726
+ translation_code = el.attr('code'),
2727
+ translation_code_system = el.attr('codeSystem'),
2728
+ translation_code_system_name = el.attr('codeSystemName');
2950
2729
  el = entry.template('2.16.840.1.113883.10.20.1.50');
2951
2730
  var status = el.tag('value').attr('displayName');
2952
2731
  var age = null;
2953
2732
  el = entry.template('2.16.840.1.113883.10.20.1.38');
2954
-
2955
2733
  if (!el.isEmpty()) {
2956
2734
  age = parseFloat(el.tag('value').attr('value'));
2957
2735
  }
2958
-
2959
2736
  data.entries.push({
2960
2737
  date_range: {
2961
2738
  start: start_date,
@@ -2974,37 +2751,34 @@ module.exports = function (doc) {
2974
2751
  code_system_name: translation_code_system_name
2975
2752
  },
2976
2753
  comment: null // not part of C32
2977
-
2978
2754
  });
2979
2755
  });
2980
2756
  return data;
2981
2757
  }
2982
-
2983
2758
  ;
2984
2759
  };
2985
2760
 
2986
- /***/ }),
2761
+ /***/ },
2987
2762
 
2988
- /***/ 383:
2989
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2763
+ /***/ 354
2764
+ (module, __unused_webpack_exports, __webpack_require__) {
2990
2765
 
2991
- /*
2992
- * Parser for the C32 procedures section
2766
+ /*
2767
+ * Parser for the C32 procedures section
2993
2768
  */
2994
- var Core = __webpack_require__(1);
2995
2769
 
2770
+ var Core = __webpack_require__(211);
2996
2771
  module.exports = function (doc) {
2997
2772
  var self = this;
2998
2773
  self.doc = doc;
2999
2774
  self.parse = parse;
3000
-
3001
2775
  function parse(c32) {
3002
2776
  var parseDate = self.doc.parseDate;
3003
2777
  var parseName = self.doc.parseName;
3004
2778
  var parseAddress = self.doc.parseAddress;
3005
2779
  var procedures = c32.section('procedures');
3006
2780
  var data = {},
3007
- el;
2781
+ el;
3008
2782
  data.entries = [];
3009
2783
  data.displayName = "Procedures";
3010
2784
  data.templateId = procedures.tag('templateId').attr('root');
@@ -3014,29 +2788,29 @@ module.exports = function (doc) {
3014
2788
  var date = parseDate(el.attr('value'));
3015
2789
  el = entry.tag('code');
3016
2790
  var name = el.attr('displayName'),
3017
- code = el.attr('code'),
3018
- code_system = el.attr('codeSystem');
3019
-
2791
+ code = el.attr('code'),
2792
+ code_system = el.attr('codeSystem');
3020
2793
  if (!name) {
3021
2794
  name = Core.stripWhitespace(entry.tag('originalText').val());
3022
- } // 'specimen' tag not always present
3023
-
2795
+ }
3024
2796
 
2797
+ // 'specimen' tag not always present
3025
2798
  el = entry.tag('specimen').tag('code');
3026
2799
  var specimen_name = el.attr('displayName'),
3027
- specimen_code = el.attr('code'),
3028
- specimen_code_system = el.attr('codeSystem');
2800
+ specimen_code = el.attr('code'),
2801
+ specimen_code_system = el.attr('codeSystem');
3029
2802
  el = entry.tag('performer').tag('addr');
3030
2803
  var organization = el.tag('name').val(),
3031
- phone = el.tag('telecom').attr('value');
2804
+ phone = el.tag('telecom').attr('value');
3032
2805
  var performer_dict = parseAddress(el);
3033
2806
  performer_dict.organization = organization;
3034
- performer_dict.phone = phone; // participant => device
2807
+ performer_dict.phone = phone;
3035
2808
 
2809
+ // participant => device
3036
2810
  el = entry.tag('participant').tag('code');
3037
2811
  var device_name = el.attr('displayName'),
3038
- device_code = el.attr('code'),
3039
- device_code_system = el.attr('codeSystem');
2812
+ device_code = el.attr('code'),
2813
+ device_code_system = el.attr('codeSystem');
3040
2814
  data.entries.push({
3041
2815
  date: date,
3042
2816
  name: name,
@@ -3057,32 +2831,30 @@ module.exports = function (doc) {
3057
2831
  });
3058
2832
  return data;
3059
2833
  }
3060
-
3061
2834
  ;
3062
2835
  };
3063
2836
 
3064
- /***/ }),
2837
+ /***/ },
3065
2838
 
3066
- /***/ 549:
3067
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2839
+ /***/ 624
2840
+ (module, __unused_webpack_exports, __webpack_require__) {
3068
2841
 
3069
- /*
3070
- * Parser for the C32 results (labs) section
2842
+ /*
2843
+ * Parser for the C32 results (labs) section
3071
2844
  */
3072
- var Core = __webpack_require__(1);
3073
2845
 
2846
+ var Core = __webpack_require__(211);
3074
2847
  module.exports = function (doc) {
3075
2848
  var self = this;
3076
2849
  self.doc = doc;
3077
2850
  self.parse = parse;
3078
-
3079
2851
  function parse(c32) {
3080
2852
  var parseDate = self.doc.parseDate;
3081
2853
  var parseName = self.doc.parseName;
3082
2854
  var parseAddress = self.doc.parseAddress;
3083
2855
  var results = c32.section('results');
3084
2856
  var data = {},
3085
- el;
2857
+ el;
3086
2858
  data.entries = [];
3087
2859
  data.displayName = "Results";
3088
2860
  data.templateId = results.tag('templateId').attr('root');
@@ -3090,60 +2862,55 @@ module.exports = function (doc) {
3090
2862
  results.entries().each(function (entry) {
3091
2863
  el = entry.tag('effectiveTime');
3092
2864
  var panel_date = parseDate(entry.tag('effectiveTime').attr('value'));
3093
-
3094
2865
  if (!panel_date) {
3095
2866
  panel_date = parseDate(entry.tag('effectiveTime').tag('low').attr('value'));
3096
- } // panel
3097
-
2867
+ }
3098
2868
 
2869
+ // panel
3099
2870
  el = entry.tag('code');
3100
2871
  var panel_name = el.attr('displayName'),
3101
- panel_code = el.attr('code'),
3102
- panel_code_system = el.attr('codeSystem'),
3103
- panel_code_system_name = el.attr('codeSystemName');
2872
+ panel_code = el.attr('code'),
2873
+ panel_code_system = el.attr('codeSystem'),
2874
+ panel_code_system_name = el.attr('codeSystemName');
3104
2875
  var observation;
3105
2876
  var tests = entry.elsByTag('observation');
3106
2877
  var tests_data = [];
3107
-
3108
2878
  for (var i = 0; i < tests.length; i++) {
3109
- observation = tests[i]; // sometimes results organizers contain non-results. we only want tests
2879
+ observation = tests[i];
3110
2880
 
2881
+ // sometimes results organizers contain non-results. we only want tests
3111
2882
  if (observation.template('2.16.840.1.113883.10.20.1.31').val()) {
3112
2883
  var date = parseDate(observation.tag('effectiveTime').attr('value'));
3113
2884
  el = observation.tag('code');
3114
2885
  var name = el.attr('displayName'),
3115
- code = el.attr('code'),
3116
- code_system = el.attr('codeSystem'),
3117
- code_system_name = el.attr('codeSystemName');
3118
-
2886
+ code = el.attr('code'),
2887
+ code_system = el.attr('codeSystem'),
2888
+ code_system_name = el.attr('codeSystemName');
3119
2889
  if (!name) {
3120
2890
  name = Core.stripWhitespace(observation.tag('text').val());
3121
2891
  }
3122
-
3123
2892
  el = observation.tag('translation');
3124
2893
  var translation_name = el.attr('displayName'),
3125
- translation_code = el.attr('code'),
3126
- translation_code_system = el.attr('codeSystem'),
3127
- translation_code_system_name = el.attr('codeSystemName');
2894
+ translation_code = el.attr('code'),
2895
+ translation_code_system = el.attr('codeSystem'),
2896
+ translation_code_system_name = el.attr('codeSystemName');
3128
2897
  el = observation.tag('value');
3129
2898
  var value = el.attr('value'),
3130
- unit = el.attr('unit'); // We could look for xsi:type="PQ" (physical quantity) but it seems better
2899
+ unit = el.attr('unit');
2900
+ // We could look for xsi:type="PQ" (physical quantity) but it seems better
3131
2901
  // not to trust that that field has been used correctly...
3132
-
3133
2902
  if (value && !isNaN(parseFloat(value))) {
3134
2903
  value = parseFloat(value);
3135
2904
  }
3136
-
3137
2905
  if (!value) {
3138
2906
  value = el.val(); // look for free-text values
3139
2907
  }
3140
-
3141
2908
  el = observation.tag('referenceRange');
3142
2909
  var reference_range_text = Core.stripWhitespace(el.tag('observationRange').tag('text').val()),
3143
- reference_range_low_unit = el.tag('observationRange').tag('low').attr('unit'),
3144
- reference_range_low_value = el.tag('observationRange').tag('low').attr('value'),
3145
- reference_range_high_unit = el.tag('observationRange').tag('high').attr('unit'),
3146
- reference_range_high_value = el.tag('observationRange').tag('high').attr('value');
2910
+ reference_range_low_unit = el.tag('observationRange').tag('low').attr('unit'),
2911
+ reference_range_low_value = el.tag('observationRange').tag('low').attr('value'),
2912
+ reference_range_high_unit = el.tag('observationRange').tag('high').attr('unit'),
2913
+ reference_range_high_value = el.tag('observationRange').tag('high').attr('value');
3147
2914
  tests_data.push({
3148
2915
  date: date,
3149
2916
  name: name,
@@ -3168,7 +2935,6 @@ module.exports = function (doc) {
3168
2935
  });
3169
2936
  }
3170
2937
  }
3171
-
3172
2938
  data.entries.push({
3173
2939
  name: panel_name,
3174
2940
  code: panel_code,
@@ -3180,30 +2946,29 @@ module.exports = function (doc) {
3180
2946
  });
3181
2947
  return data;
3182
2948
  }
3183
-
3184
2949
  ;
3185
2950
  };
3186
2951
 
3187
- /***/ }),
2952
+ /***/ },
3188
2953
 
3189
- /***/ 396:
3190
- /***/ ((module) => {
2954
+ /***/ 619
2955
+ (module) {
3191
2956
 
3192
- /*
3193
- * Parser for the C32 vitals section
2957
+ /*
2958
+ * Parser for the C32 vitals section
3194
2959
  */
2960
+
3195
2961
  module.exports = function (doc) {
3196
2962
  var self = this;
3197
2963
  self.doc = doc;
3198
2964
  self.parse = parse;
3199
-
3200
2965
  function parse(c32) {
3201
2966
  var parseDate = self.doc.parseDate;
3202
2967
  var parseName = self.doc.parseName;
3203
2968
  var parseAddress = self.doc.parseAddress;
3204
2969
  var vitals = c32.section('vitals');
3205
2970
  var data = {},
3206
- el;
2971
+ el;
3207
2972
  data.entries = [];
3208
2973
  data.displayName = "Vitals";
3209
2974
  data.templateId = vitals.tag('templateId').attr('root');
@@ -3214,18 +2979,19 @@ module.exports = function (doc) {
3214
2979
  var result;
3215
2980
  var results = entry.elsByTag('component');
3216
2981
  var results_data = [];
3217
-
3218
2982
  for (var j = 0; j < results.length; j++) {
3219
- result = results[j]; // Results
2983
+ result = results[j];
2984
+
2985
+ // Results
3220
2986
 
3221
2987
  el = result.tag('code');
3222
2988
  var name = el.attr('displayName'),
3223
- code = el.attr('code'),
3224
- code_system = el.attr('codeSystem'),
3225
- code_system_name = el.attr('codeSystemName');
2989
+ code = el.attr('code'),
2990
+ code_system = el.attr('codeSystem'),
2991
+ code_system_name = el.attr('codeSystemName');
3226
2992
  el = result.tag('value');
3227
2993
  var value = parseFloat(el.attr('value')),
3228
- unit = el.attr('unit');
2994
+ unit = el.attr('unit');
3229
2995
  results_data.push({
3230
2996
  name: name,
3231
2997
  code: code,
@@ -3235,7 +3001,6 @@ module.exports = function (doc) {
3235
3001
  unit: unit
3236
3002
  });
3237
3003
  }
3238
-
3239
3004
  data.entries.push({
3240
3005
  date: entry_date,
3241
3006
  results: results_data
@@ -3243,72 +3008,66 @@ module.exports = function (doc) {
3243
3008
  });
3244
3009
  return data;
3245
3010
  }
3246
-
3247
3011
  ;
3248
3012
  };
3249
3013
 
3250
- /***/ }),
3014
+ /***/ },
3251
3015
 
3252
- /***/ 939:
3253
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3016
+ /***/ 43
3017
+ (module, __unused_webpack_exports, __webpack_require__) {
3254
3018
 
3255
- /*
3256
- * Parser for the CCDAR2 document
3019
+ /*
3020
+ * Parser for the CCDAR2 document
3257
3021
  */
3258
- var ParseGenericInfo = __webpack_require__(711);
3259
-
3260
- var Core = __webpack_require__(1);
3261
-
3262
- var DocumentParser = __webpack_require__(74);
3263
-
3264
- var DemographicsParser = __webpack_require__(825);
3265
-
3266
- var HealthConcernsParser = __webpack_require__(329);
3267
3022
 
3023
+ var ParseGenericInfo = __webpack_require__(120);
3024
+ var Core = __webpack_require__(211);
3025
+ var DocumentParser = __webpack_require__(575);
3026
+ var DemographicsParser = __webpack_require__(533);
3027
+ var HealthConcernsParser = __webpack_require__(677);
3268
3028
  module.exports = function (doc) {
3269
3029
  var self = this;
3270
3030
  self.doc = doc;
3271
3031
  self.documentParser = new DocumentParser(self.doc);
3272
3032
  self.demographicsParser = new DemographicsParser(self.doc);
3273
3033
  self.healthConcernsParser = new HealthConcernsParser(self.doc);
3274
-
3275
3034
  self.run = function (ccda) {
3276
3035
  var data = {};
3277
3036
  data.document = self.documentParser.document(ccda);
3278
3037
  data.demographics = self.demographicsParser.demographics(ccda);
3279
3038
  data.health_concerns_document = self.healthConcernsParser.health_concerns_document(ccda);
3280
- data.json = Core.json; // Decorate each section with Title, templateId and text and adds missing sections
3039
+ data.json = Core.json;
3281
3040
 
3041
+ // Decorate each section with Title, templateId and text and adds missing sections
3282
3042
  ParseGenericInfo(ccda, data);
3283
3043
  return data;
3284
3044
  };
3285
3045
  };
3286
3046
 
3287
- /***/ }),
3047
+ /***/ },
3288
3048
 
3289
- /***/ 74:
3290
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3049
+ /***/ 575
3050
+ (module, __unused_webpack_exports, __webpack_require__) {
3291
3051
 
3292
- /*
3293
- * Parser for the CCDAR2 document section
3052
+ /*
3053
+ * Parser for the CCDAR2 document section
3294
3054
  */
3295
- var Core = __webpack_require__(1);
3296
-
3055
+ var Core = __webpack_require__(211);
3297
3056
  module.exports = function (doc) {
3298
3057
  var self = this;
3299
3058
  self.doc = doc;
3300
3059
  self.document = document;
3301
-
3302
3060
  function document(ccda) {
3303
3061
  var parseDate = self.doc.parseDate;
3304
3062
  var parseName = self.doc.parseName;
3305
3063
  var parseAddress = self.doc.parseAddress;
3306
3064
  var data = {},
3307
- el;
3065
+ el;
3308
3066
  var doc = ccda.section('document');
3309
3067
  var date = parseDate(doc.tag('effectiveTime').attr('value'));
3310
- var title = Core.stripWhitespace(doc.tag('title').val()); // Parse Doc Type Info
3068
+ var title = Core.stripWhitespace(doc.tag('title').val());
3311
3069
 
3070
+ // Parse Doc Type Info
3312
3071
  var templates = doc.elsByTag('templateId');
3313
3072
  var rootTemplate = templates[0].attr('root');
3314
3073
  var secondTemplate;
@@ -3326,7 +3085,6 @@ module.exports = function (doc) {
3326
3085
  rawText: "",
3327
3086
  reference: ""
3328
3087
  };
3329
-
3330
3088
  if (nonXmlNodes && nonXmlNodes.length > 0) {
3331
3089
  bodyType = "unstructured";
3332
3090
  var text = nonXml.tag('text');
@@ -3334,20 +3092,19 @@ module.exports = function (doc) {
3334
3092
  var representation = "";
3335
3093
  var rawText = "";
3336
3094
  var reference = "";
3337
- var type = ""; // We have an embedded doc
3095
+ var type = "";
3338
3096
 
3097
+ // We have an embedded doc
3339
3098
  if (text && text.attr('mediaType')) {
3340
3099
  mediaType = text.attr('mediaType');
3341
3100
  representation = text.attr('representation');
3342
3101
  rawText = text.val();
3343
3102
  type = "embedded";
3344
3103
  }
3345
-
3346
3104
  if (text && !mediaType) {
3347
3105
  reference = text.tag('reference').attr('value');
3348
3106
  type = "reference";
3349
3107
  }
3350
-
3351
3108
  nonXmlBody = {
3352
3109
  type: type,
3353
3110
  mediaType: mediaType,
@@ -3356,7 +3113,6 @@ module.exports = function (doc) {
3356
3113
  reference: reference
3357
3114
  };
3358
3115
  }
3359
-
3360
3116
  var docType = {
3361
3117
  type: "CCDAR2",
3362
3118
  rootTemplateId: rootTemplate,
@@ -3375,7 +3131,6 @@ module.exports = function (doc) {
3375
3131
  var work_phone = el.attr('value');
3376
3132
  var documentation_of_list = [];
3377
3133
  var performers = doc.tag('documentationOf').elsByTag('performer');
3378
-
3379
3134
  for (var i = 0; i < performers.length; i++) {
3380
3135
  el = performers[i];
3381
3136
  var performer_name_dict = parseName(el);
@@ -3389,17 +3144,14 @@ module.exports = function (doc) {
3389
3144
  address: performer_addr
3390
3145
  });
3391
3146
  }
3392
-
3393
3147
  el = doc.tag('encompassingEncounter').tag('location');
3394
3148
  var location_name = Core.stripWhitespace(el.tag('name').val());
3395
3149
  var location_addr_dict = parseAddress(el.tag('addr'));
3396
3150
  var encounter_date = null;
3397
3151
  el = el.tag('effectiveTime');
3398
-
3399
3152
  if (!el.isEmpty()) {
3400
3153
  encounter_date = parseDate(el.attr('value'));
3401
3154
  }
3402
-
3403
3155
  data = {
3404
3156
  type: docType,
3405
3157
  date: date,
@@ -3420,53 +3172,35 @@ module.exports = function (doc) {
3420
3172
  };
3421
3173
  return data;
3422
3174
  }
3423
-
3424
3175
  ;
3425
3176
  };
3426
3177
 
3427
- /***/ }),
3428
-
3429
- /***/ 193:
3430
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3431
-
3432
- var Core = __webpack_require__(1);
3433
-
3434
- var AllergiesParser = __webpack_require__(754);
3435
-
3436
- var CarePlanParser = __webpack_require__(171);
3437
-
3438
- var DemographicsParser = __webpack_require__(825);
3439
-
3440
- var DocumentParser = __webpack_require__(122);
3441
-
3442
- var EncountersParser = __webpack_require__(729);
3443
-
3444
- var FreeTextParser = __webpack_require__(833);
3445
-
3446
- var FunctionalStatusesParser = __webpack_require__(902);
3447
-
3448
- var ImmunizationsParser = __webpack_require__(530);
3449
-
3450
- var InstructionsParser = __webpack_require__(463);
3451
-
3452
- var MedicationsParser = __webpack_require__(306);
3453
-
3454
- var ProblemsParser = __webpack_require__(150);
3455
-
3456
- var ProceduresParser = __webpack_require__(361);
3457
-
3458
- var ResultsParser = __webpack_require__(824);
3459
-
3460
- var SmokingStatusParser = __webpack_require__(206);
3461
-
3462
- var VitalsParser = __webpack_require__(204);
3463
-
3464
- var ParseGenericInfo = __webpack_require__(711);
3465
- /*
3466
- * Parser for the CCDA document
3178
+ /***/ },
3179
+
3180
+ /***/ 188
3181
+ (module, __unused_webpack_exports, __webpack_require__) {
3182
+
3183
+ var Core = __webpack_require__(211);
3184
+ var AllergiesParser = __webpack_require__(447);
3185
+ var CarePlanParser = __webpack_require__(50);
3186
+ var DemographicsParser = __webpack_require__(533);
3187
+ var DocumentParser = __webpack_require__(442);
3188
+ var EncountersParser = __webpack_require__(485);
3189
+ var FreeTextParser = __webpack_require__(787);
3190
+ var FunctionalStatusesParser = __webpack_require__(771);
3191
+ var ImmunizationsParser = __webpack_require__(280);
3192
+ var InstructionsParser = __webpack_require__(122);
3193
+ var MedicationsParser = __webpack_require__(127);
3194
+ var ProblemsParser = __webpack_require__(123);
3195
+ var ProceduresParser = __webpack_require__(301);
3196
+ var ResultsParser = __webpack_require__(657);
3197
+ var SmokingStatusParser = __webpack_require__(898);
3198
+ var VitalsParser = __webpack_require__(248);
3199
+ var ParseGenericInfo = __webpack_require__(120);
3200
+
3201
+ /*
3202
+ * Parser for the CCDA document
3467
3203
  */
3468
-
3469
-
3470
3204
  module.exports = function (doc) {
3471
3205
  var self = this;
3472
3206
  self.doc = doc;
@@ -3485,7 +3219,6 @@ module.exports = function (doc) {
3485
3219
  self.resultsParser = new ResultsParser(self.doc);
3486
3220
  self.smokingStatusParser = new SmokingStatusParser(self.doc);
3487
3221
  self.vitalsParser = new VitalsParser(self.doc);
3488
-
3489
3222
  self.run = function (ccda) {
3490
3223
  var data = {};
3491
3224
  data.document = self.documentParser.document(ccda);
@@ -3521,34 +3254,34 @@ module.exports = function (doc) {
3521
3254
  data.problems.json = Core.json;
3522
3255
  data.procedures.json = Core.json;
3523
3256
  data.smoking_status.json = Core.json;
3524
- data.vitals.json = Core.json; // Decorate each section with Title, templateId and text and adds missing sections
3257
+ data.vitals.json = Core.json;
3525
3258
 
3259
+ // Decorate each section with Title, templateId and text and adds missing sections
3526
3260
  ParseGenericInfo(ccda, data);
3527
3261
  return data;
3528
3262
  };
3529
3263
  };
3530
3264
 
3531
- /***/ }),
3265
+ /***/ },
3532
3266
 
3533
- /***/ 754:
3534
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3267
+ /***/ 447
3268
+ (module, __unused_webpack_exports, __webpack_require__) {
3535
3269
 
3536
- /*
3537
- * Parser for the CCDA allergies section
3270
+ /*
3271
+ * Parser for the CCDA allergies section
3538
3272
  */
3539
- var Core = __webpack_require__(1);
3540
3273
 
3274
+ var Core = __webpack_require__(211);
3541
3275
  module.exports = function (doc) {
3542
3276
  var self = this;
3543
3277
  self.doc = doc;
3544
-
3545
3278
  self.allergies = function (ccda) {
3546
3279
  var parseDate = self.doc.parseDate;
3547
3280
  var parseName = self.doc.parseName;
3548
3281
  var parseAddress = self.doc.parseAddress;
3549
3282
  var allergies = ccda.section('allergies');
3550
3283
  var data = {},
3551
- el;
3284
+ el;
3552
3285
  data.entries = [];
3553
3286
  data.displayName = "Allergies";
3554
3287
  data.templateId = allergies.tag('templateId').attr('root');
@@ -3556,50 +3289,52 @@ module.exports = function (doc) {
3556
3289
  allergies.entries().each(function (entry) {
3557
3290
  el = entry.tag('effectiveTime');
3558
3291
  var start_date = parseDate(el.tag('low').attr('value')),
3559
- end_date = parseDate(el.tag('high').attr('value'));
3292
+ end_date = parseDate(el.tag('high').attr('value'));
3560
3293
  el = entry.template('2.16.840.1.113883.10.20.22.4.7').tag('code');
3561
3294
  var name = el.attr('displayName'),
3562
- code = el.attr('code'),
3563
- code_system = el.attr('codeSystem'),
3564
- code_system_name = el.attr('codeSystemName'); // value => reaction_type
3295
+ code = el.attr('code'),
3296
+ code_system = el.attr('codeSystem'),
3297
+ code_system_name = el.attr('codeSystemName');
3565
3298
 
3299
+ // value => reaction_type
3566
3300
  el = entry.template('2.16.840.1.113883.10.20.22.4.7').tag('value');
3567
3301
  var reaction_type_name = el.attr('displayName'),
3568
- reaction_type_code = el.attr('code'),
3569
- reaction_type_code_system = el.attr('codeSystem'),
3570
- reaction_type_code_system_name = el.attr('codeSystemName'); // reaction
3302
+ reaction_type_code = el.attr('code'),
3303
+ reaction_type_code_system = el.attr('codeSystem'),
3304
+ reaction_type_code_system_name = el.attr('codeSystemName');
3571
3305
 
3306
+ // reaction
3572
3307
  el = entry.template('2.16.840.1.113883.10.20.22.4.9').tag('value');
3573
3308
  var reaction_name = el.attr('displayName'),
3574
- reaction_code = el.attr('code'),
3575
- reaction_code_system = el.attr('codeSystem'); // severity
3309
+ reaction_code = el.attr('code'),
3310
+ reaction_code_system = el.attr('codeSystem');
3576
3311
 
3312
+ // severity
3577
3313
  el = entry.template('2.16.840.1.113883.10.20.22.4.8').tag('value');
3578
- var severity = el.attr('displayName'); // participant => allergen
3314
+ var severity = el.attr('displayName');
3579
3315
 
3316
+ // participant => allergen
3580
3317
  el = entry.tag('participant').tag('code');
3581
3318
  var allergen_name = el.attr('displayName'),
3582
- allergen_code = el.attr('code'),
3583
- allergen_code_system = el.attr('codeSystem'),
3584
- allergen_code_system_name = el.attr('codeSystemName'); // this is not a valid place to store the allergen name but some vendors use it
3319
+ allergen_code = el.attr('code'),
3320
+ allergen_code_system = el.attr('codeSystem'),
3321
+ allergen_code_system_name = el.attr('codeSystemName');
3585
3322
 
3323
+ // this is not a valid place to store the allergen name but some vendors use it
3586
3324
  if (!allergen_name) {
3587
3325
  el = entry.tag('participant').tag('name');
3588
-
3589
3326
  if (!el.isEmpty()) {
3590
3327
  allergen_name = el.val();
3591
3328
  }
3592
3329
  }
3593
-
3594
3330
  if (!allergen_name) {
3595
3331
  el = entry.template('2.16.840.1.113883.10.20.22.4.7').tag('originalText');
3596
-
3597
3332
  if (!el.isEmpty()) {
3598
3333
  allergen_name = Core.stripWhitespace(el.val());
3599
3334
  }
3600
- } // status
3601
-
3335
+ }
3602
3336
 
3337
+ // status
3603
3338
  el = entry.template('2.16.840.1.113883.10.20.22.4.28').tag('value');
3604
3339
  var status = el.attr('displayName');
3605
3340
  data.entries.push({
@@ -3636,39 +3371,38 @@ module.exports = function (doc) {
3636
3371
  };
3637
3372
  };
3638
3373
 
3639
- /***/ }),
3374
+ /***/ },
3640
3375
 
3641
- /***/ 171:
3642
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3376
+ /***/ 50
3377
+ (module, __unused_webpack_exports, __webpack_require__) {
3643
3378
 
3644
3379
  "use strict";
3645
- /*
3646
- * Parser for the CCDA "plan of care" section
3380
+ /*
3381
+ * Parser for the CCDA "plan of care" section
3647
3382
  */
3648
3383
 
3649
3384
 
3650
- var Core = __webpack_require__(1);
3651
3385
 
3386
+ var Core = __webpack_require__(211);
3652
3387
  module.exports = function (doc) {
3653
3388
  var self = this;
3654
3389
  self.doc = doc;
3655
-
3656
3390
  self.care_plan = function (ccda) {
3657
3391
  var care_plan = ccda.section('care_plan');
3658
3392
  var data = {},
3659
- el;
3393
+ el;
3660
3394
  data.entries = [];
3661
3395
  data.displayName = "Care Plan";
3662
3396
  data.templateId = care_plan.tag('templateId').attr('root');
3663
3397
  data.text = care_plan.tag('text').val(true);
3664
3398
  care_plan.entries().each(function (entry) {
3665
3399
  var name = null,
3666
- code = null,
3667
- code_system = null,
3668
- code_system_name = null; // Plan of care encounters, which have no other details
3400
+ code = null,
3401
+ code_system = null,
3402
+ code_system_name = null;
3669
3403
 
3404
+ // Plan of care encounters, which have no other details
3670
3405
  el = entry.template('2.16.840.1.113883.10.20.22.4.40');
3671
-
3672
3406
  if (!el.isEmpty()) {
3673
3407
  name = 'encounter';
3674
3408
  } else {
@@ -3678,7 +3412,6 @@ module.exports = function (doc) {
3678
3412
  code_system = el.attr('codeSystem');
3679
3413
  code_system_name = el.attr('codeSystemName');
3680
3414
  }
3681
-
3682
3415
  var text = Core.stripWhitespace(entry.tag('text').val(true));
3683
3416
  var time = entry.tag('effectiveTime').immediateChildTag('center').attr('value');
3684
3417
  data.entries.push({
@@ -3691,71 +3424,68 @@ module.exports = function (doc) {
3691
3424
  });
3692
3425
  });
3693
3426
  return data;
3694
-
3695
3427
  function parse(str) {
3696
3428
  if (!str) return null;
3697
3429
  var y = str.substr(0, 4),
3698
- m = str.substr(4, 2) - 1,
3699
- d = str.substr(6, 2);
3430
+ m = str.substr(4, 2) - 1,
3431
+ d = str.substr(6, 2);
3700
3432
  var D = new Date(y, m, d);
3701
3433
  return D.getFullYear() == y && D.getMonth() == m && D.getDate() == d ? D : null;
3702
3434
  }
3703
3435
  };
3704
3436
  };
3705
3437
 
3706
- /***/ }),
3438
+ /***/ },
3707
3439
 
3708
- /***/ 825:
3709
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3440
+ /***/ 533
3441
+ (module, __unused_webpack_exports, __webpack_require__) {
3710
3442
 
3711
- /*
3712
- * Parser for the CCDA demographics section
3443
+ /*
3444
+ * Parser for the CCDA demographics section
3713
3445
  */
3714
- var Core = __webpack_require__(1);
3715
-
3446
+ var Core = __webpack_require__(211);
3716
3447
  module.exports = function (doc) {
3717
3448
  var self = this;
3718
3449
  self.doc = doc;
3719
3450
  self.demographics = demographics;
3720
-
3721
3451
  function demographics(ccda) {
3722
3452
  var parseDate = self.doc.parseDate;
3723
3453
  var parseName = self.doc.parseName;
3724
3454
  var parseAddress = self.doc.parseAddress;
3725
3455
  var data = {},
3726
- el;
3456
+ el;
3727
3457
  var demographics = ccda.section('demographics');
3728
3458
  var patient = demographics.tag('patientRole');
3729
3459
  el = patient.tag('patient').tag('name');
3730
3460
  var patient_name_dict = parseName(el);
3731
3461
  el = patient.tag('patient');
3732
3462
  var dob = parseDate(el.tag('birthTime').attr('value')),
3733
- gender = Core.Codes.gender(el.tag('administrativeGenderCode').attr('code')),
3734
- marital_status = Core.Codes.maritalStatus(el.tag('maritalStatusCode').attr('code'));
3463
+ gender = Core.Codes.gender(el.tag('administrativeGenderCode').attr('code')),
3464
+ marital_status = Core.Codes.maritalStatus(el.tag('maritalStatusCode').attr('code'));
3735
3465
  el = patient.tag('addr');
3736
3466
  var patient_address_dict = parseAddress(el);
3737
3467
  el = patient.tag('telecom');
3738
3468
  var home = el.attr('value'),
3739
- work = null,
3740
- mobile = null;
3469
+ work = null,
3470
+ mobile = null;
3741
3471
  var email = null;
3742
3472
  var language = patient.tag('languageCommunication').tag('languageCode').attr('code'),
3743
- race = patient.tag('raceCode').attr('displayName'),
3744
- ethnicity = patient.tag('ethnicGroupCode').attr('displayName'),
3745
- religion = patient.tag('religiousAffiliationCode').attr('displayName');
3473
+ race = patient.tag('raceCode').attr('displayName'),
3474
+ ethnicity = patient.tag('ethnicGroupCode').attr('displayName'),
3475
+ religion = patient.tag('religiousAffiliationCode').attr('displayName');
3746
3476
  el = patient.tag('birthplace');
3747
3477
  var birthplace_dict = parseAddress(el);
3748
3478
  el = patient.tag('guardian');
3749
3479
  var guardian_relationship = el.tag('code').attr('displayName'),
3750
- guardian_relationship_code = el.tag('code').attr('code'),
3751
- guardian_home = el.tag('telecom').attr('value');
3480
+ guardian_relationship_code = el.tag('code').attr('code'),
3481
+ guardian_home = el.tag('telecom').attr('value');
3752
3482
  el = el.tag('guardianPerson').tag('name');
3753
3483
  var guardian_name_dict = parseName(el);
3754
3484
  el = patient.tag('guardian').tag('addr');
3755
3485
  var guardian_address_dict = parseAddress(el);
3756
3486
  el = patient.tag('providerOrganization');
3757
3487
  var provider_organization = el.tag('name').val(),
3758
- provider_phone = el.tag('telecom').attr('value');
3488
+ provider_phone = el.tag('telecom').attr('value');
3759
3489
  var provider_address_dict = parseAddress(el.tag('addr'));
3760
3490
  data = {
3761
3491
  name: patient_name_dict,
@@ -3798,32 +3528,31 @@ module.exports = function (doc) {
3798
3528
  };
3799
3529
  return data;
3800
3530
  }
3801
-
3802
3531
  ;
3803
3532
  };
3804
3533
 
3805
- /***/ }),
3534
+ /***/ },
3806
3535
 
3807
- /***/ 122:
3808
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3536
+ /***/ 442
3537
+ (module, __unused_webpack_exports, __webpack_require__) {
3809
3538
 
3810
- /*
3811
- * Parser for the CCDA document section
3539
+ /*
3540
+ * Parser for the CCDA document section
3812
3541
  */
3813
- var Core = __webpack_require__(1);
3814
3542
 
3543
+ var Core = __webpack_require__(211);
3815
3544
  module.exports = function (doc) {
3816
3545
  var self = this;
3817
3546
  self.doc = doc;
3818
-
3819
3547
  self.document = function (ccda) {
3820
3548
  var parseDate = self.doc.parseDate;
3821
3549
  var parseName = self.doc.parseName;
3822
3550
  var parseAddress = self.doc.parseAddress;
3823
3551
  var data = {},
3824
- el;
3825
- var doc = ccda.section('document'); // Parse Doc Type Info
3552
+ el;
3553
+ var doc = ccda.section('document');
3826
3554
 
3555
+ // Parse Doc Type Info
3827
3556
  var templates = doc.elsByTag('templateId');
3828
3557
  var rootTemplate = templates[0].attr('root');
3829
3558
  var secondTemplate;
@@ -3841,7 +3570,6 @@ module.exports = function (doc) {
3841
3570
  rawText: "",
3842
3571
  reference: ""
3843
3572
  };
3844
-
3845
3573
  if (nonXmlNodes && nonXmlNodes.length > 0) {
3846
3574
  bodyType = "unstructured";
3847
3575
  var text = nonXml.tag('text');
@@ -3849,20 +3577,19 @@ module.exports = function (doc) {
3849
3577
  var representation = "";
3850
3578
  var rawText = "";
3851
3579
  var reference = "";
3852
- var type = ""; // We have an embedded doc
3580
+ var type = "";
3853
3581
 
3582
+ // We have an embedded doc
3854
3583
  if (text && text.attr('mediaType')) {
3855
3584
  mediaType = text.attr('mediaType');
3856
3585
  representation = text.attr('representation');
3857
3586
  rawText = text.val();
3858
3587
  type = "embedded";
3859
3588
  }
3860
-
3861
3589
  if (text && !mediaType) {
3862
3590
  reference = text.tag('reference').attr('value');
3863
3591
  type = "reference";
3864
3592
  }
3865
-
3866
3593
  nonXmlBody = {
3867
3594
  type: type,
3868
3595
  mediaType: mediaType,
@@ -3871,7 +3598,6 @@ module.exports = function (doc) {
3871
3598
  reference: reference
3872
3599
  };
3873
3600
  }
3874
-
3875
3601
  var docType = {
3876
3602
  type: "CCDAR2",
3877
3603
  rootTemplateId: rootTemplate,
@@ -3892,7 +3618,6 @@ module.exports = function (doc) {
3892
3618
  var work_phone = el.attr('value');
3893
3619
  var documentation_of_list = [];
3894
3620
  var performers = doc.tag('documentationOf').elsByTag('performer');
3895
-
3896
3621
  for (var i = 0; i < performers.length; i++) {
3897
3622
  el = performers[i];
3898
3623
  var performer_name_dict = parseName(el);
@@ -3906,17 +3631,14 @@ module.exports = function (doc) {
3906
3631
  address: performer_addr
3907
3632
  });
3908
3633
  }
3909
-
3910
3634
  el = doc.tag('encompassingEncounter').tag('location');
3911
3635
  var location_name = Core.stripWhitespace(el.tag('name').val());
3912
3636
  var location_addr_dict = parseAddress(el.tag('addr'));
3913
3637
  var encounter_date = null;
3914
3638
  el = el.tag('effectiveTime');
3915
-
3916
3639
  if (!el.isEmpty()) {
3917
3640
  encounter_date = parseDate(el.attr('value'));
3918
3641
  }
3919
-
3920
3642
  data = {
3921
3643
  type: docType,
3922
3644
  date: date,
@@ -3939,25 +3661,25 @@ module.exports = function (doc) {
3939
3661
  };
3940
3662
  };
3941
3663
 
3942
- /***/ }),
3664
+ /***/ },
3943
3665
 
3944
- /***/ 729:
3945
- /***/ ((module) => {
3666
+ /***/ 485
3667
+ (module) {
3946
3668
 
3947
- /*
3948
- * Parser for the CCDA encounters section
3669
+ /*
3670
+ * Parser for the CCDA encounters section
3949
3671
  */
3672
+
3950
3673
  module.exports = function (doc) {
3951
3674
  var self = this;
3952
3675
  self.doc = doc;
3953
-
3954
3676
  self.encounters = function (ccda) {
3955
3677
  var parseDate = self.doc.parseDate;
3956
3678
  var parseName = self.doc.parseName;
3957
3679
  var parseAddress = self.doc.parseAddress;
3958
3680
  var encounters = ccda.section('encounters');
3959
3681
  var data = {},
3960
- el;
3682
+ el;
3961
3683
  data.entries = [];
3962
3684
  data.displayName = "Encounters";
3963
3685
  data.templateId = encounters.tag('templateId').attr('root');
@@ -3966,31 +3688,34 @@ module.exports = function (doc) {
3966
3688
  var date = parseDate(entry.tag('effectiveTime').attr('value'));
3967
3689
  el = entry.tag('code');
3968
3690
  var name = el.attr('displayName'),
3969
- code = el.attr('code'),
3970
- code_system = el.attr('codeSystem'),
3971
- code_system_name = el.attr('codeSystemName'),
3972
- code_system_version = el.attr('codeSystemVersion'); // translation
3691
+ code = el.attr('code'),
3692
+ code_system = el.attr('codeSystem'),
3693
+ code_system_name = el.attr('codeSystemName'),
3694
+ code_system_version = el.attr('codeSystemVersion');
3973
3695
 
3696
+ // translation
3974
3697
  el = entry.tag('translation');
3975
3698
  var translation_name = el.attr('displayName'),
3976
- translation_code = el.attr('code'),
3977
- translation_code_system = el.attr('codeSystem'),
3978
- translation_code_system_name = el.attr('codeSystemName'); // performer
3699
+ translation_code = el.attr('code'),
3700
+ translation_code_system = el.attr('codeSystem'),
3701
+ translation_code_system_name = el.attr('codeSystemName');
3979
3702
 
3703
+ // performer
3980
3704
  el = entry.tag('performer').tag('code');
3981
3705
  var performer_name = el.attr('displayName'),
3982
- performer_code = el.attr('code'),
3983
- performer_code_system = el.attr('codeSystem'),
3984
- performer_code_system_name = el.attr('codeSystemName'); // participant => location
3706
+ performer_code = el.attr('code'),
3707
+ performer_code_system = el.attr('codeSystem'),
3708
+ performer_code_system_name = el.attr('codeSystemName');
3985
3709
 
3710
+ // participant => location
3986
3711
  el = entry.tag('participant');
3987
3712
  var organization = el.tag('code').attr('displayName');
3988
3713
  var location_dict = parseAddress(el);
3989
- location_dict.organization = organization; // findings
3714
+ location_dict.organization = organization;
3990
3715
 
3716
+ // findings
3991
3717
  var findings = [];
3992
3718
  var findingEls = entry.elsByTag('entryRelationship');
3993
-
3994
3719
  for (var i = 0; i < findingEls.length; i++) {
3995
3720
  el = findingEls[i].tag('value');
3996
3721
  findings.push({
@@ -3999,7 +3724,6 @@ module.exports = function (doc) {
3999
3724
  code_system: el.attr('codeSystem')
4000
3725
  });
4001
3726
  }
4002
-
4003
3727
  data.entries.push({
4004
3728
  date: date,
4005
3729
  name: name,
@@ -4027,19 +3751,18 @@ module.exports = function (doc) {
4027
3751
  };
4028
3752
  };
4029
3753
 
4030
- /***/ }),
3754
+ /***/ },
4031
3755
 
4032
- /***/ 833:
4033
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3756
+ /***/ 787
3757
+ (module, __unused_webpack_exports, __webpack_require__) {
4034
3758
 
4035
- /*
4036
- * Parser for any freetext section (i.e., contains just a single <text> element)
3759
+ /*
3760
+ * Parser for any freetext section (i.e., contains just a single <text> element)
4037
3761
  */
4038
- var Core = __webpack_require__(1);
4039
3762
 
3763
+ var Core = __webpack_require__(211);
4040
3764
  module.exports = function () {
4041
3765
  var self = this;
4042
-
4043
3766
  self.free_text = function (ccda, sectionName) {
4044
3767
  var data = {};
4045
3768
  var doc = ccda.section(sectionName);
@@ -4051,35 +3774,33 @@ module.exports = function () {
4051
3774
  };
4052
3775
  };
4053
3776
 
4054
- /***/ }),
3777
+ /***/ },
4055
3778
 
4056
- /***/ 902:
4057
- /***/ ((module) => {
3779
+ /***/ 771
3780
+ (module) {
4058
3781
 
4059
- /*
4060
- * Parser for the CCDA functional & cognitive status
3782
+ /*
3783
+ * Parser for the CCDA functional & cognitive status
4061
3784
  */
3785
+
4062
3786
  module.exports = function (doc) {
4063
3787
  var self = this;
4064
3788
  self.doc = doc;
4065
-
4066
3789
  self.functional_statuses = function (ccda) {
4067
3790
  var parseDate = self.doc.parseDate;
4068
3791
  var data = [],
4069
- el;
3792
+ el;
4070
3793
  var statuses = ccda.section('functional_statuses');
4071
3794
  statuses.entries().each(function (entry) {
4072
3795
  var date = parseDate(entry.tag('effectiveTime').attr('value'));
4073
-
4074
3796
  if (!date) {
4075
3797
  date = parseDate(entry.tag('effectiveTime').tag('low').attr('value'));
4076
3798
  }
4077
-
4078
3799
  el = entry.tag('value');
4079
3800
  var name = el.attr('displayName'),
4080
- code = el.attr('code'),
4081
- code_system = el.attr('codeSystem'),
4082
- code_system_name = el.attr('codeSystemName');
3801
+ code = el.attr('code'),
3802
+ code_system = el.attr('codeSystem'),
3803
+ code_system_name = el.attr('codeSystemName');
4083
3804
  data.push({
4084
3805
  date: date,
4085
3806
  name: name,
@@ -4092,28 +3813,27 @@ module.exports = function (doc) {
4092
3813
  };
4093
3814
  };
4094
3815
 
4095
- /***/ }),
3816
+ /***/ },
4096
3817
 
4097
- /***/ 530:
4098
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3818
+ /***/ 280
3819
+ (module, __unused_webpack_exports, __webpack_require__) {
4099
3820
 
4100
- /*
4101
- * Parser for the CCDA immunizations section
3821
+ /*
3822
+ * Parser for the CCDA immunizations section
4102
3823
  */
4103
- var Core = __webpack_require__(1);
4104
3824
 
3825
+ var Core = __webpack_require__(211);
4105
3826
  module.exports = function (doc) {
4106
3827
  var self = this;
4107
3828
  self.doc = doc;
4108
-
4109
3829
  self.immunizations = function (ccda) {
4110
3830
  var parseDate = self.doc.parseDate;
4111
3831
  var parseName = self.doc.parseName;
4112
3832
  var parseAddress = self.doc.parseAddress;
4113
3833
  var administeredData = {},
4114
- declinedData = {},
4115
- product,
4116
- el;
3834
+ declinedData = {},
3835
+ product,
3836
+ el;
4117
3837
  var immunizations = ccda.section('immunizations');
4118
3838
  administeredData.entries = [];
4119
3839
  administeredData.displayName = "Immunizations";
@@ -4127,49 +3847,54 @@ module.exports = function (doc) {
4127
3847
  // date
4128
3848
  el = entry.tag('effectiveTime');
4129
3849
  var date = parseDate(el.attr('value'));
4130
-
4131
3850
  if (!date) {
4132
3851
  date = parseDate(el.tag('low').attr('value'));
4133
- } // if 'declined' is true, this is a record that this vaccine WASN'T administered
4134
-
3852
+ }
4135
3853
 
3854
+ // if 'declined' is true, this is a record that this vaccine WASN'T administered
4136
3855
  el = entry.tag('substanceAdministration');
4137
- var declined = el.boolAttr('negationInd'); // product
3856
+ var declined = el.boolAttr('negationInd');
4138
3857
 
3858
+ // product
4139
3859
  product = entry.template('2.16.840.1.113883.10.20.22.4.54');
4140
3860
  el = product.tag('code');
4141
3861
  var product_name = el.attr('displayName'),
4142
- product_code = el.attr('code'),
4143
- product_code_system = el.attr('codeSystem'),
4144
- product_code_system_name = el.attr('codeSystemName'); // translation
3862
+ product_code = el.attr('code'),
3863
+ product_code_system = el.attr('codeSystem'),
3864
+ product_code_system_name = el.attr('codeSystemName');
4145
3865
 
3866
+ // translation
4146
3867
  el = product.tag('translation');
4147
3868
  var translation_name = el.attr('displayName'),
4148
- translation_code = el.attr('code'),
4149
- translation_code_system = el.attr('codeSystem'),
4150
- translation_code_system_name = el.attr('codeSystemName'); // misc product details
3869
+ translation_code = el.attr('code'),
3870
+ translation_code_system = el.attr('codeSystem'),
3871
+ translation_code_system_name = el.attr('codeSystemName');
4151
3872
 
3873
+ // misc product details
4152
3874
  el = product.tag('lotNumberText');
4153
3875
  var lot_number = el.val();
4154
3876
  el = product.tag('manufacturerOrganization');
4155
- var manufacturer_name = el.tag('name').val(); // route
3877
+ var manufacturer_name = el.tag('name').val();
4156
3878
 
3879
+ // route
4157
3880
  el = entry.tag('routeCode');
4158
3881
  var route_name = el.attr('displayName'),
4159
- route_code = el.attr('code'),
4160
- route_code_system = el.attr('codeSystem'),
4161
- route_code_system_name = el.attr('codeSystemName'); // instructions
3882
+ route_code = el.attr('code'),
3883
+ route_code_system = el.attr('codeSystem'),
3884
+ route_code_system_name = el.attr('codeSystemName');
4162
3885
 
3886
+ // instructions
4163
3887
  el = entry.template('2.16.840.1.113883.10.20.22.4.20');
4164
3888
  var instructions_text = Core.stripWhitespace(el.tag('text').val());
4165
3889
  el = el.tag('code');
4166
3890
  var education_name = el.attr('displayName'),
4167
- education_code = el.attr('code'),
4168
- education_code_system = el.attr('codeSystem'); // dose
3891
+ education_code = el.attr('code'),
3892
+ education_code_system = el.attr('codeSystem');
4169
3893
 
3894
+ // dose
4170
3895
  el = entry.tag('doseQuantity');
4171
3896
  var dose_value = el.attr('value'),
4172
- dose_unit = el.attr('unit');
3897
+ dose_unit = el.attr('unit');
4173
3898
  var data = declined ? declinedData : administeredData;
4174
3899
  data.entries.push({
4175
3900
  date: date,
@@ -4212,30 +3937,29 @@ module.exports = function (doc) {
4212
3937
  };
4213
3938
  };
4214
3939
 
4215
- /***/ }),
3940
+ /***/ },
4216
3941
 
4217
- /***/ 463:
4218
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3942
+ /***/ 122
3943
+ (module, __unused_webpack_exports, __webpack_require__) {
4219
3944
 
4220
- /*
4221
- * Parser for the CCDA "plan of care" section
3945
+ /*
3946
+ * Parser for the CCDA "plan of care" section
4222
3947
  */
4223
- var Core = __webpack_require__(1);
4224
3948
 
3949
+ var Core = __webpack_require__(211);
4225
3950
  module.exports = function () {
4226
3951
  var self = this;
4227
-
4228
3952
  self.instructions = function (ccda) {
4229
3953
  var data = [],
4230
- el;
3954
+ el;
4231
3955
  var instructions = ccda.section('instructions');
4232
3956
  data.templateId = instructions.tag('templateId').attr('root');
4233
3957
  instructions.entries().each(function (entry) {
4234
3958
  el = entry.tag('code');
4235
3959
  var name = el.attr('displayName'),
4236
- code = el.attr('code'),
4237
- code_system = el.attr('codeSystem'),
4238
- code_system_name = el.attr('codeSystemName');
3960
+ code = el.attr('code'),
3961
+ code_system = el.attr('codeSystem'),
3962
+ code_system_name = el.attr('codeSystemName');
4239
3963
  var text = Core.stripWhitespace(entry.tag('text').val(true));
4240
3964
  data.push({
4241
3965
  text: text,
@@ -4249,25 +3973,24 @@ module.exports = function () {
4249
3973
  };
4250
3974
  };
4251
3975
 
4252
- /***/ }),
3976
+ /***/ },
4253
3977
 
4254
- /***/ 306:
4255
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3978
+ /***/ 127
3979
+ (module, __unused_webpack_exports, __webpack_require__) {
4256
3980
 
4257
- /*
4258
- * Parser for the CCDA medications section
3981
+ /*
3982
+ * Parser for the CCDA medications section
4259
3983
  */
4260
- var Core = __webpack_require__(1);
4261
3984
 
3985
+ var Core = __webpack_require__(211);
4262
3986
  module.exports = function (doc) {
4263
3987
  var self = this;
4264
3988
  self.doc = doc;
4265
-
4266
3989
  self.medications = function (ccda) {
4267
3990
  var parseDate = self.doc.parseDate;
4268
3991
  var medications = ccda.section('medications');
4269
3992
  var data = {},
4270
- el;
3993
+ el;
4271
3994
  data.entries = [];
4272
3995
  data.displayName = "Medications";
4273
3996
  data.templateId = medications.tag('templateId').attr('root');
@@ -4277,94 +4000,87 @@ module.exports = function (doc) {
4277
4000
  var sig = Core.stripWhitespace(el.val());
4278
4001
  var effectiveTimes = entry.elsByTag('effectiveTime');
4279
4002
  el = effectiveTimes[0]; // the first effectiveTime is the med start date
4280
-
4281
4003
  var start_date = null,
4282
- end_date = null;
4283
-
4004
+ end_date = null;
4284
4005
  if (el) {
4285
4006
  start_date = parseDate(el.tag('low').attr('value'));
4286
4007
  end_date = parseDate(el.tag('high').attr('value'));
4287
- } // the second effectiveTime might the schedule period or it might just
4288
- // be a random effectiveTime from further in the entry... xsi:type should tell us
4289
-
4008
+ }
4290
4009
 
4010
+ // the second effectiveTime might the schedule period or it might just
4011
+ // be a random effectiveTime from further in the entry... xsi:type should tell us
4291
4012
  el = effectiveTimes[1];
4292
4013
  var schedule_type = null,
4293
- schedule_period_value = null,
4294
- schedule_period_unit = null;
4295
-
4014
+ schedule_period_value = null,
4015
+ schedule_period_unit = null;
4296
4016
  if (el && el.attr('xsi:type') === 'PIVL_TS') {
4297
4017
  var institutionSpecified = el.attr('institutionSpecified');
4298
-
4299
4018
  if (institutionSpecified === 'true') {
4300
4019
  schedule_type = 'frequency';
4301
4020
  } else if (institutionSpecified === 'false') {
4302
4021
  schedule_type = 'interval';
4303
4022
  }
4304
-
4305
4023
  el = el.tag('period');
4306
4024
  schedule_period_value = el.attr('value');
4307
4025
  schedule_period_unit = el.attr('unit');
4308
4026
  }
4309
-
4310
4027
  el = entry.tag('manufacturedProduct').tag('code');
4311
4028
  var product_name = el.attr('displayName'),
4312
- product_code = el.attr('code'),
4313
- product_code_system = el.attr('codeSystem');
4029
+ product_code = el.attr('code'),
4030
+ product_code_system = el.attr('codeSystem');
4314
4031
  var product_original_text = null;
4315
4032
  el = entry.tag('manufacturedProduct').tag('originalText');
4316
-
4317
4033
  if (!el.isEmpty()) {
4318
4034
  product_original_text = Core.stripWhitespace(el.val());
4319
- } // if we don't have a product name yet, try the originalText version
4320
-
4321
-
4035
+ }
4036
+ // if we don't have a product name yet, try the originalText version
4322
4037
  if (!product_name && product_original_text) {
4323
4038
  product_name = product_original_text;
4324
4039
  }
4325
-
4326
4040
  el = entry.tag('manufacturedProduct').tag('translation');
4327
4041
  var translation_name = el.attr('displayName'),
4328
- translation_code = el.attr('code'),
4329
- translation_code_system = el.attr('codeSystem'),
4330
- translation_code_system_name = el.attr('codeSystemName');
4042
+ translation_code = el.attr('code'),
4043
+ translation_code_system = el.attr('codeSystem'),
4044
+ translation_code_system_name = el.attr('codeSystemName');
4331
4045
  el = entry.tag('doseQuantity');
4332
4046
  var dose_value = el.attr('value'),
4333
- dose_unit = el.attr('unit');
4047
+ dose_unit = el.attr('unit');
4334
4048
  el = entry.tag('rateQuantity');
4335
4049
  var rate_quantity_value = el.attr('value'),
4336
- rate_quantity_unit = el.attr('unit');
4050
+ rate_quantity_unit = el.attr('unit');
4337
4051
  el = entry.tag('precondition').tag('value');
4338
4052
  var precondition_name = el.attr('displayName'),
4339
- precondition_code = el.attr('code'),
4340
- precondition_code_system = el.attr('codeSystem');
4053
+ precondition_code = el.attr('code'),
4054
+ precondition_code_system = el.attr('codeSystem');
4341
4055
  el = entry.template('2.16.840.1.113883.10.20.22.4.19').tag('value');
4342
4056
  var reason_name = el.attr('displayName'),
4343
- reason_code = el.attr('code'),
4344
- reason_code_system = el.attr('codeSystem');
4057
+ reason_code = el.attr('code'),
4058
+ reason_code_system = el.attr('codeSystem');
4345
4059
  el = entry.tag('routeCode');
4346
4060
  var route_name = el.attr('displayName'),
4347
- route_code = el.attr('code'),
4348
- route_code_system = el.attr('codeSystem'),
4349
- route_code_system_name = el.attr('codeSystemName'); // participant/playingEntity => vehicle
4061
+ route_code = el.attr('code'),
4062
+ route_code_system = el.attr('codeSystem'),
4063
+ route_code_system_name = el.attr('codeSystemName');
4350
4064
 
4065
+ // participant/playingEntity => vehicle
4351
4066
  el = entry.tag('participant').tag('playingEntity');
4352
4067
  var vehicle_name = el.tag('name').val();
4353
- el = el.tag('code'); // prefer the code vehicle_name but fall back to the non-coded one
4354
-
4068
+ el = el.tag('code');
4069
+ // prefer the code vehicle_name but fall back to the non-coded one
4355
4070
  vehicle_name = el.attr('displayName') || vehicle_name;
4356
4071
  var vehicle_code = el.attr('code'),
4357
- vehicle_code_system = el.attr('codeSystem'),
4358
- vehicle_code_system_name = el.attr('codeSystemName');
4072
+ vehicle_code_system = el.attr('codeSystem'),
4073
+ vehicle_code_system_name = el.attr('codeSystemName');
4359
4074
  el = entry.tag('administrationUnitCode');
4360
4075
  var administration_name = el.attr('displayName'),
4361
- administration_code = el.attr('code'),
4362
- administration_code_system = el.attr('codeSystem'),
4363
- administration_code_system_name = el.attr('codeSystemName'); // performer => prescriber
4076
+ administration_code = el.attr('code'),
4077
+ administration_code_system = el.attr('codeSystem'),
4078
+ administration_code_system_name = el.attr('codeSystemName');
4364
4079
 
4080
+ // performer => prescriber
4365
4081
  el = entry.tag('performer');
4366
4082
  var prescriber_organization = el.tag('name').val(),
4367
- prescriber_person = null;
4083
+ prescriber_person = null;
4368
4084
  data.entries.push({
4369
4085
  date_range: {
4370
4086
  start: start_date,
@@ -4434,27 +4150,26 @@ module.exports = function (doc) {
4434
4150
  };
4435
4151
  };
4436
4152
 
4437
- /***/ }),
4153
+ /***/ },
4438
4154
 
4439
- /***/ 150:
4440
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4155
+ /***/ 123
4156
+ (module, __unused_webpack_exports, __webpack_require__) {
4441
4157
 
4442
- /*
4443
- * Parser for the CCDA problems section
4158
+ /*
4159
+ * Parser for the CCDA problems section
4444
4160
  */
4445
- var Core = __webpack_require__(1);
4446
4161
 
4162
+ var Core = __webpack_require__(211);
4447
4163
  module.exports = function (doc) {
4448
4164
  var self = this;
4449
4165
  self.doc = doc;
4450
-
4451
4166
  self.problems = function (ccda) {
4452
4167
  var parseDate = self.doc.parseDate;
4453
4168
  var parseName = self.doc.parseName;
4454
4169
  var parseAddress = self.doc.parseAddress;
4455
4170
  var problems = ccda.section('problems');
4456
4171
  var data = {},
4457
- el;
4172
+ el;
4458
4173
  data.entries = [];
4459
4174
  data.displayName = "Problems";
4460
4175
  data.templateId = problems.tag('templateId').attr('root');
@@ -4462,26 +4177,24 @@ module.exports = function (doc) {
4462
4177
  problems.entries().each(function (entry) {
4463
4178
  el = entry.tag('effectiveTime');
4464
4179
  var start_date = parseDate(el.tag('low').attr('value')),
4465
- end_date = parseDate(el.tag('high').attr('value'));
4180
+ end_date = parseDate(el.tag('high').attr('value'));
4466
4181
  el = entry.template('2.16.840.1.113883.10.20.22.4.4').tag('value');
4467
4182
  var name = el.attr('displayName'),
4468
- code = el.attr('code'),
4469
- code_system = el.attr('codeSystem'),
4470
- code_system_name = el.attr('codeSystemName');
4183
+ code = el.attr('code'),
4184
+ code_system = el.attr('codeSystem'),
4185
+ code_system_name = el.attr('codeSystemName');
4471
4186
  el = entry.template('2.16.840.1.113883.10.20.22.4.4').tag('translation');
4472
4187
  var translation_name = el.attr('displayName'),
4473
- translation_code = el.attr('code'),
4474
- translation_code_system = el.attr('codeSystem'),
4475
- translation_code_system_name = el.attr('codeSystemName');
4188
+ translation_code = el.attr('code'),
4189
+ translation_code_system = el.attr('codeSystem'),
4190
+ translation_code_system_name = el.attr('codeSystemName');
4476
4191
  el = entry.template('2.16.840.1.113883.10.20.22.4.6');
4477
4192
  var status = el.tag('value').attr('displayName');
4478
4193
  var age = null;
4479
4194
  el = entry.template('2.16.840.1.113883.10.20.22.4.31');
4480
-
4481
4195
  if (!el.isEmpty()) {
4482
4196
  age = parseFloat(el.tag('value').attr('value'));
4483
4197
  }
4484
-
4485
4198
  el = entry.template('2.16.840.1.113883.10.20.22.4.64');
4486
4199
  var comment = Core.stripWhitespace(el.tag('text').val());
4487
4200
  data.entries.push({
@@ -4508,27 +4221,26 @@ module.exports = function (doc) {
4508
4221
  };
4509
4222
  };
4510
4223
 
4511
- /***/ }),
4224
+ /***/ },
4512
4225
 
4513
- /***/ 361:
4514
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4226
+ /***/ 301
4227
+ (module, __unused_webpack_exports, __webpack_require__) {
4515
4228
 
4516
- /*
4517
- * Parser for the CCDA procedures section
4229
+ /*
4230
+ * Parser for the CCDA procedures section
4518
4231
  */
4519
- var Core = __webpack_require__(1);
4520
4232
 
4233
+ var Core = __webpack_require__(211);
4521
4234
  module.exports = function (doc) {
4522
4235
  var self = this;
4523
4236
  self.doc = doc;
4524
-
4525
4237
  self.procedures = function (ccda) {
4526
4238
  var parseDate = self.doc.parseDate;
4527
4239
  var parseName = self.doc.parseName;
4528
4240
  var parseAddress = self.doc.parseAddress;
4529
4241
  var procedures = ccda.section('procedures');
4530
4242
  var data = {},
4531
- el;
4243
+ el;
4532
4244
  data.entries = [];
4533
4245
  data.displayName = "Procedures";
4534
4246
  data.templateId = procedures.tag('templateId').attr('root');
@@ -4538,29 +4250,29 @@ module.exports = function (doc) {
4538
4250
  var date = parseDate(el.attr('value'));
4539
4251
  el = entry.tag('code');
4540
4252
  var name = el.attr('displayName'),
4541
- code = el.attr('code'),
4542
- code_system = el.attr('codeSystem');
4543
-
4253
+ code = el.attr('code'),
4254
+ code_system = el.attr('codeSystem');
4544
4255
  if (!name) {
4545
4256
  name = Core.stripWhitespace(entry.tag('originalText').val());
4546
- } // 'specimen' tag not always present
4547
-
4257
+ }
4548
4258
 
4259
+ // 'specimen' tag not always present
4549
4260
  el = entry.tag('specimen').tag('code');
4550
4261
  var specimen_name = el.attr('displayName'),
4551
- specimen_code = el.attr('code'),
4552
- specimen_code_system = el.attr('codeSystem');
4262
+ specimen_code = el.attr('code'),
4263
+ specimen_code_system = el.attr('codeSystem');
4553
4264
  el = entry.tag('performer').tag('addr');
4554
4265
  var organization = el.tag('name').val(),
4555
- phone = el.tag('telecom').attr('value');
4266
+ phone = el.tag('telecom').attr('value');
4556
4267
  var performer_dict = parseAddress(el);
4557
4268
  performer_dict.organization = organization;
4558
- performer_dict.phone = phone; // participant => device
4269
+ performer_dict.phone = phone;
4559
4270
 
4271
+ // participant => device
4560
4272
  el = entry.template('2.16.840.1.113883.10.20.22.4.37').tag('code');
4561
4273
  var device_name = el.attr('displayName'),
4562
- device_code = el.attr('code'),
4563
- device_code_system = el.attr('codeSystem');
4274
+ device_code = el.attr('code'),
4275
+ device_code_system = el.attr('codeSystem');
4564
4276
  data.entries.push({
4565
4277
  date: date,
4566
4278
  name: name,
@@ -4583,27 +4295,26 @@ module.exports = function (doc) {
4583
4295
  };
4584
4296
  };
4585
4297
 
4586
- /***/ }),
4298
+ /***/ },
4587
4299
 
4588
- /***/ 824:
4589
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4300
+ /***/ 657
4301
+ (module, __unused_webpack_exports, __webpack_require__) {
4590
4302
 
4591
- /*
4592
- * Parser for the CCDA results (labs) section
4303
+ /*
4304
+ * Parser for the CCDA results (labs) section
4593
4305
  */
4594
- var Core = __webpack_require__(1);
4595
4306
 
4307
+ var Core = __webpack_require__(211);
4596
4308
  module.exports = function (doc) {
4597
4309
  var self = this;
4598
4310
  self.doc = doc;
4599
-
4600
4311
  self.results = function (ccda) {
4601
4312
  var parseDate = self.doc.parseDate;
4602
4313
  var parseName = self.doc.parseName;
4603
4314
  var parseAddress = self.doc.parseAddress;
4604
4315
  var results = ccda.section('results');
4605
4316
  var data = {},
4606
- el;
4317
+ el;
4607
4318
  data.entries = [];
4608
4319
  data.displayName = "Results";
4609
4320
  data.templateId = results.tag('templateId').attr('root');
@@ -4612,50 +4323,45 @@ module.exports = function (doc) {
4612
4323
  // panel
4613
4324
  el = entry.tag('code');
4614
4325
  var panel_name = el.attr('displayName'),
4615
- panel_code = el.attr('code'),
4616
- panel_code_system = el.attr('codeSystem'),
4617
- panel_code_system_name = el.attr('codeSystemName');
4326
+ panel_code = el.attr('code'),
4327
+ panel_code_system = el.attr('codeSystem'),
4328
+ panel_code_system_name = el.attr('codeSystemName');
4618
4329
  var observation;
4619
4330
  var tests = entry.elsByTag('observation');
4620
4331
  var tests_data = [];
4621
-
4622
4332
  for (var i = 0; i < tests.length; i++) {
4623
4333
  observation = tests[i];
4624
4334
  var date = parseDate(observation.tag('effectiveTime').attr('value'));
4625
4335
  el = observation.tag('code');
4626
4336
  var name = el.attr('displayName'),
4627
- code = el.attr('code'),
4628
- code_system = el.attr('codeSystem'),
4629
- code_system_name = el.attr('codeSystemName');
4630
-
4337
+ code = el.attr('code'),
4338
+ code_system = el.attr('codeSystem'),
4339
+ code_system_name = el.attr('codeSystemName');
4631
4340
  if (!name) {
4632
4341
  name = Core.stripWhitespace(observation.tag('text').val());
4633
4342
  }
4634
-
4635
4343
  el = observation.tag('translation');
4636
4344
  var translation_name = el.attr('displayName'),
4637
- translation_code = el.attr('code'),
4638
- translation_code_system = el.attr('codeSystem'),
4639
- translation_code_system_name = el.attr('codeSystemName');
4345
+ translation_code = el.attr('code'),
4346
+ translation_code_system = el.attr('codeSystem'),
4347
+ translation_code_system_name = el.attr('codeSystemName');
4640
4348
  el = observation.tag('value');
4641
4349
  var value = el.attr('value'),
4642
- unit = el.attr('unit'); // We could look for xsi:type="PQ" (physical quantity) but it seems better
4350
+ unit = el.attr('unit');
4351
+ // We could look for xsi:type="PQ" (physical quantity) but it seems better
4643
4352
  // not to trust that that field has been used correctly...
4644
-
4645
4353
  if (value && !isNaN(parseFloat(value))) {
4646
4354
  value = parseFloat(value);
4647
4355
  }
4648
-
4649
4356
  if (!value) {
4650
4357
  value = el.val(); // look for free-text values
4651
4358
  }
4652
-
4653
4359
  el = observation.tag('referenceRange');
4654
4360
  var reference_range_text = Core.stripWhitespace(el.tag('observationRange').tag('text').val()),
4655
- reference_range_low_unit = el.tag('observationRange').tag('low').attr('unit'),
4656
- reference_range_low_value = el.tag('observationRange').tag('low').attr('value'),
4657
- reference_range_high_unit = el.tag('observationRange').tag('high').attr('unit'),
4658
- reference_range_high_value = el.tag('observationRange').tag('high').attr('value');
4361
+ reference_range_low_unit = el.tag('observationRange').tag('low').attr('unit'),
4362
+ reference_range_low_value = el.tag('observationRange').tag('low').attr('value'),
4363
+ reference_range_high_unit = el.tag('observationRange').tag('high').attr('unit'),
4364
+ reference_range_high_value = el.tag('observationRange').tag('high').attr('value');
4659
4365
  tests_data.push({
4660
4366
  date: date,
4661
4367
  name: name,
@@ -4679,7 +4385,6 @@ module.exports = function (doc) {
4679
4385
  }
4680
4386
  });
4681
4387
  }
4682
-
4683
4388
  data.entries.push({
4684
4389
  name: panel_name,
4685
4390
  code: panel_code,
@@ -4692,47 +4397,44 @@ module.exports = function (doc) {
4692
4397
  };
4693
4398
  };
4694
4399
 
4695
- /***/ }),
4400
+ /***/ },
4696
4401
 
4697
- /***/ 206:
4698
- /***/ ((module) => {
4402
+ /***/ 898
4403
+ (module) {
4699
4404
 
4700
- /*
4701
- * Parser for the CCDA smoking status in social history section
4405
+ /*
4406
+ * Parser for the CCDA smoking status in social history section
4702
4407
  */
4408
+
4703
4409
  module.exports = function (doc) {
4704
4410
  var self = this;
4705
4411
  self.doc = doc;
4706
-
4707
4412
  self.smoking_status = function (ccda) {
4708
4413
  var parseDate = self.doc.parseDate;
4709
4414
  var parseName = self.doc.parseName;
4710
4415
  var parseAddress = self.doc.parseAddress;
4711
4416
  var data, el;
4712
4417
  var name = null,
4713
- code = null,
4714
- code_system = null,
4715
- code_system_name = null,
4716
- entry_date = null; // We can parse all of the social_history sections,
4418
+ code = null,
4419
+ code_system = null,
4420
+ code_system_name = null,
4421
+ entry_date = null;
4422
+
4423
+ // We can parse all of the social_history sections,
4717
4424
  // but in practice, this section seems to be used for
4718
4425
  // smoking status, so we're just going to break that out.
4719
4426
  // And we're just looking for the first non-empty one.
4720
-
4721
4427
  var social_history = ccda.section('social_history');
4722
4428
  var entries = social_history.entries();
4723
-
4724
4429
  for (var i = 0; i < entries.length; i++) {
4725
4430
  var entry = entries[i];
4726
4431
  var smoking_status = entry.template('2.16.840.1.113883.10.20.22.4.78');
4727
-
4728
4432
  if (smoking_status.isEmpty()) {
4729
4433
  smoking_status = entry.template('2.16.840.1.113883.10.22.4.78');
4730
4434
  }
4731
-
4732
4435
  if (smoking_status.isEmpty()) {
4733
4436
  continue;
4734
4437
  }
4735
-
4736
4438
  el = smoking_status.tag('effectiveTime');
4737
4439
  entry_date = parseDate(el.attr('value'));
4738
4440
  el = smoking_status.tag('value');
@@ -4740,12 +4442,10 @@ module.exports = function (doc) {
4740
4442
  code = el.attr('code');
4741
4443
  code_system = el.attr('codeSystem');
4742
4444
  code_system_name = el.attr('codeSystemName');
4743
-
4744
4445
  if (name) {
4745
4446
  break;
4746
4447
  }
4747
4448
  }
4748
-
4749
4449
  data = {
4750
4450
  date: entry_date,
4751
4451
  name: name,
@@ -4757,25 +4457,25 @@ module.exports = function (doc) {
4757
4457
  };
4758
4458
  };
4759
4459
 
4760
- /***/ }),
4460
+ /***/ },
4761
4461
 
4762
- /***/ 204:
4763
- /***/ ((module) => {
4462
+ /***/ 248
4463
+ (module) {
4764
4464
 
4765
- /*
4766
- * Parser for the CCDA vitals section
4465
+ /*
4466
+ * Parser for the CCDA vitals section
4767
4467
  */
4468
+
4768
4469
  module.exports = function (doc) {
4769
4470
  var self = this;
4770
4471
  self.doc = doc;
4771
-
4772
4472
  self.vitals = function (ccda) {
4773
4473
  var parseDate = self.doc.parseDate;
4774
4474
  var parseName = self.doc.parseName;
4775
4475
  var parseAddress = self.doc.parseAddress;
4776
4476
  var vitals = ccda.section('vitals');
4777
4477
  var data = {},
4778
- el;
4478
+ el;
4779
4479
  data.entries = [];
4780
4480
  data.displayName = "Vitals";
4781
4481
  data.templateId = vitals.tag('templateId').attr('root');
@@ -4786,17 +4486,16 @@ module.exports = function (doc) {
4786
4486
  var result;
4787
4487
  var results = entry.elsByTag('component');
4788
4488
  var results_data = [];
4789
-
4790
4489
  for (var i = 0; i < results.length; i++) {
4791
4490
  result = results[i];
4792
4491
  el = result.tag('code');
4793
4492
  var name = el.attr('displayName'),
4794
- code = el.attr('code'),
4795
- code_system = el.attr('codeSystem'),
4796
- code_system_name = el.attr('codeSystemName');
4493
+ code = el.attr('code'),
4494
+ code_system = el.attr('codeSystem'),
4495
+ code_system_name = el.attr('codeSystemName');
4797
4496
  el = result.tag('value');
4798
4497
  var value = parseFloat(el.attr('value')),
4799
- unit = el.attr('unit');
4498
+ unit = el.attr('unit');
4800
4499
  results_data.push({
4801
4500
  name: name,
4802
4501
  code: code,
@@ -4806,7 +4505,6 @@ module.exports = function (doc) {
4806
4505
  unit: unit
4807
4506
  });
4808
4507
  }
4809
-
4810
4508
  data.entries.push({
4811
4509
  date: entry_date,
4812
4510
  results: results_data
@@ -4816,67 +4514,62 @@ module.exports = function (doc) {
4816
4514
  };
4817
4515
  };
4818
4516
 
4819
- /***/ }),
4517
+ /***/ },
4820
4518
 
4821
- /***/ 767:
4822
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4519
+ /***/ 236
4520
+ (module, __unused_webpack_exports, __webpack_require__) {
4823
4521
 
4824
- /*
4825
- * Parser for the CCDAR2 document
4522
+ /*
4523
+ * Parser for the CCDAR2 document
4826
4524
  */
4827
- var ParseGenericInfo = __webpack_require__(711);
4828
-
4829
- var Core = __webpack_require__(1);
4830
-
4831
- var DocumentParser = __webpack_require__(801);
4832
-
4833
- var DemographicsParser = __webpack_require__(825);
4834
-
4835
- var HealthConcernsParser = __webpack_require__(329);
4836
4525
 
4526
+ var ParseGenericInfo = __webpack_require__(120);
4527
+ var Core = __webpack_require__(211);
4528
+ var DocumentParser = __webpack_require__(466);
4529
+ var DemographicsParser = __webpack_require__(533);
4530
+ var HealthConcernsParser = __webpack_require__(677);
4837
4531
  module.exports = function (doc) {
4838
4532
  var self = this;
4839
4533
  self.doc = doc;
4840
4534
  self.documentParser = new DocumentParser(self.doc);
4841
4535
  self.demographicsParser = new DemographicsParser(self.doc);
4842
4536
  self.healthConcernsParser = new HealthConcernsParser(self.doc);
4843
-
4844
4537
  self.run = function (ccda) {
4845
4538
  var data = {};
4846
4539
  data.document = self.documentParser.document(ccda);
4847
4540
  data.demographics = self.demographicsParser.demographics(ccda);
4848
4541
  data.health_concerns_document = self.healthConcernsParser.health_concerns_document(ccda);
4849
- data.json = Core.json; // Decorate each section with Title, templateId and text and adds missing sections
4542
+ data.json = Core.json;
4850
4543
 
4544
+ // Decorate each section with Title, templateId and text and adds missing sections
4851
4545
  ParseGenericInfo(ccda, data);
4852
4546
  return data;
4853
4547
  };
4854
4548
  };
4855
4549
 
4856
- /***/ }),
4550
+ /***/ },
4857
4551
 
4858
- /***/ 801:
4859
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4552
+ /***/ 466
4553
+ (module, __unused_webpack_exports, __webpack_require__) {
4860
4554
 
4861
- /*
4862
- * Parser for the CCDAR2 document section
4555
+ /*
4556
+ * Parser for the CCDAR2 document section
4863
4557
  */
4864
- var Core = __webpack_require__(1);
4865
-
4558
+ var Core = __webpack_require__(211);
4866
4559
  module.exports = function (doc) {
4867
4560
  var self = this;
4868
4561
  self.doc = doc;
4869
-
4870
4562
  self.document = function (ccda) {
4871
4563
  var parseDate = self.doc.parseDate;
4872
4564
  var parseName = self.doc.parseName;
4873
4565
  var parseAddress = self.doc.parseAddress;
4874
4566
  var data = {},
4875
- el;
4567
+ el;
4876
4568
  var doc = ccda.section('document');
4877
4569
  var date = parseDate(doc.tag('effectiveTime').attr('value'));
4878
- var title = Core.stripWhitespace(doc.tag('title').val()); // Parse Doc Type Info
4570
+ var title = Core.stripWhitespace(doc.tag('title').val());
4879
4571
 
4572
+ // Parse Doc Type Info
4880
4573
  var templates = doc.elsByTag('templateId');
4881
4574
  var rootTemplate = templates[0].attr('root');
4882
4575
  var secondTemplate;
@@ -4894,7 +4587,6 @@ module.exports = function (doc) {
4894
4587
  rawText: "",
4895
4588
  reference: ""
4896
4589
  };
4897
-
4898
4590
  if (nonXmlNodes && nonXmlNodes.length > 0) {
4899
4591
  bodyType = "unstructured";
4900
4592
  var text = nonXml.tag('text');
@@ -4902,20 +4594,19 @@ module.exports = function (doc) {
4902
4594
  var representation = "";
4903
4595
  var rawText = "";
4904
4596
  var reference = "";
4905
- var type = ""; // We have an embedded doc
4597
+ var type = "";
4906
4598
 
4599
+ // We have an embedded doc
4907
4600
  if (text && text.attr('mediaType')) {
4908
4601
  mediaType = text.attr('mediaType');
4909
4602
  representation = text.attr('representation');
4910
4603
  rawText = text.val();
4911
4604
  type = "embedded";
4912
4605
  }
4913
-
4914
4606
  if (text && !mediaType) {
4915
4607
  reference = text.tag('reference').attr('value');
4916
4608
  type = "reference";
4917
4609
  }
4918
-
4919
4610
  nonXmlBody = {
4920
4611
  type: type,
4921
4612
  mediaType: mediaType,
@@ -4924,7 +4615,6 @@ module.exports = function (doc) {
4924
4615
  reference: reference
4925
4616
  };
4926
4617
  }
4927
-
4928
4618
  var docType = {
4929
4619
  type: "CCDAR2",
4930
4620
  rootTemplateId: rootTemplate,
@@ -4943,7 +4633,6 @@ module.exports = function (doc) {
4943
4633
  var work_phone = el.attr('value');
4944
4634
  var documentation_of_list = [];
4945
4635
  var performers = doc.tag('documentationOf').elsByTag('performer');
4946
-
4947
4636
  for (var i = 0; i < performers.length; i++) {
4948
4637
  el = performers[i];
4949
4638
  var performer_name_dict = parseName(el);
@@ -4957,17 +4646,14 @@ module.exports = function (doc) {
4957
4646
  address: performer_addr
4958
4647
  });
4959
4648
  }
4960
-
4961
4649
  el = doc.tag('encompassingEncounter').tag('location');
4962
4650
  var location_name = Core.stripWhitespace(el.tag('name').val());
4963
4651
  var location_addr_dict = parseAddress(el.tag('addr'));
4964
4652
  var encounter_date = null;
4965
4653
  el = el.tag('effectiveTime');
4966
-
4967
4654
  if (!el.isEmpty()) {
4968
4655
  encounter_date = parseDate(el.attr('value'));
4969
4656
  }
4970
-
4971
4657
  data = {
4972
4658
  type: docType,
4973
4659
  date: date,
@@ -4990,40 +4676,40 @@ module.exports = function (doc) {
4990
4676
  };
4991
4677
  };
4992
4678
 
4993
- /***/ }),
4679
+ /***/ },
4994
4680
 
4995
- /***/ 329:
4996
- /***/ ((module) => {
4681
+ /***/ 677
4682
+ (module) {
4997
4683
 
4998
- /*
4999
- * Parser for the CCDAR2 Health Concerns Section
5000
- * 2.16.840.1.113883.10.20.22.2.58
4684
+ /*
4685
+ * Parser for the CCDAR2 Health Concerns Section
4686
+ * 2.16.840.1.113883.10.20.22.2.58
5001
4687
  */
4688
+
5002
4689
  module.exports = function (doc) {
5003
4690
  var self = this;
5004
4691
  self.doc = doc;
5005
-
5006
4692
  self.health_concerns_document = function (ccda) {
5007
4693
  var parseDate = self.doc.parseDate;
5008
4694
  var parseName = self.doc.parseName;
5009
- var parseAddress = self.doc.parseAddress; // Helper to create each iterator for collection
4695
+ var parseAddress = self.doc.parseAddress;
5010
4696
 
4697
+ // Helper to create each iterator for collection
5011
4698
  var each = function each(callback) {
5012
4699
  for (var i = 0; i < this.length; i++) {
5013
4700
  callback(this[i]);
5014
4701
  }
5015
4702
  };
5016
-
5017
4703
  var model = {},
5018
- el;
4704
+ el;
5019
4705
  model.entries = [];
5020
4706
  model.text = ccda.tag('text').val(true);
5021
4707
  var health_concerns = ccda.section('health_concerns_document');
5022
4708
  var title = health_concerns.tag('title').val();
5023
4709
  health_concerns.entries().each(function (entry) {
5024
- var entryModel = {}; // Parse out the ACT Body
4710
+ var entryModel = {};
4711
+ // Parse out the ACT Body
5025
4712
  //A record of something that is being done, has been done, can be done, or is intended or requested to be done.
5026
-
5027
4713
  var act = entry.tag('act');
5028
4714
  var er = act.elsByTag('entryRelationship');
5029
4715
  var templateId = act.tag('templateId').attr('root');
@@ -5031,13 +4717,16 @@ module.exports = function (doc) {
5031
4717
  var statusCode = act.tag('statusCode').attr('code');
5032
4718
  var code = act.tag('code');
5033
4719
  var name = code.attr('displayName');
5034
- var effectiveTime = parseDate(entry.tag('effectiveTime')); // The model we want to return in json
4720
+ var effectiveTime = parseDate(entry.tag('effectiveTime'));
5035
4721
 
4722
+ // The model we want to return in json
5036
4723
  var actModel = {
5037
4724
  effective_time: effectiveTime,
5038
4725
  name: name,
5039
4726
  entry_relationship: []
5040
- }; // Parse Entity Relationship child nodes
4727
+ };
4728
+
4729
+ // Parse Entity Relationship child nodes
5041
4730
 
5042
4731
  var ers = entry.elsByTag('entryRelationship');
5043
4732
  ers.each = each;
@@ -5047,8 +4736,9 @@ module.exports = function (doc) {
5047
4736
  observations: []
5048
4737
  };
5049
4738
  var obs = er.elsByTag('observation');
5050
- obs.each = each; // Parse out Obsevations for Each ER
4739
+ obs.each = each;
5051
4740
 
4741
+ // Parse out Obsevations for Each ER
5052
4742
  obs.each(function (ob) {
5053
4743
  erModel.observations.push({
5054
4744
  class_code: ob.attr('classCode'),
@@ -5058,8 +4748,9 @@ module.exports = function (doc) {
5058
4748
  });
5059
4749
  });
5060
4750
  actModel.entry_relationship.push(erModel);
5061
- }); // Add ACT Model to our final return model
4751
+ });
5062
4752
 
4753
+ // Add ACT Model to our final return model
5063
4754
  entryModel['act'] = actModel;
5064
4755
  model.entries.push(entryModel);
5065
4756
  });
@@ -5067,24 +4758,24 @@ module.exports = function (doc) {
5067
4758
  };
5068
4759
  };
5069
4760
 
5070
- /***/ }),
4761
+ /***/ },
5071
4762
 
5072
- /***/ 711:
5073
- /***/ ((module) => {
4763
+ /***/ 120
4764
+ (module) {
5074
4765
 
5075
4766
  /* Parses out basic data about each section */
4767
+
5076
4768
  module.exports = function (ccda, data) {
5077
4769
  var each = function each(callback) {
5078
4770
  for (var i = 0; i < this.length; i++) {
5079
4771
  callback(this[i]);
5080
4772
  }
5081
4773
  };
5082
-
5083
4774
  var containsTemplateId = function containsTemplateId(templateId, data) {
5084
4775
  for (var property in data) {
5085
4776
  if (data.hasOwnProperty(property)) {
5086
- var p = data[property].templateId; //var display = this[property].displayName;
5087
-
4777
+ var p = data[property].templateId;
4778
+ //var display = this[property].displayName;
5088
4779
  if (p) {
5089
4780
  if (p === templateId) {
5090
4781
  //console.log("TemplateId Match " + templateId + " " + display);
@@ -5093,25 +4784,23 @@ module.exports = function (ccda, data) {
5093
4784
  }
5094
4785
  }
5095
4786
  }
5096
-
5097
4787
  return false;
5098
4788
  };
5099
-
5100
4789
  var allSections = ccda.elsByTag('section');
5101
4790
  allSections.each = each;
5102
4791
  allSections.each(function (s) {
5103
4792
  var code = s.tag('code').attr('displayName');
5104
4793
  var templateId = s.tag('templateId').attr('root');
5105
4794
  var existingTemplateId = containsTemplateId(templateId, data);
5106
-
5107
4795
  if (code) {
5108
- var nodeName = code.split(' ').join('_').toLowerCase(); //console.log("NODE NAME " + nodeName);
4796
+ var nodeName = code.split(' ').join('_').toLowerCase();
4797
+
4798
+ //console.log("NODE NAME " + nodeName);
5109
4799
 
5110
4800
  if (!data[nodeName] && !existingTemplateId) {
5111
4801
  //console.log("CREATE NODE " + code);
5112
4802
  data[nodeName] = {};
5113
4803
  }
5114
-
5115
4804
  if (data[nodeName]) {
5116
4805
  data[nodeName].displayName = code;
5117
4806
  data[nodeName].templateId = templateId;
@@ -5121,23 +4810,23 @@ module.exports = function (ccda, data) {
5121
4810
  });
5122
4811
  };
5123
4812
 
5124
- /***/ }),
4813
+ /***/ },
5125
4814
 
5126
- /***/ 992:
5127
- /***/ ((module) => {
4815
+ /***/ 511
4816
+ (module) {
5128
4817
 
5129
4818
  "use strict";
5130
4819
  module.exports = require("@xmldom/xmldom");
5131
4820
 
5132
- /***/ }),
4821
+ /***/ },
5133
4822
 
5134
- /***/ 517:
5135
- /***/ ((module) => {
4823
+ /***/ 825
4824
+ (module) {
5136
4825
 
5137
4826
  "use strict";
5138
4827
  module.exports = require("lodash");
5139
4828
 
5140
- /***/ })
4829
+ /***/ }
5141
4830
 
5142
4831
  /******/ });
5143
4832
  /************************************************************************/
@@ -5183,7 +4872,7 @@ module.exports = require("lodash");
5183
4872
  /******/ // startup
5184
4873
  /******/ // Load entry module and return exports
5185
4874
  /******/ // This entry module is referenced by other modules so it can't be inlined
5186
- /******/ var __webpack_exports__ = __webpack_require__(97);
4875
+ /******/ var __webpack_exports__ = __webpack_require__(376);
5187
4876
  /******/
5188
4877
  /******/ return __webpack_exports__;
5189
4878
  /******/ })()