Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EUbOPEN Web
Manage
Activity
Members
Labels
Plan
Issues
15
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChEMBL
EUbOPEN
EUbOPEN Web
Commits
9d984533
Commit
9d984533
authored
1 year ago
by
David Mendez
Browse files
Options
Downloads
Patches
Plain Diff
Reactivate metadata for compound report card
parent
4476d6ee
No related branches found
No related tags found
1 merge request
!82
Add new heatmap prototype and reactivate compound metadata
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pages/compound/_id.vue
+100
-100
100 additions, 100 deletions
pages/compound/_id.vue
with
100 additions
and
100 deletions
pages/compound/_id.vue
+
100
−
100
View file @
9d984533
...
@@ -3,119 +3,119 @@
...
@@ -3,119 +3,119 @@
</
template
>
</
template
>
<
script
>
<
script
>
//
import MetadataTagsGenerator from '@chembl/metadata-tags-generator'
import
MetadataTagsGenerator
from
'
@chembl/metadata-tags-generator
'
import
ChemicalProbeReportCard
from
'
~/components/report_cards/chemical_probe/ChemicalProbeReportCard.vue
'
import
ChemicalProbeReportCard
from
'
~/components/report_cards/chemical_probe/ChemicalProbeReportCard.vue
'
//
import MetadataLoader from '~/web-components-submodule/metadata/MetadataLoader.js'
import
MetadataLoader
from
'
~/web-components-submodule/metadata/MetadataLoader.js
'
//
import EntityNames from '~/web-components-submodule/standardisation/EntityNames.js'
import
EntityNames
from
'
~/web-components-submodule/standardisation/EntityNames.js
'
//
import ObjectPropertyAccess from '~/web-components-submodule/utils/ObjectPropertyAccess.js'
import
ObjectPropertyAccess
from
'
~/web-components-submodule/utils/ObjectPropertyAccess.js
'
//
import StringUtils from '~/web-components-submodule/utils/StringUtils.js'
import
StringUtils
from
'
~/web-components-submodule/utils/StringUtils.js
'
export
default
{
export
default
{
components
:
{
components
:
{
ChemicalProbeReportCard
,
ChemicalProbeReportCard
,
},
},
layout
:
'
reportCard
'
,
layout
:
'
reportCard
'
,
//
async asyncData({ $axios, error, params }) {
async
asyncData
({
$axios
,
error
,
params
})
{
//
try {
try
{
//
const docSource = [
const
docSource
=
[
//
'molecule_chembl_id',
'
molecule_chembl_id
'
,
//
'pref_name',
'
pref_name
'
,
//
'molecule_synonyms',
'
molecule_synonyms
'
,
//
'_metadata.compound_generated.image_file',
'
_metadata.compound_generated.image_file
'
,
//
]
]
//
const result = await MetadataLoader.getMetadataForEntity(
const
result
=
await
MetadataLoader
.
getMetadataForEntity
(
//
EntityNames.EubopenCompound.entityID,
EntityNames
.
EubopenCompound
.
entityID
,
//
params.id,
params
.
id
,
//
docSource
docSource
//
)
)
//
const itemURL = `https://gateway.eubopen.org/compound/${params.id}`
const
itemURL
=
`https://gateway.eubopen.org/compound/
${
params
.
id
}
`
//
const imgBaseURL = 'https://www.ebi.ac.uk/chembl/api/data/image'
const
imgBaseURL
=
'
https://www.ebi.ac.uk/chembl/api/data/image
'
//
const fallbackImgBaseURL = ''
const
fallbackImgBaseURL
=
''
//
const bioschemasMetadata = await MetadataTagsGenerator.EUbOPEN.CompoundMetadata.getBioschemasMetadata(
const
bioschemasMetadata
=
await
MetadataTagsGenerator
.
EUbOPEN
.
CompoundMetadata
.
getBioschemasMetadata
(
//
{
{
//
itemID: params.id,
itemID
:
params
.
id
,
//
itemURL,
itemURL
,
//
imgBaseURL,
imgBaseURL
,
//
fallbackImgBaseURL,
fallbackImgBaseURL
,
//
}
}
//
)
)
//
return {
return
{
//
rawMetadata: result.data._source,
rawMetadata
:
result
.
data
.
_source
,
//
bioschemasJSONLD: bioschemasMetadata,
bioschemasJSONLD
:
bioschemasMetadata
,
//
}
}
//
} catch (e) {
}
catch
(
e
)
{
//
error({
error
({
//
statusCode: 404,
statusCode
:
404
,
//
message: `No ${EntityNames.EubopenCompound.singularEntityName} found with id ${params.id}`,
message
:
`No
${
EntityNames
.
EubopenCompound
.
singularEntityName
}
found with id
${
params
.
id
}
`
,
//
})
})
//
}
}
//
},
},
//
head() {
head
()
{
//
const name = this.rawMetadata.pref_name || this.itemID
const
name
=
this
.
rawMetadata
.
pref_name
||
this
.
itemID
//
const synonymsList = this.rawMetadata.molecule_synonyms
const
synonymsList
=
this
.
rawMetadata
.
molecule_synonyms
//
.filter((synonym) => synonym.syn_type !== 'TRADE_NAME')
.
filter
((
synonym
)
=>
synonym
.
syn_type
!==
'
TRADE_NAME
'
)
//
.map((synonym) => synonym.molecule_synonym)
.
map
((
synonym
)
=>
synonym
.
molecule_synonym
)
//
const synonymsText =
const
synonymsText
=
//
synonymsList.length === 0 ? '' : `Synonyms: ${synonymsList.join(', ')}`
synonymsList
.
length
===
0
?
''
:
`Synonyms:
${
synonymsList
.
join
(
'
,
'
)}
`
//
const descriptionText = StringUtils.truncateString(
const
descriptionText
=
StringUtils
.
truncateString
(
//
`Explore ${name} ${this.rawMetadata.pref_name} in EUbOPEN. ${synonymsText}`,
`Explore
${
name
}
${
this
.
rawMetadata
.
pref_name
}
in EUbOPEN.
${
synonymsText
}
`
,
//
170
170
//
)
)
//
const titleText = `${EntityNames.EubopenCompound.singularEntityName} ${name}`
const
titleText
=
`
${
EntityNames
.
EubopenCompound
.
singularEntityName
}
${
name
}
`
//
const canonicalURL =
const
canonicalURL
=
//
`https://${process.env.canonicalDomain}` + this.$route.path
`https://
${
process
.
env
.
canonicalDomain
}
`
+
this
.
$route
.
path
//
const chemblID = this.rawMetadata.molecule_chembl_id
const
chemblID
=
this
.
rawMetadata
.
molecule_chembl_id
//
const generatedImageFilePath = ObjectPropertyAccess.getPropertyPalue(
const
generatedImageFilePath
=
ObjectPropertyAccess
.
getPropertyPalue
(
//
this.rawMetadata,
this
.
rawMetadata
,
//
'_metadata.compound_generated.image_file',
'
_metadata.compound_generated.image_file
'
,
//
undefined,
undefined
,
//
true
true
//
)
)
//
let imgURL
let
imgURL
//
if (generatedImageFilePath == null) {
if
(
generatedImageFilePath
==
null
)
{
//
imgURL = `${process.env.chemblWSBaseUrl}/image/${chemblID}.svg`
imgURL
=
`
${
process
.
env
.
chemblWSBaseUrl
}
/image/
${
chemblID
}
.svg`
//
} else {
}
else
{
//
imgURL = `${process.env.fallbackIMGsBaseUrl}/compound_placeholders/${this.generatedImageFilePath}`
imgURL
=
`
${
process
.
env
.
fallbackIMGsBaseUrl
}
/compound_placeholders/
${
this
.
generatedImageFilePath
}
`
//
}
}
//
return {
return
{
//
title: titleText,
title
:
titleText
,
//
meta: [
meta
:
[
//
{
{
//
hid: 'description',
hid
:
'
description
'
,
//
name: 'description',
name
:
'
description
'
,
//
content: descriptionText,
content
:
descriptionText
,
//
},
},
//
{ hid: 'og:title', name: 'og:title', content: titleText },
{
hid
:
'
og:title
'
,
name
:
'
og:title
'
,
content
:
titleText
},
//
{
{
//
hid: 'og:description',
hid
:
'
og:description
'
,
//
name: 'og:description',
name
:
'
og:description
'
,
//
content: descriptionText,
content
:
descriptionText
,
//
},
},
//
{ hid: 'og:type', name: 'og:type', content: 'object' },
{
hid
:
'
og:type
'
,
name
:
'
og:type
'
,
content
:
'
object
'
},
//
{ hid: 'og:url', name: 'og:url', content: canonicalURL },
{
hid
:
'
og:url
'
,
name
:
'
og:url
'
,
content
:
canonicalURL
},
//
{ hid: 'og:image', name: 'og:image', content: imgURL },
{
hid
:
'
og:image
'
,
name
:
'
og:image
'
,
content
:
imgURL
},
//
],
],
//
link: [
link
:
[
//
{
{
//
rel: 'canonical',
rel
:
'
canonical
'
,
//
href: canonicalURL,
href
:
canonicalURL
,
//
},
},
//
],
],
//
script: [
script
:
[
//
{
{
//
id: 'JSON_LD',
id
:
'
JSON_LD
'
,
//
type: 'application/ld+json',
type
:
'
application/ld+json
'
,
//
json: this.bioschemasJSONLD,
json
:
this
.
bioschemasJSONLD
,
//
},
},
//
],
],
//
}
}
//
},
},
computed
:
{
computed
:
{
itemID
()
{
itemID
()
{
return
this
.
$route
.
params
.
id
return
this
.
$route
.
params
.
id
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment