cdl

package
v0.85.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package cdl provides support for interacting with HSDP Clinical Data Lake services

Index

Constants

View Source
const (
	ROLE_STUDYMANAGER     = "STUDYMANAGER"
	ROLE_MONITOR          = "MONITOR"
	ROLE_UPLOADER         = "UPLOADER"
	ROLE_DATA_SCIENTIST   = "DATASCIENTIST"
	ROLE_RESEARCH_MANAGER = "RESEARCHMANAGER"
)
View Source
const (
	APIVersion = "3"
)

Variables

View Source
var (
	ErrCDLURLCannotBeEmpty = errors.New("base CDL URL cannot be empty")
	ErrEmptyResult         = errors.New("empty result")
)

Errors

Functions

This section is empty.

Types

type BundleEntry added in v0.42.1

type BundleEntry struct {
	FullURL  string          `json:"fullUrl,omitempty"`
	Resource LabelDefinition `json:"resource,omitempty"`
}

type Client

type Client struct {

	// User agent used when communicating with the HSDP Notification API
	UserAgent string

	Study              *StudyService
	DataTypeDefinition *DatatypeDefinitionService
	LabelDefinition    *LabelDefinitionService
	ExportRoute        *ExportRouteService
	// contains filtered or unexported fields
}

A Client manages communication with HSDP CDL API

func NewClient

func NewClient(iamClient *iam.Client, config *Config) (*Client, error)

NewClient returns a new HSDP CDL API client. A configured IAM client must be provided as the underlying API requires an IAM token

func (*Client) Close

func (c *Client) Close()

Close releases allocated resources of clients

func (*Client) GetCDLStoreURL

func (c *Client) GetCDLStoreURL() string

GetCDLStoreURL returns the base CDL Store base URL as configured

func (*Client) GetCDLURL

func (c *Client) GetCDLURL() string

GetCDLURL returns the base CDL Store base URL as configured

func (*Client) GetEndpointURL

func (c *Client) GetEndpointURL() string

GetEndpointURL returns the CDL Store URL including the tenant ID

func (*Client) SetCDLStoreURL

func (c *Client) SetCDLStoreURL(urlStr string) error

SetCDLStoreURL sets the CDL store URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

func (*Client) SetCDLURL

func (c *Client) SetCDLURL(urlStr string) error

SetCDLURL sets the Notification URL for API requests

func (*Client) SetEndpointURL

func (c *Client) SetEndpointURL(urlStr string) error

SetEndpointURL sets the CDL endpoint URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

func (*Client) TokenRefresh

func (c *Client) TokenRefresh() error

TokenRefresh forces a refresh of the IAM access token

type Config

type Config struct {
	Region         string
	Environment    string
	OrganizationID string `validate:"required"`
	CDLURL         string
	CDLStore       string
	DebugLog       io.Writer
	Retry          int
}

Config contains the configuration of a client

type DataTypeDefinition added in v0.41.2

type DataTypeDefinition struct {
	ID          string          `json:"id,omitempty"`
	Name        string          `json:"name,omitempty"`
	Description string          `json:"description,omitempty"`
	JsonSchema  json.RawMessage `json:"jsonSchema,omitempty"`
	CreatedOn   string          `json:"createdOn,omitempty"`
	CreatedBy   string          `json:"createdBy,omitempty"`
	UpdatedOn   string          `json:"updatedOn,omitempty"`
	UpdatedBy   string          `json:"updatedBy,omitempty"`
}

type DatatypeDefinitionService added in v0.41.2

type DatatypeDefinitionService struct {
	// contains filtered or unexported fields
}

func (*DatatypeDefinitionService) CreateDataTypeDefinition added in v0.41.2

func (dtd *DatatypeDefinitionService) CreateDataTypeDefinition(dataTypeDefinition DataTypeDefinition) (*DataTypeDefinition, *Response, error)

func (*DatatypeDefinitionService) GetDataTypeDefinitionByID added in v0.41.2

func (dtd *DatatypeDefinitionService) GetDataTypeDefinitionByID(id string) (*DataTypeDefinition, *Response, error)

func (*DatatypeDefinitionService) GetDataTypeDefinitions added in v0.41.2

func (dtd *DatatypeDefinitionService) GetDataTypeDefinitions(opt *GetOptions, options ...OptionFunc) ([]DataTypeDefinition, *Response, error)

func (*DatatypeDefinitionService) UpdateDataTypeDefinition added in v0.41.2

func (dtd *DatatypeDefinitionService) UpdateDataTypeDefinition(dataTypeDefinition DataTypeDefinition) (*DataTypeDefinition, *Response, error)

type Destination added in v0.42.3

type Destination struct {
	CDLResearchStudy ExportResearchStudyDestination `json:"cdlResearchStudy" validate:"required"`
}

type ExportAllowedField added in v0.42.3

type ExportAllowedField struct {
	DataObject []ExportDataObject `json:"dataObject,omitempty"`
}

