Skip to content
Open
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
6 changes: 6 additions & 0 deletions normalized.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
],
"type": "object",
"properties": {
"documentType": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have to add $oneOf here as most of the time this field will be None

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"description": "The type of the document",
"enum": [
null, "article", "abstract", "dataset", "book", "book-chapter", "dissertation", "correction", "preprint", "source-code", "clinical-trial", "reference-entry", "monograph"
]
},
"publisher": {
"type": "object",
"anyOf": [
Expand Down
1 change: 0 additions & 1 deletion scrapi/base/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
dif_process_contributors
)


DOESCHEMA = {
"description": ('//dc:description/node()', compose(lambda x: x.strip(), single_result)),
"contributors": ('//dc:creator/node()', compose(doe_process_contributors, lambda x: x.split(';'), single_result)),
Expand Down
13 changes: 13 additions & 0 deletions scrapi/harvesters/crossref.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def schema(self):
'sponsorships': ('/funder', lambda x: process_sponsorships(x) if x else []),
'tags': ('/subject', '/container-title', lambda x, y: [tag.lower() for tag in (x or []) + (y or [])]),
'subjects': ('/subject', '/container-title', lambda x, y: [tag.lower() for tag in (x or []) + (y or [])]),
'documentType': ('/type', lambda x: document_type_mapping.get(x)),
'otherProperties': build_properties(
('journalTitle', '/container-title'),
('volume', '/volume'),
Expand Down Expand Up @@ -131,3 +132,15 @@ def harvest(self, start_date=None, end_date=None):
}))

return doc_list

document_type_mapping = {
"book": "book",
"book-chapter": "book-chapter",
"dataset": "dataset",
"dissertation": "dissertation",
"journal-article": "article",
"monograph": "monograph",
"proceedings-article": "article",
"reference-entry": "reference-entry",
"report": "article",
}
6 changes: 6 additions & 0 deletions scrapi/harvesters/plos.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ def harvest(self, start_date=None, end_date=None):
'publisher': {
'name': ('//str[@name="journal"]/node()', single_result)
},
'documentType': ('//str[@name="article_type"]/node()', lambda x: document_type_mapping.get(single_result(x).lower(), None)),
'otherProperties': build_properties(
('eissn', '//str[@name="eissn"]/node()'),
('articleType', '//str[@name="article_type"]/node()'),
('score', '//float[@name="score"]/node()')
)
}

document_type_mapping = {
'research article': 'article',
'correction': 'correction',
}
1 change: 1 addition & 0 deletions scrapi/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
FRONTEND_KEYS = [
"uris",
"contributors",
"documentType",
"providerUpdatedDateTime",
"description",
"title",
Expand Down
1 change: 1 addition & 0 deletions scrapi/settings/local-dist.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
RAW_PROCESSING = ['postgres']
NORMALIZED_PROCESSING = ['elasticsearch', 'postgres']
RESPONSE_PROCESSOR = 'postgres'
CANONICAL_PROCESSOR = 'postgres'