Skip to content

Commit

Permalink
Merge pull request #815 from ezpaarse-project/evidal
Browse files Browse the repository at this point in the history
feat(evidal): added new paths and changed old rtypes
  • Loading branch information
felixleo22 authored Apr 16, 2024
2 parents d509549 + 1f12aa0 commit e4a386a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
21 changes: 16 additions & 5 deletions evidal/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {

let match;

if ((match = /^\/recherche/i.exec(path)) !== null) {
if ((match = /^\/recherche\.html$/i.exec(path)) !== null) {
// https://evidal.vidal.fr/recherche.html?q=DOLIPRANE%20500%20MG%20G%C3%89L
result.rtype = 'SEARCH';
result.mime = 'HTML';

} else if ((match = /^\/medicament\/.+-(\d+)\.html$/i.exec(path)) !== null) {
// https://evidal.vidal.fr/medicament/doliprane_500_mg_gel-5480.html
result.rtype = 'ABS';
result.rtype = 'RECORD';
result.mime = 'HTML';
result.unitid = match[1];

Expand All @@ -37,24 +37,35 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/medicament\/pdf\.html/i.exec(path)) !== null) {
} else if ((match = /^\/medicament\/pdf\.html$/i.exec(path)) !== null) {
// https://evidal.vidal.fr/medicament/pdf.html?id=5480
result.rtype = 'RECORD';
result.mime = 'PDF';
result.unitid = param.id;

} else if ((match = /^\/recos\/details\/(\d+)\/.+$/i.exec(path)) !== null) {
// https://evidal.vidal.fr/recos/details/2720/grippe_saisonniere/prise_en_charge
result.rtype = 'ARTICLE';
result.rtype = 'GRAPH';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/baseDocumentaire\/pdf\.html/i.exec(path)) !== null) {
} else if ((match = /^\/baseDocumentaire\/pdf\.html$/i.exec(path)) !== null) {
// https://evidal.vidal.fr/baseDocumentaire/pdf.html?id=2720&permalink=grippe_saisonniere
result.rtype = 'ARTICLE';
result.mime = 'PDF';
result.unitid = param.id;

} else if ((match = /^\/actualites\/details\/id:(\d+)/i.exec(path)) !== null) {
// https://evidal-vidal-fr/actualites/details/id:28957/permalink:glaucome_xiop_nouvelle_specialite_a_base_de_latanoprost_en_unidose_et_sans_conservateur/
result.rtype = 'ARTICLE';
result.mime = 'HTML';
result.unitid = match[1];

} else if (/^\/analyse-ordonnance\.html$/i.test(path)) {
// https://evidal-vidal-fr/analyse-ordonnance.html
result.rtype = 'ANALYSIS';
result.mime = 'HTML';

}

return result;
Expand Down
2 changes: 0 additions & 2 deletions evidal/test/evidal.2018-10-22.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
out-unitid;out-rtype;out-mime;in-url
2720;ARTICLE;PDF;https://evidal.vidal.fr/baseDocumentaire/pdf.html?id=2720&permalink=grippe_saisonniere
2720;ARTICLE;HTML;https://evidal.vidal.fr/recos/details/2720/grippe_saisonniere/prise_en_charge
5480;RECORD;PDF;https://evidal.vidal.fr/medicament/pdf.html?id=5480
5480;RECORD;HTML;https://evidal.vidal.fr/medicament/html/5480/doliprane_500_mg_gel.html
5480;ABS;HTML;https://evidal.vidal.fr/medicament/doliprane_500_mg_gel-5480.html
;SEARCH;HTML;https://evidal.vidal.fr/recherche.html?q=DOLIPRANE%20500%20MG%20G%C3%89L
5 changes: 5 additions & 0 deletions evidal/test/evidal.2024-04-16.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out-unitid;out-rtype;out-mime;in-url
5485;RECORD;HTML;https://evidal-vidal-fr/medicament/doliprane_100_mg_pdre_p_sol_buv_en_sachet_dose-5485.html
28957;ARTICLE;HTML;https://evidal-vidal-fr/actualites/details/id:28957/permalink:glaucome_xiop_nouvelle_specialite_a_base_de_latanoprost_en_unidose_et_sans_conservateur/
;ANALYSIS;HTML;https://evidal-vidal-fr/analyse-ordonnance.html
2731;GRAPH;HTML;https://evidal-vidal-fr/recos/details/2731/dermatite_atopique_de_l_adulte/prise_en_charge

0 comments on commit e4a386a

Please sign in to comment.