SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
6a0a4303
Commit
6a0a4303
authored
6 years ago
by
Boris Ponsioen
Browse files
Options
Downloads
Patches
Plain Diff
Removes error handling in get_crossref_test temporarily
parent
5591e33e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
metacore/services.py
+39
-38
39 additions, 38 deletions
metacore/services.py
with
39 additions
and
38 deletions
metacore/services.py
+
39
−
38
View file @
6a0a4303
...
@@ -22,8 +22,8 @@ def get_crossref_test(cursor='*'):
...
@@ -22,8 +22,8 @@ def get_crossref_test(cursor='*'):
batches
=
2000
batches
=
2000
for
i
in
range
(
0
,
batches
):
for
i
in
range
(
0
,
batches
):
print
(
"
Batch %s
"
%
(
i
,
))
print
(
"
-------------------------------
"
)
print
(
"
-------------------------------
"
)
print
(
"
Batch %s
"
%
(
i
,
))
print
(
cursor
)
print
(
cursor
)
params
=
{
'
cursor
'
:
cursor
,
'
rows
'
:
rows
,
'
mailto
'
:
'
b.g.t.ponsioen@uva.nl
'
}
params
=
{
'
cursor
'
:
cursor
,
'
rows
'
:
rows
,
'
mailto
'
:
'
b.g.t.ponsioen@uva.nl
'
}
...
@@ -74,40 +74,41 @@ def parse_crossref_citable(citable_item):
...
@@ -74,40 +74,41 @@ def parse_crossref_citable(citable_item):
return
return
if
not
Citable
.
objects
(
doi
=
doi
):
if
not
Citable
.
objects
(
doi
=
doi
):
try
:
# try:
# Parse certain fields for storage on top level in document
# Parse certain fields for storage on top level in document
# Blame the convoluted joining and looping on CR
# Blame the convoluted joining and looping on CR
if
'
reference
'
in
citable_item
:
if
'
reference
'
in
citable_item
:
references_with_doi
=
[
ref
for
ref
in
citable_item
[
'
reference
'
]
if
'
DOI
'
in
ref
]
references_with_doi
=
[
ref
for
ref
in
citable_item
[
'
reference
'
]
if
'
DOI
'
in
ref
]
references
=
[
ref
[
'
DOI
'
].
lower
()
for
ref
in
references_with_doi
]
references
=
[
ref
[
'
DOI
'
].
lower
()
for
ref
in
references_with_doi
]
else
:
else
:
references
=
[]
references
=
[]
authors
=
[]
authors
=
[]
for
author_names
in
citable_item
[
'
author
'
]:
for
author_names
in
citable_item
[
'
author
'
]:
author
=
[]
author
=
[]
if
'
given
'
in
author_names
:
if
'
given
'
in
author_names
:
author
.
append
(
author_names
[
'
given
'
])
author
.
append
(
author_names
[
'
given
'
])
if
'
family
'
in
author_names
:
if
'
family
'
in
author_names
:
author
.
append
(
author_names
[
'
family
'
])
author
.
append
(
author_names
[
'
family
'
])
authors
.
append
(
'
'
.
join
(
author
))
authors
.
append
(
'
'
.
join
(
author
))
publisher
=
citable_item
[
'
publisher
'
]
publisher
=
citable_item
[
'
publisher
'
]
title
=
citable_item
[
'
title
'
][
0
]
title
=
citable_item
[
'
title
'
][
0
]
publication_date
=
'
-
'
.
join
([
str
(
date_part
)
for
date_part
in
citable_item
[
'
issued
'
][
'
date-parts
'
][
0
]])
publication_date
=
'
-
'
.
join
([
str
(
date_part
)
for
date_part
in
citable_item
[
'
issued
'
][
'
date-parts
'
][
0
]])
if
'
license
'
in
citable_item
:
if
'
license
'
in
citable_item
:
license
=
citable_item
[
'
license
'
][
0
][
'
URL
'
]
license
=
citable_item
[
'
license
'
][
0
][
'
URL
'
]
else
:
else
:
license
=
''
license
=
''
return
CitableWithDOI
(
doi
=
doi
,
references
=
references
,
authors
=
authors
,
publisher
=
publisher
,
title
=
title
,
return
CitableWithDOI
(
doi
=
doi
,
references
=
references
,
authors
=
authors
,
publisher
=
publisher
,
title
=
title
,
publication_date
=
publication_date
,
license
=
license
,
metadata
=
citable_item
)
publication_date
=
publication_date
,
license
=
license
,
metadata
=
citable_item
)
except
BaseException
as
e
:
# except BaseException as e:
print
(
e
)
# print("Error!")
# raise
# print(e)
except
e
:
# # raise
print
(
"
Error:
"
,
e
)
# except e:
print
(
citable_item
)
# print("Error: ", e)
# print(citable_item)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment