Skip to content
Snippets Groups Projects
Unverified Commit 99f8d7ac authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #13 from FZJ-INM1-BDA/chore/queryApiV2

chore update to query api v2
parents 1ad91fdd a857573d
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,7 @@ const populateSet = (flattenedRegions, set = new Set()) => {
const initPrArray = []
let juBrainSet = new Set(),
bigbrainCytoSet = new Set()
shortBundleSet = new Set(),
longBundleSet = new Set(),
waxholm1Set = new Set(),
......@@ -81,6 +82,16 @@ let juBrainSet = new Set(),
allen2015Set = new Set(),
allen2017Set = new Set()
initPrArray.push(
readConfigFile('bigbrain.json')
.then(data => JSON.parse(data))
.then(json => {
const bigbrainCyto = flattenArray(json.parcellations.find(({ name }) => name === 'Cytoarchitectonic Maps').regions)
bigbrainCytoSet = populateSet(bigbrainCyto)
})
.catch(console.error)
)
initPrArray.push(
readConfigFile('MNI152.json')
.then(data => JSON.parse(data))
......@@ -164,8 +175,7 @@ const getKgId = ({ templateName }) => {
* @param { templateName } template to be queried
*/
const datasetBelongsInTemplate = ({ templateName }) => ({ referenceSpaces }) => {
if (referenceSpaces.length === 0) return true
else return referenceSpaces.some(({ name, fullId }) =>
return referenceSpaces.some(({ name, fullId }) =>
name === templateName
|| fullId && fullId.includes(getKgId({ templateName })))
}
......@@ -201,6 +211,9 @@ const filterDataset = async (dataset = null, { templateName, parcellationName })
let overwriteParcellationName
switch (parcellationName) {
case 'Cytoarchitectonic Maps':
useSet = bigbrainCytoSet
overwriteParcellationName = 'Jülich Cytoarchitechtonic Brain Atlas (human)'
break;
case 'JuBrain Cytoarchitectonic Atlas':
useSet = juBrainSet
overwriteParcellationName = 'Jülich Cytoarchitechtonic Brain Atlas (human)'
......@@ -232,7 +245,7 @@ const filterDataset = async (dataset = null, { templateName, parcellationName })
const flagDatasetBelongToParcellation = datasetBelongToParcellation({ dataset, parcellationName: overwriteParcellationName || parcellationName })
&& await datasetRegionExistsInParcellationRegion(dataset.parcellationRegion, useSet)
return flagDatasetBelongToTemplate && flagDatasetBelongToParcellation
return flagDatasetBelongToTemplate || flagDatasetBelongToParcellation
}
/**
......
......@@ -72,11 +72,11 @@ describe('datasets/util.js', () => {
}
})
it('should include datasets without any reference space defined', () => {
it('should NOT include datasets without any reference space defined', () => {
for (const ds of humanReceptor) {
const belong = datasetBelongsInTemplate({ templateName: 'Big Brain (Histology)' })(ds)
expect(belong).to.be.true
expect(belong).to.be.false
}
})
......
......@@ -66,7 +66,7 @@ Then datasets which have *`Mus musculus`* as one of its species described above
The datasets are then filtered based on the selected template space and parcellation atlas.
The dataset must satisfy both conditionals.
The dataset may satisfy either conditionals to be presented to the user.
### Template space
......@@ -100,7 +100,7 @@ The dataset is considered relevant (returns true for this conditional) if the st
| MNI Colin 27 | minds/core/dataset/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992 |
!!! important
If the dataset does not have any reference spaces defined, it is considered relevant for any template space, and will return `true` for this conditional.
If the dataset does not have any reference spaces defined, it is considered NOT relevant for any template space, and will return `false` for this conditional.
### Parcellation atlas
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment