-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from bcbi/dev
data parameter accepts file handles
- Loading branch information
Showing
25 changed files
with
246 additions
and
1,117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,24 @@ | ||
export delete_arms, | ||
export_arms, | ||
import_arms | ||
|
||
function delete_arms(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
arms=nothing, | ||
) | ||
|
||
function delete_arms(; url=get_url(), token=get_token(), arms=nothing,) | ||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
content=REDCap_content(:arm), | ||
action=REDCap_action(:import), | ||
arms=arms, | ||
kwargs = (;token=REDCap_token(token), content=:arm, action=:import, arms,), | ||
) | ||
end | ||
|
||
function export_arms(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
format::redcap_format_input=nothing, | ||
returnFormat::redcap_returnFormat_input=nothing, | ||
arms=nothing, | ||
) | ||
|
||
function export_arms(; url=get_url(), token=get_token(), format=nothing, returnFormat=nothing, arms=nothing,) | ||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
content=REDCap_content(:arm), | ||
format=REDCap_format(format), | ||
arms=arms, | ||
returnFormat=REDCap_format(returnFormat), | ||
kwargs = (; token=REDCap_token(token), content=:arm, format=REDCap_format(format), arms, returnFormat=REDCap_format(returnFormat),), | ||
) | ||
end | ||
|
||
#All examples use JSON | ||
#TODO: what is the proper format for multi-item XML? I can't find this anywhere... | ||
function import_arms(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
format::redcap_format_input=nothing, | ||
data::redcap_data_input=nothing, #TODO: is this required, given the action parameter? | ||
returnFormat::redcap_returnFormat_input=nothing, | ||
override=0, | ||
) | ||
|
||
# #TODO: is this ata paratamet required, given the action parameter? | ||
function import_arms(; url=get_url(), token=get_token(), format=nothing, data=nothing, returnFormat=nothing, override=0,) | ||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
content=REDCap_content(:arm), | ||
override=override, | ||
action=REDCap_action(:import), | ||
format=REDCap_format(format), | ||
data=REDCap_data(data,REDCap_format(format),xml_tag="arms"), | ||
returnFormat=REDCap_format(returnFormat), | ||
kwargs = (; token=REDCap_token(token), content=:arm, override, action=:import, format=REDCap_format(format), returnFormat=REDCap_format(returnFormat),), | ||
) | ||
end | ||
|
||
#= | ||
julia> arms = export_arms() | ||
POSTing | ||
POSTd | ||
1-element Array{Any,1}: | ||
Dict{String,Any}(Pair{String,Any}("name", "Arm 1"),Pair{String,Any}("arm_num", 1)) | ||
julia> newarm | ||
Dict{String,Any} with 2 entries: | ||
"name" => "Arm 1" | ||
"arm_num" => 1 | ||
julia> push!(arms, newarm) | ||
2-element Array{Any,1}: | ||
Dict{String,Any}(Pair{String,Any}("name", "Arm 1"),Pair{String,Any}("arm_num", "1")) | ||
Dict{String,Any}(Pair{String,Any}("name", "Arm 2"),Pair{String,Any}("arm_num", "2")) | ||
julia> import_arms(arms) | ||
POSTing | ||
POSTd | ||
2 <- this should indicate 2 arms added. | ||
julia> export_arms() | ||
POSTing | ||
POSTd | ||
1-element Array{Any,1}: | ||
Dict{String,Any}(Pair{String,Any}("name", "Arm 1"),Pair{String,Any}("arm_num", 1)) | ||
=# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,25 @@ | ||
export delete_events, | ||
import_events, | ||
export_events | ||
|
||
function delete_events(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
events=nothing, | ||
) | ||
|
||
function delete_events(; url=get_url(), token=get_token(), events=nothing,) | ||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
content=REDCap_content(:event), | ||
action=REDCap_action(:import), | ||
events=events, | ||
kwargs = (; token=REDCap_token(token), content=:event, action=:import, events,), | ||
) | ||
end | ||
|
||
function export_events(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
format::redcap_format_input=nothing, | ||
returnFormat::redcap_returnFormat_input=nothing, | ||
arms=nothing, | ||
) | ||
function export_events(; url=get_url(), token=get_token(), format=nothing, returnFormat=nothing, arms=nothing,) | ||
|
||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
format=REDCap_format(format), | ||
returnFormat=REDCap_format(returnFormat), | ||
content=REDCap_content(:event), | ||
arms=arms, | ||
kwargs = (; token=REDCap_token(token), format=REDCap_format(format), returnFormat=REDCap_format(returnFormat), content=:event, arms,), | ||
) | ||
end | ||
|
||
function import_events(; | ||
url::redcap_url_input=get_url(), | ||
token::redcap_token_input=get_token(), | ||
format::redcap_format_input=nothing, | ||
returnFormat::redcap_returnFormat_input=nothing, | ||
data=nothing, #TODO: required? | ||
override=0, | ||
) | ||
#TODO: data parameter required? | ||
function import_events(; url=get_url(), token=get_token(), format=nothing, returnFormat=nothing, data=nothing, override=0,) | ||
|
||
REDCap.request(; | ||
url=REDCap_url(url), | ||
token=REDCap_token(token), | ||
format=REDCap_format(format), | ||
returnFormat=REDCap_format(returnFormat), | ||
content=REDCap_content(:event), | ||
action=REDCap_action(:import), | ||
override=override, | ||
data=REDCap_data(data,REDCap_format(format),xml_tag="events"), | ||
kwargs = (; token=REDCap_token(token), format=REDCap_format(format), returnFormat=REDCap_format(returnFormat), content=:event, action=:import, override,), | ||
) | ||
end | ||
|
Oops, something went wrong.