Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
50cae75
Map ids to UniProt, otherwise fallback to HGNC, then text
jvwong Mar 24, 2021
dbc3052
Transitioned all but one function to async/await style
jvwong Mar 25, 2021
ee80a4d
Updating the indra.js module to present lists of evidence with aggreg…
jvwong Mar 26, 2021
50255d7
Filter for statements with non-empty evidence
jvwong Mar 26, 2021
04d3d60
Drop testing suite
jvwong Mar 29, 2021
42e4b83
Environment variables to control the number of INDRA interactions ret…
jvwong Mar 30, 2021
952e148
- expose a search function that accepts element and doc
jvwong Mar 30, 2021
5edcb71
- Accommodate new indra search function
jvwong Mar 30, 2021
7f8f0ca
Take into account edge case where no dbXref exists
jvwong Mar 31, 2021
f808cc4
- Extend the related papers (doc) to a related interactions component…
jvwong Mar 31, 2021
da3425a
- Ensure component is backwards-compatible
jvwong Apr 1, 2021
04384e3
- Make font sizes more consistent
jvwong Apr 1, 2021
29b7870
Pull the 'Show more papers' link right
jvwong Apr 1, 2021
68f572b
- Use string-similarity to ensure that excerpts are unique
jvwong Jun 9, 2021
cde7ba3
Allow the evidence detail block to take up the remaining space
jvwong Jun 10, 2021
e0b4cf2
Breakpoints for interaction component on smaller screens (<800px)
jvwong Jun 11, 2021
815ca35
Merging with Unstable and resolving conflicts
jvwong Jun 11, 2021
54f1d54
- Do a more in-depth mapping of INDRA datasource to MIRIAM registered…
jvwong Jun 11, 2021
3346eb1
Swallow any INDRA errors on initial submit (issue 985)
jvwong Jun 11, 2021
ea61d3e
- tag the INDRA data source as a given type (nlp, db)
jvwong Jun 14, 2021
e013547
Abstract out a RelatedInteraction component
jvwong Jun 14, 2021
1d84633
Abstract an Evidence component for reuse
jvwong Jun 14, 2021
8827d41
Abstract an Evidence component for reuse
jvwong Jun 14, 2021
8355f78
- RelatedInterations just extends component
jvwong Jun 15, 2021
825561d
Resolving conflicts in related-papers component
jvwong Jun 15, 2021
1e67e21
Merge origin/iss937_interaction-info into iss937_interaction-info
jvwong Jun 15, 2021
caca6ea
Addressing misc conflicts in merge
jvwong Jun 15, 2021
13d3fe3
Merge branch 'unstable' into iss937_interaction-info
jvwong Dec 8, 2021
749a6d0
Merge branch 'unstable' into iss937_interaction-info
jvwong Dec 21, 2021
a090f9e
Document level related papers limited by env var: MAX_DOC_RELATED_PAPERS
jvwong Dec 21, 2021
4e293cd
Revert "Document level related papers limited by env var: MAX_DOC_REL…
jvwong Dec 21, 2021
bd2a4df
Use a MAX_DOC_RELATED_PAPERS to limit the doc related papers.
jvwong Dec 21, 2021
e77b907
Add back the network related papers fallback scheme.
jvwong Dec 21, 2021
21fabe1
To reduce data size, just retrieve and show the first evidence from I…
jvwong Dec 21, 2021
d2b387f
Rank the statements via the top (only) evidence paper. Keep only MAX_…
jvwong Dec 21, 2021
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
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"soap": "^0.25.0",
"socket.io": "^2.1.1",
"socket.io-client": "^2.1.1",
"string-similarity": "^4.0.4",
"swagger-jsdoc": "^4.0.0",
"swagger-ui-express": "^4.1.4",
"tippy.js": "^2.6.0",
Expand Down
3 changes: 2 additions & 1 deletion src/client-env-vars.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"DEMO_CAN_BE_SHARED_MULTIPLE_TIMES",
"SAMPLE_DOC_ID",
"EMAIL_ADDRESS_INFO",
"MAX_WAIT_TWEET"
"MAX_WAIT_TWEET",
"MAX_DOC_RELATED_PAPERS"
]
8 changes: 4 additions & 4 deletions src/client/components/element-info/entity-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Notification from '../notification';
import assocDisp from './entity-assoc-display';
import CancelablePromise from 'p-cancelable';
import { isComplex, isGGP, ELEMENT_TYPE } from '../../../model/element/element-type';
import RelatedPapers from '../related-papers';
import { RelatedInteractions } from '../related-papers';
import Organism from '../../../model/organism';

