labkey.domain.create: Create a new LabKey domain

View source: R/labkey.domain.R

labkey.domain.createR Documentation

Create a new LabKey domain

Description

Create a domain of the type specified by the domainKind and the domainDesign. A LabKey domain represents a table in a specific schema.

Usage

labkey.domain.create(baseUrl=NULL, folderPath,
    domainKind=NULL, domainDesign=NULL, options=NULL,
    module=NULL, domainGroup=NULL, domainTemplate=NULL,
    createDomain=TRUE, importData=TRUE)

Arguments

baseUrl

a string specifying the baseUrl for the labkey server

folderPath

a string specifying the folderPath

domainKind

(optional) a string specifying the type of domain to create

domainDesign

(optional) a list containing the domain design to create

options

(optional) a list containing options specific to the domain kind

module

(optional) the name of the module that contains the domain template group

domainGroup

(optional) the name of a domain template group

domainTemplate

(optional) the name of a domain template within the domain group

createDomain

(optional) when using a domain template, create the domain. Defaults to TRUE

importData

(optional) when using a domain template, import initial data asociated in the template. Defaults to TRUE

Details

When creating a domain using a domainKind parameter, the domainDesign parameter will be required. If a domain template is being used, then module, domainGroup, and domainTemplate are required.

Will create a domain of the specified domain type, valid types are

  • "IntList": A list with an integer key field

  • "VarList": A list with a string key field

  • "StudyDatasetVisit": A dataset in a visit based study

  • "StudyDatasetDate": A dataset in a date based study

  • "IssueDefinition": An issue list domain

  • "SampleSet": Sample set

  • "DataClass": Data class

The domain design parameter describes the set of fields in the domain, see labkey.domain.createDesign for the helper function that can be used to construct this data structure. The options parameter should contain a list of attributes that are specific to the domain kind specified. The list of valid options for each domain kind are:

  • IntList and VarList

    • keyName (required) : The name of the field in the domain design which identifies the key field

  • StudyDatasetVisit and StudyDatasetDate

    • datasetId : Specifies a dataset ID to use, the default is to auto generate an ID

    • categoryId : Specifies an existing category ID

    • categoryName : Specifies an existing category name

    • demographics : (TRUE | FALSE) Determines whether the dataset is created as demographic

    • keyPropertyName : The name of an additional key field to be used in conjunction with participantId and (visitId or date) to create unique records

    • useTimeKeyField : (TRUE | FALSE) Specifies to use the time portion of the date field as an additional key

    • isManagedField : (TRUE | FALSE) Specifies whether the field from keyPropertyName should be managed by LabKey.

  • IssueDefinition

    • providerName : The type of issue list to create (IssueDefinition (default) or AssayRequestDefinition)

    • singularNoun : The singular name to use for items in the issue definition (defaults to issue)

    • pluralNoun : The plural name (defaults to issues)

  • SampleSet

    • idCols : The columns to use when constructing the concatenated unique ID. Can be up to 3 numeric IDs which represent the zero-based position of the fields in the domain.

    • parentCol : The column to represent the parent identifier in the sample set. This is a numeric value representing the zero-based position of the field in the domain.

    • nameExpression : The name expression to use for creating unique IDs

  • DataClass

    • sampleSet : The ID of the sample set if this data class is associated with a sample set.

    • nameExpression : The name expression to use for creating unique IDs

Value

A list containing elements describing the newly created domain.

Author(s)

Karl Lum

See Also

labkey.domain.get, labkey.domain.inferFields, labkey.domain.createDesign, labkey.domain.createIndices, labkey.domain.save, labkey.domain.drop, labkey.domain.createConditionalFormat, labkey.domain.createConditionalFormatQueryFilter, labkey.domain.FILTER_TYPES

Examples

## Not run: 

## create a data frame and infer it's fields, then create a domain design from it
library(Rlabkey)

df <- data.frame(ptid=c(1:3), age = c(10,20,30), sex = c("f", "m", "f"))
fields <- labkey.domain.inferFields(baseUrl="http://labkey/", folderPath="home", df=df)
dd <- labkey.domain.createDesign(name="test list", fields=fields)

## create a new list with an integer key field
labkey.domain.create(baseUrl="http://labkey/", folderPath="home",
    domainKind="IntList", domainDesign=dd, options=list(keyName = "ptid"))

## create a domain using a domain template
labkey.domain.create(baseUrl="http://labkey/", folderPath="home",
    domainTemplate="Priority", module="simpletest", domainGroup="todolist")

## End(Not run)

Rlabkey documentation built on Oct. 23, 2024, 5:06 p.m.