Skip to content
Merged

v0.25.0 #1231

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9e9fe28
Merge pull request #1191 from PathwayCommons/v0.24.0
jvwong Jul 4, 2023
d5c058f
Optional PubMed ID in info panel.
jvwong Jul 27, 2023
44bb190
CrossRef API wrapper.
jvwong Aug 1, 2023
593cc58
Works and utils for prioritizing search hits from CrossRef
jvwong Aug 1, 2023
a9a9395
Merge pull request #1196 from PathwayCommons/iss961_allow-doi-or-pubm…
maxkfranz Aug 3, 2023
bfd4334
Merge pull request #1198 from PathwayCommons/iss961_crossref-service
maxkfranz Aug 3, 2023
e58466c
Rename modules.
jvwong Aug 30, 2023
b83bb18
Merging api
jvwong Aug 30, 2023
ee512dc
Add a default publication type list field in template.
jvwong Aug 30, 2023
088c928
Merge pull request #1199 from PathwayCommons/iss961_PublicationTypeList
jvwong Aug 30, 2023
fb99876
Include a PublicationType from CrossRef - fail silently.
jvwong Aug 30, 2023
5c088b4
Uncomment map tests.
jvwong Aug 30, 2023
04abc8a
Renaming test harness.
jvwong Aug 30, 2023
a4c2851
Refactoring find to work with preprints.
jvwong Aug 31, 2023
2878ce4
Merge pull request #1200 from PathwayCommons/iss961_crossref-works
jvwong Sep 6, 2023
f31fce3
disable layout via keyboard.
jvwong Sep 8, 2023
af81c09
Merge pull request #1204 from PathwayCommons/iss1202_disable-layouts
jvwong Sep 11, 2023
3ca01de
Timer helper class
jvwong Oct 3, 2023
454ee0c
Use Timer class in Doc update. Everything in milliseconds.
jvwong Oct 3, 2023
7c87809
Reenable graphdb refresh.
jvwong Oct 4, 2023
006268a
CRON variable documentation.
jvwong Oct 4, 2023
e153a1f
Merge pull request #1207 from PathwayCommons/iss1201_cron-refactor
jvwong Oct 4, 2023
5030a2c
Don't utilize 'score' from CrossRef.
jvwong Oct 5, 2023
897e680
Merge pull request #1208 from PathwayCommons/iss961_flex-top-hit
jvwong Oct 5, 2023
095bf60
Format paper date using three-letter month to match Pubmed.
jvwong Oct 10, 2023
617ca3a
Merge pull request #1210 from PathwayCommons/iss961_pubdate-formatting
jvwong Oct 10, 2023
a64d858
Create a findPreprint function to search crossref.
jvwong Oct 4, 2023
d025db2
First pass - find article in PubMed or CrossRef
jvwong Oct 5, 2023
c84ee43
prototype for fillDoc article.
jvwong Oct 6, 2023
f0e4109
Retrieve latest when pubmed and crossref return items.
jvwong Oct 11, 2023
1764f31
Extract string tests for string that look like DOIs and PMIDs
jvwong Oct 12, 2023
a6f0a43
Merge pull request #1212 from PathwayCommons/iss1201_extract-doi-test
jvwong Oct 19, 2023
c97479d
Merge branch 'unstable' into iss1201_fill-article-by-id
jvwong Oct 19, 2023
eef4b32
Throw an articleID error or original Http status error.
jvwong Oct 19, 2023
1b2f402
Differentiate between HTTP errors and failure to find article Error.
jvwong Oct 20, 2023
8b6602a
Merge pull request #1211 from PathwayCommons/iss1201_fill-article-by-id
jvwong Oct 25, 2023
d6bb869
Fix CrossRef module import casing.
jvwong Oct 26, 2023
4517cb3
Merge pull request #1214 from PathwayCommons/iss1213_import-casing
jvwong Oct 26, 2023
c99a965
Set the Document status using functions
jvwong Nov 15, 2023
226a072
Merge pull request #1224 from PathwayCommons/iss1223_use-model-status…
jvwong Nov 15, 2023
20b6c7a
Create a new document route; block from crawlers
jvwong Nov 27, 2023
5d822e7
Implement a blank document create helper
jvwong Nov 27, 2023
9a459a2
Retain information when popup closes.
jvwong Nov 27, 2023
d786351
Stub out correspondence to accommodate admin
jvwong Nov 27, 2023
c7f2a0a
Set temp errors on blank document so admin is aware of missing fields.
jvwong Nov 27, 2023
a2916cd
Merge pull request #1226 from PathwayCommons/iss1056_get-document
jvwong Nov 29, 2023
4ae70c1
Remove request form references.
jvwong Nov 29, 2023
b6c3dbd
Merge pull request #1227 from PathwayCommons/iss1056_add-article-home-ez
maxkfranz Nov 30, 2023
41d8c78
Cover cases where there is a preprint, no paper ID
jvwong Dec 4, 2023
1ea3236
Always provide a Google Scholar link based on title
jvwong Dec 4, 2023
5db3187
Merge pull request #1228 from PathwayCommons/iss1215_relPapers-preprints
jvwong Dec 5, 2023
321b5c2
No hyphens in db name
jvwong Dec 6, 2023
3b30d73
Merge pull request #1230 from PathwayCommons/iss1229_neo4j-hyphens-co…
jvwong Dec 6, 2023
196c0f3
0.25.0
jvwong Dec 6, 2023
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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ General:
CRON:

- `CRON_SCHEDULE` : second (optional), minute, hour, day of month, month, day of week
- `DOCUMENT_CRON_UPDATE_PERIOD_DAYS` : The minimum time between successive Document cron update calls
- `DOCUMENT_CRON_CREATED_AGE_DAYS` : Only Documents created fewer than this many days will be selecte for update. When undefined (default), ignores filtering on creation date.
- `DOCUMENT_CRON_REFRESH_ENABLED` : Flag to enable existing Document metadata to be refreshed (e.g. PubMed UID) (default true).
- `DOCUMENT_CRON_UNEDITED_DAYS` : Number of days since Documemt was last edited; criteria for trashing
- `DOCUMENT_CRON_UPDATE_PERIOD` : Milliseconds between successive Document cron update calls
- `DOCUMENT_CRON_STALE_PERIOD` : Milliseconds since Documemt was last edited; criteria for trashing
- `GRAPHDB_CRON_REFRESH_PERIOD_MINUTES` : Minimum time (minutes) between refreshes of graph DB data

Database:
Expand Down Expand Up @@ -88,6 +86,7 @@ Services:
- `ORCID_BASE_URL` : url for [ORCID](https://orcid.org/) website
- `ORCID_PUBLIC_API_BASE_URL` : url for version of [ORCID](https://orcid.org/) public API
- `NO_ABSTRACT_HANDLING` : labels directing how to sort documents missing query text. 'text' (default): autogenerate text from templates; 'date': sort by date and ignore text.
- `CROSSREF_API_BASE_URL` : url for [Crossref Unified Resource API](https://api.crossref.org/)

Links:

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@
"engines": {
"node": ">=16.19.0"
},
"version": "0.24.0"
"version": "0.25.0"
}
15 changes: 14 additions & 1 deletion src/client/components/document-management-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,20 @@ class DocumentManagementDocumentComponent extends React.Component {
checked: _.get( DOCUMENT_STATUS_FIELDS, typeVal ) === doc.status(),
onChange: e => {
let newlySelectedStatus = _.get( DOCUMENT_STATUS_FIELDS, e.target.value );
doc.status( newlySelectedStatus );
switch ( newlySelectedStatus ) {
case DOCUMENT_STATUS_FIELDS.INITIATED:
doc.initiate();
break;
case DOCUMENT_STATUS_FIELDS.SUBMITTED:
doc.submit();
break;
case DOCUMENT_STATUS_FIELDS.PUBLIC:
doc.makePublic();
break;
case DOCUMENT_STATUS_FIELDS.TRASHED:
doc.trash();
break;
}
}
}),
h('label', {
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/editor/cy/layout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import on from './on-key';
// import on from './on-key';
import * as defs from './defs';
import _ from 'lodash';
import { isInteractionNode, getCyLayoutOpts } from '../../../../util';
Expand Down Expand Up @@ -31,6 +31,6 @@ export default function( { bus, cy, document } ){
lastLayout.run();
};

on('r', layout);
// on('r', layout);
bus.on('layout', layout);
}
34 changes: 17 additions & 17 deletions src/client/components/editor/info-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ export class InfoPanel extends Component {
const retractedPubType = _.find( citation.pubTypes, ['UI', 'D016441'] );
const retractFlag = retractedPubType ? h('span.editor-info-flag.super-salient-button.danger', retractedPubType.value) : null;

const hasPubmedMetadata = pmid != null;
const hasArticleId = pmid != null || doi != null;
const hasRelatedPapers = !_.isEmpty( document.relatedPapers() );

return h('div.editor-info-panel', [
h('div.editor-info-flags', [ retractFlag ]),

h('div.editor-info-title', title),

h('div.editor-info-authors', _.flatten(authorProfiles.map((a, i) => {
let orcid = findOrcidIdentifier( a.orcid ); // Backwards compatible with URI
if ( orcid ) {
Expand All @@ -94,27 +95,26 @@ export class InfoPanel extends Component {
i !== authorProfiles.length - 1 ? h('span.editor-info-author-spacer', ', ') : null
];
}))),

h(Credits, { controller, bus, document }),

hasPubmedMetadata ? h('div.editor-info-links', [
h( doi ? 'a.editor-info-link.plain-link': 'div.editor-info-link', doi ? { target: '_blank', href: `${DOI_LINK_BASE_URL}${doi}` }: {}, reference),
h('a.editor-info-link.plain-link', { target: '_blank', href: `${PUBMED_LINK_BASE_URL}${pmid}` }, 'PubMed'),
h('a.editor-info-link.plain-link', { target: '_blank', href: `${GOOGLE_SCHOLAR_BASE_URL}${ doi ? doi : ( "\u0022" + title + "\u0022") }` }, 'Google Scholar')
]) : null,
h(Credits, { controller, bus, document }),

abstract ? h('div.editor-info-main-sections', [
h('div.editor-info-abstract-section.editor-info-main-section', [
h('div.editor-info-links', [
reference ? h( doi ? 'a.editor-info-link.plain-link': 'div.editor-info-link', doi ? { target: '_blank', href: `${DOI_LINK_BASE_URL}${doi}` }: {}, reference) : null,
pmid ? h('a.editor-info-link.plain-link', { target: '_blank', href: `${PUBMED_LINK_BASE_URL}${pmid}` }, 'PubMed') : null,
h('a.editor-info-link.plain-link', { target: '_blank', href: `${GOOGLE_SCHOLAR_BASE_URL}${( "\u0022" + title + "\u0022") }`}, 'Google Scholar')
]),
h('div.editor-info-main-sections', [
abstract ? h('div.editor-info-abstract-section.editor-info-main-section', [
h('div.editor-info-section-title', abstract ? 'Abstract': 'Summary'),
h('div.editor-info-abstract-content', abstract ? abstract : document.toText() )
]),
h('div.editor-info-related-papers-section.editor-info-main-section', [
]) : null,
hasRelatedPapers ? h('div.editor-info-related-papers-section.editor-info-main-section', [
h('div.editor-info-section-title', 'Recommended articles'),
h('div.editor-info-related-papers', [ h(RelatedPapers, { document, source: document }) ])
])
]) : null,
]) : null
]),

!hasPubmedMetadata && !document.editable() ? h('div.editor-coming-soon-placeholder', `Biofactoid is looking for more information about this article from PubMed and pathway databases. This information will appear here as soon as it is available.`) : null
!hasArticleId && !document.editable() ? h('div.editor-coming-soon-placeholder', `Biofactoid is looking for more information about this article from PubMed and pathway databases. This information will appear here as soon as it is available.`) : null
]);
}
}
Expand Down
56 changes: 7 additions & 49 deletions src/client/components/home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import h from 'react-hyperscript';
import { Component } from 'react';
import Popover from './popover/popover';
import RequestForm from './request-form';
import { makeClassList } from '../dom';
import EventEmitter from 'eventemitter3';
import { Carousel, CAROUSEL_CONTENT } from './carousel';
Expand Down Expand Up @@ -277,24 +276,7 @@ class Home extends Component {
}

render(){
const CTAPopover = props => {
return h(Popover, {
tippy: {
html: h(RequestForm, {
bus: this.bus,
submitBtnText: 'Create my article profile'
}),
onHidden: () => this.bus.emit('closecta'),
placement: props.placement || 'top'
}
}, props.children || []);
};

// const CTA = () => {
// return h(CTAPopover, [
// h('button.home-cta-button.salient-button', 'Get started')
// ]);
// };
const CTA = h('a', { href: 'document/new', target: '_blank' },[ h('button.home-intro-cta', 'Add my article') ]);

const ContactPopover = (props) => {
return h(Popover, {
Expand Down Expand Up @@ -412,11 +394,7 @@ class Home extends Component {
]),
` supported by their results, letting researchers explore a firsthand account of an article’s findings and connect to related articles and knowledge. `
]),
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-intro-cta', 'Add my article')
])
CTA
]),
h('div.home-intro-figure'),
h('div.home-explore#home-explore', [
Expand All @@ -426,11 +404,7 @@ class Home extends Component {
]),
h('div.home-section.home-fluid-section.home-intro-figure-sm-alt-section', [
h('div.home-intro-figure-sm-alt'),
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-intro-cta', 'Add my article')
])
CTA
]),
h('div.home-section.home-fluid-section', [
h('div.home-fluid-section-copy', [
Expand Down Expand Up @@ -470,11 +444,7 @@ class Home extends Component {
h('h3', `Don’t let your research get left behind`),
h('p', `Research is increasingly online, interactive, and interconnected. Biofactoid helps you connect your research to the world.`),
h('p.home-cta-p', [
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-cta-alt-button', 'Add my article')
]),
CTA,
h('a', {
target: '_blank',
href: `/document/${SAMPLE_DOC_ID}`
Expand All @@ -498,11 +468,7 @@ class Home extends Component {
])
]),
h('p.home-cta-p', [
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-cta-alt-button', 'Add my article')
]),
CTA,
h('a', {
target: '_blank',
href: `/document/${SAMPLE_DOC_ID}`
Expand All @@ -522,11 +488,7 @@ class Home extends Component {
h('h3', `Easy sharing `),
h('p', `Want your colleagues to know about an interesting report? Share an interactive graphical abstract via social media or email with just a click.`),
h('p.home-cta-p', [
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-cta-alt-button', 'Add my article')
]),
CTA,
h('a', {
target: '_blank',
href: `/document/${SAMPLE_DOC_ID}`
Expand All @@ -540,11 +502,7 @@ class Home extends Component {
h('div.home-fluid-section-phone-aoi')
]),
h('p.home-cta-p', [
h(CTAPopover, {
placement: 'bottom'
}, [
h('button.home-cta-alt-button', 'Add my article')
]),
CTA,
h('a', {
target: '_blank',
href: `/document/${SAMPLE_DOC_ID}`
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/request-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class RequestForm extends Component {

if(titleEl){
focusDomElement(titleEl);
}
}
}, 50);

this.onCloseCTA = () => this.reset();
this.onCloseCTA = () => {};
this.onOpenCTA = () => this.focusTitle();
}

Expand Down
7 changes: 3 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ export const APPSIGNAL_APP_ENV = env('APPSIGNAL_APP_ENV', 'development');

// CRON jobs
export const CRON_SCHEDULE = env('CRON_SCHEDULE', '0 * * * *');
export const DOCUMENT_CRON_UPDATE_PERIOD_DAYS = env('DOCUMENT_CRON_UPDATE_PERIOD_DAYS', 7);
export const DOCUMENT_CRON_CREATED_AGE_DAYS = env('DOCUMENT_CRON_CREATED_AGE_DAYS', undefined);
export const DOCUMENT_CRON_REFRESH_ENABLED = env('DOCUMENT_CRON_REFRESH_ENABLED', true);
export const DOCUMENT_CRON_UNEDITED_DAYS = env('DOCUMENT_CRON_UNEDITED_DAYS', 30);
export const DOCUMENT_CRON_UPDATE_PERIOD = env('DOCUMENT_CRON_UPDATE_PERIOD', 7 * 24 * 60 * 60 * 1000);
export const DOCUMENT_CRON_STALE_PERIOD = env('DOCUMENT_CRON_STALE_PERIOD', 30 * 24 * 60 * 60 * 1000);
export const GRAPHDB_CRON_REFRESH_PERIOD_MINUTES = env('GRAPHDB_CRON_REFRESH_PERIOD_MINUTES', 1440);

// Connect to localhost
Expand Down Expand Up @@ -75,6 +73,7 @@ export const INDRA_ENGLISH_ASSEMBLER_URL = env('INDRA_ENGLISH_ASSEMBLER_URL', 'h
export const SEMANTIC_SEARCH_BASE_URL = env('SEMANTIC_SEARCH_BASE_URL', 'https://main.semanticsearch.baderlab.org/');
export const ORCID_BASE_URL = env('ORCID_BASE_URL', 'https://orcid.org/');
export const ORCID_PUBLIC_API_BASE_URL = env('ORCID_PUBLIC_API_BASE_URL', 'https://pub.orcid.org/v3.0/');
export const CROSSREF_API_BASE_URL = env('CROSSREF_API_BASE_URL', 'https://api.crossref.org/');

// Links
export const UNIPROT_LINK_BASE_URL = env('UNIPROT_LINK_BASE_URL', 'http://www.uniprot.org/uniprot/');
Expand Down
85 changes: 85 additions & 0 deletions src/server/routes/api/document/crossref/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import _ from 'lodash';
import queryString from 'query-string';
import fetch from 'node-fetch';

import { CROSSREF_API_BASE_URL, EMAIL_ADDRESS_INFO, BASE_URL } from '../../../../../config.js';
import { checkHTTPStatus } from '../../../../../util/index.js';

const WORKS_URL = CROSSREF_API_BASE_URL + 'works';

const toJson = response => response.json();
const checkResultStatus = json => {
const status = _.get( json, ['status'] );
const isOK = status === 'ok';
if( isOK ){
return json;
} else {
const message = _.get( json, ['message'] );
throw new Error(`${message}`);
}
};

/**
* search
*
* Query the CrossRef web service API for matching Work.
* [See docs]{@link https://api.crossref.org/swagger-ui/index.html#/Works/get_works}
*
* @param { String } q The query term
* @param { Object } opts Search options
* @returns { Object } result The search results
* @returns { Array } result.searchHits A list of matching records
* @returns { Number } result.count The number of searchHits
*/
const search = (q, opts) => {
const DEFAULT_WORKS_PARAMS = {
'query.bibliographic': undefined, //query field for: citation look up, includes titles, authors, ISSNs and publication years
'rows': 5
};
const formatSearchHits = json => {
const searchHits = _.get( json, ['message', 'items'] );
const count = searchHits.length;
return { searchHits, count };
};
const params = _.assign( {}, DEFAULT_WORKS_PARAMS, { 'query.bibliographic': q }, opts );
const url = WORKS_URL + '?' + queryString.stringify( params );
const userAgent = `${process.env.npm_package_name}/${process.env.npm_package_version} (${BASE_URL}; mailto:${EMAIL_ADDRESS_INFO})`;
return fetch( url, {
method: 'GET',
headers: {
'User-Agent': userAgent
}
})
.then( checkHTTPStatus )
.then( toJson )
.then( checkResultStatus )
.then( formatSearchHits );
};


/**
* get
*
* Retrieve Work from CrossRef web service API.
* [See docs]{@link https://api.crossref.org/swagger-ui/index.html#/Works/get_works__doi_}
*
* @param { String } doi The object DOI
* @returns { Object } The matching record
*/
const get = doi => {
const formatGetResponse = json => _.get( json, ['message'] );
const url = WORKS_URL + `/${doi}`;
const userAgent = `${process.env.npm_package_name}/${process.env.npm_package_version} (${BASE_URL}; mailto:${EMAIL_ADDRESS_INFO})`;
return fetch( url, {
method: 'GET',
headers: {
'User-Agent': userAgent
}
})
.then( checkHTTPStatus )
.then( toJson )
.then( checkResultStatus )
.then( formatGetResponse );
};

export { search, get };
3 changes: 3 additions & 0 deletions src/server/routes/api/document/crossref/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './map.js';
export * from './works.js';
export * from './api.js';
Loading