@@ -39,9 +39,11 @@ export function pmcLoader(options: { orcid: string }): Loader {
3939 authors : z . string ( ) ,
4040 firstAuthor : z . string ( ) ,
4141 date : z . string ( ) ,
42+ year : z . number ( ) ,
4243 journal : z . string ( ) ,
4344 link : z . string ( ) . url ( ) ,
4445 isPreprint : z . boolean ( ) ,
46+ isReview : z . boolean ( ) ,
4547 pmid : z . string ( ) . optional ( ) ,
4648 doi : z . string ( ) . optional ( ) ,
4749 pmcid : z . string ( ) . optional ( ) ,
@@ -84,22 +86,29 @@ export function pmcLoader(options: { orcid: string }): Loader {
8486
8587 for ( const pub of data . resultList . result ) {
8688
89+ const publicationDate = pub . firstPublicationDate || '' ;
90+ const year = publicationDate ? new Date ( publicationDate ) . getFullYear ( ) : new Date ( ) . getFullYear ( ) ;
91+ const pubTypeString = pub . pubType ?. toLowerCase ( ) || '' ;
92+ const titleString = ( pub . title || '' ) . toLowerCase ( ) ;
93+
8794 const processedPub = {
8895 title : pub . title || '' ,
8996 authors : pub . authorString || '' ,
9097 firstAuthor : pub . authorString ? pub . authorString . split ( ',' ) [ 0 ] . trim ( ) : '' ,
91- date : pub . firstPublicationDate || '' ,
98+ date : publicationDate ,
99+ year : year ,
92100 journal : pub . journalTitle || 'Unknown Journal' ,
93101 link : pub . source && pub . id
94102 ? `http://europepmc.org/abstract/${ pub . source } /${ pub . id } `
95103 : pub . doi
96104 ? `https://doi.org/${ pub . doi } `
97105 : '' ,
98- isPreprint : pub . pubType ?. toLowerCase ( ) . includes ( 'preprint' ) || false ,
106+ isPreprint : pubTypeString . includes ( 'preprint' ) ,
107+ isReview : pubTypeString . includes ( 'review' ) || titleString . includes ( 'review' ) ,
99108 pmid : pub . pmid ,
100109 doi : pub . doi ,
101110 pmcid : pub . pmcid ,
102- isOpenAccess : pub . isOpenAccess === 'Y' || pub . pubType ?. toLowerCase ( ) . includes ( 'preprint' ) ,
111+ isOpenAccess : pub . isOpenAccess === 'Y' || pubTypeString . includes ( 'preprint' ) ,
103112 volume : pub . journalVolume ,
104113 issue : pub . issue ,
105114 pages : pub . pageInfo ,
0 commit comments