Skip to content

Commit

Permalink
SUDOC: tweak "place" handling. Bump lastUpdated to push previous comm…
Browse files Browse the repository at this point in the history
…it. PubMed: move url to attachment, since this is a catalog
  • Loading branch information
aurimasv committed Oct 1, 2012
1 parent f60972d commit f9c00a1
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 45 deletions.
55 changes: 41 additions & 14 deletions NCBI PubMed.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"inRepository": true,
"translatorType": 13,
"browserSupport": "gcsbv",
"lastUpdated": "2012-03-12 01:14:39"
"lastUpdated": "2012-10-01 10:55:04"
}

function detectWeb(doc, url) {
Expand Down Expand Up @@ -117,8 +117,16 @@ function doImportFromText(text) {
var newItem = new Zotero.Item("journalArticle");

var citation = ZU.xpath(articles[i], 'MedlineCitation');

//store link as attachment, since this is a catalog
var PMID = ZU.xpathText(citation, 'PMID');
newItem.url = "http://www.ncbi.nlm.nih.gov/pubmed/" + PMID;
newItem.attachments.push({
title: "PubMed Link",
url: "http://www.ncbi.nlm.nih.gov/pubmed/" + PMID,
mimeType: "text/html",
snapshot: false
});

newItem.extra = "PMID: "+PMID;

var article = ZU.xpath(citation, 'Article');
Expand Down Expand Up @@ -236,8 +244,15 @@ function doImportFromText(text) {

var citation = ZU.xpath(books[i], 'BookDocument');
var PMID = ZU.xpathText(citation, 'PMID');
//url
newItem.url = "http://www.ncbi.nlm.nih.gov/pubmed/" + PMID;

//store as attachment, since this is a catalog
newItem.attachments.push({
title: "PubMed Link",
url: "http://www.ncbi.nlm.nih.gov/pubmed/" + PMID,
mimetype: "text/html",
snapshot: false
});

//Extra:PMID
newItem.extra = "PMID: "+PMID;

Expand Down Expand Up @@ -459,8 +474,13 @@ var testCases = [
"Humans"
],
"seeAlso": [],
"attachments": [],
"url": "http://www.ncbi.nlm.nih.gov/pubmed/20729678",
"attachments": [
{
"title": "PubMed Link",
"mimeType": "text/html",
"snapshot": false
}
],
"extra": "PMID: 20729678",
"title": "Zotero: harnessing the power of a personal bibliographic manager",
"pages": "205-207",
Expand All @@ -473,7 +493,6 @@ var testCases = [
"abstractNote": "Zotero is a powerful free personal bibliographic manager (PBM) for writers. Use of a PBM allows the writer to focus on content, rather than the tedious details of formatting citations and references. Zotero 2.0 (http://www.zotero.org) has new features including the ability to synchronize citations with the off-site Zotero server and the ability to collaborate and share with others. An overview on how to use the software and discussion about the strengths and limitations are included.",
"DOI": "10.1097/NNE.0b013e3181ed81e4",
"libraryCatalog": "NCBI PubMed",
"accessDate": "CURRENT_TIMESTAMP",
"shortTitle": "Zotero"
}
]
Expand Down Expand Up @@ -504,8 +523,13 @@ var testCases = [
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"url": "http://www.ncbi.nlm.nih.gov/pubmed/20821847",
"attachments": [
{
"title": "PubMed Link",
"mimetype": "text/html",
"snapshot": false
}
],
"extra": "PMID: 20821847",
"ISBN": "1859962521",
"title": "Endocrinology: An Integrated Approach",
Expand All @@ -516,7 +540,6 @@ var testCases = [
"abstractNote": "Endocrinology has been written to meet the requirements of today's trainee doctors and the demands of an increasing number of degree courses in health and biomedical sciences, and allied subjects. It is a truly integrated text using large numbers of real clinical cases to introduce the basic biochemistry, physiology and pathophysiology underlying endocrine disorders and also the principles of clinical diagnosis and treatment. The increasing importance of the molecular and genetic aspects of endocrinology in relation to clinical medicine is explained.",
"rights": "Copyright © 2001, BIOS Scientific Publishers Limited",
"libraryCatalog": "NCBI PubMed",
"accessDate": "CURRENT_TIMESTAMP",
"shortTitle": "Endocrinology"
}
]
Expand Down Expand Up @@ -552,8 +575,13 @@ var testCases = [
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"url": "http://www.ncbi.nlm.nih.gov/pubmed/21249754",
"attachments": [
{
"title": "PubMed Link",
"mimetype": "text/html",
"snapshot": false
}
],
"extra": "PMID: 21249754",
"title": "Cancer Syndromes",
"date": "2009",
Expand All @@ -562,8 +590,7 @@ var testCases = [
"language": "en",
"abstractNote": "Cancer Syndromes is a comprehensive multimedia resource for selected single gene cancer syndromes. Syndromes currently included are Peutz-Jeghers syndrome, juvenile polyposis, Birt-Hogg-Dubé syndrome, multiple endocrine neoplasia type 1 and familial atypical multiple mole melanoma syndrome. For each syndrome the history, epidemiology, natural history and management are reviewed. If possible the initial report in the literature of each syndrome is included as an appendix. Chapters are extensively annotated with figures and movie clips. Mission Statement: Improving the care of cancer syndrome patients.",
"rights": "Copyright © 2009-, Douglas L Riegert-Johnson",
"libraryCatalog": "NCBI PubMed",
"accessDate": "CURRENT_TIMESTAMP"
"libraryCatalog": "NCBI PubMed"
}
]
}
Expand Down
77 changes: 46 additions & 31 deletions Sudoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsb",
"lastUpdated": "2012-03-11 15:38:39"
"lastUpdated": "2012-10-01 12:55:07"
}

