Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update segmentation data to come from sparc-api endpoint #786

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions pages/datasets/file/_datasetId/_datasetVersion/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
</template>

<script>
import discover from '@/services/discover'
import biolucida from '@/services/biolucida'
import scicrunch from '@/services/scicrunch'
import BiolucidaViewer from '@/components/BiolucidaViewer/BiolucidaViewer'
Expand Down Expand Up @@ -127,7 +128,6 @@ export default {
}))
}


let biolucidaData = {}
try {
if (sourcePackageId != "")
Expand All @@ -137,23 +137,31 @@ export default {
}
const hasBiolucidaViewer = !isEmpty(biolucidaData) && biolucidaData.status !== 'error'
// We must remove the N: in order for scicrunch to realize the package
const expectedScicrunchIdentifier = sourcePackageId.replace("N:", "")
const expectedScicrunchIdentifier = sourcePackageId != "" ? sourcePackageId.replace("N:", "") : ""
let scicrunchData = {}
try {
const scicrunchResponse = await scicrunch.getDatasetInfoFromObjectIdentifier(
expectedScicrunchIdentifier
)
const result = pathOr([], ['data', 'result'], scicrunchResponse)
scicrunchData = result?.length > 0 ? result[0] : []
if (expectedScicrunchIdentifier != "") {
const scicrunchResponse = await scicrunch.getDatasetInfoFromObjectIdentifier(expectedScicrunchIdentifier)
const result = pathOr([], ['data', 'result'], scicrunchResponse)
scicrunchData = result?.length > 0 ? result[0] : []
}
} catch(e) {
console.log(`Error retrieving sci crunch data (possibly because there is none for this file): ${e}`)
}

let segmentationData = {}
const matchedSegmentationData = scicrunchData['mbf-segmentation']?.filter(function(el) {
return el.identifier == expectedScicrunchIdentifier
})
segmentationData = matchedSegmentationData?.length > 0 ? matchedSegmentationData[0] : {}
// We should just be able to just pull from scicrunch response as shown below, but due to discrepancies we pull from the sparc api endpoint
// const matchedSegmentationData = scicrunchData['mbf-segmentation']?.filter(function(el) {
// return el.identifier == expectedScicrunchIdentifier
// })
// segmentationData = segmentationData?.length > 0 ? matchedSegmentationData[0] : {}*/
try {
await discover.getSegmentationInfo(route.params.datasetId, route.params.datasetVersion, filePath, s3Bucket).then(({ data }) => {
segmentationData = data
})
} catch(e) {
console.log(`Error retrieving segmentation data (possibly because there is none for this file): ${e}`)
}
const hasSegmentationViewer = !isEmpty(segmentationData)

let plotData = {}
Expand Down