Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit e7cedef0 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Modify the method duplicate_article since JHEP 06 (2012) 115 and JHEP 06...

Modify the method duplicate_article since JHEP 06 (2012) 115 and JHEP 06 (2015) 115 is valid (see cds 1443914 and 2003394).
parent ebf71895
......@@ -8,34 +8,34 @@ import re
import regex
from gluon import current
from plugin_dbui import (UNDEF,
UNDEF_ID,
get_id,
from plugin_dbui import (UNDEF,
UNDEF_ID,
get_id,
get_where_query)
# syntax for the submission date YYYY-MM or YYYY-MM-DD
REG_SUBMITTED = re.compile(regex.REG_SUBMITTED)
# HTML code like >
# HTML code like >
REG_HTML = re.compile('&[a-z]+;')
def check_publication(row):
"""Check the publication fields.
@type row: gluon.dal.Row
@param row: record defining a publication. Its contains the publications
table as well as its reference tables.
@rtype: tuple
@return:
@return:
- the first element contains the list of message
- the second one contains the list of duplicate ids.
"""
T, li, idset = current.T, [], set()
# status code
if row.status.code == '???':
text = T("The status is ???")
......@@ -45,7 +45,7 @@ def check_publication(row):
if row.categories.code == UNDEF:
text = T("The category is undefined")
li.append(text)
# team
if row.publications.id_teams == UNDEF_ID:
text = T("The team is undefined")
......@@ -55,8 +55,8 @@ def check_publication(row):
if row.publications.id_projects == UNDEF_ID:
text = T("The project is undefined")
li.append(text)
# authors list
# authors list
if 'et al' in row.publications.authors:
text = T("'et al.' in authors")
li.append(text)
......@@ -65,23 +65,23 @@ def check_publication(row):
if row.teams.team in row.publications.authors_institute:
text = T("The institute authors contains the team name?")
li.append(text)
# submitted date
if not row.publications.submitted:
if not row.publications.submitted:
text = T("Submitted date is not defined")
li.append(text)
if row.publications.submitted:
if not REG_SUBMITTED.match(row.publications.submitted):
if row.publications.submitted:
if not REG_SUBMITTED.match(row.publications.submitted):
text = T("Submitted date is not valid")
li.append(text)
# publication URL
if row.publications.publication_url:
if 'pdf' not in row.publications.publication_url:
text = T("Check that the publication URL corresponds to a pdf file.")
li.append(text)
# latex syntax
title = row.publications.title
rules = "√" in title or \
......@@ -90,39 +90,39 @@ def check_publication(row):
("->" in title) or \
("s**(1/2)" in title) or \
REG_HTML.search(title)
if rules:
text = T("Check latex syntax in the title")
li.append(text)
# "Note :" in report number
value = row.publications.report_numbers
rules = "Note :" in value or \
"Note:" in value or \
";" in value
if rules:
text = T('Report numbers contains "Note :" or ";"')
li.append(text)
# duplicate by origin
ids = duplicate_origin(row.publications)
if len(ids):
idset = idset.union(ids)
text = T("Entries with duplicate origin")
li.append(text)
# specific fields for article
if row.categories.usual == 'article':
if row.publications.id_publishers == UNDEF_ID:
text = T("Publishers is not defined")
li.append(text)
if not row.publications.volume:
text = T("Volume number is not defined")
li.append(text)
if not row.publications.pages:
text = T("Pages range is not defined")
li.append(text)
......@@ -165,10 +165,10 @@ def check_publication(row):
idset = idset.union(ids)
text = T("Possible duplicate entries")
li.append(text)
# specific fields for report
if row.categories.usual == 'report':
if not row.publications.report_numbers:
text = T("Report number is missing")
li.append(text)
......@@ -178,25 +178,25 @@ def check_publication(row):
idset = idset.union(ids)
text = T("Possible duplicate entries")
li.append(text)
return (li, list(idset))
def extend_ids(db, query, ids):
"""helper functions
@type db: gluon.dal.DAL
@param db:
@type query: gluon.dal.query
@param query:
@param query:
@type ids: list of string
@param ids: the current list of ids
@note: the current list of publication ids will be extend by those
corresponding to the C{query}. The id are unique in the list.
"""
set = db(query)
if set.count():
......@@ -205,47 +205,48 @@ def extend_ids(db, query, ids):
if id not in ids:
ids.append(id)
def duplicate_article(publication):
"""Look for duplicate article.
The comparison is performed on article published by the given team
using the following criteria:
- title, publishers, volume and pages
- publisher, volume and pages
- publisher and title
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
"""
ids = []
db = current.globalenv['db']
qcat = (db.categories.code == 'ACL') | (db.categories.code == 'ACLN')
qmain = get_where_query(db.publications)
qmain = ((qmain) & (qcat))
qmain = ((qmain) & (db.publications.id_teams == publication['id_teams']))
qmain = ((qmain) & (db.publications.id_publishers == publication['id_publishers']))
if 'id' in publication and publication['id']:
qmain = ((qmain) & (db.publications.id != publication['id']))
# title, publishers, volume and pages
query = ((qmain) & (db.publications.title == publication['title']))
query = ((query) & (db.publications.volume == publication['volume']))
query = ((query) & (db.publications.pages == publication['pages']))
extend_ids(db, query, ids)
# publisher, volume and pages
# publisher, volume, pages and year
query = ((qmain) & (db.publications.volume == publication['volume']))
query = ((query) & (db.publications.pages == publication['pages']))
query = ((query) & (db.publications.year == publication['year']))
extend_ids(db, query, ids)
# publisher and title
query = ((qmain) & (db.publications.title == publication['title']))
extend_ids(db, query, ids)
......@@ -255,51 +256,51 @@ def duplicate_article(publication):
def duplicate_conference(publication):
"""Look for duplicate talk / proceeding.
The comparison is performed on conference talk/proceeding published
The comparison is performed on conference talk/proceeding published
by the given team using the following criteria:
- title, conference title, conference date and conference town
- title, conference date and conference town
- title, conference title and conference town
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
"""
ids = []
db = current.globalenv['db']
qcat = (db.categories.code == 'ACTI') | \
(db.categories.code == 'ACTN') | \
(db.categories.code == 'COM')
qmain = get_where_query(db.publications)
qmain = ((qmain) & (qcat))
qmain = ((qmain) & (db.publications.id_teams == publication['id_teams']))
qmain = ((qmain) & (db.publications.title == publication['title']))
if 'id' in publication and publication['id']:
qmain = ((qmain) & (db.publications.id != publication['id']))
# title, conference title, conference date and conference town
query = ((qmain) & (db.publications.conference_title == publication['conference_title']))
query = ((query) & (db.publications.conference_dates == publication['conference_dates']))
query = ((query) & (db.publications.conference_town == publication['conference_town']))
extend_ids(db, query, ids)
extend_ids(db, query, ids)
# title, conference date and conference town
query = ((query) & (db.publications.conference_dates == publication['conference_dates']))
query = ((query) & (db.publications.conference_town == publication['conference_town']))
extend_ids(db, query, ids)
extend_ids(db, query, ids)
# title, conference title and conference town
query = ((qmain) & (db.publications.conference_title == publication['conference_title']))
query = ((query) & (db.publications.conference_town == publication['conference_town']))
extend_ids(db, query, ids)
extend_ids(db, query, ids)
return ids
......@@ -308,10 +309,10 @@ def duplicate_origin(publication):
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
"""
ids = []
db = current.globalenv['db']
......@@ -328,29 +329,29 @@ def duplicate_origin(publication):
if set.count():
for row in set.select():
ids.append(str(row.id))
return ids
def duplicate_report(publication):
"""Look for duplicate report.
The comparison is performed on report published by the given team
The comparison is performed on report published by the given team
using the following criteria:
- title
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
"""
ids = []
db = current.globalenv['db']
qcat = db.categories.code == 'AP'
qmain = get_where_query(db.publications)
qmain = ((qmain) & (qcat))
qmain = ((qmain) & (db.publications.id_teams == publication['id_teams']))
......@@ -358,7 +359,7 @@ def duplicate_report(publication):
if 'id' in publication and publication['id']:
qmain = ((qmain) & (db.publications.id != publication['id']))
extend_ids(db, qmain, ids)
return ids
\ No newline at end of file
extend_ids(db, qmain, ids)
return ids
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment