-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrlabkey-api-study.xml
More file actions
71 lines (70 loc) · 3.4 KB
/
Copy pathrlabkey-api-study.xml
File metadata and controls
71 lines (70 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<ApiTests xmlns="http://labkey.org/query/xml">
<test name="create a dataset with a invalid category ID" type="post">
<url>
<![CDATA[
library(Rlabkey)
df <- data.frame(customInt=c(1:3), customString=c("aaa", "bbb", "ccc"))
fields <- labkey.domain.inferFields(baseUrl=labkey.url.base, folderPath="%projectName%", df)
dd <- labkey.domain.createDesign(name="test dataset one", fields=fields)
print(labkey.domain.create(baseUrl=labkey.url.base, folderPath="%projectName%", domainKind="StudyDatasetVisit", domainDesign=dd, options=list(categoryId = -1)))
]]>
</url>
<response>
<![CDATA[
HTTP request was unsuccessful. Status code = 500, Error message = Unable to find a category with the ID : -1 in this folder.
]]>
</response>
</test>
<test name="create a dataset with a category ID and category name" type="post">
<url>
<![CDATA[
library(Rlabkey)
df <- data.frame(customInt=c(1:3), customString=c("aaa", "bbb", "ccc"))
fields <- labkey.domain.inferFields(baseUrl=labkey.url.base, folderPath="%projectName%", df)
dd <- labkey.domain.createDesign(name="test dataset one", fields=fields)
print(labkey.domain.create(baseUrl=labkey.url.base, folderPath="%projectName%", domainKind="StudyDatasetVisit", domainDesign=dd, options=list(categoryId = -1, categoryName = "Control Group A")))
]]>
</url>
<response>
<![CDATA[
HTTP request was unsuccessful. Status code = 500, Error message = Category ID and category name cannot both be specified.
]]>
</response>
</test>
<test name="create a dataset with a valid category name" type="post">
<url>
<![CDATA[
library(Rlabkey)
df <- data.frame(customInt=c(1:3), customString=c("aaa", "bbb", "ccc"))
fields <- labkey.domain.inferFields(baseUrl=labkey.url.base, folderPath="%projectName%", df)
dd <- labkey.domain.createDesign(name="test dataset one", fields=fields)
print(labkey.domain.create(baseUrl=labkey.url.base, folderPath="%projectName%", domainKind="StudyDatasetVisit", domainDesign=dd, options=list(categoryName = "Control Group A")))
]]>
</url>
<response>
<![CDATA[
$success
[1] TRUE
$name
[1] "test dataset one"
]]>
</response>
</test>
<test name="create dataset and load data" type="post">
<url>
<![CDATA[
library(Rlabkey)
df <- data.frame(ParticipantID=c(1,1,1), Visit=c(1,2,3), customInt=c(1:3), customString=c("aaa", "bbb", "ccc"))
info <- labkey.domain.createAndLoad(baseUrl=labkey.url.base, folderPath="%projectName%", domainKind="StudyDatasetVisit", df=df, name="test dataset with load data")
print(paste("Create successful = ", info$success, sep=""))
print(paste("Rows via createAndLoad = ", info$rowCount, sep=""))
]]>
</url>
<response>
<![CDATA[
Create successful = TRUE
Rows via createAndLoad = 3
]]>
</response>
</test>
</ApiTests>