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: import missing fields from RERODOC #178

Merged
merged 1 commit into from
Mar 17, 2020
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
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ prune docs/_build

recursive-include _sources *.txt
recursive-include _static *.css *.js *.png
recursive-include data *.crt *.json
recursive-include data *.crt *.json *.csv
recursive-include docker *.cfg *.conf *.crt *.ini *.key *.pem *.sh
recursive-include docs *.bat *.py *.rst *.txt Makefile
recursive-include sonar *.babelrc *.eslintignore *.gitkeep *.json *.html *.js *.scss *.css *.png *.jpg *.svg *.po *.pot *.mo *.py *.txt *.woff *.woff2
Expand Down
77 changes: 77 additions & 0 deletions data/affiliations.csv

Large diffs are not rendered by default.

66 changes: 26 additions & 40 deletions data/complete_document_sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
"type": "bf:Language"
}
],
"authors": [
"contribution": [
{
"type": "person",
"name": "Mancini, Loriano",
"date": "1975-03-23",
"qualifier": "Librarian"
},
{
"type": "person",
"name": "Ronchetti, Elvezio"
},
{
"type": "person",
"name": "Trojani, Fabio"
"agent": {
"type": "bf:Person",
"preferred_name": "John, Doe",
"date_of_birth": "1960",
"date_of_death": "2000"
},
"role": [
"cre"
],
"affiliation": "Institute for Research"
}
],
"title": [
Expand Down Expand Up @@ -119,43 +117,31 @@
]
}
],
"editionStatement": [
{
"editionDesignation": [
{
"value": "Di 3 ban"
},
{
"value": "第3版",
"language": "chi-hani"
}
],
"responsibility": [
{
"value": "Zeng Lingliang zhu bian"
},
{
"value": "曾令良主编",
"language": "chi-hani"
}
]
"editionStatement": {
"editionDesignation": {
"value": "Di 3 ban"
},
"responsibility": {
"value": "Zeng Lingliang zhu bian"
}
],
"is_part_of": "Is part of",
},
"copyrightDate": [
"© 1971"
],
"series": [
{
"name": "Collection One",
"number": "5"
"name": "Collection One",
"number": "5"
},
{
"name": "Collection Two",
"number": "123"
"name": "Collection Two",
"number": "123"
}
],
"notes": ["Note 1", "Note 2"],
"notes": [
"Note 1",
"Note 2"
],
"institution": {
"$ref": "https://sonar.ch/api/institutions/org"
}
Expand Down
12 changes: 3 additions & 9 deletions sonar/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,21 +399,15 @@ def _(x):
dict(aggs=dict(
institution=dict(terms=dict(field='institution.pid')),
language=dict(terms=dict(field='language.value')),
author__en=dict(terms=dict(field='facet_authors_en')),
author__fr=dict(terms=dict(field='facet_authors_fr')),
author__de=dict(terms=dict(field='facet_authors_de')),
author__it=dict(terms=dict(field='facet_authors_it')),
subject=dict(terms=dict(field='facet_subjects')),
specific_collections=dict(terms=dict(field='specificCollections'))),
specific_collections=dict(terms=dict(field='specificCollections')),
document_type=dict(terms=dict(field='documentType'))),
filters={
_('institution'): terms_filter('institution.pid'),
_('language'): terms_filter('language.value'),
_('author__en'): terms_filter('facet_authors_en'),
_('author__fr'): terms_filter('facet_authors_fr'),
_('author__de'): terms_filter('facet_authors_de'),
_('author__it'): terms_filter('facet_authors_it'),
_('subject'): terms_filter('facet_subjects'),
_('specific_collections'): terms_filter('specificCollections'),
_('document_type'): terms_filter('documentType')
}),
'deposits':
dict(aggs=dict(status=dict(terms=dict(field='status')),
Expand Down
2 changes: 1 addition & 1 deletion sonar/modules/deposits/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def create_document(self):
'value': self['metadata']['title']
}]
}],
'type':
'documentType':
self['metadata']['document_type'],
'language': [{
'type': 'bf:Language',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
"title": "Type of document",
"description": "Type of document",
"type": "string",
"default": "preprint",
"enum": ["preprint", "postprint"]
"default": "coar:c_816b",
"enum": ["coar:c_816b", "coar:c_6501"]
},
"languages": {
"title": "Languages",
Expand Down
2 changes: 1 addition & 1 deletion sonar/modules/documents/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_record_by_identifier(cls, identifiers):
:param list identifiers: List of identifiers
"""
for identifier in identifiers:
if identifier['type'] == 'bf:Identifier':
if identifier['type'] == 'bf:Local':
results = list(DocumentSearch().filter(
'term', identifiedBy__value=identifier['value']).source(
includes=['pid']))
Expand Down
Loading