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
c4213512
Commit
c4213512
authored
3 years ago
by
JOUNEAU Thomas
Browse files
Options
Downloads
Patches
Plain Diff
Replace generate_citation.py
parent
cff32d87
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
generate_citation.py
+16
-2
16 additions, 2 deletions
generate_citation.py
with
16 additions
and
2 deletions
generate_citation.py
+
16
−
2
View file @
c4213512
...
...
@@ -10,6 +10,13 @@ print ("# d'un export JSON Dataverse
print
(
"
# ===========================================================================#
"
)
print
(
"
\n
"
)
# Génération de citations selon le modèle décrit sur le site de Dataverse :
# https://dataverse.org/best-practices/data-citation
# !!!!!!!!!!
# TODO
# - proposer différents styles de citations
# - accepter le nom de fichier comme argument en ligne de commande
# -----------------------
# Imports et déclarations
...
...
@@ -20,12 +27,15 @@ import os
from
pyDataverse.api
import
NativeApi
,
DataAccessApi
from
pyDataverse.models
import
Dataverse
# -------------------------------------
# Fonction de génération de la citation
# -------------------------------------
def
citation_generation
(
cit_authors
,
cit_title
,
cit_year
,
cit_data_repository
,
cit_version_number
,
cit_version_minor_number
,
cit_doi
,
cit_unf
):
cit_authors_len
=
len
(
cit_authors
)
cit_authors_len_test
=
cit_authors_len
for
cit_author
in
cit_authors
:
if
cit_authors_len_test
==
cit_authors_len
:
if
cit_authors_len_test
==
cit_authors_len
:
# le nom du premier auteur est suivi d'un point-virgule, les autres d'une simple virgule
print
(
f
"
{
cit_author
}
;
"
,
end
=
''
)
else
:
print
(
f
"
{
cit_author
}
,
"
,
end
=
''
)
...
...
@@ -41,8 +51,10 @@ def citation_generation(cit_authors,cit_title,cit_year,cit_data_repository,cit_v
print
(
"
.
\n
"
)
# ----------------
# Fichier d'entrée
# ----------------
filename_input
=
input
(
"
Entrez le nom du fichier à traiter [export_json.json] :
"
)
if
filename_input
==
""
:
filename
=
"
export_json.json
"
...
...
@@ -110,6 +122,8 @@ for doi,metadata in complete_list.items(): #
if
typeName
==
'
dateofDeposit
'
:
dateofDeposit
=
field
[
'
value
'
]
# Appel de la fonction
citation_generation
(
cit_authors
=
authors_list
,
cit_title
=
title
,
cit_year
=
dataset_yearofPublication
,
cit_data_repository
=
dataset_publisher
,
cit_version_number
=
dataset_versionNumber
,
cit_version_minor_number
=
dataset_versionMinorNumber
,
cit_doi
=
doi
,
cit_unf
=
dataset_unf
)
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