@abi-software/map-side-bar 2.12.2 → 2.12.4-acupoint.1
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.
- package/README.md +0 -2
- package/dist/map-side-bar.js +9126 -8590
- package/dist/map-side-bar.umd.cjs +63 -63
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/App.vue +24 -2
- package/src/acupoints.js +78 -0
- package/src/components/AcupointsCard.vue +234 -0
- package/src/components/AcupointsInfoSearch.vue +468 -0
- package/src/components/BadgesGroup.vue +1 -17
- package/src/components/DatasetCard.vue +0 -30
- package/src/components/DatasetExplorer.vue +0 -3
- package/src/components/ImageGallery.vue +0 -93
- package/src/components/SideBar.vue +48 -6
- package/src/components.d.ts +5 -0
- package/src/services/flatmapKnowledge.js +94 -0
- package/src/services/flatmapQueries.js +498 -0
|
@@ -40,12 +40,6 @@ export default {
|
|
|
40
40
|
components: { Gallery },
|
|
41
41
|
mixins: [GalleryHelper, S3Bucket],
|
|
42
42
|
props: {
|
|
43
|
-
datasetBiolucida: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: () => {
|
|
46
|
-
return {}
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
43
|
envVars: {
|
|
50
44
|
type: Object,
|
|
51
45
|
default: () => {},
|
|
@@ -89,13 +83,10 @@ export default {
|
|
|
89
83
|
ro: null,
|
|
90
84
|
maxWidth: 3,
|
|
91
85
|
items: {
|
|
92
|
-
//Use the Images instead for Biolucida Images
|
|
93
|
-
//"Biolucida Images": [],
|
|
94
86
|
Dataset: [],
|
|
95
87
|
Flatmaps:[],
|
|
96
88
|
Images: [],
|
|
97
89
|
Scaffolds: [],
|
|
98
|
-
Segmentations: [],
|
|
99
90
|
Simulations: [],
|
|
100
91
|
Videos: [],
|
|
101
92
|
Plots: [],
|
|
@@ -128,7 +119,6 @@ export default {
|
|
|
128
119
|
this.createScaffoldItems()
|
|
129
120
|
this.createSimulationItems()
|
|
130
121
|
this.createPlotItems()
|
|
131
|
-
this.createSegmentationItems()
|
|
132
122
|
/* Disable these two
|
|
133
123
|
this.createImageItems();
|
|
134
124
|
this.createVideoItems();
|
|
@@ -324,47 +314,6 @@ export default {
|
|
|
324
314
|
})
|
|
325
315
|
}
|
|
326
316
|
},
|
|
327
|
-
createSegmentationItems: function () {
|
|
328
|
-
if (this.entry.segmentation) {
|
|
329
|
-
this.entry.segmentation.forEach((segmentation) => {
|
|
330
|
-
const id = segmentation.id
|
|
331
|
-
let filePath = segmentation.dataset.path
|
|
332
|
-
filePath = filePath.replaceAll(' ', '_')
|
|
333
|
-
filePath = filePath.replaceAll(',', '_')
|
|
334
|
-
const prefix = this.envVars.NL_LINK_PREFIX
|
|
335
|
-
const resource = {
|
|
336
|
-
share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
|
|
337
|
-
}
|
|
338
|
-
let action = {
|
|
339
|
-
label: capitalise(this.label),
|
|
340
|
-
resource: resource,
|
|
341
|
-
datasetId: this.datasetId,
|
|
342
|
-
s3uri: this.entry.s3uri,
|
|
343
|
-
title: 'View segmentation',
|
|
344
|
-
type: 'Segmentation',
|
|
345
|
-
}
|
|
346
|
-
const thumbnailURL = this.getSegmentationThumbnailURL(
|
|
347
|
-
this.envVars.API_LOCATION,
|
|
348
|
-
{
|
|
349
|
-
id,
|
|
350
|
-
datasetId: this.datasetId,
|
|
351
|
-
datasetVersion: this.datasetVersion,
|
|
352
|
-
segmentationFilePath: filePath,
|
|
353
|
-
s3Bucket: this.s3Bucket,
|
|
354
|
-
}
|
|
355
|
-
)
|
|
356
|
-
this.items['Segmentations'].push({
|
|
357
|
-
id,
|
|
358
|
-
title: baseName(filePath),
|
|
359
|
-
type: 'Segmentation',
|
|
360
|
-
thumbnail: thumbnailURL,
|
|
361
|
-
userData: action,
|
|
362
|
-
hideType: true,
|
|
363
|
-
mimetype: 'image/png',
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
317
|
createSimulationItems: function () {
|
|
369
318
|
if (this.entry.simulation) {
|
|
370
319
|
this.entry.simulation.forEach((simulation) => {
|
|
@@ -496,48 +445,6 @@ export default {
|
|
|
496
445
|
galleryItems: function () {
|
|
497
446
|
this.resetIndex = false
|
|
498
447
|
},
|
|
499
|
-
datasetBiolucida: {
|
|
500
|
-
deep: true,
|
|
501
|
-
immediate: true,
|
|
502
|
-
handler: function (biolucidaData) {
|
|
503
|
-
let items = []
|
|
504
|
-
if ('dataset_images' in biolucidaData) {
|
|
505
|
-
items.push(
|
|
506
|
-
...Array.from(biolucidaData.dataset_images, (dataset_image) => {
|
|
507
|
-
const thumbnailURL = this.getThumbnailURLFromBiolucida(
|
|
508
|
-
this.envVars.API_LOCATION,
|
|
509
|
-
{
|
|
510
|
-
id: dataset_image.image_id,
|
|
511
|
-
}
|
|
512
|
-
)
|
|
513
|
-
const resource = {
|
|
514
|
-
share_link: dataset_image.share_link,
|
|
515
|
-
id: dataset_image.image_id,
|
|
516
|
-
itemId: dataset_image.sourcepkg_id,
|
|
517
|
-
}
|
|
518
|
-
let action = {
|
|
519
|
-
label: capitalise(this.label),
|
|
520
|
-
resource: resource,
|
|
521
|
-
datasetId: this.datasetId,
|
|
522
|
-
title: 'View image',
|
|
523
|
-
name: capitalise(this.label),
|
|
524
|
-
type: 'Biolucida',
|
|
525
|
-
}
|
|
526
|
-
return {
|
|
527
|
-
id: dataset_image.image_id,
|
|
528
|
-
title: `Image`,
|
|
529
|
-
type: 'Image',
|
|
530
|
-
thumbnail: thumbnailURL,
|
|
531
|
-
userData: action,
|
|
532
|
-
mimetype: 'image/png',
|
|
533
|
-
hideType: true,
|
|
534
|
-
}
|
|
535
|
-
})
|
|
536
|
-
)
|
|
537
|
-
}
|
|
538
|
-
this.items['Images'] = items
|
|
539
|
-
},
|
|
540
|
-
},
|
|
541
448
|
},
|
|
542
449
|
mounted() {
|
|
543
450
|
this.ro = new ResizeObserver(this.onResize).observe(this.$el)
|
|
@@ -64,6 +64,14 @@
|
|
|
64
64
|
@connectivity-item-close="onConnectivityItemClose"
|
|
65
65
|
/>
|
|
66
66
|
</template>
|
|
67
|
+
<template v-else-if="tab.type === 'acupoints' && acupointsInfoList">
|
|
68
|
+
<acupoints-info-search
|
|
69
|
+
:ref="'acupointsTab_' + tab.id"
|
|
70
|
+
:entry="acupointsInfoList"
|
|
71
|
+
@on-acupoints-click="acupointClicked"
|
|
72
|
+
v-show="tab.id === activeTabId"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
67
75
|
<template v-else>
|
|
68
76
|
<DatasetExplorer
|
|
69
77
|
class="sidebar-content-container"
|
|
@@ -92,6 +100,7 @@ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
|
|
|
92
100
|
import DatasetExplorer from './DatasetExplorer.vue'
|
|
93
101
|
import EventBus from './EventBus.js'
|
|
94
102
|
import Tabs from './Tabs.vue'
|
|
103
|
+
import AcupointsInfoSearch from './AcupointsInfoSearch.vue'
|
|
95
104
|
import AnnotationTool from './AnnotationTool.vue'
|
|
96
105
|
import ConnectivityExplorer from './ConnectivityExplorer.vue'
|
|
97
106
|
import { removeShowAllFacets } from '../algolia/utils.js'
|
|
@@ -129,9 +138,8 @@ export default {
|
|
|
129
138
|
},
|
|
130
139
|
/**
|
|
131
140
|
* The environment variables object with
|
|
132
|
-
* `API_LOCATION`, `ALGOLIA_KEY`, `ALGOLIA_ID`,
|
|
133
|
-
* `
|
|
134
|
-
* `NL_LINK_PREFIX`, `ROOT_URL`
|
|
141
|
+
* `API_LOCATION`, `ALGOLIA_KEY`, `ALGOLIA_ID`, `ALGOLIA_INDEX`,
|
|
142
|
+
* `PENNSIEVE_API_LOCATION`, `BL_SERVER_URL`, `ROOT_URL`
|
|
135
143
|
*/
|
|
136
144
|
envVars: {
|
|
137
145
|
type: Object,
|
|
@@ -151,6 +159,13 @@ export default {
|
|
|
151
159
|
type: Array,
|
|
152
160
|
default: [],
|
|
153
161
|
},
|
|
162
|
+
/**
|
|
163
|
+
* The acupoints info to show in sidebar.
|
|
164
|
+
*/
|
|
165
|
+
acupointsInfoList: {
|
|
166
|
+
type: Object,
|
|
167
|
+
default: null,
|
|
168
|
+
},
|
|
154
169
|
/**
|
|
155
170
|
* The annotation data to show in sidebar.
|
|
156
171
|
*/
|
|
@@ -204,6 +219,13 @@ export default {
|
|
|
204
219
|
}
|
|
205
220
|
},
|
|
206
221
|
methods: {
|
|
222
|
+
/**
|
|
223
|
+
* This event is emitted with a mouse click on acupoint card
|
|
224
|
+
* @arg data
|
|
225
|
+
*/
|
|
226
|
+
acupointClicked: function (data) {
|
|
227
|
+
this.$emit('acupoints-clicked', data)
|
|
228
|
+
},
|
|
207
229
|
onConnectivityCollapseChange: function (data) {
|
|
208
230
|
this.$emit('connectivity-collapse-change', data)
|
|
209
231
|
},
|
|
@@ -295,9 +317,6 @@ export default {
|
|
|
295
317
|
datasetExplorerTabRef.openSearch(facets, query);
|
|
296
318
|
})
|
|
297
319
|
},
|
|
298
|
-
/**
|
|
299
|
-
* Get the ref id of the tab by id and type.
|
|
300
|
-
*/
|
|
301
320
|
getTabRef: function (id, type, switchTab = false) {
|
|
302
321
|
const matchedTab = this.tabEntries.filter((tabEntry) => {
|
|
303
322
|
return (id === undefined || tabEntry.id === id) &&
|
|
@@ -407,6 +426,14 @@ export default {
|
|
|
407
426
|
updateConnectivityError: function (errorInfo) {
|
|
408
427
|
EventBus.emit('connectivity-error', errorInfo);
|
|
409
428
|
},
|
|
429
|
+
openAcupointsSearch: function (term) {
|
|
430
|
+
this.drawerOpen = true
|
|
431
|
+
// Because refs are in v-for, nextTick is needed here
|
|
432
|
+
this.$nextTick(() => {
|
|
433
|
+
const tabRef = this.getTabRef(undefined, 'acupoints', true);
|
|
434
|
+
tabRef.search(term);
|
|
435
|
+
})
|
|
436
|
+
},
|
|
410
437
|
/**
|
|
411
438
|
* Store available anatomy facets data for connectivity list component
|
|
412
439
|
*/
|
|
@@ -503,6 +530,11 @@ export default {
|
|
|
503
530
|
// This should respect the information provided by the property
|
|
504
531
|
tabEntries: function () {
|
|
505
532
|
return this.tabs.filter((tab) =>
|
|
533
|
+
(tab.type === "acupoints" &&
|
|
534
|
+
(
|
|
535
|
+
this.acupointsInfoList &&
|
|
536
|
+
Object.keys(this.acupointsInfoList).length > 0
|
|
537
|
+
)) ||
|
|
506
538
|
tab.type === "datasetExplorer" ||
|
|
507
539
|
tab.type === "connectivityExplorer" ||
|
|
508
540
|
(
|
|
@@ -565,6 +597,16 @@ export default {
|
|
|
565
597
|
this.$emit('connectivity-source-change', payLoad);
|
|
566
598
|
})
|
|
567
599
|
|
|
600
|
+
// Emit acupoints clicked event
|
|
601
|
+
EventBus.on('acupoints-clicked', (payLoad) => {
|
|
602
|
+
this.$emit('acupoints-clicked', payLoad);
|
|
603
|
+
})
|
|
604
|
+
|
|
605
|
+
// Emit acupoints hovered event
|
|
606
|
+
EventBus.on('acupoints-hovered', (payLoad) => {
|
|
607
|
+
this.$emit('acupoints-hovered', payLoad);
|
|
608
|
+
})
|
|
609
|
+
|
|
568
610
|
// Get available anatomy facets for the connectivity info
|
|
569
611
|
EventBus.on('available-facets', (payLoad) => {
|
|
570
612
|
this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
|
package/src/components.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export {}
|
|
|
7
7
|
|
|
8
8
|
declare module 'vue' {
|
|
9
9
|
export interface GlobalComponents {
|
|
10
|
+
AcupointsCard: typeof import('./components/AcupointsCard.vue')['default']
|
|
11
|
+
AcupointsInfoSearch: typeof import('./components/AcupointsInfoSearch.vue')['default']
|
|
10
12
|
AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
|
|
11
13
|
BadgesGroup: typeof import('./components/BadgesGroup.vue')['default']
|
|
12
14
|
ConnectivityCard: typeof import('./components/ConnectivityCard.vue')['default']
|
|
@@ -19,6 +21,8 @@ declare module 'vue' {
|
|
|
19
21
|
ElCascader: typeof import('element-plus/es')['ElCascader']
|
|
20
22
|
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
|
21
23
|
ElCol: typeof import('element-plus/es')['ElCol']
|
|
24
|
+
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
|
25
|
+
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
|
22
26
|
ElDrawer: typeof import('element-plus/es')['ElDrawer']
|
|
23
27
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
|
24
28
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
|
@@ -38,6 +42,7 @@ declare module 'vue' {
|
|
|
38
42
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
|
39
43
|
ElPopover: typeof import('element-plus/es')['ElPopover']
|
|
40
44
|
ElRadio: typeof import('element-plus/es')['ElRadio']
|
|
45
|
+
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
|
|
41
46
|
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
|
42
47
|
ElRow: typeof import('element-plus/es')['ElRow']
|
|
43
48
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
async function getReferenceConnectivitiesFromStorage(resource) {
|
|
2
|
+
const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
|
|
3
|
+
|
|
4
|
+
if (flatmapKnowledgeRaw) {
|
|
5
|
+
const flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
|
|
6
|
+
const dataWithRefs = flatmapKnowledge.filter((x) => x.references && x.references.length);
|
|
7
|
+
const foundData = dataWithRefs.filter((x) => x.references.includes(resource));
|
|
8
|
+
|
|
9
|
+
if (foundData.length) {
|
|
10
|
+
const featureIds = foundData.map((x) => x.id);
|
|
11
|
+
return featureIds;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function getReferenceConnectivitiesByAPI(mapImp, resource, flatmapQueries) {
|
|
18
|
+
const knowledgeSource = getKnowledgeSource(mapImp);
|
|
19
|
+
const sql = `select knowledge from knowledge
|
|
20
|
+
where source="${knowledgeSource}" and
|
|
21
|
+
knowledge like "%${resource}%" order by source desc`;
|
|
22
|
+
console.log(sql)
|
|
23
|
+
const response = await flatmapQueries.flatmapQuery(sql);
|
|
24
|
+
const mappedData = response.values.map((x) => x[0]);
|
|
25
|
+
const parsedData = mappedData.map((x) => JSON.parse(x));
|
|
26
|
+
const featureIds = parsedData.map((x) => x.id);
|
|
27
|
+
return featureIds;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getKnowledgeSource(mapImp) {
|
|
31
|
+
let mapKnowledgeSource = '';
|
|
32
|
+
if (mapImp.provenance?.connectivity) {
|
|
33
|
+
const sckanProvenance = mapImp.provenance.connectivity;
|
|
34
|
+
if ('knowledge-source' in sckanProvenance) {
|
|
35
|
+
mapKnowledgeSource = sckanProvenance['knowledge-source'];
|
|
36
|
+
} else if ('npo' in sckanProvenance) {
|
|
37
|
+
mapKnowledgeSource = `${sckanProvenance.npo.release}-npo`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return mapKnowledgeSource;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function loadAndStoreKnowledge(mapImp, flatmapQueries) {
|
|
45
|
+
const knowledgeSource = getKnowledgeSource(mapImp);
|
|
46
|
+
const sql = `select knowledge from knowledge
|
|
47
|
+
where source="${knowledgeSource}"
|
|
48
|
+
order by source desc`;
|
|
49
|
+
const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
|
|
50
|
+
|
|
51
|
+
if (!flatmapKnowledge) {
|
|
52
|
+
flatmapQueries.flatmapQuery(sql).then((response) => {
|
|
53
|
+
const mappedData = response.values.map(x => x[0]);
|
|
54
|
+
const parsedData = mappedData.map(x => JSON.parse(x));
|
|
55
|
+
sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
|
|
56
|
+
updateFlatmapKnowledgeCache();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function updateFlatmapKnowledgeCache() {
|
|
62
|
+
const CACHE_LIFETIME = 24 * 60 * 60 * 1000; // One day
|
|
63
|
+
const now = new Date();
|
|
64
|
+
const expiry = now.getTime() + CACHE_LIFETIME;
|
|
65
|
+
|
|
66
|
+
sessionStorage.setItem('flatmap-knowledge-expiry', expiry);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function removeFlatmapKnowledgeCache() {
|
|
70
|
+
const keys = [
|
|
71
|
+
'flatmap-knowledge',
|
|
72
|
+
'flatmap-knowledge-expiry',
|
|
73
|
+
];
|
|
74
|
+
keys.forEach((key) => {
|
|
75
|
+
sessionStorage.removeItem(key);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function refreshFlatmapKnowledgeCache() {
|
|
80
|
+
const expiry = sessionStorage.getItem('flatmap-knowledge-expiry');
|
|
81
|
+
const now = new Date();
|
|
82
|
+
|
|
83
|
+
if (now.getTime() > expiry) {
|
|
84
|
+
removeFlatmapKnowledgeCache();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
getReferenceConnectivitiesFromStorage,
|
|
90
|
+
getReferenceConnectivitiesByAPI,
|
|
91
|
+
loadAndStoreKnowledge,
|
|
92
|
+
getKnowledgeSource,
|
|
93
|
+
refreshFlatmapKnowledgeCache,
|
|
94
|
+
}
|