function detectWeb(doc, url) {
Expand Down Expand Up @@ -112,11 +112,12 @@ function scrape(doc, url) {
{
var authorText = author.textContent;

var authorFields = authorText.match(/^\s*(.+?)\s*(?:\(.+?\)\s*)?\.\s*([^\.]+)\s*$/);
var authorFields = authorText.match(/^\s*(.+?)\s*(?:\((.+?)\)\s*)?\.\s*([^\.]+)\s*$/);
var authorFunction = '';
if(authorFields) {
authorFunction = authorFields[2];
authorFunction = authorFields[3];
authorText = authorFields[1];
var extra = authorFields[2];
}
if (authorFunction)
{
Expand All @@ -143,10 +144,11 @@ function scrape(doc, url) {
zoteroFunction = 'author';
}

if (authorFunction == "Université de soutenance")
if (authorFunction == "Université de soutenance" || authorFunction == "Organisme de soutenance")
{
// If the author function is "université de soutenance" it means that this author has to be in "university" field
newItem.university = authorText;
newItem.city = extra; //store for later
}
else
{
Expand Down Expand Up @@ -212,21 +214,29 @@ function scrape(doc, url) {
break;
case 'editeur':
case 'publisher': //en = de
//ignore publisher for thesis, so that it does not overwrite university
if(newItem.itemType == 'thesis' && newItem.university) break;

var m = value.match(/(.*):(.*),(.*)/);

if (m)
{
if (!(newItem.place))
if (!(newItem.city))
{
newItem.place = Zotero.Utilities.trimInternal(m[1]);
newItem.city = Zotero.Utilities.trimInternal(m[1]);
}
if (!(newItem.publisher))
{
newItem.publisher = Zotero.Utilities.trimInternal(m[2]);
}
}
break;

case 'pays':
case 'country':
if(!newItem.country) {
newItem.country = value;
}
break;
case 'description':
// We're going to extract the number of pages from this field
// Known bug doesn't work when there are 2 volumes,
Expand Down Expand Up @@ -276,11 +286,10 @@ function scrape(doc, url) {
case "identifiant pérenne de la notice":
case 'persistent identifier of the record':
case 'persistent identifier des datensatzes':
var permalink = value;
if (permalink)
{
newItem.attachments.push( { url: permalink, title: 'SUDOC Snapshot', mimeType: 'text/html' } );
}
var permalink = value;
if (permalink) {
newItem.attachments.push( { url: permalink, title: 'SUDOC Snapshot', mimeType: 'text/html' } );
}
break;

case 'worldcat':
Expand All @@ -292,6 +301,13 @@ function scrape(doc, url) {
}
}

var location = [];
if(newItem.city) location.push(newItem.city);
newItem.city = undefined;
if(newItem.country) location.push(newItem.country);
newItem.country = undefined;
newItem.place = location.join(', ');

newItem.complete();
}
}
Expand Down Expand Up @@ -348,7 +364,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.sudoc.fr/147745608",
"url": "http://www.sudoc.abes.fr/DB=2.1/SRCH?IKT=12&TRM=147745608",
"items": [
{
"itemType": "book",
Expand Down Expand Up @@ -382,18 +398,17 @@ var testCases = [
"ISBN": "978-2-7472-1729-3",
"title": "Souffrance au travail dans les grandes entreprises",
"language": "français",
"place": "Paris",
"publisher": "Eska",
"numberOfVolumes": "1",
"numPages": "290",
"libraryCatalog": "SUDOC",
"accessDate": "CURRENT_TIMESTAMP"
"place": "Paris, France",
"libraryCatalog": "SUDOC"
}
]
},
{
"type": "web",
"url": "http://www.sudoc.fr/156726319",
"url": "http://www.sudoc.abes.fr/DB=2.1/SRCH?IKT=12&TRM=156726319",
"items": [
{
"itemType": "book",
Expand All @@ -413,25 +428,28 @@ var testCases = [
{
"title": "SUDOC Snapshot",
"mimeType": "text/html"
},
{
"title": "Worldcat Link",
"mimeType": "text/html"
}
],
"date": "2011",
"ISBN": "978-0-83898589-2",
"title": "Zotero : a guide for librarians, researchers and educators",
"language": "anglais",
"place": "Chicago",
"publisher": "Association of College and Research Libraries",
"numberOfVolumes": "1",
"numPages": "159",
"place": "Chicago, Etats-Unis",
"libraryCatalog": "SUDOC",
"accessDate": "CURRENT_TIMESTAMP",
"shortTitle": "Zotero"
}
]
},
{
"type": "web",
"url": "http://www.sudoc.fr/093838956",
"url": "http://www.sudoc.abes.fr/DB=2.1/SRCH?IKT=12&TRM=093838956",
"items": [
{
"itemType": "thesis",
Expand Down Expand Up @@ -468,19 +486,17 @@ var testCases = [
{
"title": "Worldcat Link",
"mimeType": "text/html"
}
}
],
"date": "2004",
"title": "Facteurs pronostiques des lymphomes diffus lymphocytiques",
"university": "Université du droit et de la santé",
"language": "français",
"place": "[S.l.]",
"publisher": "[s.n.]",
"numberOfVolumes": "1",
"numPages": "87",
"type": "Thèse d'exercice",
"libraryCatalog": "SUDOC",
"accessDate": "CURRENT_TIMESTAMP"
"place": "Lille, France",
"libraryCatalog": "SUDOC"
}
]
},
Expand Down Expand Up @@ -609,7 +625,7 @@ var testCases = [
],
"seeAlso": [],
"attachments": [
{
{
"title": "SUDOC Snapshot",
"mimeType": "text/html"
},
Expand All @@ -631,7 +647,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.sudoc.fr/05625248X",
"url": "http://www.sudoc.abes.fr/DB=2.1/SRCH?IKT=12&TRM=05625248X",
"items": [
{
"itemType": "audioRecording",
Expand Down Expand Up @@ -663,7 +679,7 @@ var testCases = [
],
"seeAlso": [],
"attachments": [
{
{
"title": "SUDOC Snapshot",
"mimeType": "text/html"
},
Expand All @@ -675,12 +691,11 @@ var testCases = [
"date": "1986",
"title": "English music for mass and offices (II) and music for other ceremonies",
"language": "latin",
"place": "Monoco",
"publisher": "Éditions de l'oiseau-lyre",
"numPages": "243",
"series": "Polyphonic music of the fourteenth century ; v. 17",
"libraryCatalog": "SUDOC",
"accessDate": "CURRENT_TIMESTAMP"
"place": "Monoco, Monaco",
"libraryCatalog": "SUDOC"
}
]
}
Expand Down

0 comments on commit f9c00a1

Please sign in to comment.