Skip to content

Commit

Permalink
elixir updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemma committed Jun 6, 2024
1 parent 52676f5 commit 055d729
Show file tree
Hide file tree
Showing 17 changed files with 194 additions and 258 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/Analyses/AnalysesResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ function AnalysesResults (props) {
} else {
let filter = { id: props.query }
let labelToOntology = 0
console.log('holi')

let queryTermLowerCase = props.query.toLowerCase()
console.log(props.filteringTerms)

props.filteringTerms.data.response.filteringTerms.forEach(
element => {
if (element.label) {
Expand Down Expand Up @@ -286,7 +286,7 @@ function AnalysesResults (props) {
} else {
token = auth.userData.access_token
}
console.log(jsonData2)

if (token === null) {
console.log('Querying without token')
res = await axios.post(configData.API_URL + '/analyses', jsonData2)
Expand Down
73 changes: 20 additions & 53 deletions frontend/src/components/Biosamples/BiosamplesResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function BiosamplesResults (props) {
element.scope = [selectedScopes[index]]
}
})
console.log(updatedArrayFilter)

setArrayFilter(updatedArrayFilter)

setUpdatedArrayFilterVar(updatedArrayFilter)
Expand Down Expand Up @@ -239,9 +239,6 @@ function BiosamplesResults (props) {

var requestParameters = {}

console.log(updatedArrayFilterVar)
console.log(selectedScopes)

if (props.query !== null) {
if (props.query.includes(',')) {
let queryStringTerm2 = props.query.split(',')
Expand All @@ -254,33 +251,32 @@ function BiosamplesResults (props) {
let reqParameters = []
if (props.query.includes('&')) {
arrayParameters = props.query.split('&')
console.log(arrayParameters)

arrayParameters.forEach(element => {
reqParameters.length = 0
reqParameters = element.split(':')
console.log(reqParameters)

requestParameters[reqParameters[0]] = reqParameters[1]
})
arrayRequestParameters.push(requestParameters)
} else {
let reqParameters = props.query.split(':')
console.log(reqParameters)

requestParameters[reqParameters[0]] = reqParameters[1]
arrayRequestParameters.push(requestParameters)
}
} else if (props.query.includes(':') && props.query.includes('>')) {
let reqParameters = props.query.split(':')
console.log(reqParameters)

let position = []
if (props.query.includes('-')) {
position = reqParameters[0].split('-')
} else {
position = reqParameters[0]
}

console.log(position)
let bases = reqParameters[2].split('>')
console.log(bases)

requestParameters['start'] = position[0]
if (position[1]) {
requestParameters['end'] = position[1]
Expand All @@ -294,11 +290,9 @@ function BiosamplesResults (props) {
}
}

console.log(queryStringTerm)
let filter = {}
if (updatedArrayFilterVar.length === 0) {
queryStringTerm.forEach((term, index) => {
console.log(term)
requestParameters = {}
if (
(term.includes('=') ||
Expand All @@ -311,7 +305,6 @@ function BiosamplesResults (props) {
if (term.includes('=')) {
queryArray[index] = term.split('=')
queryArray[index].push('=')
console.log(queryArray)
} else if (term.includes('>')) {
queryArray[index] = term.split('>')
queryArray[index].push('>')
Expand All @@ -325,7 +318,7 @@ function BiosamplesResults (props) {
queryArray[index] = term.split('%')
queryArray[index].push('%')
}
console.log(queryArray[index][1].toLowerCase())

let alphanumericFilter = {}
props.filteringTerms.forEach(element => {
if (element.label) {
Expand Down Expand Up @@ -375,7 +368,6 @@ function BiosamplesResults (props) {
})

if (Object.keys(alphanumericFilter).length === 0) {
console.log(queryArray[index][0])
props.filteringTerms.forEach(element => {
if (
queryArray[index][0].toLowerCase() ===
Expand All @@ -388,14 +380,13 @@ function BiosamplesResults (props) {
if (queryArray[index][3] === undefined) {
queryArray[index][3] = [collection]
}
console.log(queryArray)

alphanumericFilter = {
id: queryArray[index][0],
operator: queryArray[index][2],
value: queryArray[index][1],
scope: queryArray[index][3]
}
console.log(alphanumericFilter)
}

arrayFilter.push(alphanumericFilter)
Expand All @@ -404,23 +395,23 @@ function BiosamplesResults (props) {
let reqParameters = []
if (term.includes('&')) {
arrayParameters = term.split('&')
console.log(arrayParameters)

arrayParameters.forEach(element => {
reqParameters.length = 0
reqParameters = element.split(':')
console.log(reqParameters)

requestParameters[reqParameters[0]] = reqParameters[1]
})
arrayRequestParameters.push(requestParameters)
} else {
let reqParameters = term.split(':')
console.log(reqParameters)

requestParameters[reqParameters[0]] = reqParameters[1]
arrayRequestParameters.push(requestParameters)
}
} else if (term.includes(':') && term.includes('>')) {
let reqParameters = term.split(':')
console.log(reqParameters)

let position = []
if (term.includes('-')) {
position = reqParameters[0].split('-')
Expand All @@ -429,7 +420,7 @@ function BiosamplesResults (props) {
}

let bases = reqParameters[2].split('>')
console.log(bases)

requestParameters['start'] = position[0]
if (position[1]) {
requestParameters['end'] = position[1]
Expand Down Expand Up @@ -466,23 +457,20 @@ function BiosamplesResults (props) {
}
}

console.log(arrayFilter)

try {
let res = await axios.get(configData.API_URL + '/info')
let res2 = await axios.get(configData.API_URL + '/datasets')
console.log(res2)

if (res2) {
datasetList.push(res2.data.response.collections)
}
console.log(datasetList)

if (updatedArrayFilterVar.length === 0) {
beaconsList.push(res.data.response)
}

let variablePause = false
console.log(ontologyMultipleScope)

if (props.query === null || props.query === '') {
// show all individuals

Expand Down Expand Up @@ -527,7 +515,7 @@ function BiosamplesResults (props) {
}

jsonData1 = JSON.stringify(jsonData1)
console.log(jsonData1)

let token = null
if (auth.userData === null) {
token = getStoredToken()
Expand All @@ -540,8 +528,6 @@ function BiosamplesResults (props) {
configData.API_URL + '/biosamples',
jsonData1
)
console.log(jsonData1)
console.log(res)
} else {
const headers = { Authorization: `Bearer ${token}` }
console.log('querying with token')
Expand All @@ -550,7 +536,6 @@ function BiosamplesResults (props) {
jsonData1,
{ headers: headers }
)
console.log(res)
}
setTimeOut(true)

Expand Down Expand Up @@ -604,7 +589,6 @@ function BiosamplesResults (props) {
if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [element.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
console.log(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
Expand Down Expand Up @@ -661,7 +645,6 @@ function BiosamplesResults (props) {
if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [element.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
console.log(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
Expand Down Expand Up @@ -717,7 +700,6 @@ function BiosamplesResults (props) {
if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [res.data.meta.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
console.log(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
Expand All @@ -743,7 +725,6 @@ function BiosamplesResults (props) {
if (updatedArrayFilterVar.length > 0) {
updatedArrayFilterVar.forEach((element, index) => {
if (Array.isArray(element.scope) && !selectedScopes[index]) {
console.log(element.scope)
setPause(true)
variablePause = true

Expand Down Expand Up @@ -775,7 +756,6 @@ function BiosamplesResults (props) {
} else {
let newOptionsScope = [...optionsScope]
arrayFilter.forEach((element, index) => {
console.log(element.scope)
if (
Array.isArray(element.scope) &&
element.scope.length > 1 &&
Expand All @@ -789,7 +769,7 @@ function BiosamplesResults (props) {
newOptionsScope[index].push(elementScope)
})
setOptionsScope(newOptionsScope)
console.log(newOptionsScope)

let newOntologyMultipleScope = [...ontologyMultipleScope]

props.filteringTerms.forEach(element2 => {
Expand All @@ -799,7 +779,7 @@ function BiosamplesResults (props) {
newOntologyMultipleScope[index].push(element2.label)
}
})
console.log(newOntologyMultipleScope)

setOntologyMultipleScope(newOntologyMultipleScope)
} else if (
Array.isArray(element.scope) &&
Expand All @@ -808,7 +788,6 @@ function BiosamplesResults (props) {
) {
element.scope = selectedScopes[index]
} else {
console.log(element)
element.scope = element.scope[0]
}
})
Expand Down Expand Up @@ -877,26 +856,21 @@ function BiosamplesResults (props) {
token = auth.userData.access_token
}
if (token === null) {
console.log(jsonData2)
console.log('Querying without token')
res = await axios.post(
configData.API_URL + '/biosamples',
jsonData2
)
console.log(res)
} else {
console.log('Querying WITH token')
console.log(token)

const headers = { Authorization: `Bearer ${token}` }
console.log(headers)
console.log(jsonData2)

res = await axios.post(
configData.API_URL + '/biosamples',
jsonData2,
{ headers: headers }
)
console.log(res)
console.log(token)
}

setTimeOut(true)
Expand All @@ -912,8 +886,6 @@ function BiosamplesResults (props) {
setBoolean(false)
} else {
if (props.isNetwork) {
console.log(res.data.response.resultSets)
console.log(resultsPerDataset)
res.data.response.resultSets.forEach((element, index) => {
if (element.id && element.id !== '') {
if (resultsPerDataset.length > 0) {
Expand Down Expand Up @@ -954,7 +926,6 @@ function BiosamplesResults (props) {
if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [element.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
console.log(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
Expand Down Expand Up @@ -1010,7 +981,6 @@ function BiosamplesResults (props) {
if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [res.data.meta.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
console.log(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
Expand All @@ -1036,7 +1006,6 @@ function BiosamplesResults (props) {
}
}
} catch (error) {
console.log(error)
setError(error.message)
setTimeOut(true)
setTriggerSubmit(true)
Expand Down Expand Up @@ -1091,8 +1060,6 @@ function BiosamplesResults (props) {
</div>
)}



{triggerSubmit && (
<div>
<div>
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/Cohorts/Cohorts.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function Cohorts (props) {
optionsCohorts.forEach(cohort => {
found = 0
if (cohort.value === element.id) {
console.log(element.id)
found = 1
}
})
Expand All @@ -111,7 +110,7 @@ function Cohorts (props) {
}
optionsCohorts.push(obj)
}
console.log(optionsCohorts)

arrayCohorts.push(element)
const timer = setTimeout(() => {
setTriggerLayout(true)
Expand Down
Loading

0 comments on commit 055d729

Please sign in to comment.