@esri/solutions-components 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. package/dist/cjs/calcite-input-text_5.cjs.entry.js +36 -36
  2. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +1 -1
  3. package/dist/cjs/solution-configuration.cjs.entry.js +1 -1
  4. package/dist/cjs/solution-contents_3.cjs.entry.js +1 -1
  5. package/dist/cjs/{solution-store-70002b57.js → solution-store-ca4639d5.js} +3 -3
  6. package/dist/collection/components/add-record-modal/test/add-record-modal.e2e.js +24 -0
  7. package/dist/collection/components/add-record-modal/test/add-record-modal.spec.js +32 -0
  8. package/dist/collection/components/buffer-tools/test/buffer-tools.e2e.js +24 -0
  9. package/dist/collection/components/buffer-tools/test/buffer-tools.spec.js +157 -0
  10. package/dist/collection/components/card-manager/test/card-manager.e2e.js +24 -0
  11. package/dist/collection/components/card-manager/test/card-manager.spec.js +32 -0
  12. package/dist/collection/components/comment-card/test/comment-card.e2e.js +24 -0
  13. package/dist/collection/components/comment-card/test/comment-card.spec.js +32 -0
  14. package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.e2e.js +24 -0
  15. package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.spec.js +32 -0
  16. package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.e2e.js +24 -0
  17. package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.spec.js +32 -0
  18. package/dist/collection/components/deduct-calculator/test/deduct-calculator.e2e.js +24 -0
  19. package/dist/collection/components/deduct-calculator/test/deduct-calculator.spec.js +32 -0
  20. package/dist/collection/components/edit-record-modal/test/edit-record-modal.e2e.js +24 -0
  21. package/dist/collection/components/edit-record-modal/test/edit-record-modal.spec.js +32 -0
  22. package/dist/collection/components/info-card/test/info-card.e2e.js +24 -0
  23. package/dist/collection/components/info-card/test/info-card.spec.js +32 -0
  24. package/dist/collection/components/json-editor/test/json-editor.e2e.js +31 -0
  25. package/dist/collection/components/json-editor/test/json-editor.spec.js +60 -0
  26. package/dist/collection/components/layer-table/test/layer-table.e2e.js +24 -0
  27. package/dist/collection/components/layer-table/test/layer-table.spec.js +32 -0
  28. package/dist/collection/components/list-item/test/list-item.e2e.js +24 -0
  29. package/dist/collection/components/list-item/test/list-item.spec.js +32 -0
  30. package/dist/collection/components/map-card/test/map-card.e2e.js +24 -0
  31. package/dist/collection/components/map-card/test/map-card.spec.js +32 -0
  32. package/dist/collection/components/map-draw-tools/test/map-draw-tools.e2e.js +24 -0
  33. package/dist/collection/components/map-draw-tools/test/map-draw-tools.spec.js +32 -0
  34. package/dist/collection/components/map-layer-picker/test/map-layer-picker.e2e.js +24 -0
  35. package/dist/collection/components/map-layer-picker/test/map-layer-picker.spec.js +109 -0
  36. package/dist/collection/components/map-search/test/map-search.e2e.js +24 -0
  37. package/dist/collection/components/map-search/test/map-search.spec.js +53 -0
  38. package/dist/collection/components/map-select-tools/map-select-tools.js +36 -36
  39. package/dist/collection/components/map-select-tools/test/map-select-tools.e2e.js +24 -0
  40. package/dist/collection/components/map-select-tools/test/map-select-tools.spec.js +349 -0
  41. package/dist/collection/components/media-card/test/media-card.e2e.js +24 -0
  42. package/dist/collection/components/media-card/test/media-card.spec.js +32 -0
  43. package/dist/collection/components/pci-calculator/test/pci-calculator.e2e.js +24 -0
  44. package/dist/collection/components/pci-calculator/test/pci-calculator.spec.js +32 -0
  45. package/dist/collection/components/pdf-download/test/pdf-download.e2e.js +71 -0
  46. package/dist/collection/components/pdf-download/test/pdf-download.spec.js +104 -0
  47. package/dist/collection/components/public-notification/test/public-notification.e2e.js +95 -0
  48. package/dist/collection/components/public-notification/test/public-notification.spec.js +149 -0
  49. package/dist/collection/components/refine-selection/refine-selection.css +85 -85
  50. package/dist/collection/components/solution-configuration/test/solution-configuration.e2e.js +31 -0
  51. package/dist/collection/components/solution-configuration/test/solution-configuration.spec.js +114 -0
  52. package/dist/collection/components/solution-contents/test/solution-contents.e2e.js +89 -0
  53. package/dist/collection/components/solution-contents/test/solution-contents.spec.js +138 -0
  54. package/dist/collection/components/solution-item/test/solution-item.e2e.js +31 -0
  55. package/dist/collection/components/solution-item/test/solution-item.spec.js +72 -0
  56. package/dist/collection/components/solution-item-details/test/solution-item-details.e2e.js +31 -0
  57. package/dist/collection/components/solution-item-details/test/solution-item-details.spec.js +137 -0
  58. package/dist/collection/components/solution-item-icon/test/solution-item-icon.e2e.js +24 -0
  59. package/dist/collection/components/solution-item-icon/test/solution-item-icon.spec.js +34 -0
  60. package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.e2e.js +31 -0
  61. package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.spec.js +49 -0
  62. package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.e2e.js +31 -0
  63. package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.spec.js +60 -0
  64. package/dist/collection/components/solution-resource-item/test/solution-resource-item.e2e.js +31 -0
  65. package/dist/collection/components/solution-resource-item/test/solution-resource-item.spec.js +50 -0
  66. package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.e2e.js +31 -0
  67. package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.spec.js +170 -0
  68. package/dist/collection/components/solution-template-data/test/solution-template-data.e2e.js +31 -0
  69. package/dist/collection/components/solution-template-data/test/solution-template-data.spec.js +55 -0
  70. package/dist/collection/components/solution-variables/test/solution-variables.e2e.js +31 -0
  71. package/dist/collection/components/solution-variables/test/solution-variables.spec.js +126 -0
  72. package/dist/collection/utils/publicNotificationUtils.js +45 -0
  73. package/dist/collection/utils/templates.e2e.js +25 -0
  74. package/dist/collection/utils/test/csvUtils.spec.js +46 -0
  75. package/dist/collection/utils/test/downloadUtils.spec.js +102 -0
  76. package/dist/collection/utils/test/pciUtils.spec.js +297 -0
  77. package/dist/collection/utils/test/solution-store.spec.js +439 -0
  78. package/dist/components/map-select-tools2.js +36 -36
  79. package/dist/components/solution-store.js +3 -3
  80. package/dist/esm/calcite-input-text_5.entry.js +36 -36
  81. package/dist/esm/calcite-shell-panel_14.entry.js +1 -1
  82. package/dist/esm/solution-configuration.entry.js +1 -1
  83. package/dist/esm/solution-contents_3.entry.js +1 -1
  84. package/dist/esm/{solution-store-5d068b07.js → solution-store-70f874f8.js} +3 -3
  85. package/dist/solutions-components/{p-41802f6b.entry.js → p-16dfb254.entry.js} +1 -1
  86. package/dist/solutions-components/{p-4769a2a5.entry.js → p-5ed755a2.entry.js} +1 -1
  87. package/dist/solutions-components/{p-826a814d.js → p-78719506.js} +2 -2
  88. package/dist/solutions-components/{p-9f620303.entry.js → p-b4b19fd3.entry.js} +1 -1
  89. package/dist/solutions-components/{p-24fe6e1c.entry.js → p-d5d5942d.entry.js} +1 -1
  90. package/dist/solutions-components/solutions-components.esm.js +1 -1
  91. package/dist/solutions-components/utils/common.js +291 -0
  92. package/dist/solutions-components/utils/csvDownload.js +36 -0
  93. package/dist/solutions-components/utils/csvUtils.js +32 -0
  94. package/dist/solutions-components/utils/downloadUtils.js +386 -0
  95. package/dist/solutions-components/utils/interfaces.js +56 -0
  96. package/dist/solutions-components/utils/languageUtil.js +85 -0
  97. package/dist/solutions-components/utils/loadModules.js +20 -0
  98. package/dist/solutions-components/utils/locale.js +56 -0
  99. package/dist/solutions-components/utils/mapViewUtils.js +140 -0
  100. package/dist/solutions-components/utils/pciUtils.js +837 -0
  101. package/dist/solutions-components/utils/pdfUtils.js +62 -0
  102. package/dist/solutions-components/utils/publicNotificationStore.js +38 -0
  103. package/dist/solutions-components/utils/publicNotificationUtils.js +45 -0
  104. package/dist/solutions-components/utils/queryUtils.js +148 -0
  105. package/dist/solutions-components/utils/solution-store.js +579 -0
  106. package/dist/solutions-components/utils/templates.e2e.js +25 -0
  107. package/dist/solutions-components/utils/templates.js +341 -0
  108. package/dist/solutions-components/utils/test/csvUtils.spec.js +46 -0
  109. package/dist/solutions-components/utils/test/downloadUtils.spec.js +102 -0
  110. package/dist/solutions-components/utils/test/mocks/jsApi.js +74 -0
  111. package/dist/solutions-components/utils/test/pciUtils.spec.js +297 -0
  112. package/dist/solutions-components/utils/test/solution-store.spec.js +439 -0
  113. package/dist/solutions-components/utils/test/testUtils.js +135 -0
  114. package/dist/solutions-components/utils/types.js +14 -0
  115. package/dist/solutions-components_commit.txt +7 -0
  116. package/package.json +7 -7
@@ -0,0 +1,837 @@
1
+ /** @license
2
+ * Copyright 2022 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Effect of the distresses on ride quality.
18
+ *
19
+ * L - Low. Individual bumps or settlements, or both, cause the vehicle to bounce slightly,
20
+ * but create little discomfort.
21
+ *
22
+ * M - Medium. Individual bumps or settlements, or both, cause the vehicle to bounce significantly,
23
+ * creating some discomfort.
24
+ *
25
+ * H - High. Individual bumps or settlements, or both, cause the vehicle to bounce excessively,
26
+ * creating substantial discomfort, safety hazard, or high potential vehicle damage.
27
+ *
28
+ * @returns Promise resolving when function is done
29
+ *
30
+ */
31
+ export var ESeverity;
32
+ (function (ESeverity) {
33
+ ESeverity["H"] = "H";
34
+ ESeverity["M"] = "M";
35
+ ESeverity["L"] = "L";
36
+ })(ESeverity || (ESeverity = {}));
37
+ /**
38
+ * Type of distress as defined by ASTM standard
39
+ *
40
+ */
41
+ export var EDistressType;
42
+ (function (EDistressType) {
43
+ EDistressType[EDistressType["ALLIGATOR_CRACKING"] = 1] = "ALLIGATOR_CRACKING";
44
+ EDistressType[EDistressType["BLEEDING"] = 2] = "BLEEDING";
45
+ EDistressType[EDistressType["BLOCK_CRACKING"] = 3] = "BLOCK_CRACKING";
46
+ EDistressType[EDistressType["BUMPS_SAGS"] = 4] = "BUMPS_SAGS";
47
+ EDistressType[EDistressType["CORRUGATION"] = 5] = "CORRUGATION";
48
+ EDistressType[EDistressType["DEPRESSION"] = 6] = "DEPRESSION";
49
+ EDistressType[EDistressType["EDGE_CRACKING"] = 7] = "EDGE_CRACKING";
50
+ EDistressType[EDistressType["REFLECTION_CRACKING"] = 8] = "REFLECTION_CRACKING";
51
+ EDistressType[EDistressType["LANE_SHOULDER_DROP_OFF"] = 9] = "LANE_SHOULDER_DROP_OFF";
52
+ EDistressType[EDistressType["LONG_TRANS_CRACKING"] = 10] = "LONG_TRANS_CRACKING";
53
+ EDistressType[EDistressType["PATCHING_UTIL_CUT_PATCHING"] = 11] = "PATCHING_UTIL_CUT_PATCHING";
54
+ EDistressType[EDistressType["POLISHED_AGGREGATE"] = 12] = "POLISHED_AGGREGATE";
55
+ EDistressType[EDistressType["POTHOLES"] = 13] = "POTHOLES";
56
+ EDistressType[EDistressType["RAILROAD_CROSSING"] = 14] = "RAILROAD_CROSSING";
57
+ EDistressType[EDistressType["RUTTING"] = 15] = "RUTTING";
58
+ EDistressType[EDistressType["SHOVING"] = 16] = "SHOVING";
59
+ EDistressType[EDistressType["SLIPPAGE_CRACKING"] = 17] = "SLIPPAGE_CRACKING";
60
+ EDistressType[EDistressType["SWELL"] = 18] = "SWELL";
61
+ EDistressType[EDistressType["RAVELING"] = 19] = "RAVELING";
62
+ EDistressType[EDistressType["WEATHERING"] = 20] = "WEATHERING";
63
+ })(EDistressType || (EDistressType = {}));
64
+ /**
65
+ * Calculate the deduct value for the given distress.
66
+ *
67
+ * @param type expects 1-19 as a string
68
+ * @param severity expects "H" | "M" | "L"
69
+ * @param density the calculated percent density ralative to the total sample area
70
+ * @param showDebugging used to control debugging messages to show the various
71
+ * calculations a required steps along the way.
72
+ * The main reason this is optional is that it provides no value when used within
73
+ * Survey123 as we have nowhere to see the messages and I wasn't sure if writing to a
74
+ * console in that context could have any negative side effects.
75
+ *
76
+ * @returns pipe delimited string: type|severity|roundedDeductValue|density
77
+ */
78
+ export function calculateDeductValue(type, severity, density, showDebugging = false) {
79
+ // When called from survey123 we will get the args as strings
80
+ // not sure if they could be numbers so a little extra conversion to make sure with the density
81
+ const _type = parseInt(type);
82
+ const _severity = ESeverity[severity];
83
+ const _density = parseFloat(density.toString());
84
+ // When called from survey123 all distress types and severities will be passed in
85
+ // We only need to calculate the deduct value if we have a valid density
86
+ if (Number.isNaN(_density) || _density === 0) {
87
+ return "";
88
+ }
89
+ const _showDebugging = showDebugging === true || showDebugging.toString().toLowerCase() === "true";
90
+ let calc;
91
+ switch (_type) {
92
+ case EDistressType.ALLIGATOR_CRACKING:
93
+ calc = _calcAlligator;
94
+ break;
95
+ case EDistressType.BLEEDING:
96
+ calc = _calcBleeding;
97
+ break;
98
+ case EDistressType.BLOCK_CRACKING:
99
+ calc = _calcBlockCracking;
100
+ break;
101
+ case EDistressType.BUMPS_SAGS:
102
+ calc = _calcBumpsSags;
103
+ break;
104
+ case EDistressType.CORRUGATION:
105
+ calc = _calcCorrugation;
106
+ break;
107
+ case EDistressType.DEPRESSION:
108
+ calc = _calcDepression;
109
+ break;
110
+ case EDistressType.EDGE_CRACKING:
111
+ calc = _calcEdgeCracking;
112
+ break;
113
+ case EDistressType.REFLECTION_CRACKING:
114
+ calc = _calcReflectionCracking;
115
+ break;
116
+ case EDistressType.LANE_SHOULDER_DROP_OFF:
117
+ calc = _calcLaneShoulderDropOff;
118
+ break;
119
+ case EDistressType.LONG_TRANS_CRACKING:
120
+ calc = _calcLongTransCracking;
121
+ break;
122
+ case EDistressType.PATCHING_UTIL_CUT_PATCHING:
123
+ calc = _calcPatchingUtilCutPatching;
124
+ break;
125
+ case EDistressType.POLISHED_AGGREGATE:
126
+ calc = _calcPolishedAggregate;
127
+ break;
128
+ case EDistressType.POTHOLES:
129
+ calc = _calcPotholes;
130
+ break;
131
+ case EDistressType.RAILROAD_CROSSING:
132
+ calc = _calcRailroadCrossing;
133
+ break;
134
+ case EDistressType.RUTTING:
135
+ calc = _calcRutting;
136
+ break;
137
+ case EDistressType.SHOVING:
138
+ calc = _calcShoving;
139
+ break;
140
+ case EDistressType.SLIPPAGE_CRACKING:
141
+ calc = _calcSlippageCracking;
142
+ break;
143
+ case EDistressType.SWELL:
144
+ calc = _calcSwell;
145
+ break;
146
+ case EDistressType.RAVELING:
147
+ calc = _calcRaveling;
148
+ break;
149
+ case EDistressType.WEATHERING:
150
+ calc = _calcWeathering;
151
+ break;
152
+ }
153
+ const dv = calc(_severity, Math.log10(_density));
154
+ const roundedDV = _round(dv);
155
+ const formattedDV = `${type}|${severity}|${roundedDV}|${_density}`;
156
+ if (_showDebugging) {
157
+ console.log(`Deduct value: ${dv}`);
158
+ console.log(`Rounded deduct value: ${roundedDV}`);
159
+ console.log(`Formatted devduct value (type|severity|roundedDV|density): ${formattedDV}`);
160
+ }
161
+ return formattedDV;
162
+ }
163
+ /**
164
+ * Calculate the pavement condition index (PCI)
165
+ *
166
+ * @param deductValues string of comma delimited values
167
+ * @param showDebugging used to control debugging messages to show the various
168
+ * calculations a required steps along the way.
169
+ * The main reason this is optional is that it provides no value when used within
170
+ * Survey123 as we have nowhere to see the messages and I wasn't sure if writing to a
171
+ * console in that context could have any negative side effects.
172
+ *
173
+ * @returns the calculated PCI
174
+ */
175
+ export function calculatePCI(deductValues, showDebugging = false) {
176
+ // When called from survey123 we will get the args as strings
177
+ // When comparing multi-severities calculatePCI will be called multiple times
178
+ // When called from _evaluateMultiSeverity we will just recieve a comma delimited string
179
+ // When its just comma delimited we don't need to re-evaluate the multiple severities
180
+ let _deductValues = deductValues.indexOf("|") > -1 ?
181
+ _evaluateMultiSeverity(deductValues, showDebugging) :
182
+ deductValues.split(",").map(dv => parseFloat(dv));
183
+ const _showDebugging = showDebugging === true || showDebugging.toString().toLowerCase() === "true";
184
+ let pci = 0;
185
+ // filter out non-numbers
186
+ _deductValues = _deductValues.filter(dv => Math.abs(dv) > 0);
187
+ if (_deductValues.length > 0) {
188
+ const maxCDV = _getMaxCDV(_deductValues, _showDebugging);
189
+ pci = 100 - _round(maxCDV);
190
+ }
191
+ return pci;
192
+ }
193
+ /**
194
+ * Determine if corrections are required when we have multiple severities of a single distress type.
195
+ *
196
+ * @param deductValues string of comma delimited values e.g. "1|L|10|0.52,1|H|7|0.58"
197
+ * @param showDebugging used to control debugging messages to show the various
198
+ * calculations a required steps along the way.
199
+ *
200
+ * @returns an object that will contain any corrections for the current distress type
201
+ */
202
+ function _evaluateMultiSeverity(deductValues, showDebugging) {
203
+ const updates = {};
204
+ const _dvObject = _parseDeductValues(deductValues);
205
+ const multiSeverityKeys = Object.keys(_dvObject).filter(k => Object.keys(_dvObject[k]).length > 1);
206
+ if (multiSeverityKeys.length > 0) {
207
+ multiSeverityKeys.forEach(k => {
208
+ let hDeductValue;
209
+ let mDeductValue;
210
+ let lDeductValue;
211
+ let hDensity;
212
+ let mDensity;
213
+ let lDensity;
214
+ // need to know if 2 or 3 severity case
215
+ Object.keys(_dvObject[k]).forEach(_k => {
216
+ if (_k === "H") {
217
+ hDeductValue = _dvObject[k][_k].deductValue;
218
+ hDensity = _dvObject[k][_k].density;
219
+ }
220
+ else if (_k === "M") {
221
+ mDeductValue = _dvObject[k][_k].deductValue;
222
+ mDensity = _dvObject[k][_k].density;
223
+ }
224
+ else {
225
+ lDeductValue = _dvObject[k][_k].deductValue;
226
+ lDensity = _dvObject[k][_k].density;
227
+ }
228
+ });
229
+ const func = (hDensity && mDensity && lDensity) ?
230
+ _getThreeSeverityCaseUpdates : _getTwoSeverityCaseUpdates;
231
+ const update = func(k, hDeductValue, mDeductValue, lDeductValue, hDensity, mDensity, lDensity, showDebugging);
232
+ if (update) {
233
+ updates[k] = update;
234
+ if (showDebugging) {
235
+ console.log("updates");
236
+ console.log(updates);
237
+ }
238
+ }
239
+ });
240
+ }
241
+ return _getFinalDeductValues(deductValues, updates);
242
+ }
243
+ /**
244
+ * Determine if corrections are required when we have 3 severities of a single distress type.
245
+ *
246
+ * @param type the distress type 1-19 as a string
247
+ * @param hDeductValue high severity deduct value
248
+ * @param mDeductValue med severity deduct value
249
+ * @param lDeductValue low severity deduct value
250
+ * @param hDensity high severity density
251
+ * @param mDensity med severity density
252
+ * @param lDensity low severity density
253
+ * @param showDebugging used to control debugging messages to show the various
254
+ * calculations a required steps along the way.
255
+ *
256
+ * @returns undefined or an object that will contain any corrections for the current distress type
257
+ */
258
+ function _getThreeSeverityCaseUpdates(type, hDeductValue, mDeductValue, lDeductValue, hDensity, mDensity, lDensity, showDebugging) {
259
+ const pci1 = calculatePCI(`${hDeductValue},${mDeductValue},${lDeductValue}`, true);
260
+ if (showDebugging) {
261
+ console.log("pci1");
262
+ console.log(pci1);
263
+ }
264
+ const lm = lDensity + mDensity;
265
+ const lmPCI2 = _getPCI2(type, "M", lm.toString(), hDeductValue, showDebugging);
266
+ const mh = mDensity + hDensity;
267
+ const mhPCI2 = _getPCI2(type, "H", mh.toString(), lDeductValue, showDebugging);
268
+ const lh = lDensity + hDensity;
269
+ const lhPCI2 = _getPCI2(type, "H", lh.toString(), mDeductValue, showDebugging);
270
+ const lmh = lDensity + mDensity + hDensity;
271
+ const lmhPCI2 = _getPCI2(type, "H", lmh.toString(), 0, showDebugging);
272
+ if (showDebugging) {
273
+ console.log("low med pci2");
274
+ console.log(lmPCI2.pci);
275
+ console.log("med high pci2");
276
+ console.log(mhPCI2.pci);
277
+ console.log("low high pci2");
278
+ console.log(lhPCI2.pci);
279
+ console.log("low med high pci2");
280
+ console.log(lmhPCI2.pci);
281
+ }
282
+ const pcis = [lmPCI2, mhPCI2, lhPCI2, lmhPCI2];
283
+ const highest = pcis.reduce((prev, cur) => {
284
+ return cur.pci > pci1 && (!prev || cur.pci > prev.pci) ? cur : prev;
285
+ }, undefined);
286
+ return highest ? highest.dv : undefined;
287
+ }
288
+ /**
289
+ * Determine if corrections are required when we have 2 severities of a single distress type.
290
+ *
291
+ * @param type the distress type 1-19 as a string
292
+ * @param hDeductValue high severity deduct value
293
+ * @param mDeductValue med severity deduct value
294
+ * @param lDeductValue low severity deduct value
295
+ * @param hDensity high severity density
296
+ * @param mDensity med severity density
297
+ * @param lDensity low severity density
298
+ * @param showDebugging used to control debugging messages to show the various
299
+ * calculations a required steps along the way.
300
+ *
301
+ * @returns undefined or an object that will contain any corrections for the current distress type
302
+ */
303
+ function _getTwoSeverityCaseUpdates(type, hDeductValue, mDeductValue, lDeductValue, hDensity, mDensity, lDensity, showDebugging) {
304
+ const hDV = hDeductValue || mDeductValue;
305
+ const lDV = lDeductValue || mDeductValue;
306
+ const pci1 = calculatePCI(`${hDV},${lDV}`, true);
307
+ if (showDebugging) {
308
+ console.log("pci1");
309
+ console.log(pci1);
310
+ }
311
+ const hDen = hDensity || mDensity;
312
+ const lDen = lDensity || mDensity;
313
+ const sumDen = hDen + lDen;
314
+ const highestSeverity = hDen === hDensity ? "H" : "M";
315
+ const pci2 = _getPCI2(type, highestSeverity, sumDen.toString(), 0, showDebugging);
316
+ if (showDebugging) {
317
+ console.log("pci2");
318
+ console.log(pci2.pci);
319
+ }
320
+ return pci2.pci > pci1 ? pci2.dv : undefined;
321
+ }
322
+ /**
323
+ * Used to test for highest PCI when we have multiple severity cases for a single distress type.
324
+ *
325
+ * @param type the distress type 1-19 as a string
326
+ * @param severity expects "H" | "M" | "L"
327
+ * @param density the calculated percent density ralative to the total sample area
328
+ * @param secondDeductValue optional deduct value will be 0 for all 2 severity cases and will be a non 0 number for 3 severity cases
329
+ * @param showDebugging used to control debugging messages to show the various
330
+ * calculations a required steps along the way.
331
+ *
332
+ * @returns ICorrection that contains the new PCI as well as the deduct values that should be used for corrections
333
+ */
334
+ function _getPCI2(type, severity, density, secondDeductValue, showDebugging) {
335
+ const deductValue = calculateDeductValue(type, severity, density);
336
+ const splitVal = deductValue.split("|");
337
+ const newDV = parseFloat(splitVal[2]);
338
+ return {
339
+ pci: calculatePCI(`${splitVal[2]},${secondDeductValue}`, showDebugging),
340
+ dv: secondDeductValue ? [newDV, secondDeductValue] : [newDV]
341
+ };
342
+ }
343
+ /**
344
+ * Parse the deduct value string into individual values for type, severity, deduct value, and density
345
+ *
346
+ * @param deductValues string of comma delimited values for type, severity, deduct value, and density
347
+ *
348
+ * @returns an object with the parsed values
349
+ */
350
+ function _parseDeductValues(deductValues) {
351
+ return deductValues.split(",").reduce((prev, cur) => {
352
+ const splitVal = cur.split("|");
353
+ const type = splitVal[0];
354
+ const severity = splitVal[1];
355
+ const deductValue = parseFloat(splitVal[2]);
356
+ const density = parseFloat(splitVal[3]);
357
+ if (!prev[type]) {
358
+ prev[type] = {};
359
+ }
360
+ prev[type][severity] = {
361
+ deductValue,
362
+ density
363
+ };
364
+ return prev;
365
+ }, {});
366
+ }
367
+ /**
368
+ * Replace any deduct values for the given distress types when it is determined that corrections
369
+ * are required for a multi-severity case
370
+ *
371
+ * @param deductValues string of comma delimited values for type, severity, deduct value, and density
372
+ * @param updates will contain the new corrected deduct value(s) that should be substituted for the original deduct value
373
+ *
374
+ * @returns an object with the parsed and updated deduct values to use for final PCI calculation
375
+ */
376
+ function _getFinalDeductValues(deductValues, updates) {
377
+ const skipAdditionalTypes = [];
378
+ return deductValues.split(",").reduce((prev, cur) => {
379
+ //0: type, 1: severity, 2: deductValue, 3: density
380
+ const splitVal = cur.split("|");
381
+ const type = splitVal[0];
382
+ const deductValue = parseFloat(splitVal[2]);
383
+ if (Object.keys(updates).length > 0 && updates[type]) {
384
+ skipAdditionalTypes.push(type);
385
+ prev.push(...updates[type]);
386
+ delete (updates[type]);
387
+ }
388
+ else if (skipAdditionalTypes.indexOf(type) < 0) {
389
+ prev.push(deductValue);
390
+ }
391
+ return prev;
392
+ }, []);
393
+ }
394
+ /**
395
+ * Executes the polynomial equation using the provided values and density.
396
+ * In the ASTM standard this is the step represented by finding the values
397
+ * on the plotted graphs.
398
+ *
399
+ * @returns the calculated deduct value
400
+ */
401
+ function _calc(density, vals) {
402
+ return vals.reduce((prev, cur, i) => {
403
+ return prev += i === 0 ? cur :
404
+ i === 1 ? (cur * density) :
405
+ (cur * Math.pow(density, i));
406
+ }, 0);
407
+ }
408
+ /**
409
+ * Round to the nerest decimal in the 10ths place
410
+ */
411
+ function _round(v) {
412
+ return Math.round(v * 10) / 10;
413
+ }
414
+ /**
415
+ * Execute the deduct value calculation for the distress type
416
+ *
417
+ * @param severity The severity of the distress type
418
+ * @param density percent density of the distress type
419
+ *
420
+ * @returns the calculated deduct value
421
+ */
422
+ function _calcAlligator(severity, density) {
423
+ const vals = severity === ESeverity.H ? [30.71, 29.22, 9.407, -6.981, -2.158, 3.047, -0.6578] :
424
+ severity === ESeverity.M ? [21.62, 21.32, 5.194, -1.343, 0.2341] :
425
+ [11.31, 16.05, 7.572, -1.471];
426
+ return _calc(density, vals);
427
+ }
428
+ /**
429
+ * Execute the deduct value calculation for the distress type
430
+ *
431
+ * @param severity The severity of the distress type
432
+ * @param density percent density of the distress type
433
+ *
434
+ * @returns the calculated deduct value
435
+ */
436
+ function _calcBleeding(severity, density) {
437
+ const vals = severity === ESeverity.H ? [5.343, 6.927, 7.926, 4.265, -0.7582] :
438
+ severity === ESeverity.M ? [2.38, 5.483, 4.128, 0.8366, 0.03659, 0.1052] :
439
+ [0.01391, 0.5079, 1.576, 1.191, 0.1329, 0.03823];
440
+ return _calc(density, vals);
441
+ }
442
+ /**
443
+ * Execute the deduct value calculation for the distress type
444
+ *
445
+ * @param severity The severity of the distress type
446
+ * @param density percent density of the distress type
447
+ *
448
+ * @returns the calculated deduct value
449
+ */
450
+ function _calcBlockCracking(severity, density) {
451
+ const vals = severity === ESeverity.H ? [7.926, 11.93, 8.826, 3.432, -1.382] :
452
+ severity === ESeverity.M ? [2.587, 9.142, 6.647, -0.455, -0.2439, 0.1107] :
453
+ [0.646, 4.002, 4.2, 0.4987, -0.06269];
454
+ return _calc(density, vals);
455
+ }
456
+ /**
457
+ * Execute the deduct value calculation for the distress type
458
+ *
459
+ * @param severity The severity of the distress type
460
+ * @param density percent density of the distress type
461
+ *
462
+ * @returns the calculated deduct value
463
+ */
464
+ function _calcBumpsSags(severity, density) {
465
+ const vals = severity === ESeverity.H ? [52.77, 38.07, 8.964, -0.4148, -1.589, 2.478] :
466
+ severity === ESeverity.M ? [24.66, 27.86, 15.73, 3.295, -5.27, 5.921, 7.959] :
467
+ [8.768, 13.79, 7.064, 7.455, 6.041, -1.739, -1.371];
468
+ return _calc(density, vals);
469
+ }
470
+ /**
471
+ * Execute the deduct value calculation for the distress type
472
+ *
473
+ * @param severity The severity of the distress type
474
+ * @param density percent density of the distress type
475
+ *
476
+ * @returns the calculated deduct value
477
+ */
478
+ function _calcCorrugation(severity, density) {
479
+ const vals = severity === ESeverity.H ? [34.21, 21.59, 1.863, 6.1410, -0.687, -1.885, 0.4916] :
480
+ severity === ESeverity.M ? [15.78, 19.69, 6.276, -2.124, 0.5868, 0.06045] :
481
+ [2.173, 5.609, 5.976, -0.7348, -0.2172, 1.494, -0.5659];
482
+ return _calc(density, vals);
483
+ }
484
+ /**
485
+ * Execute the deduct value calculation for the distress type
486
+ *
487
+ * @param severity The severity of the distress type
488
+ * @param density percent density of the distress type
489
+ *
490
+ * @returns the calculated deduct value
491
+ */
492
+ function _calcDepression(severity, density) {
493
+ const vals = severity === ESeverity.H ? [17.84, 5.904, 9.406, 18.28, -2.753, -7.798, 2.402] :
494
+ severity === ESeverity.M ? [8.471, 3.171, 10.25, 12.2, -0.9687, -4.601, 1.079] :
495
+ [4.836, -0.7572, 4.786, 12.39, 1.233, -4.871, 0.9749];
496
+ return _calc(density, vals);
497
+ }
498
+ /**
499
+ * Execute the deduct value calculation for the distress type
500
+ *
501
+ * @param severity The severity of the distress type
502
+ * @param density percent density of the distress type
503
+ *
504
+ * @returns the calculated deduct value
505
+ */
506
+ function _calcEdgeCracking(severity, density) {
507
+ const vals = severity === ESeverity.H ? [14.99, 13.5, 10.62, 5.15, -1.792, -2.826] :
508
+ severity === ESeverity.M ? [9.177, 10.26, 5.704, -0.6812, -0.8588, 0.2123] :
509
+ [3.049, 4.802, 4.058, -0.3556, -1.55, 1.02];
510
+ return _calc(density, vals);
511
+ }
512
+ /**
513
+ * Execute the deduct value calculation for the distress type
514
+ *
515
+ * @param severity The severity of the distress type
516
+ * @param density percent density of the distress type
517
+ *
518
+ * @returns the calculated deduct value
519
+ */
520
+ function _calcReflectionCracking(severity, density) {
521
+ const vals = severity === ESeverity.H ? [14.99, 17.21, 27.63, 31.13, -20.94, -18.82, 9.985] :
522
+ severity === ESeverity.M ? [9.9193, 10.88, 8.073, 14.8, -3.792, -9.583, 3.651] :
523
+ [2.356, 6.664, 3.717, -1.393, 1.94, 1.785, -0.9707];
524
+ return _calc(density, vals);
525
+ }
526
+ /**
527
+ * Execute the deduct value calculation for the distress type
528
+ *
529
+ * @param severity The severity of the distress type
530
+ * @param density percent density of the distress type
531
+ *
532
+ * @returns the calculated deduct value
533
+ */
534
+ function _calcLaneShoulderDropOff(severity, density) {
535
+ const vals = severity === ESeverity.H ? [7.549, 6.907, 7.284, 9.304, 2.064] :
536
+ severity === ESeverity.M ? [4.02, 1.744, 14.36, 15.92, -40.22, 23.6] :
537
+ [2.004, 1.065, 9.706, 11.75, -27.52, 15.04];
538
+ return _calc(density, vals);
539
+ }
540
+ /**
541
+ * Execute the deduct value calculation for the distress type
542
+ *
543
+ * @param severity The severity of the distress type
544
+ * @param density percent density of the distress type
545
+ *
546
+ * @returns the calculated deduct value
547
+ */
548
+ function _calcLongTransCracking(severity, density) {
549
+ const vals = severity === ESeverity.H ? [19.56, 24.06, 12.12, 9.336, 1.532, -4.396] :
550
+ severity === ESeverity.M ? [9.751, 15.53, 4.719, 1.369, 1.206, -1.164] :
551
+ [2.347, 9.074, 8.424, -1.338, -1.873, 1.144];
552
+ return _calc(density, vals);
553
+ }
554
+ /**
555
+ * Execute the deduct value calculation for the distress type
556
+ *
557
+ * @param severity The severity of the distress type
558
+ * @param density percent density of the distress type
559
+ *
560
+ * @returns the calculated deduct value
561
+ */
562
+ function _calcPatchingUtilCutPatching(severity, density) {
563
+ const vals = severity === ESeverity.H ? [20.15, 16.55, 5.415, 10.77, 3.257, -4.502] :
564
+ severity === ESeverity.M ? [10.28, 12.71, 6.174, 1.928, 0.6923, -0.4673] :
565
+ [2.523, 6.892, 5.702, 2.407, 0.2185, -0.8722];
566
+ return _calc(density, vals);
567
+ }
568
+ /**
569
+ * Execute the deduct value calculation for the distress type
570
+ *
571
+ * @param severity The severity of the distress type
572
+ * @param density percent density of the distress type
573
+ *
574
+ * @returns the calculated deduct value
575
+ */
576
+ function _calcPolishedAggregate(severity, density) {
577
+ const vals = severity === "H" || severity === "M" || severity === "L" ?
578
+ [3.417, -26.82, 71.15, -76.22, 38.52, -6.904] : [];
579
+ return _calc(density, vals);
580
+ }
581
+ /**
582
+ * Execute the deduct value calculation for the distress type
583
+ *
584
+ * @param severity The severity of the distress type
585
+ * @param density percent density of the distress type
586
+ *
587
+ * @returns the calculated deduct value
588
+ */
589
+ function _calcPotholes(severity, density) {
590
+ const vals = severity === ESeverity.H ? [110.7, 60.66, 2.378, -2.664] :
591
+ severity === ESeverity.M ? [90.47, 60.41, -0.1123, -4.746] :
592
+ [58.19, 40.53, 2.884, -1.443, 0.1195];
593
+ return _calc(density, vals);
594
+ }
595
+ /**
596
+ * Execute the deduct value calculation for the distress type
597
+ *
598
+ * @param severity The severity of the distress type
599
+ * @param density percent density of the distress type
600
+ *
601
+ * @returns the calculated deduct value
602
+ */
603
+ function _calcRailroadCrossing(severity, density) {
604
+ const vals = severity === ESeverity.H ? [20, 38.64, -62.82, 193.6, -162.7, 41.22] :
605
+ severity === ESeverity.M ? [6.994, 23.47, -52.3, 167.3, -143.6, 37.64] :
606
+ [1.998, -0.7488, 13.8, -0.7917, -1.981];
607
+ return _calc(density, vals);
608
+ }
609
+ /**
610
+ * Execute the deduct value calculation for the distress type
611
+ *
612
+ * @param severity The severity of the distress type
613
+ * @param density percent density of the distress type
614
+ *
615
+ * @returns the calculated deduct value
616
+ */
617
+ function _calcRutting(severity, density) {
618
+ const vals = severity === ESeverity.H ? [27.61, 25.19, 8.557, 1.65, -2.2030] :
619
+ severity === ESeverity.M ? [18.47, 20.77, 6.617, -1.13, -2.286] :
620
+ [8.833, 14.84, 3.129, 0.1451, 2.438, -1.279];
621
+ return _calc(density, vals);
622
+ }
623
+ /**
624
+ * Execute the deduct value calculation for the distress type
625
+ *
626
+ * @param severity The severity of the distress type
627
+ * @param density percent density of the distress type
628
+ *
629
+ * @returns the calculated deduct value
630
+ */
631
+ function _calcShoving(severity, density) {
632
+ const vals = severity === ESeverity.H ? [18.7, 20.17, 10.3, 4.694, 1.331, -2.61] :
633
+ severity === ESeverity.M ? [10.39, 14.78, 5.488, 4.001, 3.23, -2.387] :
634
+ [4.002, 10.66, 6.332, -0.5226, -0.1923];
635
+ return _calc(density, vals);
636
+ }
637
+ /**
638
+ * Execute the deduct value calculation for the distress type
639
+ *
640
+ * @param severity The severity of the distress type
641
+ * @param density percent density of the distress type
642
+ *
643
+ * @returns the calculated deduct value
644
+ */
645
+ function _calcSlippageCracking(severity, density) {
646
+ const vals = severity === ESeverity.H ? [19.73, 32.21, 25.87, -2.871, -10.55, 1.496, 0.7393] :
647
+ severity === ESeverity.M ? [11.38, 18.55, 18.38, 1.628, -7.596, 0.5841, 0.5946] :
648
+ [5.144, 12.95, 11.95, -0.833, -2.995, 1.325, -0.2113];
649
+ return _calc(density, vals);
650
+ }
651
+ /**
652
+ * Execute the deduct value calculation for the distress type
653
+ *
654
+ * @param severity The severity of the distress type
655
+ * @param density percent density of the distress type
656
+ *
657
+ * @returns the calculated deduct value
658
+ */
659
+ function _calcSwell(severity, density) {
660
+ const vals = severity === ESeverity.H ? [34, 16.84, -23.09, 41.17, -14.84] :
661
+ severity === ESeverity.M ? [12, 15.67, 20.59, -28.33, 21, -5.508] :
662
+ [1.995, 11.9, -12.83, 16.74, -5.361];
663
+ return _calc(density, vals);
664
+ }
665
+ /**
666
+ * Execute the deduct value calculation for the distress type
667
+ *
668
+ * @param severity The severity of the distress type
669
+ * @param density percent density of the distress type
670
+ *
671
+ * @returns the calculated deduct value
672
+ */
673
+ function _calcRaveling(severity, density) {
674
+ const vals = severity === ESeverity.H ? [16.77, 10.67, 5.758, 12.9, -0.0633, -5.659, 1.48] :
675
+ severity === ESeverity.M ? [8.512, 5.106, 1.63, 3.469, 1.028, -1.211, 0.1938] :
676
+ [];
677
+ return _calc(density, vals);
678
+ }
679
+ /**
680
+ * Execute the deduct value calculation for the distress type
681
+ *
682
+ * @param severity The severity of the distress type
683
+ * @param density percent density of the distress type
684
+ *
685
+ * @returns the calculated deduct value
686
+ */
687
+ function _calcWeathering(severity, density) {
688
+ const vals = severity === ESeverity.H ? [3.673, 3.349, 2.598, -1.233, 2.754, 2.434, -1.485] :
689
+ severity === ESeverity.M ? [1.12, 0.9769, 0.93, -0.5955, 1.041, 1.111, -0.614] :
690
+ [-0.0386, -0.0736, 0.834, 1.63, -0.0287, -0.639, 0.1515];
691
+ return _calc(density, vals);
692
+ }
693
+ /**
694
+ * Determine maximum Corrected Deduct Value (CDV) iteratively
695
+ *
696
+ * @param deductValues The calculated deduct values that will be used to determine max CDV
697
+ * @param showDebugging used to optionally show debugging messages
698
+ *
699
+ * @returns the max CDV value
700
+ */
701
+ function _getMaxCDV(deductValues, showDebugging) {
702
+ let maxCDV;
703
+ // If none or only one individual deduct value is greater
704
+ // than two, the total value is used in place of the maximum CD
705
+ const valuesGreaterThan2 = deductValues.filter(deductValue => deductValue > 2);
706
+ if (valuesGreaterThan2.length <= 1) {
707
+ maxCDV = valuesGreaterThan2.reduce((prev, cur) => {
708
+ prev += cur;
709
+ return prev;
710
+ }, 0);
711
+ if (showDebugging) {
712
+ console.log("If none or only one individual deduct value is greater");
713
+ console.log("than two, the total value is used in place of the maximum CD");
714
+ console.log(`Max CDV: ${maxCDV}`);
715
+ }
716
+ }
717
+ else {
718
+ // sort in descending order (section 9.5.2 in ASTM doc)
719
+ const sortedDVs = deductValues.sort((a, b) => b - a);
720
+ // Determine the allowable number of deducts, m (section 9.5.3 in ASTM doc)
721
+ const highestDV = sortedDVs[0];
722
+ // m = allowable number of deducts including fractions (must be less than or equal to ten)
723
+ const m = 1 + (9 / 98) * (100 - highestDV);
724
+ if (showDebugging) {
725
+ console.log(`Deduct values sorted in descending order: ${sortedDVs}`);
726
+ console.log(`Highest deduct value: ${highestDV}`);
727
+ console.log(`Allowable number of deducts including fractions: ${m}`);
728
+ }
729
+ // TODO they mention (must be less than or equal to ten) but don't say what happens if its over
730
+ if (m <= 10) {
731
+ const vals = _reduceDeductValues(sortedDVs, m);
732
+ if (showDebugging) {
733
+ console.log(`Reduce deduct values to the m largest including the fractional part: ${vals}`);
734
+ }
735
+ // iteratively determined cdv values
736
+ const cdvs = _getCDVs(vals, showDebugging);
737
+ maxCDV = Math.max(...cdvs);
738
+ if (showDebugging) {
739
+ console.log(`Max CDV: ${maxCDV}`);
740
+ }
741
+ }
742
+ else {
743
+ if (showDebugging) {
744
+ console.log("Allowable number of deducts including fractions (must be less than or equal to ten)");
745
+ }
746
+ }
747
+ }
748
+ return maxCDV;
749
+ }
750
+ /**
751
+ * Reduce deduct values to the m largest including the fractional part
752
+ *
753
+ * @param sortedDVs individual deduct values in descending order
754
+ * @param m allowable number of deducts (9.5.3 in ASTM standard)
755
+ *
756
+ * @returns updated deduct values
757
+ */
758
+ function _reduceDeductValues(sortedDVs, m) {
759
+ const fractionalPart = m - Math.floor(m);
760
+ // If less than m deduct values are available, all of the deduct values are used
761
+ return sortedDVs.length < m ? sortedDVs :
762
+ sortedDVs.reduce((prev, cur, i) => {
763
+ if (i + 1 < m) {
764
+ prev.push(cur);
765
+ }
766
+ else if (fractionalPart > 0) {
767
+ prev.push(_round(cur * fractionalPart));
768
+ }
769
+ return prev;
770
+ }, []);
771
+ }
772
+ /**
773
+ * Reduce the smallest individual deduct value greater to 2.0 and repeat
774
+ *
775
+ * @param vals the list of deduct values
776
+ * @param showDebugging optionally show debugging messages
777
+ *
778
+ * @returns array of CDV values
779
+ */
780
+ function _getCDVs(vals, showDebugging) {
781
+ let len = vals.length;
782
+ const cdvs = [];
783
+ while (len >= 1) {
784
+ if (showDebugging) {
785
+ console.log(`vals: ${vals}`);
786
+ }
787
+ cdvs.push(_getCDV(vals, showDebugging));
788
+ len -= 1;
789
+ vals.splice(len, 1, 2);
790
+ }
791
+ return cdvs;
792
+ }
793
+ /**
794
+ * Determine the total and max number deducts higher than two and calculate the CDV
795
+ *
796
+ * @param vals the list of deduct values
797
+ * @param showDebugging optionally show debugging messages
798
+ *
799
+ * @returns the calculated CDV
800
+ */
801
+ function _getCDV(vals, showDebugging) {
802
+ // section 9.5.5.1 in ASTM doc
803
+ const totalDV = vals.reduce((prev, cur) => prev += cur, 0);
804
+ // section 9.5.5.2 in ASTM doc
805
+ // the number of deducts with a value greater than 2.0
806
+ const q = vals.reduce((prev, cur) => cur > 2 ? prev + 1 : prev, 0);
807
+ // section 9.5.5.3 in ASTM doc
808
+ return _calcCDV(totalDV, q, showDebugging);
809
+ }
810
+ /**
811
+ * Determine the total and max number deducts higher than two and calculate the CDV
812
+ *
813
+ * @param total the sum of all deduct values
814
+ * @param q the number of deducts with a value greater than 2.0
815
+ * @param showDebugging optionally show debugging messages
816
+ *
817
+ * @returns the calculated CDV
818
+ */
819
+ function _calcCDV(total, q, showDebugging) {
820
+ // Determine the CDV from total deduct value and q
821
+ const vals2 = {
822
+ 7: [-9.482, 0.6045, 0.0003563, -5.448e-06],
823
+ 6: [-8.165, 0.5724, 0.0004266, -4.254e-06],
824
+ 5: [-7.932, 0.6091, 0.0003464, -4.265e-06],
825
+ 4: [-6.78, 0.6301, 0.0007376, -6.357e-06],
826
+ 3: [-5.015, 0.7546, -0.00043, -3.075e-06],
827
+ 2: [-1.668, 0.7992, -0.0003013, -5.214e-06],
828
+ 1: [1.651e-15, 1, -4.249e-18, 1.149e-19]
829
+ };
830
+ const cdv = _calc(total, vals2[q >= 7 ? 7 : q]);
831
+ if (showDebugging) {
832
+ console.log(`totalDV: ${total}`);
833
+ console.log(`q: ${q}`);
834
+ console.log(`CDV: ${cdv}`);
835
+ }
836
+ return cdv;
837
+ }