@abi-software/map-side-bar 2.7.2-beta.0 → 2.7.2-beta.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/dist/map-side-bar.js +6951 -6547
- package/dist/map-side-bar.umd.cjs +61 -61
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +103 -27
- package/src/components/ConnectivityCard.vue +83 -0
- package/src/components/ConnectivityExplorer.vue +468 -0
- package/src/components/ConnectivityInfo.vue +157 -82
- package/src/components/SearchFilters.vue +66 -51
- package/src/components/SideBar.vue +83 -88
- package/src/components/SidebarContent.vue +2 -1
- package/src/components/Tabs.vue +56 -95
- package/src/components.d.ts +3 -0
- package/src/exampleConnectivityInput.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.7.2-beta.
|
|
3
|
+
"version": "2.7.2-beta.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/*",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@abi-software/gallery": "^1.1.2",
|
|
42
|
-
"@abi-software/map-utilities": "^1.4.
|
|
42
|
+
"@abi-software/map-utilities": "^1.4.0",
|
|
43
43
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
package/src/App.vue
CHANGED
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
<el-button @click="keywordSearch">keyword search</el-button>
|
|
17
17
|
<el-button @click="getFacets">Get facets</el-button>
|
|
18
18
|
<el-button @click="toggleCreateData">Create Data/Annotation</el-button>
|
|
19
|
+
<el-button @click="openConnectivitySearch()">Connectivity Search</el-button>
|
|
19
20
|
</div>
|
|
20
21
|
<SideBar
|
|
21
22
|
:envVars="envVars"
|
|
22
23
|
class="side-bar"
|
|
23
24
|
ref="sideBar"
|
|
24
25
|
:visible="sideBarVisibility"
|
|
25
|
-
:tabs="tabs"
|
|
26
|
-
:activeTabId="activeId"
|
|
27
26
|
:annotationEntry="annotationEntry"
|
|
28
27
|
:createData="createData"
|
|
29
28
|
:connectivityInfo="connectivityInput"
|
|
30
|
-
|
|
29
|
+
:connectivityKnowledge="connectivityKnowledge"
|
|
31
30
|
@search-changed="searchChanged($event)"
|
|
32
31
|
@hover-changed="hoverChanged($event)"
|
|
33
|
-
@connectivity-
|
|
32
|
+
@connectivity-clicked="openConnectivitySearch"
|
|
33
|
+
@connectivity-hovered="onConnectivityHovered"
|
|
34
34
|
@actionClick="action"
|
|
35
35
|
/>
|
|
36
36
|
</div>
|
|
@@ -39,12 +39,31 @@
|
|
|
39
39
|
<script>
|
|
40
40
|
/* eslint-disable no-alert, no-console */
|
|
41
41
|
// optionally import default styles
|
|
42
|
+
import { markRaw } from "vue";
|
|
42
43
|
import SideBar from './components/SideBar.vue'
|
|
43
44
|
import EventBus from './components/EventBus.js'
|
|
44
45
|
import exampleConnectivityInput from './exampleConnectivityInput.js'
|
|
46
|
+
// import { FlatmapQueries } from "@abi-software/map-utilities/src/services/flatmapQueries.js";
|
|
47
|
+
// import { getKnowledgeSource, loadAndStoreKnowledge } from "@abi-software/map-utilities/src/services/flatmapKnowledge.js";
|
|
48
|
+
|
|
45
49
|
|
|
46
50
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
47
51
|
|
|
52
|
+
const flatmapQuery = (flatmapApi, sql) => {
|
|
53
|
+
const data = { sql: sql };
|
|
54
|
+
return fetch(`${flatmapApi}knowledge/query/`, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
},
|
|
59
|
+
body: JSON.stringify(data),
|
|
60
|
+
})
|
|
61
|
+
.then((response) => response.json())
|
|
62
|
+
.catch((error) => {
|
|
63
|
+
console.error("Error:", error);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
48
67
|
// let testContext = {
|
|
49
68
|
// "description": "3D digital tracings of the enteric plexus obtained from seven subjects (M11, M16, M162, M163, M164, M168) are mapped randomly on mouse proximal colon. The data depicts individual neural wiring patterns in enteric microcircuits, and revealed both neuron and fiber units wired in a complex organization.",
|
|
50
69
|
// "heading": "Digital tracings of enteric plexus",
|
|
@@ -94,27 +113,19 @@ export default {
|
|
|
94
113
|
components: {
|
|
95
114
|
SideBar,
|
|
96
115
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return temp
|
|
104
|
-
},
|
|
116
|
+
provide() {
|
|
117
|
+
return {
|
|
118
|
+
$annotator: undefined,
|
|
119
|
+
userApiKey: undefined,
|
|
120
|
+
}
|
|
105
121
|
},
|
|
106
122
|
data: function () {
|
|
107
123
|
return {
|
|
108
124
|
annotationEntry: {
|
|
109
|
-
featureId
|
|
110
|
-
resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
|
|
125
|
+
featureId: "epicardium",
|
|
126
|
+
resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
|
|
127
|
+
"resource": "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json"
|
|
111
128
|
},
|
|
112
|
-
contextArray: [null, null],
|
|
113
|
-
tabArray: [
|
|
114
|
-
{ title: 'Flatmap', id: 1, type: 'search'},
|
|
115
|
-
{ title: 'Connectivity', id: 2, type: 'connectivity' },
|
|
116
|
-
{ title: 'Annotation', id: 3, type: 'annotation' },
|
|
117
|
-
],
|
|
118
129
|
sideBarVisibility: true,
|
|
119
130
|
envVars: {
|
|
120
131
|
API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
|
|
@@ -128,7 +139,6 @@ export default {
|
|
|
128
139
|
FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
|
|
129
140
|
},
|
|
130
141
|
connectivityInput: exampleConnectivityInput,
|
|
131
|
-
activeId: 1,
|
|
132
142
|
createData: {
|
|
133
143
|
toBeConfirmed: false,
|
|
134
144
|
points: [],
|
|
@@ -137,17 +147,75 @@ export default {
|
|
|
137
147
|
y: 0,
|
|
138
148
|
},
|
|
139
149
|
createDataSet: false,
|
|
150
|
+
sckanVersion: 'sckan-2024-09-21-npo',
|
|
151
|
+
flatmapKnowledge: [],
|
|
152
|
+
connectivityKnowledge: [],
|
|
153
|
+
query: '',
|
|
154
|
+
filter: [],
|
|
155
|
+
target: [],
|
|
140
156
|
}
|
|
141
157
|
},
|
|
142
158
|
methods: {
|
|
159
|
+
loadConnectivityKnowledge: async function (flatmap) {
|
|
160
|
+
// const sckanVersion = getKnowledgeSource(flatmap);
|
|
161
|
+
// const flatmapQueries = markRaw(new FlatmapQueries());
|
|
162
|
+
// flatmapQueries.initialise(this.envVars.FLATMAPAPI_LOCATION);
|
|
163
|
+
// const knowledge = await loadAndStoreKnowledge(flatmap, flatmapQueries);
|
|
164
|
+
const sql = `select knowledge from knowledge
|
|
165
|
+
where source="${this.sckanVersion}"
|
|
166
|
+
order by source desc`;
|
|
167
|
+
const response = await flatmapQuery(this.envVars.FLATMAPAPI_LOCATION, sql);
|
|
168
|
+
const mappedData = response.values.map(x => x[0]);
|
|
169
|
+
const knowledge = mappedData.map(x => JSON.parse(x));
|
|
170
|
+
this.flatmapKnowledge = knowledge.filter((item) => {
|
|
171
|
+
if (item.source === this.sckanVersion && item.connectivity?.length) return true;
|
|
172
|
+
return false;
|
|
173
|
+
});
|
|
174
|
+
this.connectivityKnowledge = this.flatmapKnowledge;
|
|
175
|
+
},
|
|
176
|
+
connectivityQueryFilter: async function (flatmap, payload) {
|
|
177
|
+
let results = this.flatmapKnowledge;
|
|
178
|
+
if (payload.type === "query-update") {
|
|
179
|
+
if (this.query !== payload.value) this.target = [];
|
|
180
|
+
this.query = payload.value;
|
|
181
|
+
} else if (payload.type === "filter-update") {
|
|
182
|
+
this.filter = payload.value;
|
|
183
|
+
this.target = [];
|
|
184
|
+
} else if (payload.type === "query-filter-update") {
|
|
185
|
+
this.query = payload.query;
|
|
186
|
+
this.filter = payload.filter;
|
|
187
|
+
this.target = payload.data;
|
|
188
|
+
}
|
|
189
|
+
if (this.query) {
|
|
190
|
+
let flag = "", order = [], suggestions = [], paths = [];
|
|
191
|
+
// this.searchSuggestions(this.query, suggestions);
|
|
192
|
+
// const labels = [...new Set(suggestions)];
|
|
193
|
+
const labels = ['neuron type aacar 11'];
|
|
194
|
+
flag = 'label';
|
|
195
|
+
order = labels;
|
|
196
|
+
if (labels.length === 1) {
|
|
197
|
+
// const options = {
|
|
198
|
+
// type: this.filter.map(f => f.facet.toLowerCase()),
|
|
199
|
+
// target: this.target.map(d => d.id),
|
|
200
|
+
// };
|
|
201
|
+
// paths = await flatmap.retrieveConnectedPaths(this.query, options);
|
|
202
|
+
paths =['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
|
|
203
|
+
flag = 'id';
|
|
204
|
+
order = [this.query, ...paths.filter(item => item !== this.query)];
|
|
205
|
+
}
|
|
206
|
+
results = results.filter(item => paths.includes(item.id) || labels.includes(item.label));
|
|
207
|
+
results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
|
|
208
|
+
}
|
|
209
|
+
this.connectivityKnowledge = results;
|
|
210
|
+
},
|
|
143
211
|
hoverChanged: function (data) {
|
|
144
212
|
console.log('hoverChanged', data)
|
|
145
213
|
},
|
|
146
214
|
searchChanged: function (data) {
|
|
147
215
|
console.log(data)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
216
|
+
if (data.id === 4) {
|
|
217
|
+
this.connectivityQueryFilter({}, data)
|
|
218
|
+
}
|
|
151
219
|
},
|
|
152
220
|
// For connectivity input actions
|
|
153
221
|
action: function (action) {
|
|
@@ -279,11 +347,16 @@ export default {
|
|
|
279
347
|
this.createDataSet = false
|
|
280
348
|
}
|
|
281
349
|
},
|
|
282
|
-
|
|
283
|
-
console.log("
|
|
350
|
+
onConnectivityHovered: function(data) {
|
|
351
|
+
console.log("onConnectivityHovered" , data)
|
|
352
|
+
},
|
|
353
|
+
openConnectivitySearch: function (entry) {
|
|
354
|
+
const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5'
|
|
355
|
+
const filter = entry ? entry.filter : []
|
|
356
|
+
this.$refs.sideBar.openConnectivitySearch(filter, query)
|
|
284
357
|
}
|
|
285
358
|
},
|
|
286
|
-
mounted: function () {
|
|
359
|
+
mounted: async function () {
|
|
287
360
|
console.log('mounted app')
|
|
288
361
|
EventBus.on('contextUpdate', (payLoad) => {
|
|
289
362
|
console.log('contextUpdate', payLoad)
|
|
@@ -291,6 +364,9 @@ export default {
|
|
|
291
364
|
EventBus.on('datalink-clicked', (payLoad) => {
|
|
292
365
|
console.log('datalink-clicked', payLoad)
|
|
293
366
|
});
|
|
367
|
+
setTimeout(()=>{
|
|
368
|
+
this.loadConnectivityKnowledge({ 'provenance': { 'connectivity': { 'knowledge-source': this.sckanVersion } } });
|
|
369
|
+
}, 2000)
|
|
294
370
|
},
|
|
295
371
|
}
|
|
296
372
|
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="connectivity-card-container" ref="container">
|
|
3
|
+
<div class="connectivity-card" ref="card">
|
|
4
|
+
<div class="seperator-path"></div>
|
|
5
|
+
<div class="card">
|
|
6
|
+
<div class="title" @click="cardClicked(entry)">{{ entry.label }}</div>
|
|
7
|
+
<template v-for="field in displayFields" :key="field">
|
|
8
|
+
<div class="details" v-if="entry[field]">
|
|
9
|
+
<strong>{{ field }}:</strong> {{ entry[field] }}
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<el-button @click="cardClicked(entry)" size="small" class="button">
|
|
13
|
+
View connectivity
|
|
14
|
+
</el-button>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
/* eslint-disable no-alert, no-console */
|
|
22
|
+
import EventBus from "./EventBus.js";
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
displayFields: ["label", "id"],
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
name: "ConnectivityCard",
|
|
31
|
+
props: {
|
|
32
|
+
/**
|
|
33
|
+
* Object containing information for
|
|
34
|
+
* the required viewing.
|
|
35
|
+
*/
|
|
36
|
+
entry: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: () => {},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
cardClicked: function (data) {
|
|
43
|
+
EventBus.emit("connectivity-explorer-clicked", data);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<style lang="scss" scoped>
|
|
50
|
+
.connectivity-card {
|
|
51
|
+
padding-left: 5px;
|
|
52
|
+
position: relative;
|
|
53
|
+
min-height: 8.5rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.card {
|
|
57
|
+
padding-top: 18px;
|
|
58
|
+
padding-left: 6px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.title {
|
|
62
|
+
padding-bottom: 0.75rem;
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
line-height: 1.5;
|
|
65
|
+
letter-spacing: 1.05px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.details {
|
|
70
|
+
line-height: 1.5;
|
|
71
|
+
letter-spacing: 1.05px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.button {
|
|
75
|
+
font-family: Asap;
|
|
76
|
+
font-size: 14px;
|
|
77
|
+
font-weight: normal;
|
|
78
|
+
background-color: $app-primary-color;
|
|
79
|
+
border: $app-primary-color;
|
|
80
|
+
color: white;
|
|
81
|
+
margin-top: 8px;
|
|
82
|
+
}
|
|
83
|
+
</style>
|