import { makeClassList, focusDomElement } from '../../dom';
Expand Down Expand Up @@ -605,7 +605,7 @@ class EntityInfo extends DataComponent {
if( isComplex(s.element.type()) ){
children.push( h('div.entity-info-assoc', targetFromAssoc({ type, name, entityNames }, true )) );
children.push( h('div.entity-info-related-papers', [
h(RelatedPapers, { document, source: s.element })
h(RelatedInteractions, { document, source: s.element })
]) );
} else {
children.push( h('div.entity-info-no-assoc', [
Expand All @@ -618,10 +618,10 @@ class EntityInfo extends DataComponent {
} else {
children.push( h('div.entity-info-assoc', allAssoc( assoc, true, false )) );

children.push( h('div.entity-info-reld-papers-title', `Recommended articles`) );
children.push( h('div.entity-info-reld-papers-title', `Related interactions`) );

children.push( h('div.entity-info-related-papers', [
h(RelatedPapers, { document, source: s.element })
h(RelatedInteractions, { document, source: s.element })
]) );
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/client/components/element-info/interaction-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Progression from './progression';
import EventEmitter from 'eventemitter3';
import { INTERACTION_TYPES, INTERACTION_TYPE } from '../../../model/element/interaction-type';
// import { Carousel, CAROUSEL_CONTENT } from '../carousel';
import RelatedPapers from '../related-papers';
import { RelatedInteractions } from '../related-papers';

let stageCache = new WeakMap();

Expand Down Expand Up @@ -236,10 +236,10 @@ class InteractionInfo extends DataComponent {
// h(Carousel, { content: CAROUSEL_CONTENT.ABSTRACT })
// ]) );

summaryChildren.push( h('div.interaction-info-reld-papers-title', 'Recommended articles') );
summaryChildren.push( h('div.interaction-info-reld-papers-title', 'Related interactions') );

summaryChildren.push( h('div.interaction-info-related-papers', [
h(RelatedPapers, { document, source: el })
h(RelatedInteractions, { document, source: el })
]) );
}

Expand Down
193 changes: 165 additions & 28 deletions src/client/components/related-papers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
import h from 'react-hyperscript';
import { Component } from 'react';
import { DOI_LINK_BASE_URL, PUBMED_LINK_BASE_URL } from '../../config';
import _ from 'lodash';
import {
DOI_LINK_BASE_URL,
PUBMED_LINK_BASE_URL,
MAX_DOC_RELATED_PAPERS
} from '../../config';

const MAX_PAPERS = 6;
class RelatedPapersLoading extends Component {
render(){
return h('div.related-papers.related-papers-loading', [
h('div.related-papers-empty-icon', [
h('i.icon.icon-spinner')
]),
h('p.related-papers-loading-msg', [
`Biofactoid is looking for other interesting articles.`,
h('br'),
`They'll be ready for you in a moment.`
])
]);
}
}

class RelatedPaper extends Component {

render(){
const { title, authors: { abbreviation: author }, reference: journal, doi, pmid, pubTypes } = this.props.citation;
let link = `${DOI_LINK_BASE_URL}${doi}`;
if( !doi ) link = `${PUBMED_LINK_BASE_URL}${pmid}`;
const isReview = _.find( pubTypes, ["UI", "D016454"] ) === undefined ? false : true;

return h('div.related-paper', [
h('a.related-paper-title.related-paper-link', {
href: link,
target: '_blank'
}, title),
h('div.related-paper-author', author),
h('div.related-paper-journal', [
isReview ? h('span.related-paper-journal-badge.super-salient-button', 'Review'): null,
journal
])
]);
}
}

export class RelatedPapers extends Component {
constructor(props){
Expand All @@ -29,37 +69,134 @@ export class RelatedPapers extends Component {
let { papers } = this.state;

if( !papers ){
return h('div.related-papers.related-papers-empty', [
h('div.related-papers-empty-icon', [
h('i.icon.icon-spinner')
]),
h('p.related-papers-empty-msg', [
`Biofactoid is looking for other interesting articles.`,
h('br'),
`They'll be ready for you in a moment.`
])
]);
return h( RelatedPapersLoading );
} else {
papers = papers.slice(0, MAX_DOC_RELATED_PAPERS);
return h('div.related-papers', papers.map( paper => h( RelatedPaper, { citation: paper.pubmed } ) ) );
}
}
}

export class EvidenceComponent extends Component {
constructor(props){
super(props);
}

render(){

const { evidence } = this.props;
const { source, citation } = evidence;

// Format excerpts from the top evidence's sources
let excerptComponent = null;
const texts = _.compact( source.map( s => _.get( s, 'text' ) ) );
const hasExcerpts = !_.isEmpty( texts );
if( hasExcerpts ){
let excerpts = texts.map( text => h('div.related-interaction-evidence-source-excerpt', text ) );
excerptComponent = h('div.related-interaction-evidence-source-excerpts', excerpts );
}

papers = papers.slice(0, MAX_PAPERS);
let paperComponent = h('div.related-interaction-evidence-paper', [ h( RelatedPaper, { citation } ) ]);

return h('div.related-papers', papers.map( paper => {
const { pubmed: { title, authors: { abbreviation: author }, reference: journal, abstract, doi, pmid } } = paper;
let link = `${DOI_LINK_BASE_URL}${doi}`;
if( !doi ) link = `${PUBMED_LINK_BASE_URL}${pmid}`;
// Database/source names
const isDatabaseType = s => s.type == 'db';
const getSourceName = s => s.name;
let sourceNames = source
.filter( isDatabaseType )
.map( getSourceName );
sourceNames = _.uniqBy( sourceNames, 'name' );
// names = _.filter( names, [ 'type', 'db' ] );
let namesComponent = sourceNames.length ?
h('div..related-interaction-evidence-sources', `Source: ${sourceNames.join( '; ' )}` ) :
null;

return h('a.related-paper', {
href: link,
target: '_blank'
}, [
h('div.related-paper-title', [
h('span.link-like.plain-link', title)
return h('div.related-interaction-evidence', [
excerptComponent,
paperComponent,
namesComponent
]);
}
}

export class RelatedInteraction extends Component {
constructor(props){
super(props);
}

render(){

const { interaction } = this.props;
const { evidence, sentence } = interaction;

//// NB: To reduce data size, only show top evidence
// Link to more evidence (i.e. papers for the interaction )
// let additionalEvidenceLink = null;
// let numArticles = evidence.length;
// let hasMoreEvidence = numArticles > 1;
// if( hasMoreEvidence ){
// additionalEvidenceLink = h('a.related-interaction-additional-evidence.related-paper-link', {
// target: '_blank'
// }, `Show more articles (${numArticles})` );
// }

return h('div.related-interaction', [
h('div.related-interaction-body', [
h('div.related-interaction-meta', [
h('div.related-interaction-sentence', sentence )
]),
h('div.related-paper-abstract', abstract),
h('div.related-paper-author', author),
h('div.related-paper-journal', journal)
]);
}));
h( EvidenceComponent, { evidence: _.head( evidence ) })
]),
// h('div.related-interaction-footer', [
// additionalEvidenceLink
// ])
]);

}
}

export class RelatedInteractions extends Component {
constructor(props){
super(props);

this.state = {
papers: this.props.source.relatedPapers()
};
}

componentDidMount(){
this.onRefresh = () => {
this.setState({ papers: this.props.source.relatedPapers() });
};

this.props.source.on('relatedpapers', this.onRefresh);
}

componentWillUnmount(){
this.props.source.removeListener('relatedpapers', this.onRefresh);
}

render(){
let { papers } = this.state;

// Haven't loaded yet
if( !papers ) return h( RelatedPapersLoading );

const emptyComponent = h('div.related-papers.related-papers-empty', [
h('p.related-papers-empty-msg', 'There were no interactions found for the selected item' )
]);

// Nothing here to show
if( _.isEmpty( papers ) ) return emptyComponent;

// Backwards-compatibility: Check schema { type, sentence, evidence, participants }
let areInteractions = papers.every( paper => _.has( paper, 'evidence' ) && _.has( paper, 'sentence' ) );
if( !areInteractions ) return emptyComponent;

// OK - Display interactions
const interactions = papers;
return h('div.related-interactions',
interactions.map( interaction => h( RelatedInteraction, { interaction } ) )
);
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ export const SAMPLE_DOC_ID = env('SAMPLE_DOC_ID', '5df17c41-acb7-4c42-a37b-fe323
export const NO_ABSTRACT_HANDLING = env('NO_ABSTRACT_HANDLING', 'text');
export const MIN_SEMANTIC_SCORE = env('MIN_SEMANTIC_SCORE', 0.47);
export const SEMANTIC_SEARCH_LIMIT = env('SEMANTIC_SEARCH_LIMIT', 30);
export const MIN_RELATED_PAPERS = env('MIN_RELATED_PAPERS', 6);
export const MAX_DOC_RELATED_PAPERS = env('MAX_DOC_RELATED_PAPERS', 5);
export const MAX_STATEMENTS = env('MAX_STATEMENTS', 10);
export const MAX_STATEMENTS_ELEMENT = env('MAX_STATEMENTS_ELEMENT', 5);
export const EVIDENCE_LIMIT = env('EVIDENCE_LIMIT', 1);

// google analytics
export const GA_ID = env('GA_ID', 'UA-43341809-12');
Loading