-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds parser for Ethnicity & Disease [ethnds]
- Loading branch information
AGCooper
committed
Nov 22, 2019
1 parent
9c536ff
commit 9ef35d1
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"longname": "Ethnicity & Disease", | ||
"name": "ethndis", | ||
"describe": "Recognizes the accesses to the platform Ethnicity & Disease", | ||
"contact": "acoope5@emory.edu", | ||
"pkb": false, | ||
"docurl": "http://ang.couperin.org/platforms/to_be_completed/", | ||
"domains": [ | ||
"www.ethndis.org", | ||
"ethndis.org" | ||
], | ||
"version": "2019-10-01", | ||
"status": "beta" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
const Parser = require('../.lib/parser.js'); | ||
|
||
/** | ||
* Recognizes the accesses to the platform Ethnicity & Disease | ||
* @param {Object} parsedUrl an object representing the URL to analyze | ||
* main attributes: pathname, query, hostname | ||
* @param {Object} ec an object representing the EC whose URL is being analyzed | ||
* @return {Object} the result | ||
*/ | ||
module.exports = new Parser(function analyseEC(parsedUrl, ec) { | ||
let result = {}; | ||
let path = parsedUrl.pathname; | ||
// let param = parsedUrl.query || {}; | ||
// console.error(parsedUrl); | ||
|
||
let match; | ||
|
||
if ((/^\/edonline\/index.php\/ethndis\/search\/search$/i.test(path)) || (/^\/edonline\/index.php\/ethndis\/search$/i.test(path))) { | ||
// https://www.ethndis.org:443/edonline/index.php/ethndis/search/search?query=brain&authors=&title=&abstract=&galleyFullText=&suppFiles=&dateFromMonth=&dateFromDay=&dateFromYear=&dateToMonth=&dateToDay=&dateToYear=&dateToHour=23&dateToMinute=59&dateToSecond=59&discipline=&subject=&type=&coverage=&indexTerms= | ||
result.rtype = 'SEARCH'; | ||
result.mime = 'MISC'; | ||
|
||
} else if (((match = /^\/edonline\/index.php\/ethndis\/issue\/([a-z-]+)$/i.exec(path)) !== null) || ((match = /^\/edonline\/index.php\/ethndis\/issue\/view\/([0-9]+)$/i.exec(path)) !== null)) { | ||
// https://www.ethndis.org:443/edonline/index.php/ethndis/issue/archive | ||
// https://www.ethndis.org:443/edonline/index.php/ethndis/issue/view/43 | ||
result.rtype = 'TOC'; | ||
result.mime = 'HTML'; | ||
result.title_id = match[1]; | ||
result.unitid = match[1]; | ||
|
||
} else if ((match = /^\/edonline\/index.php\/ethndis\/article\/(view|viewFile|download)\/([0-9]+)\/([0-9]+)\/([0-9]+)$/i.exec(path)) !== null) { | ||
result.title_id = match[2] + '/'+ match[3] + '/'+ match[4]; | ||
result.unitid = match[2] + '/'+ match[3] + '/'+ match[4]; | ||
if (match[1] == 'view') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'viewFile') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'download') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'PDF'; | ||
} | ||
|
||
} else if ((match = /^\/edonline\/index.php\/ethndis\/article\/(view|viewFile|download)\/([0-9]+)\/([0-9]+)$/i.exec(path)) !== null) { | ||
result.title_id = match[2] + '/'+ match[3]; | ||
result.unitid = match[2] + '/'+ match[3]; | ||
if (match[1] == 'view') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'viewFile') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'download') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'PDF'; | ||
} | ||
|
||
} else if ((match = /^\/edonline\/index.php\/ethndis\/article\/(view|viewFile|download)\/([0-9]+)$/i.exec(path)) !== null) { | ||
result.title_id = match[2]; | ||
result.unitid = match[2]; | ||
if (match[1] == 'view') { | ||
result.rtype = 'ABS'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'viewFile') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'HTML'; | ||
} | ||
else if (match[1] == 'download') { | ||
result.rtype = 'ARTICLE'; | ||
result.mime = 'PDF'; | ||
} | ||
|
||
} | ||
|
||
return result; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
out-unitid;out-title_id;out-rtype;out-mime;in-url | ||
;;SEARCH;MISC;https://www.ethndis.org:443/edonline/index.php/ethndis/search/search?query=brain&authors=&title=&abstract=&galleyFullText=&suppFiles=&dateFromMonth=&dateFromDay=&dateFromYear=&dateToMonth=&dateToDay=&dateToYear=&dateToHour=23&dateToMinute=59&dateToSecond=59&discipline=&subject=&type=&coverage=&indexTerms= | ||
archive;archive;TOC;HTML;https://www.ethndis.org:443/edonline/index.php/ethndis/issue/archive | ||
43;43;TOC;HTML;https://www.ethndis.org:443/edonline/index.php/ethndis/issue/view/43 | ||
1118;1118;ABS;HTML;https://www.ethndis.org:443/edonline/index.php/ethndis/article/view/1118 | ||
1118/1636/8544;1118/1636/8544;ARTICLE;HTML;https://www.ethndis.org:443/edonline/index.php/ethndis/article/viewFile/1118/1636/8544 | ||
1118/1634;1118/1634;ARTICLE;PDF;https://www.ethndis.org:443/edonline/index.php/ethndis/article/download/1118/1634 |