type ExportDataObject added in v0.42.3

type ExportDataObject struct {
	Type        string        `json:"type"`
	ExportLabel []ExportLabel `json:"label,omitempty"`
}

type ExportLabel added in v0.42.3

type ExportLabel struct {
	Name             string `json:"name,omitempty"`
	ApprovalRequired bool   `json:"approvalRequired,omitempty"`
}

type ExportResearchStudyDestination added in v0.42.3

type ExportResearchStudyDestination struct {
	Endpoint string `json:"endpoint" validate:"required"`
}

type ExportResearchStudySource added in v0.42.3

type ExportResearchStudySource struct {
	Endpoint string              `json:"endpoint" validate:"required"`
	Allowed  *ExportAllowedField `json:"allowed,omitempty"`
}

type ExportRoute added in v0.42.3

type ExportRoute struct {
	ID              string               `json:"id,omitempty"`
	ExportRouteName string               `json:"name" validate:"required"`
	Description     string               `json:"description,omitempty"`
	DisplayName     string               `json:"displayName" validate:"required"`
	Source          Source               `json:"source" validate:"required"`
	AutoExport      bool                 `json:"autoExport,omitempty"`
	Destination     Destination          `json:"destination" validate:"required"`
	ServiceAccount  ExportServiceAccount `json:"serviceAccount" validate:"required"`
	CreatedBy       string               `json:"createdBy,omitempty"`
	CreatedOn       string               `json:"createdOn,omitempty"`
	UpdatedBy       string               `json:"updatedBy,omitempty"`
	UpdatedOn       string               `json:"updatedOn,omitempty"`
}

type ExportRouteBundleEntry added in v0.42.3

type ExportRouteBundleEntry struct {
	FullURL  string      `json:"fullUrl,omitempty"`
	Resource ExportRoute `json:"resource,omitempty"`
}

type ExportRouteBundleResponse added in v0.42.3

type ExportRouteBundleResponse struct {
	ResourceType string                   `json:"resourceType,omitempty"`
	ID           string                   `json:"id,omitempty"`
	Type         string                   `json:"type,omitempty"`
	Link         []LinkElementType        `json:"link,omitempty"`
	Entry        []ExportRouteBundleEntry `json:"entry" validate:"required"`
}

type ExportRouteService added in v0.42.3

type ExportRouteService struct {
	// contains filtered or unexported fields
}

func (*ExportRouteService) CreateExportRoute added in v0.42.3

func (exp *ExportRouteService) CreateExportRoute(exportRoute ExportRoute) (*ExportRoute, *Response, error)

func (*ExportRouteService) DeleteExportRouteByID added in v0.42.3

func (exp *ExportRouteService) DeleteExportRouteByID(exportRouteId string) (*Response, error)

func (*ExportRouteService) GetExportRouteByID added in v0.42.3

func (exp *ExportRouteService) GetExportRouteByID(exportRouteId string) (*ExportRoute, *Response, error)

func (*ExportRouteService) GetExportRoutes added in v0.42.3

func (exp *ExportRouteService) GetExportRoutes(page int, options ...OptionFunc) ([]ExportRoute, *ExportRouteBundleResponse, *Response, error)

type ExportServiceAccount added in v0.42.3

type ExportServiceAccount struct {
	CDLServiceAccount ExportServiceAccountDetails `json:"cdlServiceAccount" validate:"required"`
}

type ExportServiceAccountDetails added in v0.42.3

type ExportServiceAccountDetails struct {
	ServiceID           string `json:"serviceId" validate:"required"`
	PrivateKey          string `json:"privateKey" validate:"required"`
	AccessTokenEndPoint string `json:"accessTokenEndPoint" validate:"required"`
	TokenEndPoint       string `json:"tokenEndPoint" validate:"required"`
}

type GetOptions

type GetOptions struct {
	Page *int `url:"page,omitempty"`
}

GetOptions describes the fields on which you can search for studies

type LabelDefBundleResponse added in v0.42.1

type LabelDefBundleResponse struct {
	ResourceType string          `json:"resourceType,omitempty"`
	Id           string          `json:"id,omitempty"`
	Type         string          `json:"type,omitempty"`
	Link         json.RawMessage `json:"link,omitempty"`
	Entry        []BundleEntry   `json:"entry" validate:"required"`
}

type LabelDefinition added in v0.42.1

type LabelDefinition struct {
	ID           string            `json:"id,omitempty"`
	LabelDefName string            `json:"labelDefName" validate:"labelDefValidationHandler"`
	Description  string            `json:"description,omitempty"`
	LabelScope   LabelScope        `json:"labelScope" validate:"labelDefValidationHandler"`
	Label        string            `json:"label" validate:"required"`
	Type         string            `json:"type" validate:"required"`
	Labels       []LabelsArrayElem `json:"labels" validate:"labelDefValidationHandler"`
	CreatedBy    string            `json:"createdBy,omitempty"`
	CreatedOn    string            `json:"createdOn,omitempty"`
}

