Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Riricdata
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
Container Registry
Model registry
Operate
Environments
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
bioinfo_iric
Riricdata
Commits
7c785cac
Commit
7c785cac
authored
4 years ago
by
LouisGendron
Browse files
Options
Downloads
Patches
Plain Diff
Improved validation of 'annotation' parameter in file_upload function
parent
dcd881e6
No related branches found
No related tags found
1 merge request
!3
Resolve "fetch files annotations when download dataset"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/IRICData-class.R
+14
-4
14 additions, 4 deletions
R/IRICData-class.R
README.md
+1
-1
1 addition, 1 deletion
README.md
with
15 additions
and
5 deletions
R/IRICData-class.R
+
14
−
4
View file @
7c785cac
...
...
@@ -178,6 +178,16 @@ setMethod(
f
=
'file_upload'
,
signature
=
'IRICData'
,
definition
=
function
(
object
,
session
,
file_path
,
annotation
=
''
,
lab
=
''
,
dataset
=
''
){
#Check if annotation can be parsed as JSON
if
(
typeof
(
annotation
)
==
'list'
){
annotation
<-
toJSON
(
annotation
)}
else
if
(
typeof
(
annotation
)
==
'character'
){
validation
=
jsonlite
::
validate
(
annotation
)
if
(
!
(
validation
[[
1
]])){
print
(
paste
(
'Error occured while uploading'
,
file_path
,
': the annotation parameter could not be parsed as JSON'
))
return
(
NULL
)
}
}
file_form
=
list
(
file
=
httr
::
upload_file
(
file_path
),
lab
=
lab
,
annotations
=
annotation
,
dataset
=
dataset
)
...
...
@@ -273,12 +283,12 @@ setMethod(
if
(
is.null
(
metas
[
ix
][[
1
]])){
next
}
else
{
ds_details
<-
rbind
(
ds_details
,
data.table
(
file_name
=
metas
[[
ix
]]
$
filename
,
file_id
=
files_id
[[
ix
]],
hash
=
metas
[[
ix
]]
$
hash
))
ds_details
<-
rbind
(
ds_details
,
data.table
(
file_name
=
metas
[[
ix
]]
$
filename
,
file_id
=
files_id
[[
ix
]],
hash
=
metas
[[
ix
]]
$
hash
))
}
}
return
(
ds_details
)
}
)
This diff is collapsed.
Click to expand it.
README.md
+
1
−
1
View file @
7c785cac
...
...
@@ -36,7 +36,7 @@ DL_file(IData, IData_session, file_id, "directory/output/path")
# To download a file annotations using file db_id or slug_id
DL_file_annotation(IData, IData_session, file_id, "directory/output/path")
# To upload a file
# To upload a file
, annotation as a named list or JSON formated character.
file_upload(IData, IData_session, '/path/to/my/file.txt', annotation, lab, dataset)
# To get file metadata using file db_id or slud_id
...
...
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