Commit 7a1d1f17 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Polish rule related to REG_CONF_DATES and improve the repair procedure.

parent cdf033f0
......@@ -290,7 +290,8 @@
'Invalid': 'Non conforme',
"Invalid database table '%s'": "Invalid database table '%s'",
'Invalid email': 'Invalid email',
'invalid expression': 'expression invalide',
'Invalid expression': 'Expression non conforme',
'invalid expression': 'expression non conforme',
'Invalid keyword argument': 'Invalid keyword argument',
'Invalid list of record identifiers': "La liste des identifiants n'est pas valide",
'Invalid login': 'Invalid login',
......
......@@ -109,11 +109,11 @@ db.publications.title.filter_in = dbui.CLEAN_SPACES
db.publications.authors.requires = IS_LENGTH(65535)
# rule: 30 Dec 2012
db.publications.defense.requires = IS_MATCH(REG_DEFENSE)
db.publications.defense.requires = IS_EMPTY_OR(IS_MATCH(REG_DEFENSE))
db.publications.id_publishers.requires = IS_IN_DB(db, 'publishers.abbreviation')
# rule: 10-14 Dec 2012 or 28 Jun - 4 Jul 2012
db.publications.conference_dates.requires = IS_MATCH(REG_CONF_DATES)
db.publications.conference_dates.requires = IS_EMPTY_OR(IS_MATCH(REG_CONF_DATES))
db.publications.conference_url.requires = IS_EMPTY_OR(IS_URL())
db.publications.origin.requires = IS_EMPTY_OR(IS_URL())
......
......@@ -92,6 +92,8 @@ OAI_URL = "http://%s/record/%s"
REG_BODY = re.compile("<body>(.*)</body>")
REG_COLLABORATION = re.compile(regex.REG_COLLABORATION)
REG_CONF = re.compile("^C\d+-\d+-\d+(\.\d+)?$")
REG_CONF_DATES_1 = re.compile("(\d+) *-? *(\d+) *([A-Z][a-z]{2}) *(\d{4})")
REG_CONF_DATES_2 = re.compile("(\d+) *([A-Z][a-z]{2}) *-? *(\d+) *([A-Z][a-z]{2}) *(\d{4})")
REG_CONF_DATES = re.compile(regex.REG_CONF_DATES)
REG_IDS_OK = re.compile("^\[[\d, ]*\]$")
REG_INT = re.compile("^\d+$")
......@@ -414,10 +416,23 @@ class CheckAndFix(object):
if not id:
raise CheckException(MSG_NO_COUNTRY)
# check conference date
m = REG_CONF_DATES.match(record.conference_dates())
# check and fix conference date
value = record[u"111"]["d"]
m = REG_CONF_DATES.match(value)
if not m:
raise CheckException(MSG_WELL_FORMED_CONF_DATES)
# 12 - 15 Mar 2014 or 29 Feb - 1 Mar 2014
m1 = REG_CONF_DATES_1.match(value)
m2 = REG_CONF_DATES_2.match(value)
if m1:
record[u"111"]["d"] = "%s-%s %s %s" % m1.groups()
elif m2:
record[u"111"]["d"] = "%s %s - %s %s %s" % m2.groups()
else:
raise CheckException(MSG_WELL_FORMED_CONF_DATES)
def format_authors(self, record, func):
......
......@@ -20,7 +20,7 @@ REG_COLLABORATION = r'^[A-Za-z0-9\-/, ]+([Cc]ollaboration|[Cc]onsortium|[Gg]roup
# - 28 Jun - 4 Jul 2012
#
reg1 = r'\d{1,2}-\d{1,2} [A-Z][a-z]{2} \d{4}'
reg2 = r'\d{1,2} [A-Z][a-z]{2} -\d{1,2} [A-Z][a-z]{2} \d{4}'
reg2 = r'\d{1,2} [A-Z][a-z]{2} - \d{1,2} [A-Z][a-z]{2} \d{4}'
REG_CONF_DATES = r'%s|%s' % (reg1, reg2)
# Defence date
......
......@@ -26,8 +26,7 @@ HEAD
Harvester can not add country anymore.
- Re-enforce rule for fields: collaborations, defense, conference_dates,
submitted and publications_url
- Add the dashbaord reports. It shows the cumulative number of publications
as a function of the months.
- Add the dashbaord, line chart and stacked chart reports.
0.8.7.2 (Sep 2014)
- Migrate to plugin_dbui 0.6.1.7.
......
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