Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UGA Open Research Data Monitor backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Elias Chetouane
UGA Open Research Data Monitor backend
Commits
e2e466d5
Commit
e2e466d5
authored
10 months ago
by
Elias Chetouane
Browse files
Options
Downloads
Patches
Plain Diff
Version fonctionelle avec les colonnes "dois_traveled" et "all_relations"
parent
e4cd98ec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
1-enrich-with-datacite/concatenate-enrich-dois.py
+6
-6
6 additions, 6 deletions
1-enrich-with-datacite/concatenate-enrich-dois.py
1-enrich-with-datacite/z_personal_functions.py
+9
-5
9 additions, 5 deletions
1-enrich-with-datacite/z_personal_functions.py
with
15 additions
and
11 deletions
1-enrich-with-datacite/concatenate-enrich-dois.py
+
6
−
6
View file @
e2e466d5
...
@@ -56,17 +56,17 @@ for doi in dois : #[:300]
...
@@ -56,17 +56,17 @@ for doi in dois : #[:300]
## if new datasets has been founded
## if new datasets has been founded
if
temp_rows
:
if
temp_rows
:
df_fresh
=
pd
.
DataFrame
(
temp_rows
)
df_fresh
=
pd
.
DataFrame
(
temp_rows
)
i_to_drop
=
[]
dois_added
=
list
(
df_old
[
"
doi
"
])
dois_added
=
list
(
df_old
[
"
doi
"
])
to_del
=
[]
to_del
=
[]
for
i
in
range
(
0
,
len
(
df_fresh
)):
for
i
in
range
(
0
,
len
(
df_fresh
)):
result
=
my_functions
.
get_origin_version
(
df_fresh
.
loc
[
df_fresh
.
index
[
i
]
,
"
doi
"
])
result
=
my_functions
.
get_origin_version
(
df_fresh
.
loc
[
i
,
"
doi
"
])
if
result
[
0
]
not
in
dois_added
:
if
result
[
0
]
not
in
dois_added
:
dois_added
.
append
(
result
[
0
])
dois_added
.
append
(
result
[
0
])
df_fresh
.
loc
[
df_fresh
.
index
[
i
],
"
doi
"
]
=
result
[
0
]
df_fresh
.
loc
[
i
,
"
doi
"
]
=
result
[
0
]
df_fresh
.
loc
[
df_fresh
.
index
[
i
],
"
relation_nbInstances
"
]
=
result
[
1
]
df_fresh
.
loc
[
i
,
"
relation_nbInstances
"
]
=
result
[
1
]
df_fresh
.
loc
[
df_fresh
.
index
[
i
],
"
relation_nbCitation
"
]
=
result
[
2
]
df_fresh
.
loc
[
i
,
"
relation_nbCitation
"
]
=
result
[
2
]
df_fresh
.
loc
[
df_fresh
.
index
[
i
],
"
relations_all
"
]
=
str
(
result
[
3
])
if
str
(
result
[
3
])
!=
"
[]
"
:
df_fresh
.
loc
[
i
,
"
traveled_dois
"
]
=
str
(
result
[
3
])
if
str
(
result
[
4
])
!=
"
[]
"
:
df_fresh
.
loc
[
i
,
"
all_relations
"
]
=
str
(
result
[
4
])
else
:
else
:
to_del
.
append
(
i
)
to_del
.
append
(
i
)
...
...
This diff is collapsed.
Click to expand it.
1-enrich-with-datacite/z_personal_functions.py
+
9
−
5
View file @
e2e466d5
import
requests
,
json
import
requests
,
json
def
get_origin_version
(
doi
,
count
=
0
,
cited
=
0
,
history
=
[]):
def
get_origin_version
(
doi
,
count
=
0
,
cited
=
0
,
history
=
[],
first
=
True
):
if
first
:
history
=
[]
# ligne ajoutée pour éviter certains soucis de cache où history n'est pas vide au premier appel de la fonction
cited
=
0
cited
=
0
req
=
requests
.
get
(
f
"
https://api.datacite.org/dois/
{
doi
}
"
)
req
=
requests
.
get
(
f
"
https://api.datacite.org/dois/
{
doi
}
"
)
res
=
req
.
json
()
res
=
req
.
json
()
result
=
(
doi
,
count
,
cited
,
history
)
final
=
[]
result
=
(
doi
,
count
,
cited
,
history
,
final
)
try
:
try
:
related
=
res
[
"
data
"
][
"
attributes
"
][
"
relatedIdentifiers
"
]
related
=
res
[
"
data
"
][
"
attributes
"
][
"
relatedIdentifiers
"
]
except
:
except
:
...
@@ -13,17 +15,19 @@ def get_origin_version(doi, count=0, cited=0, history=[]):
...
@@ -13,17 +15,19 @@ def get_origin_version(doi, count=0, cited=0, history=[]):
ignore
=
False
ignore
=
False
duplicate
=
False
duplicate
=
False
for
i
in
related
:
for
i
in
related
:
history
.
append
(
[
i
.
get
(
"
relationType
"
)
,
i
.
get
(
"
relatedIdentifier
"
)]
)
final
.
append
(
i
.
get
(
"
relationType
"
))
if
i
.
get
(
"
relationType
"
)
==
"
IsVersionOf
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
if
i
.
get
(
"
relationType
"
)
==
"
IsVersionOf
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
ignore
=
True
ignore
=
True
elem_to_save_i
=
i
.
get
(
"
relatedIdentifier
"
)
elem_to_save_i
=
i
.
get
(
"
relatedIdentifier
"
)
history
.
append
([
i
.
get
(
"
relationType
"
),
i
.
get
(
"
relatedIdentifier
"
)])
if
i
.
get
(
"
relationType
"
)
==
"
isCitedBy
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
cited
+=
1
if
i
.
get
(
"
relationType
"
)
==
"
isCitedBy
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
cited
+=
1
if
i
.
get
(
"
relationType
"
)
==
"
IsIdenticalTo
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
if
i
.
get
(
"
relationType
"
)
==
"
IsIdenticalTo
"
and
i
.
get
(
"
relatedIdentifierType
"
)
==
"
DOI
"
:
duplicate
=
True
duplicate
=
True
elem_to_save_d
=
i
.
get
(
"
relatedIdentifier
"
)
elem_to_save_d
=
i
.
get
(
"
relatedIdentifier
"
)
history
.
append
([
i
.
get
(
"
relationType
"
),
i
.
get
(
"
relatedIdentifier
"
)])
if
duplicate
and
not
(
ignore
):
if
duplicate
and
not
(
ignore
):
result
=
(
elem_to_save_d
,
count
,
cited
,
history
)
result
=
(
elem_to_save_d
,
count
,
cited
,
history
,
final
)
if
ignore
:
result
=
get_origin_version
(
elem_to_save_i
,
count
+
1
,
cited
,
history
)
if
ignore
:
result
=
get_origin_version
(
elem_to_save_i
,
count
+
1
,
cited
,
history
,
False
)
return
result
return
result
def
get_md_from_datacite
(
doi
)
:
def
get_md_from_datacite
(
doi
)
:
...
...
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