type LabelDefinitionService added in v0.42.1

type LabelDefinitionService struct {
	// contains filtered or unexported fields
}

func (*LabelDefinitionService) CreateLabelDefinition added in v0.42.1

func (l *LabelDefinitionService) CreateLabelDefinition(studyId string, labelDef LabelDefinition) (*LabelDefinition, *Response, error)

func (*LabelDefinitionService) DeleteLabelDefinitionById added in v0.42.3

func (l *LabelDefinitionService) DeleteLabelDefinitionById(studyId string, labelDefId string) (*Response, error)

func (*LabelDefinitionService) GetLabelDefinitionByID added in v0.42.1

func (l *LabelDefinitionService) GetLabelDefinitionByID(studyId string, labelDefId string) (*LabelDefinition, *Response, error)

func (*LabelDefinitionService) GetLabelDefinitions added in v0.42.1

func (l *LabelDefinitionService) GetLabelDefinitions(studyId string, opt *GetOptions, options ...OptionFunc) ([]LabelDefinition, *Response, error)

type LabelScope added in v0.42.1

type LabelScope struct {
	Type string `json:"type" validate:"required"`
}

type LabelsArrayElem added in v0.42.1

type LabelsArrayElem struct {
	Label string `json:"label" validate:"required"`
}

type LinkElementType added in v0.42.3

type LinkElementType struct {
	Relation string `json:"relation"`
	URL      string `json:"url"`
}

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

type Period

type Period struct {
	End string `json:"end"`
}

type Response

type Response struct {
	*http.Response
	Link []LinkElementType
}

Response is a HSDP IAM API response. This wraps the standard http.Response returned from HSDP IAM and provides convenient access to things like errors

func (*Response) StatusCode added in v0.73.0

func (r *Response) StatusCode() int

type RoleAssignment added in v0.41.1

type RoleAssignment struct {
	IAMUserUUID string `json:"IAMuserUUID"`
	Roles       []struct {
		Role string `json:"role"`
	} `json:"roles"`
}

type RoleAssignmentResult added in v0.41.1

type RoleAssignmentResult []RoleAssignment

func (RoleAssignmentResult) Roles added in v0.41.1

func (r RoleAssignmentResult) Roles(userUUID string) []string

type RoleRequest added in v0.41.1

type RoleRequest struct {
	IAMUserUUID string `json:"IAMuserUUID" validate:"required"`
	Email       string `json:"email" validate:"required"`
	Role        string `json:"role" validate:"required"`
	InstituteID string `json:"instituteID"`
}

func (RoleRequest) Equal added in v0.41.1

func (r RoleRequest) Equal(other RoleRequest) bool

Equal compares role requests

func (RoleRequest) EqualEnough added in v0.41.1

func (r RoleRequest) EqualEnough(other RoleRequest) bool

EqualEnough returns true if user and role match up

type Source added in v0.42.3

type Source struct {
	CDLResearchStudy ExportResearchStudySource `json:"cdlResearchStudy" validate:"required"`
}

type Study

type Study struct {
	ID                        string `json:"id,omitempty"`
	Title                     string `json:"title" validate:"required"`
	Description               string `json:"description,omitempty"`
	Organization              string `json:"organization,omitempty"`
	StudyOwner                string `json:"studyOwner" validate:"required"`
	Period                    Period `json:"period" validate:"required"`
	DataProtectedFromDeletion bool   `json:"dataProtectedFromDeletion,omitempty"`
}

type StudyService

type StudyService struct {
	// contains filtered or unexported fields
}

func (*StudyService) CreateStudy

func (s *StudyService) CreateStudy(study Study) (*Study, *Response, error)

func (*StudyService) GetAllStudies added in v0.46.1

func (s *StudyService) GetAllStudies(options ...OptionFunc) ([]Study, *Response, error)

func (*StudyService) GetPermissions added in v0.41.1

func (s *StudyService) GetPermissions(study Study, opt *GetOptions, options ...OptionFunc) (RoleAssignmentResult, *Response, error)

func (*StudyService) GetStudies

func (s *StudyService) GetStudies(opt *GetOptions, options ...OptionFunc) ([]Study, *Response, error)

func (*StudyService) GetStudyByID

func (s *StudyService) GetStudyByID(id string) (*Study, *Response, error)

func (*StudyService) GetStudyByTitle added in v0.46.1

func (s *StudyService) GetStudyByTitle(title string, options ...OptionFunc) (*Study, *Response, error)

func (*StudyService) GrantPermission added in v0.41.1

func (s *StudyService) GrantPermission(study Study, request RoleRequest, options ...OptionFunc) (bool, *Response, error)

func (*StudyService) RevokePermission added in v0.41.1

func (s *StudyService) RevokePermission(study Study, request RoleRequest, options ...OptionFunc) (bool, *Response, error)

func (*StudyService) UpdateStudy

func (s *StudyService) UpdateStudy(study Study) (*Study, *Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL