ixbrl-viewer 1.4.14__py3-none-any.whl → 1.4.16__py3-none-any.whl
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.
Potentially problematic release.
This version of ixbrl-viewer might be problematic. Click here for more details.
- iXBRLViewerPlugin/__init__.py +87 -66
- iXBRLViewerPlugin/_version.py +2 -2
- iXBRLViewerPlugin/constants.py +6 -0
- iXBRLViewerPlugin/iXBRLViewer.py +36 -32
- iXBRLViewerPlugin/ui.py +16 -3
- iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js +1 -1
- iXBRLViewerPlugin/viewer/src/html/inspector.html +27 -0
- iXBRLViewerPlugin/viewer/src/i18n/en/translation.json +18 -1
- iXBRLViewerPlugin/viewer/src/i18n/es/translation.json +18 -1
- iXBRLViewerPlugin/viewer/src/icons/calculator.svg +13 -0
- iXBRLViewerPlugin/viewer/src/icons/circle-cross.svg +11 -0
- iXBRLViewerPlugin/viewer/src/icons/circle-tick.svg +11 -0
- iXBRLViewerPlugin/viewer/src/icons/dimension.svg +1 -5
- iXBRLViewerPlugin/viewer/src/icons/member.svg +2 -5
- iXBRLViewerPlugin/viewer/src/icons/multi-tag.svg +10 -0
- iXBRLViewerPlugin/viewer/src/js/accordian.js +2 -2
- iXBRLViewerPlugin/viewer/src/js/calculation.js +202 -0
- iXBRLViewerPlugin/viewer/src/js/calculation.test.js +306 -0
- iXBRLViewerPlugin/viewer/src/js/calculationInspector.js +190 -0
- iXBRLViewerPlugin/viewer/src/js/concept.js +7 -1
- iXBRLViewerPlugin/viewer/src/js/fact.js +59 -5
- iXBRLViewerPlugin/viewer/src/js/factset.js +54 -5
- iXBRLViewerPlugin/viewer/src/js/factset.test.js +71 -5
- iXBRLViewerPlugin/viewer/src/js/inspector.js +85 -30
- iXBRLViewerPlugin/viewer/src/js/interval.js +70 -0
- iXBRLViewerPlugin/viewer/src/js/interval.test.js +153 -0
- iXBRLViewerPlugin/viewer/src/js/test-utils.js +19 -0
- iXBRLViewerPlugin/viewer/src/less/accordian.less +2 -2
- iXBRLViewerPlugin/viewer/src/less/calculation-inspector.less +83 -0
- iXBRLViewerPlugin/viewer/src/less/colours.less +2 -0
- iXBRLViewerPlugin/viewer/src/less/dialog.less +8 -4
- iXBRLViewerPlugin/viewer/src/less/inspector.less +67 -23
- iXBRLViewerPlugin/viewer/src/less/validation-report.less +1 -2
- iXBRLViewerPlugin/viewer/src/less/viewer.less +1 -1
- iXBRLViewerPlugin/xhtmlserialize.py +1 -1
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/METADATA +2 -2
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/RECORD +43 -34
- tests/puppeteer/tools/generate.sh +1 -1
- iXBRLViewerPlugin/viewer/src/js/calculations.js +0 -111
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/LICENSE +0 -0
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/NOTICE +0 -0
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/WHEEL +0 -0
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/entry_points.txt +0 -0
- {ixbrl_viewer-1.4.14.dist-info → ixbrl_viewer-1.4.16.dist-info}/top_level.txt +0 -0
|
@@ -370,6 +370,33 @@ See COPYRIGHT.md for copyright information
|
|
|
370
370
|
</div>
|
|
371
371
|
</div>
|
|
372
372
|
</div>
|
|
373
|
+
<div class="dialog calculation-inspector">
|
|
374
|
+
<div class="close"></div>
|
|
375
|
+
<div class="contents">
|
|
376
|
+
<h2 data-i18n="inspector.calculationDetails">Calculation details</h2>
|
|
377
|
+
<table class="calculation-trace">
|
|
378
|
+
<thead>
|
|
379
|
+
<tr>
|
|
380
|
+
<th class="weight"></th>
|
|
381
|
+
<th class="line-item" data-i18n="calculation.concept">Concept</th>
|
|
382
|
+
<th class="value-column" data-i18n="calculation.reported-value">Reported Value</th>
|
|
383
|
+
<th class="icons"></th>
|
|
384
|
+
<th class="value-column calc11-only" data-i18n="calculation.mininum">Minimum</th>
|
|
385
|
+
<th class="value-column calc11-only" data-i18n="calculation.maximum">Maximum</th>
|
|
386
|
+
</tr>
|
|
387
|
+
</thead>
|
|
388
|
+
<tbody>
|
|
389
|
+
</tbody>
|
|
390
|
+
<tfoot>
|
|
391
|
+
<tr>
|
|
392
|
+
<td colspan="6" class="status"><span class="icon"></span> <span class="message"></span></td>
|
|
393
|
+
</tr>
|
|
394
|
+
</tfoot>
|
|
395
|
+
</table>
|
|
396
|
+
<div class="buttons">
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
373
400
|
<div class="dialog text-block-viewer">
|
|
374
401
|
<div class="close"></div>
|
|
375
402
|
<div class="contents">
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"calculation": {
|
|
3
|
+
"calculated-total": "Calculated",
|
|
4
|
+
"calculations11": "Calculations v1.1",
|
|
5
|
+
"concept": "Concept",
|
|
6
|
+
"consistent-duplicate-facts-present": "{{nfacts}} consistent duplicate facts present",
|
|
7
|
+
"inconsistent-duplicate-facts-present": "{{nfacts}} inconsistent duplicate facts present",
|
|
8
|
+
"maximum": "Maximum",
|
|
9
|
+
"mininum": "Minimum",
|
|
10
|
+
"reported-total": "Reported",
|
|
11
|
+
"reported-value": "Reported value"
|
|
12
|
+
},
|
|
2
13
|
"common": {
|
|
3
14
|
"accuracyInfinite": "Infinite precision",
|
|
4
15
|
"none": "None",
|
|
@@ -8,6 +19,9 @@
|
|
|
8
19
|
},
|
|
9
20
|
"factDetails": {
|
|
10
21
|
"accuracy": "Accuracy",
|
|
22
|
+
"calculationIsConsistent": "Calculation is consistent",
|
|
23
|
+
"calculationIsInconsistent": "Calculation is inconsistent",
|
|
24
|
+
"calculationUnchecked": "Calculation not checked due to presence of duplicate facts",
|
|
11
25
|
"change": "Change",
|
|
12
26
|
"changeFromIn": "From {{from}} in ",
|
|
13
27
|
"changePercentageDecrease": "{{decrease}}% decrease on ",
|
|
@@ -18,10 +32,12 @@
|
|
|
18
32
|
"duplicatesCount": "{{current}} of {{total}}",
|
|
19
33
|
"entity": "Entity",
|
|
20
34
|
"factValue": "Fact Value",
|
|
35
|
+
"nonNumericFact": "non-numeric fact",
|
|
21
36
|
"noPriorFactInThisReport": "No prior fact in this report",
|
|
22
37
|
"noUnit": "<NOUNIT>",
|
|
23
38
|
"properties": "Properties",
|
|
24
|
-
"scale": "Scale"
|
|
39
|
+
"scale": "Scale",
|
|
40
|
+
"viewCalculationDetails": "View calculation details"
|
|
25
41
|
},
|
|
26
42
|
"footnotes": {
|
|
27
43
|
"footnote": "Footnote"
|
|
@@ -29,6 +45,7 @@
|
|
|
29
45
|
"inspector": {
|
|
30
46
|
"anchoring": "Anchoring",
|
|
31
47
|
"associatedFacts": "Associated facts",
|
|
48
|
+
"calculationDetails": "",
|
|
32
49
|
"calculations": "Calculations",
|
|
33
50
|
"concealedFact": "Concealed fact",
|
|
34
51
|
"conceptType": "Concept Type",
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"calculation": {
|
|
3
|
+
"calculated-total": "",
|
|
4
|
+
"calculations11": "",
|
|
5
|
+
"concept": "",
|
|
6
|
+
"consistent-duplicate-facts-present": "",
|
|
7
|
+
"inconsistent-duplicate-facts-present": "",
|
|
8
|
+
"maximum": "",
|
|
9
|
+
"mininum": "",
|
|
10
|
+
"reported-total": "",
|
|
11
|
+
"reported-value": ""
|
|
12
|
+
},
|
|
2
13
|
"common": {
|
|
3
14
|
"accuracyInfinite": "Precisió infinita",
|
|
4
15
|
"none": "Ninguno",
|
|
@@ -8,6 +19,9 @@
|
|
|
8
19
|
},
|
|
9
20
|
"factDetails": {
|
|
10
21
|
"accuracy": "Precisión",
|
|
22
|
+
"calculationIsConsistent": "",
|
|
23
|
+
"calculationIsInconsistent": "",
|
|
24
|
+
"calculationUnchecked": "",
|
|
11
25
|
"change": "Cambio",
|
|
12
26
|
"changeFromIn": "Anteriormente {{from}} en ",
|
|
13
27
|
"changePercentageDecrease": "{{decrease}}% menos que en ",
|
|
@@ -18,10 +32,12 @@
|
|
|
18
32
|
"duplicatesCount": "{{current}} de {{total}}",
|
|
19
33
|
"entity": "Entidad",
|
|
20
34
|
"factValue": "Valor del hecho",
|
|
35
|
+
"nonNumericFact": "",
|
|
21
36
|
"noPriorFactInThisReport": "No hay un hecho previo",
|
|
22
37
|
"noUnit": "Sin unidad",
|
|
23
38
|
"properties": "Características",
|
|
24
|
-
"scale": "Escala"
|
|
39
|
+
"scale": "Escala",
|
|
40
|
+
"viewCalculationDetails": ""
|
|
25
41
|
},
|
|
26
42
|
"footnotes": {
|
|
27
43
|
"footnote": "Nota al pie de página"
|
|
@@ -29,6 +45,7 @@
|
|
|
29
45
|
"inspector": {
|
|
30
46
|
"anchoring": "Anclaje",
|
|
31
47
|
"associatedFacts": "Hechos asociados",
|
|
48
|
+
"calculationDetails": "",
|
|
32
49
|
"calculations": "Cálculos",
|
|
33
50
|
"concealedFact": "",
|
|
34
51
|
"conceptType": "Tipo de concepto",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1034 1024">
|
|
4
|
+
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
|
+
<path fill="currentColor"
|
|
6
|
+
d="M768 832q26 0 45 -19t19 -45v-640q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v640q0 26 19 45t45 19h512zM768 896h-512q-53 0 -90.5 -37.5t-37.5 -90.5v-640q0 -53 37.5 -90.5t90.5 -37.5h512q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5v0z
|
|
7
|
+
M321 320h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5t18.5 -44.5v-2q0 -26 -18.5 -44.5t-44.5 -18.5zM513 320h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5t18.5 -44.5v-2q0 -26 -18.5 -44.5
|
|
8
|
+
t-44.5 -18.5zM705 320h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5t18.5 -44.5v-2q0 -26 -18.5 -44.5t-44.5 -18.5zM321 128h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5t18.5 -44.5v-2
|
|
9
|
+
q0 -26 -18.5 -44.5t-44.5 -18.5zM513 128h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5t18.5 -44.5v-2q0 -26 -18.5 -44.5t-44.5 -18.5zM705 128h-2q-26 0 -44.5 18.5t-18.5 44.5v2q0 26 18.5 44.5t44.5 18.5h2q26 0 44.5 -18.5
|
|
10
|
+
t18.5 -44.5v-2q0 -26 -18.5 -44.5t-44.5 -18.5zM320 704h384v-128h-384v128zM256 704v-128q0 -27 18.5 -45.5t45.5 -18.5h384q27 0 45.5 18.5t18.5 45.5v128q0 27 -18.5 45.5t-45.5 18.5h-384q-27 0 -45.5 -18.5t-18.5 -45.5v0z" />
|
|
11
|
+
</g>
|
|
12
|
+
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1044 1024">
|
|
4
|
+
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
|
+
<path fill="currentColor"
|
|
6
|
+
d="M512 896q93 0 174 -35q82 -36 142.5 -96.5t96.5 -142.5q35 -81 35 -174t-35 -174q-36 -82 -96.5 -142.5t-142.5 -96.5q-81 -35 -174 -35t-174 35q-82 36 -142.5 96.5t-96.5 142.5q-35 81 -35 174t35 174q36 82 96.5 142.5t142.5 96.5q81 35 174 35zM512 960
|
|
7
|
+
q-106 0 -199 -40q-94 -40 -163.5 -109.5t-109.5 -163.5q-40 -93 -40 -199t40 -199q40 -94 109.5 -163.5t163.5 -109.5q93 -40 199 -40t199 40q94 40 163.5 109.5t109.5 163.5q40 93 40 199t-40 199q-40 94 -109.5 163.5t-163.5 109.5q-93 40 -199 40v0zM716 606l-46 46
|
|
8
|
+
l-158 -159l-158 159l-46 -46l159 -158l-159 -158l46 -46l158 159l158 -159l46 46l-159 158z" />
|
|
9
|
+
</g>
|
|
10
|
+
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1044 1024">
|
|
4
|
+
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
|
+
<path fill="currentColor"
|
|
6
|
+
d="M512 896q93 0 174 -35q82 -36 142.5 -96.5t96.5 -142.5q35 -81 35 -174t-35 -174q-36 -82 -96.5 -142.5t-142.5 -96.5q-81 -35 -174 -35t-174 35q-82 36 -142.5 96.5t-96.5 142.5q-35 81 -35 174t35 174q36 82 96.5 142.5t142.5 96.5q81 35 174 35zM512 960
|
|
7
|
+
q-106 0 -199 -40q-94 -40 -163.5 -109.5t-109.5 -163.5q-40 -93 -40 -199t40 -199q40 -94 109.5 -163.5t163.5 -109.5q93 -40 199 -40t199 40q94 40 163.5 109.5t109.5 163.5q40 93 40 199t-40 199q-40 94 -109.5 163.5t-163.5 109.5q-93 40 -199 40v0zM446 224l-222 224
|
|
8
|
+
l89 90l133 -135l265 269l89 -90z" />
|
|
9
|
+
</g>
|
|
10
|
+
|
|
11
|
+
</svg>
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1034 1024">
|
|
4
4
|
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
5
|
<path fill="currentColor"
|
|
6
|
-
d="
|
|
7
|
-
q13 -13 29 -19.5t33 -6.5q16 0 31 6t28 18l464 450q13 12 20 28t7 33v393v0zM469 617q-4 0 -7.5 -1.5t-7.5 -4.5q-6 -6 -6 -15t6 -15l208 -214q3 -4 7 -5.5t8 -1.5t8 1.5t7 4.5q6 6 6.5 15t-6.5 15l-207 215q-4 3 -8 4.5t-8 1.5v0v0zM377 528q-4 0 -7.5 -1.5t-6.5 -4.5
|
|
8
|
-
q-7 -6 -7 -15t6 -15l208 -215q3 -3 7 -4.5t8 -1.5t8 1.5t7 4.5v0q6 6 6.5 15t-5.5 15l-208 215q-3 3 -7 4.5t-9 1.5v0v0zM285 439q-4 0 -7.5 -1.5t-6.5 -4.5q-7 -6 -7 -15t6 -15l208 -215q3 -3 7 -4.5t8 -1.5t8 1.5t7 4.5q6 6 6.5 15t-5.5 15l-208 215q-3 3 -7 4.5t-9 1.5v0
|
|
9
|
-
v0zM811 768q8 0 16 -3.5t14 -9.5t9 -14t3 -16q0 -9 -3.5 -16.5t-9.5 -13.5t-13.5 -9t-15.5 -3q-9 0 -17 3t-14 10q-6 6 -9 13.5t-3 16.5t3.5 16.5t9.5 13.5t13.5 9t16.5 3zM811 811q-16 0 -31.5 -6t-28.5 -18q-25 -25 -25.5 -60.5t23.5 -60.5q13 -13 29 -19.5t33 -6.5
|
|
10
|
-
q16 0 31.5 6t27.5 18q25 25 26 60t-24 61q-13 13 -29 19.5t-32 6.5v0v0z" />
|
|
6
|
+
d="M853 853h-682q-36 0 -61 -25t-25 -60v-683q0 -35 25 -60t61 -25h682q36 0 61 25t25 60v683q0 35 -25 60t-61 25zM896 85q0 -17 -12.5 -29.5t-30.5 -12.5h-512v554h555v-512z" />
|
|
11
7
|
</g>
|
|
12
8
|
|
|
13
9
|
</svg>
|
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1034 1024">
|
|
4
4
|
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
5
|
<path fill="currentColor"
|
|
6
|
-
d="
|
|
7
|
-
|
|
8
|
-
q-7 -6 -7 -15t6 -15l208 -215q3 -3 7 -4.5t8 -1.5t8 1.5t7 4.5v0q6 6 6.5 15t-5.5 15l-208 215q-3 3 -7 4.5t-9 1.5v0v0zM285 439q-4 0 -7.5 -1.5t-6.5 -4.5q-7 -6 -7 -15t6 -15l208 -215q3 -3 7 -4.5t8 -1.5t8 1.5t7 4.5q6 6 6.5 15t-5.5 15l-208 215q-3 3 -7 4.5t-9 1.5v0
|
|
9
|
-
v0zM811 768q8 0 16 -3.5t14 -9.5t9 -14t3 -16q0 -9 -3.5 -16.5t-9.5 -13.5t-13.5 -9t-15.5 -3q-9 0 -17 3t-14 10q-6 6 -9 13.5t-3 16.5t3.5 16.5t9.5 13.5t13.5 9t16.5 3zM811 811q-16 0 -31.5 -6t-28.5 -18q-25 -25 -25.5 -60.5t23.5 -60.5q13 -13 29 -19.5t33 -6.5
|
|
10
|
-
q16 0 31.5 6t27.5 18q25 25 26 60t-24 61q-13 13 -29 19.5t-32 6.5v0v0z" />
|
|
6
|
+
d="M725 427q0 -44 -16 -83q-17 -39 -46 -68t-68 -46t-83 -17t-83 17t-68 46t-46 68q-16 39 -16 83t16 83q17 39 46 67.5t68 45.5t83 17t83 -17t68 -45.5t46 -67.5q16 -39 16 -83zM853 811q18 0 30.5 -12.5t12.5 -30.5v-683q0 -17 -12.5 -29.5t-30.5 -12.5h-682
|
|
7
|
+
q-18 0 -30.5 12.5t-12.5 29.5v683q0 18 12.5 30.5t30.5 12.5h682v0zM853 853h-682q-36 0 -61 -25t-25 -60v-683q0 -35 25 -60t61 -25h682q36 0 61 25t25 60v683q0 35 -25 60t-61 25v0z" />
|
|
11
8
|
</g>
|
|
12
9
|
|
|
13
10
|
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 1034 1024">
|
|
4
|
+
<g transform="matrix(1 0 0 -1 0 960)">
|
|
5
|
+
<path fill="currentColor"
|
|
6
|
+
d="M832 896h-448q-27 0 -45.5 -18.5t-18.5 -45.5h512v-512q27 0 45.5 18.5t18.5 45.5v448q0 27 -18.5 45.5t-45.5 18.5zM576 640h-448q-27 0 -45.5 -18.5t-18.5 -45.5v-448q0 -27 18.5 -45.5t45.5 -18.5h448q27 0 45.5 18.5t18.5 45.5v448q0 27 -18.5 45.5t-45.5 18.5z
|
|
7
|
+
M128 576h448v-448h-448v448zM704 768h-448q-27 0 -45.5 -18.5t-18.5 -45.5h512v-512q27 0 45.5 18.5t18.5 45.5v448q0 27 -18.5 45.5t-45.5 18.5z" />
|
|
8
|
+
</g>
|
|
9
|
+
|
|
10
|
+
</svg>
|
|
@@ -31,7 +31,7 @@ export class Accordian {
|
|
|
31
31
|
}
|
|
32
32
|
})
|
|
33
33
|
)
|
|
34
|
-
.append($('<div class="body"></div>').append(body))
|
|
34
|
+
.append($('<div class="card-body"></div>').append(body))
|
|
35
35
|
.appendTo(this._contents);
|
|
36
36
|
|
|
37
37
|
if (data !== null) {
|
|
@@ -48,7 +48,7 @@ export class Accordian {
|
|
|
48
48
|
this._contents.find(".card").first().addClass("active");
|
|
49
49
|
}
|
|
50
50
|
if (this.options.dissolveSingle && this._contents.children().length == 1) {
|
|
51
|
-
return this._contents.children().first().find(".body");
|
|
51
|
+
return this._contents.children().first().find(".card-body");
|
|
52
52
|
}
|
|
53
53
|
return this._contents;
|
|
54
54
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// See COPYRIGHT.md for copyright information
|
|
2
|
+
|
|
3
|
+
import $ from 'jquery';
|
|
4
|
+
import Decimal from 'decimal.js';
|
|
5
|
+
import { setDefault } from './util.js';
|
|
6
|
+
import { Interval } from './interval.js';
|
|
7
|
+
import { FactSet } from './factset.js';
|
|
8
|
+
|
|
9
|
+
export class Calculation {
|
|
10
|
+
|
|
11
|
+
constructor(fact, calc11) {
|
|
12
|
+
this.fact = fact;
|
|
13
|
+
this.calc11 = calc11;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Resolve calculation relationships to a map of maps of arrays
|
|
17
|
+
* (ELR->conceptName->facts) */
|
|
18
|
+
calculationFacts() {
|
|
19
|
+
const fact = this.fact;
|
|
20
|
+
const report = fact.report;
|
|
21
|
+
if (!this._conceptToFact) {
|
|
22
|
+
const rels = report.getChildRelationships(fact.conceptName(), "calc")
|
|
23
|
+
const ctf = {};
|
|
24
|
+
for (const [elr, rr] of Object.entries(rels)) {
|
|
25
|
+
ctf[elr] = {};
|
|
26
|
+
if (rr.length > 0) {
|
|
27
|
+
const otherFacts = report.getAlignedFacts(fact, {"c": rr.map(r => r.t )});
|
|
28
|
+
otherFacts.forEach(otherFact => setDefault(ctf[elr], otherFact.conceptName(), new FactSet()).add(otherFact));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
this._conceptToFact = ctf;
|
|
32
|
+
}
|
|
33
|
+
return this._conceptToFact;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
hasCalculations() {
|
|
37
|
+
const ctf = this.calculationFacts();
|
|
38
|
+
return Object.keys(ctf).length > 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
resolvedCalculations() {
|
|
42
|
+
const calculations = [];
|
|
43
|
+
const ctf = this.calculationFacts();
|
|
44
|
+
for (const [elr, concepts] of Object.entries(ctf)) {
|
|
45
|
+
if (Object.keys(concepts).length > 0) {
|
|
46
|
+
calculations.push(this.resolvedCalculation(elr));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return calculations;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Select the ELR which is the best match for a given array of facts
|
|
54
|
+
*/
|
|
55
|
+
bestELRForFactSet(facts) {
|
|
56
|
+
const ctf = this.calculationFacts();
|
|
57
|
+
let bestMatchELR = "";
|
|
58
|
+
let bestMatchCount = -1;
|
|
59
|
+
for (const [elr, rr] of Object.entries(ctf)) {
|
|
60
|
+
let matchCount = 0;
|
|
61
|
+
for (const [concept, calcFactSet] of Object.entries(rr)) {
|
|
62
|
+
let matched = 0;
|
|
63
|
+
for (const calcFact of calcFactSet.items()) {
|
|
64
|
+
if (facts.includes(calcFact.vuid)) {
|
|
65
|
+
matched = 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
matchCount += matched;
|
|
69
|
+
}
|
|
70
|
+
if (matchCount/Object.keys(rr).length > bestMatchCount) {
|
|
71
|
+
bestMatchCount = matchCount/Object.keys(rr).length;
|
|
72
|
+
bestMatchELR = elr;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return bestMatchELR;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* Returns a ResolvedCalculation object for the specified ELR
|
|
80
|
+
*/
|
|
81
|
+
resolvedCalculation(elr) {
|
|
82
|
+
const calc = [];
|
|
83
|
+
const calcFacts = this.calculationFacts()[elr];
|
|
84
|
+
const report = this.fact.report;
|
|
85
|
+
const rels = report.getChildRelationships(this.fact.conceptName(), "calc")[elr];
|
|
86
|
+
const resolvedCalcClass = this.calc11 ? ResolvedCalc11Calculation : ResolvedLegacyCalculation;
|
|
87
|
+
const resolvedCalculation = new resolvedCalcClass(elr, this.fact);
|
|
88
|
+
for (const r of rels) {
|
|
89
|
+
const factset = calcFacts[r.t] ?? new FactSet();
|
|
90
|
+
resolvedCalculation.addRow(new CalculationContribution(report.getConcept(r.t), r.w, factset));
|
|
91
|
+
}
|
|
92
|
+
return resolvedCalculation;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
class CalculationContribution {
|
|
97
|
+
|
|
98
|
+
constructor(concept, weight, facts) {
|
|
99
|
+
this.concept = concept;
|
|
100
|
+
this.weight = weight;
|
|
101
|
+
this.facts = facts;
|
|
102
|
+
|
|
103
|
+
if (weight == 1) {
|
|
104
|
+
this.weightSign = '+';
|
|
105
|
+
}
|
|
106
|
+
else if (weight == -1) {
|
|
107
|
+
this.weightSign = '-';
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.weightSign = weight.toString();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
contributionInterval() {
|
|
115
|
+
const intersection = this.facts.valueIntersection();
|
|
116
|
+
if (intersection === undefined) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
return intersection.times(this.weight);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
class AbstractResolvedCalculation {
|
|
124
|
+
|
|
125
|
+
constructor(elr, fact) {
|
|
126
|
+
this.totalFact = fact;
|
|
127
|
+
this.totalFactSet = new FactSet(fact.report.getAlignedFacts(fact));
|
|
128
|
+
this.elr = elr;
|
|
129
|
+
this.rows = [];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
addRow(contribution) {
|
|
133
|
+
this.rows.push(contribution);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
binds() {
|
|
137
|
+
return this.rows.some((r) => !r.facts.isEmpty());
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
unchecked() {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export class ResolvedCalc11Calculation extends AbstractResolvedCalculation {
|
|
146
|
+
|
|
147
|
+
calculatedTotalInterval() {
|
|
148
|
+
let total = new Interval(0, 0);
|
|
149
|
+
for (const item of this.rows) {
|
|
150
|
+
if (!item.facts.isEmpty()) {
|
|
151
|
+
const contribution = item.contributionInterval();
|
|
152
|
+
if (contribution === undefined) {
|
|
153
|
+
// Inconsistent duplicates
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
total = total.plus(contribution);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return total;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* Is the calculation consistent under Calculations v1.1 rules?
|
|
165
|
+
*/
|
|
166
|
+
isConsistent() {
|
|
167
|
+
const cti = this.calculatedTotalInterval();
|
|
168
|
+
const ti = this.totalFactSet.valueIntersection();
|
|
169
|
+
return cti !== undefined && cti.intersection(ti) !== undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export class ResolvedLegacyCalculation extends AbstractResolvedCalculation {
|
|
174
|
+
|
|
175
|
+
binds() {
|
|
176
|
+
return super.binds() && this.rows.every((r) => r.facts.completeDuplicates());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
unchecked() {
|
|
180
|
+
return super.binds() && !this.binds();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
calculatedTotal() {
|
|
184
|
+
let total = new Decimal(0);
|
|
185
|
+
|
|
186
|
+
for (const row of this.rows) {
|
|
187
|
+
if (!row.facts.isConsistent()) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
if (!row.facts.isEmpty()) {
|
|
191
|
+
// Calculation does not bind if there are consistent (non-exact)
|
|
192
|
+
// duplicates, so we can just take the first duplicate value
|
|
193
|
+
total = total.plus(row.facts.items()[0].roundedValue().times(row.weight));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return total;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
isConsistent() {
|
|
200
|
+
return this.calculatedTotal().equals(this.totalFact.roundedValue());
|
|
201
|
+
}
|
|
202
|
+
}
|