Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts pyDataverse
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
JOUNEAU Thomas
scripts pyDataverse
Commits
d13de066
Commit
d13de066
authored
3 years ago
by
JOUNEAU Thomas
Browse files
Options
Downloads
Patches
Plain Diff
Replace get_batch_dataset_metadata_with_subcollections.py
parent
9606cdcd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
get_batch_dataset_metadata_with_subcollections.py
+4
-3
4 additions, 3 deletions
get_batch_dataset_metadata_with_subcollections.py
with
4 additions
and
3 deletions
get_batch_dataset_metadata_with_subcollections.py
+
4
−
3
View file @
d13de066
...
@@ -171,13 +171,14 @@ complete_list = []
...
@@ -171,13 +171,14 @@ complete_list = []
counter
=
len
(
pid_list
)
counter
=
len
(
pid_list
)
for
pid
in
pid_list
:
for
pid
in
pid_list
:
counter
=
counter
-
1
counter
=
counter
-
1
dataset_json
=
api
.
get_dataset
(
identifier
=
f
"
doi:
{
pid
}
"
).
json
()[
"
data
"
][
"
latestVersion
"
][
"
metadataBlocks
"
][
"
citation
"
]
dataset_json
=
api
.
get_dataset
(
identifier
=
f
"
doi:
{
pid
}
"
).
json
()[
"
data
"
]
# export de la référence correspondant à 'pid'
complete_list
.
append
(
dataset_json
)
# ajout de la sortie json pure à une liste
del
(
dataset_json
[
"
latestVersion
"
][
"
files
"
])
# suppression des métadonnées de fichiers
complete_list
.
append
(
dataset_json
)
# ajout de la sortie json à une liste
# Ecriture du fichier si l'utilisateur le souhaite
# Ecriture du fichier si l'utilisateur le souhaite
if
file_wished
==
True
:
if
file_wished
==
True
:
print
(
"
Écriture du fichier JSON en cours...
"
)
print
(
"
Écriture du fichier JSON en cours...
"
)
formatted_dataset_json
=
json
.
dumps
(
dataset_json
,
sort_keys
=
False
,
indent
=
8
)
formatted_dataset_json
=
json
.
dumps
(
dataset_json
,
sort_keys
=
False
,
indent
=
4
)
formatted_dataset_json_string
=
str
(
formatted_dataset_json
)
# Conversion en chaîne de caractères
formatted_dataset_json_string
=
str
(
formatted_dataset_json
)
# Conversion en chaîne de caractères
# formatted_dataset_json_string = f'"doi" : "{pid}" , "citation" : [{formatted_dataset_json_string}] ,'
# formatted_dataset_json_string = f'"doi" : "{pid}" , "citation" : [{formatted_dataset_json_string}] ,'
if
counter
>
0
:
# Si c'est la dernière référence on ne met pas de virgule pour que le fichier JSON soit valide.
if
counter
>
0
:
# Si c'est la dernière référence on ne met pas de virgule pour que le fichier JSON soit valide.
...
...
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