Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documents: refactoring work_access_point field #3292

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 87 additions & 115 deletions data/documents_big.json

Large diffs are not rendered by default.

67 changes: 31 additions & 36 deletions data/documents_small.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Bach, Johann Sebastian"
},
Expand Down Expand Up @@ -3097,7 +3097,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Marguerite",
"date_of_birth": "1492",
Expand Down Expand Up @@ -3309,7 +3309,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Plas, Alain"
},
Expand Down Expand Up @@ -6448,7 +6448,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Binet, Christian"
},
Expand Down Expand Up @@ -7198,7 +7198,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Mozart, Wolfgang Amadeus"
},
Expand Down Expand Up @@ -7548,7 +7548,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Glanzmann, Arthur"
},
Expand Down Expand Up @@ -8311,7 +8311,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Cantin, Marc"
},
Expand Down Expand Up @@ -8697,7 +8697,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Urlaub, Farin",
"date_of_birth": "1963"
Expand Down Expand Up @@ -10004,7 +10004,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "King, Stephen",
"date_of_birth": "1947"
Expand Down Expand Up @@ -10175,7 +10175,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "King, Stephen",
"date_of_birth": "1947"
Expand Down Expand Up @@ -11760,7 +11760,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Haydn, Joseph",
"date_of_birth": "1732",
Expand Down Expand Up @@ -14788,11 +14788,11 @@
"intendedAudience": [
{
"audienceType": "school_level",
"value": "target_school_harmos1"
"value": "target_school_harmos2"
},
{
"audienceType": "school_level",
"value": "target_school_harmos2"
"value": "target_school_harmos1"
},
{
"audienceType": "school_level",
Expand Down Expand Up @@ -19441,11 +19441,6 @@
],
"work_access_point": [
{
"agent": {
"type": "bf:Organisation",
"conference": false,
"preferred_name": "Italia"
},
"title": "Code p\u00e9nal"
}
],
Expand Down Expand Up @@ -20166,7 +20161,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Knoepfel, Peter"
},
Expand Down Expand Up @@ -22690,7 +22685,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Mauriac, Claude"
},
Expand Down Expand Up @@ -25987,7 +25982,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Shelley, Mary Wollstonecraft Godwin",
"date_of_birth": "1797",
Expand Down Expand Up @@ -27679,7 +27674,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "PoiPoi"
},
Expand Down Expand Up @@ -30134,7 +30129,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Bertholet, Alfred",
"qualifier": "Musicien"
Expand Down Expand Up @@ -34984,7 +34979,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Nix, Garth"
},
Expand Down Expand Up @@ -37509,7 +37504,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Marek, Robert"
},
Expand Down Expand Up @@ -40601,7 +40596,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Schumann, Robert",
"date_of_birth": "1810",
Expand All @@ -40613,7 +40608,7 @@
]
},
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Schumann, Robert",
"date_of_birth": "1810",
Expand Down Expand Up @@ -40915,7 +40910,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Haydn, Joseph",
"date_of_birth": "1732",
Expand All @@ -40928,7 +40923,7 @@
"key_for_music": "Hob. 1:7, do majeur"
},
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Haydn, Joseph",
"date_of_birth": "1732",
Expand All @@ -40941,7 +40936,7 @@
"key_for_music": "Hob. 1:8, sol majeur"
},
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Haydn, Joseph",
"date_of_birth": "1732",
Expand Down Expand Up @@ -44078,7 +44073,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Mendelssohn-Bartholdy, Felix"
},
Expand Down Expand Up @@ -44845,7 +44840,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Plato",
"date_of_birth": "ca. 427",
Expand Down Expand Up @@ -48905,7 +48900,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Bubnoff, Serge von"
},
Expand Down Expand Up @@ -50140,7 +50135,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Glanzmann, Arthur"
},
Expand Down Expand Up @@ -51551,7 +51546,7 @@
],
"work_access_point": [
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Darbellay, Etienne",
"identifiedBy": {
Expand All @@ -51562,7 +51557,7 @@
"title": "Luigi Ferdinando Tagliavini: le musicologue"
},
{
"agent": {
"creator": {
"type": "bf:Person",
"preferred_name": "Darbellay, Etienne"
},
Expand Down
13 changes: 6 additions & 7 deletions rero_ils/dojson/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,21 +321,20 @@ def error_print(*args):


def make_year(date):
"""Test if string is integer and between 1000 to 9999."""
"""Test if string is integer and between 1000 and 9999."""
with contextlib.suppress(Exception):
int_date = int(date)
if int_date >= 1000 and int_date < 9999:
if 1000 <= int_date < 9999:
return int_date
return None


def not_repetitive(bibid, reroid, key, value, subfield, default=None):
"""Get the first value if the value is a list or tuple."""
data = value.get(
subfield) if default is None else value.get(subfield, default)
data = value.get(subfield, default)
if isinstance(data, (list, tuple)):
error_print('WARNING NOT REPETITIVE:', bibid, reroid, key, subfield,
value)
error_print(
'WARNING NOT REPETITIVE:', bibid, reroid, key, subfield, value)
data = data[0]
return data

Expand Down Expand Up @@ -381,7 +380,7 @@ def remove_trailing_punctuation(
:type spaced_punctuation: str
:return: the data string with specific trailing punctuation removed
:rtype: list
:rtype: str
"""
# escape chars: .[]^-
if punctuation:
Expand Down
Loading