@@ -11,25 +11,24 @@ import { writeFormattedJSON } from './cli.js';
1111 * @returns {collection }, a JSON array of search results for each set topic.
1212 */
1313export async function getData ( ) {
14- // set dates for past month
15-
14+ // Set dates for past month
1615 const now = new Date ( ) ;
17- const startOffset = { days : 1 } ;
16+ const startOffset = { months : 1 } ;
1817 const start = format ( sub ( now , startOffset ) , 'yyyy-MM-dd' ) ;
1918 const end = format ( now , 'yyyy-MM-dd' ) ;
2019
21- // reading config file for list of topics
20+ // Reading config file for list of topics
2221 const config = JSON . parse ( fs . readFileSync ( 'example-data/data-config.json' ) ) ;
2322
24- // download all recent papers & combine the arrays
23+ // Download all recent papers & combine the arrays
2524 const data = await Promise . all ( [
2625 download ( 'biorxiv' , start , end ) ,
2726 download ( 'medrxiv' , start , end )
2827 ] ) ;
2928
3029 const articles = _ . flatten ( data ) ;
3130
32- // search using list of topic objects from config
31+ // Search using list of topic objects from config
3332 const searcher = new Search ( ) ;
3433
3534 await searcher . articles ( articles ) ;
@@ -41,16 +40,13 @@ export async function getData () {
4140 return _ . assign ( { } , config , { papers } ) ;
4241 } ;
4342 const collection = await Promise . all ( config . map ( doSearches ) ) ;
44- // const parsedCollection = JSON.parse(collection);
4543
46- // output all search result papers into data json
44+ // Output all search result papers into data. json
4745 const fileHandle = await fs . openSync ( 'example-data/data.json' , 'w' ) ;
4846 await writeFormattedJSON ( collection , 'example-data/data.json' ) ;
4947 fs . closeSync ( fileHandle ) ;
5048
51- return collection ;
49+ // return collection;
5250}
5351
54- const out = await getData ( ) ;
55- console . log ( out [ 0 ] . papers . length ) ;
56- console . log ( 'done!' ) ;
52+ await getData ( ) ;
0 commit comments