Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
db4ff11b
Commit
db4ff11b
authored
Jun 04, 2014
by
LE GAC Renaud
Browse files
Check entries with the same origin field value.
parent
857be877
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
8 deletions
+42
-8
modules/check_tools.py
modules/check_tools.py
+41
-8
static/CHANGELOG
static/CHANGELOG
+1
-0
No files found.
modules/check_tools.py
View file @
db4ff11b
...
...
@@ -86,6 +86,12 @@ def check_publication(row):
text
=
T
(
'Report numbers contains "Note :" or ";"'
)
li
.
append
(
text
)
# duplicate by origin
ids
=
duplicate_origin
(
row
.
publications
)
if
len
(
ids
)
>
1
:
text
=
T
(
"Entries with duplicate origin [%s]"
)
%
', '
.
join
(
ids
)
li
.
append
(
text
)
# specific fields for article
if
row
.
categories
.
usual
==
'article'
:
...
...
@@ -153,7 +159,7 @@ def check_publication(row):
return
(
li
,
ids
)
def
_
extend_ids
(
db
,
query
,
ids
):
def
extend_ids
(
db
,
query
,
ids
):
"""helper functions
@type db: gluon.dal.DAL
...
...
@@ -210,16 +216,16 @@ def duplicate_article(publication):
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
)
extend_ids
(
db
,
query
,
ids
)
# publisher, volume and pages
query
=
((
qmain
)
&
(
db
.
publications
.
volume
==
publication
[
'volume'
]))
query
=
((
query
)
&
(
db
.
publications
.
pages
==
publication
[
'pages'
]))
_
extend_ids
(
db
,
query
,
ids
)
extend_ids
(
db
,
query
,
ids
)
# publisher and title
query
=
((
qmain
)
&
(
db
.
publications
.
title
==
publication
[
'title'
]))
_
extend_ids
(
db
,
query
,
ids
)
extend_ids
(
db
,
query
,
ids
)
return
ids
...
...
@@ -259,17 +265,44 @@ def duplicate_conference(publication):
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
def
duplicate_origin
(
publication
):
"""Look for publications with the same value in the origin field.
@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'
]
# protection against empty origin field
if
not
publication
[
'origin'
]:
return
ids
# look for publication with the same origin field
query
=
db
.
publications
.
origin
==
publication
[
'origin'
]
set
=
db
(
query
)
if
set
.
count
():
for
row
in
set
.
select
():
ids
.
append
(
str
(
row
.
id
))
return
ids
...
...
@@ -301,7 +334,7 @@ def duplicate_report(publication):
if
'id'
in
publication
:
qmain
=
((
qmain
)
&
(
db
.
publications
.
id
!=
publication
[
'id'
]))
_
extend_ids
(
db
,
qmain
,
ids
)
extend_ids
(
db
,
qmain
,
ids
)
return
ids
\ No newline at end of file
static/CHANGELOG
View file @
db4ff11b
...
...
@@ -4,6 +4,7 @@ HEAD
- Bugs fixed.
- Add and deploy the methods Record.host, oai and oai_url.
- Add the application property reg_institute.
- Check entries with the same value in the origin field.
0.8.5 (May 2014)
- Migrate to plugin_dbui 0.6.1.1 and web2py 2.9.5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment