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

Merge branch '31-32-synonym' into 'master'

31 32  add synonym field to the table collaborations, coutries and publishers

* Modify the database schema.
* Add the script `mv_dbschema_0815` to modify the schema of existing databases.
* Add the new function `harvest_tools.search_synonym`.
* Add the methods `Automaton.search_collaboration`, `Automaton.search_country` and `Automaton.search_publisher`.
* Modify the `Msg` class and the harvester view to display the synonym when the record is rejected.
* Update the documentation.
* Add more tests.
* Close #5, #31, #32

See merge request !30
parents f0670efa 0eb38798
......@@ -10,6 +10,7 @@ from harvest_tools import (build_harvester_tool,
DRY_RUN,
format_author_fr,
family_name_fr,
search_synonym,
ToolException)
from invenio_tools import (CheckAndFix,
CheckException,
......@@ -145,8 +146,15 @@ def edit_insert():
values['PublicationsAuthors_institute'] = record.my_authors
# collaboration
recId = get_id(db.collaborations, collaboration=record.collaboration())
values['PublicationsId_collaborations'] = int(recId) if recId else UNDEF_ID
recId = UNDEF_ID
try:
recId = search_synonym(db.collaborations,
"collaboration",
record.collaboration())
except ToolException:
pass
values['PublicationsId_collaborations'] = int(recId)
# teams, project, categories, origin
values['PublicationsId_categories'] = int(selector.id_categories)
......@@ -160,8 +168,15 @@ def edit_insert():
check.clean_erratum(record)
check.format_editor(record)
recId = get_id(db.publishers, abbreviation=record.paper_editor())
values['PublicationsId_publishers'] = int(recId) if recId else UNDEF_ID
recId = UNDEF_ID
try:
recId = search_synonym(db.publishers,
"abbreviation",
record.paper_editor())
except ToolException:
pass
values['PublicationsId_publishers'] = int(recId)
values['PublicationsVolume'] = record.paper_volume()
values['PublicationsPages'] = record.paper_pages()
......@@ -181,10 +196,15 @@ def edit_insert():
values['PublicationsConference_dates'] = record.conference_dates()
values['PublicationsConference_town'] = record.conference_town()
recId = get_id(db.countries, country=record.conference_country())
values['PublicationsId_countries'] = \
recId if recId is not None else UNDEF_ID
recId = UNDEF_ID
try:
recId = search_synonym(db.countries,
"country",
record.conference_country())
except ToolException:
pass
values['PublicationsId_countries'] = int(recId)
values['PublicationsConference_speaker'] = record.first_author()
# thesis
......
......@@ -55,7 +55,7 @@ extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode']
# autosummary configuration
autosummary_generate = False
autosummary_generate = True
# intersphinx configuration
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}
......
harvest_tools.automaton.Automaton.__init__
==========================================
.. currentmodule:: harvest_tools.automaton
.. automethod:: Automaton.__init__
\ No newline at end of file
harvest_tools.automaton.Automaton.get_create_collaboration
==========================================================
.. currentmodule:: harvest_tools.automaton
.. automethod:: Automaton.get_create_collaboration
\ No newline at end of file
harvest_tools.automaton.Automaton.get_create_publisher
harvest_tools.automaton.Automaton.search_collaboration
======================================================
.. currentmodule:: harvest_tools.automaton
.. automethod:: Automaton.get_create_publisher
\ No newline at end of file
.. automethod:: Automaton.search_collaboration
\ No newline at end of file
harvest_tools.automaton.Automaton.search_country
================================================
.. currentmodule:: harvest_tools.automaton
.. automethod:: Automaton.search_country
\ No newline at end of file
harvest_tools.automaton.Automaton.search_publisher
==================================================
.. currentmodule:: harvest_tools.automaton
.. automethod:: Automaton.search_publisher
\ No newline at end of file
......@@ -12,15 +12,9 @@ harvest_tools.articles.Articles
:toctree: articles/
~Articles.check_record
~Articles.decode_xml
~Articles.get_create_collaboration
~Articles.get_create_publisher
~Articles.get_record_by_fields
~Articles.get_record_by_origin
~Articles.insert_record
~Articles.process_url
~Articles.process_xml
~Articles.report
......
......@@ -4,23 +4,22 @@ harvest_tools.automaton.Automaton
.. currentmodule:: harvest_tools.automaton
.. autoclass:: Automaton
:show-inheritance:
.. rubric:: Methods
.. autosummary::
:toctree: automaton/
~Automaton.__init__
~Automaton.check_record
~Automaton.decode_xml
~Automaton.get_create_collaboration
~Automaton.get_create_publisher
~Automaton.get_record_by_fields
~Automaton.insert_record
~Automaton.process_url
~Automaton.process_xml
~Automaton.report
~Automaton.search_collaboration
~Automaton.search_country
~Automaton.search_publisher
......
harvest_tools.automaton.search_synonym
======================================
.. currentmodule:: harvest_tools.automaton
.. autofunction:: search_synonym
\ No newline at end of file
harvest_tools.base.search_synonym
=================================
.. currentmodule:: harvest_tools.base
.. autofunction:: search_synonym
\ No newline at end of file
......@@ -12,14 +12,7 @@ harvest_tools.notes.Notes
:toctree: notes/
~Notes.check_record
~Notes.decode_xml
~Notes.get_create_collaboration
~Notes.get_create_publisher
~Notes.get_record_by_fields
~Notes.insert_record
~Notes.process_url
~Notes.process_xml
~Notes.report
......
......@@ -12,14 +12,7 @@ harvest_tools.preprints.Preprints
:toctree: preprints/
~Preprints.check_record
~Preprints.decode_xml
~Preprints.get_create_collaboration
~Preprints.get_create_publisher
~Preprints.get_record_by_fields
~Preprints.insert_record
~Preprints.process_url
~Preprints.process_xml
~Preprints.report
......
......@@ -12,14 +12,7 @@ harvest_tools.proceedings.Proceedings
:toctree: proceedings/
~Proceedings.check_record
~Proceedings.decode_xml
~Proceedings.get_create_collaboration
~Proceedings.get_create_publisher
~Proceedings.get_record_by_fields
~Proceedings.insert_record
~Proceedings.process_url
~Proceedings.process_xml
~Proceedings.report
......
......@@ -12,14 +12,7 @@ harvest_tools.reports.Reports
:toctree: reports/
~Reports.check_record
~Reports.decode_xml
~Reports.get_create_collaboration
~Reports.get_create_publisher
~Reports.get_record_by_fields
~Reports.insert_record
~Reports.process_url
~Reports.process_xml
~Reports.report
......
......@@ -12,14 +12,7 @@ harvest_tools.talks.Talks
:toctree: talks/
~Talks.check_record
~Talks.decode_xml
~Talks.get_create_collaboration
~Talks.get_create_publisher
~Talks.get_record_by_fields
~Talks.insert_record
~Talks.process_url
~Talks.process_xml
~Talks.report
......
......@@ -12,14 +12,7 @@ harvest_tools.thesis.Thesis
:toctree: thesis/
~Thesis.check_record
~Thesis.decode_xml
~Thesis.get_create_collaboration
~Thesis.get_create_publisher
~Thesis.get_record_by_fields
~Thesis.insert_record
~Thesis.process_url
~Thesis.process_xml
~Thesis.report
......
......@@ -4,7 +4,6 @@ invenio_tools.checkandfix.CheckAndFix
.. currentmodule:: invenio_tools.checkandfix
.. autoclass:: CheckAndFix
:show-inheritance:
.. rubric:: Methods
......
......@@ -4,7 +4,6 @@ invenio_tools.inveniostore.InvenioStore
.. currentmodule:: invenio_tools.inveniostore
.. autoclass:: InvenioStore
:show-inheritance:
.. rubric:: Methods
......
......@@ -4,7 +4,6 @@ invenio_tools.iterrecord.IterRecord
.. currentmodule:: invenio_tools.iterrecord
.. autoclass:: IterRecord
:show-inheritance:
.. rubric:: Methods
......
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