@abi-software/map-side-bar 1.3.35 → 1.3.36-staging
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/img/logo-sparc-wave-primary.8ed83a51.svg +1 -0
- package/dist/map-side-bar.common.js +2068 -1133
- package/dist/map-side-bar.common.js.map +1 -1
- package/dist/map-side-bar.css +1 -1
- package/dist/map-side-bar.umd.js +2068 -1133
- package/dist/map-side-bar.umd.js.map +1 -1
- package/dist/map-side-bar.umd.min.js +3 -1
- package/dist/map-side-bar.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -4
- package/src/algolia/algolia.js +13 -13
- package/src/algolia/utils.js +2 -2
- package/src/components/BadgesGroup.vue +2 -3
- package/src/components/ContextCard.vue +4 -1
- package/src/components/DatasetCard.vue +67 -7
- package/src/components/ImageGallery.vue +8 -14
- package/src/components/SearchFilters.vue +23 -0
- package/src/components/SideBar.vue +22 -1
- package/src/components/SidebarContent.vue +7 -4
- package/src/mixins/GalleryHelpers.js +104 -0
- package/delte.json +0 -30
package/package-lock.json
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
package/src/algolia/algolia.js
CHANGED
|
@@ -79,10 +79,10 @@ export class AlgoliaClient {
|
|
|
79
79
|
newResult = { ...res }
|
|
80
80
|
newResult = {
|
|
81
81
|
doi: res.item.curie.split(':')[1],
|
|
82
|
-
name: res.item.name,
|
|
83
|
-
description: res.item.description,
|
|
84
|
-
updated: res.pennsieve ? res.pennsieve.updatedAt :
|
|
85
|
-
publishDate: res.pennsieve
|
|
82
|
+
name: res.item.dataset.name,
|
|
83
|
+
description: res.item.dataset.description,
|
|
84
|
+
updated: res.pennsieve ? res.pennsieve.updatedAt : 'Unkown',
|
|
85
|
+
publishDate: res.pennsieve? res.pennsieve.publishDate : 'Uknown',
|
|
86
86
|
datasetId: res.objectID,
|
|
87
87
|
detailsReady: false
|
|
88
88
|
}
|
|
@@ -133,20 +133,20 @@ export class AlgoliaClient {
|
|
|
133
133
|
page: page - 1,
|
|
134
134
|
filters: filter,
|
|
135
135
|
attributesToHighlight: [],
|
|
136
|
-
attributesToRetrieve: [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
],
|
|
136
|
+
// attributesToRetrieve: [
|
|
137
|
+
// 'pennsieve.publishDate',
|
|
138
|
+
// 'pennsieve.updatedAt',
|
|
139
|
+
// 'item.curie',
|
|
140
|
+
// 'item.name',
|
|
141
|
+
// 'item.description',
|
|
142
|
+
// 'objectID',
|
|
143
|
+
// ],
|
|
144
144
|
})
|
|
145
145
|
.then(response => {
|
|
146
146
|
let searchData = {
|
|
147
147
|
items: this._processResultsForCards(response.hits),
|
|
148
148
|
total: response.nbHits,
|
|
149
|
-
discoverIds: response.hits.map(r => r.pennsieve ? r.pennsieve.identifier :
|
|
149
|
+
discoverIds: response.hits.map(r => r.pennsieve ? r.pennsieve.identifier : undefined),
|
|
150
150
|
dois: response.hits.map(r => r.item.curie.split(':')[1])
|
|
151
151
|
}
|
|
152
152
|
resolve(searchData)
|
package/src/algolia/utils.js
CHANGED
|
@@ -8,16 +8,16 @@ export const facetPropPathMapping = {
|
|
|
8
8
|
'item.modalities.keyword' : 'Experimental Approach',
|
|
9
9
|
'attributes.subject.sex.value' : 'Sex',
|
|
10
10
|
'attributes.subject.ageCategory.value' : 'Age Categories',
|
|
11
|
-
'item.
|
|
11
|
+
'item.keywords.keyword' : 'Keywords'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Same as above, but these show on the sidebar filters
|
|
15
15
|
export const shownFilters = {
|
|
16
16
|
'anatomy.organ.name' : 'Anatomical Structure',
|
|
17
17
|
'organisms.primary.species.name' : 'Species',
|
|
18
|
+
'item.modalities.keyword' : 'Experimental Approach',
|
|
18
19
|
'attributes.subject.sex.value' : 'Sex',
|
|
19
20
|
'attributes.subject.ageCategory.value' : 'Age Categories',
|
|
20
|
-
'item.types.name' : 'Data type',
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/* Returns filter for searching algolia. All facets of the same category are joined with OR,
|
|
@@ -53,8 +53,7 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
data: function () {
|
|
55
55
|
return {
|
|
56
|
-
|
|
57
|
-
categories: { "All": {size: 1}, "Dataset": {size: 1} },
|
|
56
|
+
categories: { "All": {size: 1} },
|
|
58
57
|
active: "All"
|
|
59
58
|
};
|
|
60
59
|
},
|
|
@@ -83,7 +82,7 @@ export default {
|
|
|
83
82
|
immediate: true,
|
|
84
83
|
handler: function (biolucidaData) {
|
|
85
84
|
if ("dataset_images" in biolucidaData) {
|
|
86
|
-
this.addToCategories(biolucidaData["dataset_images"], "Images");
|
|
85
|
+
this.addToCategories(biolucidaData["dataset_images"], "Biolucida Images");
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
},
|
|
@@ -143,8 +143,11 @@ export default {
|
|
|
143
143
|
computed: {
|
|
144
144
|
samplesUnderViews: function(){
|
|
145
145
|
if (this.contextData){
|
|
146
|
+
if (!this.contextData.views || !this.contextData.samples){
|
|
147
|
+
return false
|
|
148
|
+
}
|
|
146
149
|
if (this.contextData.samplesUnderViews){
|
|
147
|
-
return
|
|
150
|
+
return this.contextData.samplesUnderViews
|
|
148
151
|
} else {
|
|
149
152
|
let viewId = this.contextData.views.map(v=>v.id)
|
|
150
153
|
let samplesView = this.contextData.samples.map(s=>s.view)
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<div class="seperator-path"></div>
|
|
5
5
|
<div v-loading="loading" class="card" >
|
|
6
6
|
<span class="card-left">
|
|
7
|
-
<image-gallery v-if="!loading
|
|
8
|
-
:datasetId="discoverId"
|
|
7
|
+
<image-gallery v-if="!loading"
|
|
8
|
+
:datasetId="String(discoverId)"
|
|
9
9
|
:datasetVersion="version"
|
|
10
10
|
:entry="entry"
|
|
11
11
|
:envVars="envVars"
|
|
@@ -172,9 +172,11 @@ export default {
|
|
|
172
172
|
splitDOI: function(doi){
|
|
173
173
|
return [doi.split('/')[doi.split('/').length-2], doi.split('/')[doi.split('/').length-1]]
|
|
174
174
|
},
|
|
175
|
-
getBanner: function () {
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
getBanner: function () { // NOTE! This getBanner uses the pennsieve api to retrive the banner. Only use for curation!
|
|
176
|
+
if (this.entry.datasetId.length > 4){
|
|
177
|
+
this.loading = true
|
|
178
|
+
this.getPennsieveBanner()
|
|
179
|
+
} else if (this.lastDoi !== this.entry.doi) {
|
|
178
180
|
this.lastDoi = this.entry.doi
|
|
179
181
|
this.loading = true
|
|
180
182
|
let doi = this.splitDOI(this.entry.doi)
|
|
@@ -191,7 +193,7 @@ export default {
|
|
|
191
193
|
this.discoverId = data.id
|
|
192
194
|
this.version = data.version
|
|
193
195
|
this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
|
|
194
|
-
this.getBiolucidaInfo(this.discoverId)
|
|
196
|
+
if (this.discoverId.length < 5) this.getBiolucidaInfo(this.discoverId)
|
|
195
197
|
this.loading = false
|
|
196
198
|
})
|
|
197
199
|
.catch(() => {
|
|
@@ -200,9 +202,67 @@ export default {
|
|
|
200
202
|
this.discoverId = Number(this.entry.datasetId)
|
|
201
203
|
this.loading = false
|
|
202
204
|
});
|
|
203
|
-
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
getPennsieveBanner: function(){
|
|
208
|
+
// authenticate with pennsieve
|
|
209
|
+
fetch('https://cognito-idp.us-east-1.amazonaws.com/', {
|
|
210
|
+
method: 'POST',
|
|
211
|
+
headers: {
|
|
212
|
+
'Accept': 'application/json, text/plain, */*',
|
|
213
|
+
'Content-Type': 'application/x-amz-json-1.1',
|
|
214
|
+
'X-Amz-Target': 'AWSCognitoIdentityProviderService.InitiateAuth',
|
|
215
|
+
'X-Amz-User-Agent': 'aws-amplify/0.1.x js',
|
|
216
|
+
},
|
|
217
|
+
body: JSON.stringify({"AuthFlow":"USER_PASSWORD_AUTH","ClientId":"670mo7si81pcc3sfub7o1914d8","AuthParameters":{"USERNAME":"jessekhorasanee@gmail.com","PASSWORD":"Asameswayhey@666","DEVICE_KEY":"us-east-1_0d4e8de7-6079-470d-bedd-62043ba70f7e"},"ClientMetadata":{}})
|
|
218
|
+
}).then(res => res.json())
|
|
219
|
+
.then(res => {
|
|
220
|
+
console.log(res)
|
|
221
|
+
let token = res.AuthenticationResult.AccessToken
|
|
222
|
+
let proxy = `${this.envVars.API_LOCATION}proxy/?url=` // set up proxy
|
|
223
|
+
|
|
224
|
+
// call pennsieve api via proxy
|
|
225
|
+
fetch(`${proxy}https://api.pennsieve.io/datasets/N%3Adataset%3A${this.entry.datasetId}/banner?api_key=${token}`
|
|
226
|
+
).then(res=>res.json()).then(res=>{
|
|
227
|
+
console.log('success!')
|
|
228
|
+
this.thumbnail = res.banner
|
|
229
|
+
this.discoverId = this.entry.datasetId
|
|
230
|
+
this.loading = false
|
|
231
|
+
})
|
|
232
|
+
})
|
|
204
233
|
|
|
205
234
|
},
|
|
235
|
+
// getBanner: function () {
|
|
236
|
+
// // Only load banner if card has changed
|
|
237
|
+
// if (this.lastDoi !== this.entry.doi) {
|
|
238
|
+
// this.lastDoi = this.entry.doi
|
|
239
|
+
// this.loading = true
|
|
240
|
+
// let doi = this.splitDOI(this.entry.doi)
|
|
241
|
+
// fetch(`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`)
|
|
242
|
+
// .then((response) =>{
|
|
243
|
+
// if (!response.ok){
|
|
244
|
+
// throw Error(response.statusText)
|
|
245
|
+
// } else {
|
|
246
|
+
// return response.json()
|
|
247
|
+
// }
|
|
248
|
+
// })
|
|
249
|
+
// .then((data) => {
|
|
250
|
+
// this.thumbnail = data.banner
|
|
251
|
+
// this.discoverId = data.id
|
|
252
|
+
// this.version = data.version
|
|
253
|
+
// this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
|
|
254
|
+
// this.getBiolucidaInfo(this.discoverId)
|
|
255
|
+
// this.loading = false
|
|
256
|
+
// })
|
|
257
|
+
// .catch(() => {
|
|
258
|
+
// //set defaults if we hit an error
|
|
259
|
+
// this.thumbnail = require('@/../assets/missing-image.svg')
|
|
260
|
+
// this.discoverId = Number(this.entry.datasetId)
|
|
261
|
+
// this.loading = false
|
|
262
|
+
// });
|
|
263
|
+
// }
|
|
264
|
+
|
|
265
|
+
// },
|
|
206
266
|
lastName: function(fullName){
|
|
207
267
|
return fullName.split(',')[0]
|
|
208
268
|
},
|
|
@@ -28,7 +28,7 @@ const capitalise = function (string) {
|
|
|
28
28
|
return string.replace(/\b\w/g, (v) => v.toUpperCase());
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
import GalleryHelper from "
|
|
31
|
+
import GalleryHelper from "../mixins/GalleryHelpers";
|
|
32
32
|
import Gallery from "@abi-software/gallery";
|
|
33
33
|
import "@abi-software/gallery/dist/gallery.css";
|
|
34
34
|
|
|
@@ -58,8 +58,8 @@ export default {
|
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
datasetId: {
|
|
61
|
-
type:
|
|
62
|
-
default:
|
|
61
|
+
type: String,
|
|
62
|
+
default: "",
|
|
63
63
|
},
|
|
64
64
|
datasetVersion: {
|
|
65
65
|
type: Number,
|
|
@@ -86,8 +86,7 @@ export default {
|
|
|
86
86
|
ro: null,
|
|
87
87
|
maxWidth: 3,
|
|
88
88
|
items: {
|
|
89
|
-
|
|
90
|
-
//"Biolucida Images": [],
|
|
89
|
+
"Biolucida Images": [],
|
|
91
90
|
'Dataset': [],
|
|
92
91
|
'Images': [],
|
|
93
92
|
'Scaffolds': [],
|
|
@@ -229,12 +228,7 @@ export default {
|
|
|
229
228
|
let mimetype = '';
|
|
230
229
|
let thumbnailURL = undefined;
|
|
231
230
|
if (thumbnail) {
|
|
232
|
-
thumbnailURL = this.
|
|
233
|
-
id,
|
|
234
|
-
datasetId: this.datasetId,
|
|
235
|
-
datasetVersion: this.datasetVersion,
|
|
236
|
-
file_path: thumbnail.dataset.path,
|
|
237
|
-
});
|
|
231
|
+
thumbnailURL = `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`
|
|
238
232
|
mimetype = thumbnail.mimetype.name;
|
|
239
233
|
}
|
|
240
234
|
let action = {
|
|
@@ -350,7 +344,7 @@ export default {
|
|
|
350
344
|
return undefined
|
|
351
345
|
} else {
|
|
352
346
|
// The line below checks if there is a context file for each scaffold. If there is not, we use the first context card for each scaffold.
|
|
353
|
-
let contextIndex = this.entry
|
|
347
|
+
let contextIndex = this.entry.contextualInformation.length == this.entry.scaffolds.length ? scaffoldIndex : 0
|
|
354
348
|
return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}`
|
|
355
349
|
}
|
|
356
350
|
}
|
|
@@ -411,7 +405,7 @@ export default {
|
|
|
411
405
|
};
|
|
412
406
|
return {
|
|
413
407
|
id: dataset_image.image_id,
|
|
414
|
-
title: `Image`,
|
|
408
|
+
title: `Biolucida Image`,
|
|
415
409
|
type: "Image",
|
|
416
410
|
thumbnail: thumbnailURL,
|
|
417
411
|
userData: action,
|
|
@@ -421,7 +415,7 @@ export default {
|
|
|
421
415
|
})
|
|
422
416
|
);
|
|
423
417
|
}
|
|
424
|
-
this.items['Images'] = items;
|
|
418
|
+
this.items['Biolucida Images'] = items;
|
|
425
419
|
},
|
|
426
420
|
},
|
|
427
421
|
},
|
|
@@ -178,6 +178,7 @@ export default {
|
|
|
178
178
|
this.createCascaderItemValue(facet.label, facetItem.label);
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
|
+
this.createDataTypeFacet();
|
|
181
182
|
})
|
|
182
183
|
.finally(() => {
|
|
183
184
|
resolve();
|
|
@@ -289,6 +290,28 @@ export default {
|
|
|
289
290
|
}
|
|
290
291
|
return event;
|
|
291
292
|
},
|
|
293
|
+
createDataTypeFacet: function(){
|
|
294
|
+
let dataFacet = {...this.facets[2]} // copy the 'Experiemental approach' facet
|
|
295
|
+
let count = this.facets.at(-1).id // get the last id count
|
|
296
|
+
|
|
297
|
+
// Step through the children that are valid data types, switch thier values
|
|
298
|
+
let newChildren = dataFacet.children.filter( el=> {
|
|
299
|
+
if (el.label === 'Scaffold' || el.label === 'Simulation' || el.label === 'Show all'){
|
|
300
|
+
el.key = el.label
|
|
301
|
+
el.id = count
|
|
302
|
+
el.value = el.value.replace('Experimental approach', 'Data type')
|
|
303
|
+
count++
|
|
304
|
+
return el
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
dataFacet.id = count
|
|
308
|
+
dataFacet.key = 'Data type'
|
|
309
|
+
// Add 'duplicate' so that the key is unique. This is removed in the cascade event for filtering
|
|
310
|
+
dataFacet.value += 'duplicate'
|
|
311
|
+
dataFacet.children = newChildren
|
|
312
|
+
dataFacet.label = 'Data type'
|
|
313
|
+
this.facets.push(dataFacet)
|
|
314
|
+
},
|
|
292
315
|
cascadeExpandChange: function (event) {
|
|
293
316
|
//work around as the expand item may change on modifying the cascade props
|
|
294
317
|
this.__expandItem__ = event;
|
|
@@ -52,6 +52,23 @@ locale.use(lang);
|
|
|
52
52
|
Vue.use(Drawer);
|
|
53
53
|
Vue.use(Icon);
|
|
54
54
|
|
|
55
|
+
var initial_state = {
|
|
56
|
+
searchInput: "",
|
|
57
|
+
lastSearch: "",
|
|
58
|
+
results: [],
|
|
59
|
+
drawerOpen: false,
|
|
60
|
+
numberOfHits: 0,
|
|
61
|
+
filter:{},
|
|
62
|
+
filterFacet: undefined,
|
|
63
|
+
loadingCards: false,
|
|
64
|
+
numberPerPage: 10,
|
|
65
|
+
page: 1,
|
|
66
|
+
pageModel: 1,
|
|
67
|
+
start: 0,
|
|
68
|
+
hasSearched: false,
|
|
69
|
+
sciCrunchError: false
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
export default {
|
|
56
73
|
components: {SidebarContent, Tabs },
|
|
57
74
|
name: "SideBar",
|
|
@@ -60,6 +77,10 @@ export default {
|
|
|
60
77
|
type: Boolean,
|
|
61
78
|
default: false
|
|
62
79
|
},
|
|
80
|
+
entry: {
|
|
81
|
+
type: Object,
|
|
82
|
+
default: () => (initial_state)
|
|
83
|
+
},
|
|
63
84
|
envVars: {
|
|
64
85
|
type: Object,
|
|
65
86
|
default: () => {}
|
|
@@ -79,7 +100,7 @@ export default {
|
|
|
79
100
|
},
|
|
80
101
|
data: function () {
|
|
81
102
|
return {
|
|
82
|
-
|
|
103
|
+
...this.entry,
|
|
83
104
|
}
|
|
84
105
|
},
|
|
85
106
|
methods: {
|
|
@@ -311,9 +311,12 @@ export default {
|
|
|
311
311
|
}
|
|
312
312
|
data.results.forEach(element => {
|
|
313
313
|
// match the scicrunch result with algolia result
|
|
314
|
-
let i = this.results.findIndex(res
|
|
314
|
+
let i = this.results.findIndex(res=> (res.datasetId === element.dataset_identifier) || (res.identifier === element.dataset_identifier))
|
|
315
|
+
console.log('i: ', i)
|
|
316
|
+
let name = this.results[i].name
|
|
315
317
|
// Assign scicrunch results to the object
|
|
316
318
|
Object.assign(this.results[i], element)
|
|
319
|
+
this.results[i].name = name
|
|
317
320
|
// Assign the attributes that need some processing
|
|
318
321
|
Object.assign(this.results[i],{
|
|
319
322
|
numberSamples: element.sampleSize
|
|
@@ -322,8 +325,8 @@ export default {
|
|
|
322
325
|
numberSubjects: element.subjectSize
|
|
323
326
|
? parseInt(element.subjectSize)
|
|
324
327
|
: 0,
|
|
325
|
-
updated:
|
|
326
|
-
url: element.uri[0],
|
|
328
|
+
updated: element.updated ? element.updated[0].timestamp.split("T")[0] : undefined,
|
|
329
|
+
url: element.uri? element.uri[0] : undefined,
|
|
327
330
|
datasetId: element.dataset_identifier,
|
|
328
331
|
datasetRevision: element.dataset_revision,
|
|
329
332
|
datasetVersion: element.dataset_version,
|
|
@@ -380,7 +383,7 @@ export default {
|
|
|
380
383
|
// initialise algolia
|
|
381
384
|
this.algoliaClient = new AlgoliaClient(this.envVars.ALGOLIA_ID, this.envVars.ALGOLIA_KEY, this.envVars.PENNSIEVE_API_LOCATION);
|
|
382
385
|
this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
|
|
383
|
-
this.openSearch(
|
|
386
|
+
this.openSearch(undefined, '');
|
|
384
387
|
},
|
|
385
388
|
created: function() {
|
|
386
389
|
//Create non-reactive local variables
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
//this mixin is not used by this code base but it can be used by other
|
|
5
|
+
//projects to get a handle to various resources
|
|
6
|
+
data() {
|
|
7
|
+
return {
|
|
8
|
+
defaultImg: require('../../assets/logo-sparc-wave-primary.svg'),
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
async getRequest(url, params, timeout) {
|
|
13
|
+
return await axios({
|
|
14
|
+
method: 'get',
|
|
15
|
+
url,
|
|
16
|
+
params,
|
|
17
|
+
timeout,
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Returns a file path for S3.
|
|
22
|
+
* @param {String} dataset_id dataset id.
|
|
23
|
+
* @param {String} dataset_version dataset version.
|
|
24
|
+
* @param {String} file_path file path.
|
|
25
|
+
* @returns {String} full path to S3 file.
|
|
26
|
+
*/
|
|
27
|
+
getS3FilePath(dataset_id, dataset_version, file_path) {
|
|
28
|
+
const encoded_file_path = encodeURIComponent(file_path)
|
|
29
|
+
return `${dataset_id}/${dataset_version}/files/${encoded_file_path}`
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Find data path in the array that matches the provide path
|
|
33
|
+
*/
|
|
34
|
+
findEntryWithPathInArray(array, path) {
|
|
35
|
+
if (path && array) {
|
|
36
|
+
for (let i = 0; i < array.length; i++) {
|
|
37
|
+
if (path === array[i].dataset.path) return array[i]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined
|
|
41
|
+
},
|
|
42
|
+
getThumbnailForPlot(plot, thumbnails) {
|
|
43
|
+
if (thumbnails && plot) {
|
|
44
|
+
return this.findEntryWithPathInArray(thumbnails, plot.datacite.isSourceOf.path[0])
|
|
45
|
+
}
|
|
46
|
+
return undefined
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Use the scaffoldViews to help with finding the correct thumbnails.
|
|
50
|
+
* Use the index if the workflow stated above fails.
|
|
51
|
+
*/
|
|
52
|
+
getThumbnailForScaffold(scaffold, scaffoldViews, thumbnails, index) {
|
|
53
|
+
if (thumbnails && thumbnails.length > 0) {
|
|
54
|
+
let thumbnail = undefined
|
|
55
|
+
if (scaffold && scaffoldViews) {
|
|
56
|
+
const view = this.findEntryWithPathInArray(scaffoldViews, scaffold.datacite.isSourceOf.path[0])
|
|
57
|
+
if (view) {
|
|
58
|
+
thumbnail = this.findEntryWithPathInArray(thumbnails, view.datacite.isSourceOf.path[0])
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (thumbnail) {
|
|
62
|
+
return thumbnail
|
|
63
|
+
} else if (index < thumbnails.length) {
|
|
64
|
+
return thumbnails[index]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined
|
|
68
|
+
},
|
|
69
|
+
getImageURLFromS3(apiEndpoint, info) {
|
|
70
|
+
return `${apiEndpoint}/s3-resource/${info.datasetId}/${info.datasetVersion}/files/${info.file_path}?encodeBase64=true`
|
|
71
|
+
},
|
|
72
|
+
getSegmentationThumbnailURL(apiEndpoint, info) {
|
|
73
|
+
let endpoint = `${apiEndpoint}/thumbnail/neurolucida`
|
|
74
|
+
endpoint = endpoint + `?datasetId=${info.datasetId}`
|
|
75
|
+
endpoint = endpoint + `&version=${info.datasetVersion}`
|
|
76
|
+
endpoint = endpoint + `&path=files/${info.segmentationFilePath}`
|
|
77
|
+
return endpoint
|
|
78
|
+
},
|
|
79
|
+
getThumbnailURLFromBiolucida(apiEndpoint, info) {
|
|
80
|
+
return `${apiEndpoint}/thumbnail/${info.id}`
|
|
81
|
+
},
|
|
82
|
+
getImageInfoFromBiolucida(apiEndpoint, items, info) {
|
|
83
|
+
const endpoint = `${apiEndpoint}/image/${info.id}`
|
|
84
|
+
const params = {}
|
|
85
|
+
this.getRequest(endpoint, params, 20000).then(
|
|
86
|
+
(response) => {
|
|
87
|
+
let item = items.find((x) => x.id === info.id)
|
|
88
|
+
const name = response.name
|
|
89
|
+
if (name) {
|
|
90
|
+
item.title = name
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
(reason) => {
|
|
94
|
+
if (reason.message.includes('timeout') && reason.message.includes('exceeded') && info.fetchAttempts < 3) {
|
|
95
|
+
info.fetchAttempts += 1
|
|
96
|
+
this.getImageInfoFromBiolucida(apiEndpoint, items, info)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return Promise.reject('Maximum iterations reached.')
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}
|
package/delte.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
|
|
3
|
-
"heading": "Mapped ICN samples",
|
|
4
|
-
"id": "sparc.science.context_data",
|
|
5
|
-
"samples": [
|
|
6
|
-
{
|
|
7
|
-
"annotation": "",
|
|
8
|
-
"description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
|
|
9
|
-
"doi": "",
|
|
10
|
-
"heading": "ICNS from subject M54-8",
|
|
11
|
-
"id": "Sample 1",
|
|
12
|
-
"path": "",
|
|
13
|
-
"view": "View 1",
|
|
14
|
-
"color": "#FFFF00",
|
|
15
|
-
"thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"annotation": "",
|
|
19
|
-
"description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
|
|
20
|
-
"doi": "",
|
|
21
|
-
"heading": "ICNS from subject M54-5",
|
|
22
|
-
"id": "Sample 2",
|
|
23
|
-
"path": "",
|
|
24
|
-
"view": "View 2",
|
|
25
|
-
"color": "#FFA500",
|
|
26
|
-
"thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"version": "0.1.0"
|
|
30
|
-
}
|