Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pour les uri des theses en preparation consultées par l'API ( de la forme /api/v1/theses/these/s383095 étaient ignorées) + modifs commentaires exemples #851

Merged
merged 6 commits into from
Sep 26, 2024
Merged
12 changes: 10 additions & 2 deletions thesesfr/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
const apiPersonRegex = /\/api\/v1\/personnes\/personne\/([0-9]{8}[0-9X])/ig;
const apiOrganismeRegex = /\/api\/v1\/theses\/organisme\/([0-9]{8}[0-9X])/ig;
const apiThesisRegex = /\/api\/v1\/theses\/these\/(([0-9]{4})([a-z]{2}[0-9a-z]{2})[0-9a-z]+)/ig;
const apiSubjectRegex = /\/api\/v1\/theses\/these\/(s[0-9]+)/ig;

const apiDocumentRegex = /\/api\/v1\/document\/(([0-9]{4})([a-z]{2}[0-9a-z]{2})[0-9a-z]+)/ig;
const apiProtectedDocRegex = /\/api\/v1\/document\/protected\/(([0-9]{4})([a-z]{2}[0-9a-z]{2})[0-9a-z]+)/ig;
Expand Down Expand Up @@ -83,15 +84,22 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
result.unitid = match[1];
result.ppn = match[1];

} else if ((match = apiSubjectRegex.exec(path)) !== null) {
// ABStract notice d’une thèse en préparation
// /api/v1/theses/these/s383095
result.rtype = 'ABS';
result.mime = 'JSON';
result.unitid = match[1];

} else if ((match = /^\/(s[0-9]+)$/i.exec(path)) !== null) {
// /s366354 ABStract notice d’une thèse en préparation
// /s366354 ABStract notice d’une thèse en préparation HTML
result.rtype = 'ABS';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = apiThesisRegex.exec(path)) !== null) {
// ABStract notice d’une thèse soutenue JSON
// /api/v1/theses/these/s383095
// /api/v1/theses/these/2023UPASP097
result.rtype = 'ABS';
result.mime = 'JSON';
result.unitid = match[1];
Expand Down
9 changes: 4 additions & 5 deletions thesesfr/test/thesesfr.2024-07-18.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
out-publication_date;out-ppn;out-unitid;out-rtype;out-mime;out-publication_date;out-institution_code;in-url;in-status
;;2019LYSE2053;PHD_THESIS;PDF;2019;LYSE;https://theses.fr/api/v1/document/2019LYSE2053;200
;;2010AIX22039;PHD_THESIS;HTML;2010;AIX2;https://theses.fr/api/v1/document/2010AIX22039;302
;264066944;264066944;BIO;HTML;;;https://theses.fr/264066944;200
;264066944;264066944;BIO;HTML;;;https://theses.fr/api/v1/personnes/personne/264066944;200
;264066944;264066944;RECORD;HTML;;;https://theses.fr/264066944;200
;264066944;264066944;RECORD;JSON;;;https://theses.fr/api/v1/personnes/personne/264066944;200
;;s383095;ABS;HTML;;;https://theses.fr/s383095;200
;;s383095;ABS;HTML;;;https://theses.fr/api/v1/theses/these/s383095;200
;;s383095;ABS;JSON;;;https://theses.fr/api/v1/theses/these/s383095;200
2023;;2024BORD0122;ABS;HTML;2024;BORD;https://theses.fr/2024BORD0122;200
2023;;2024BORD0122;ABS;HTML;2024;BORD;https://theses.fr/api/v1/theses/these/2024BORD0122;200
;;;SEARCH;HTML;;;https://theses.fr/api/v1/theses/recherche/?q=test&debut=0&nombre=10&tri=pertinence;200
2023;;2024BORD0122;ABS;JSON;2024;BORD;https://theses.fr/api/v1/theses/these/2024BORD0122;200
Loading