datasource

package
v1.0.6-ti4health Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

Package pkg/datasource

This package exposes the i2b2 data source conforming to the TI Note data source plugin interface. It implements the different operations of the i2b2 data source.

Documentation

Index

Constants

View Source
const (
	// DataSourceType is the type of the data source.
	DataSourceType sdk.DataSourceType = "i2b2"

	// DBCredentialsID is the ID for the database credentials.
	DBCredentialsID string = "dbCredentials"
	// I2B2CredentialsID is the ID for the i2b2 credentials.
	I2B2CredentialsID string = "i2b2Credentials"
)

Variables

This section is empty.

Functions

func NewI2b2DataSource

func NewI2b2DataSource(dsc *sdk.DataSourceCore, config map[string]interface{}, manager *sdk.DBManager) (plugin sdk.DataSource, err error)

NewI2b2DataSource creates an i2b2 data source. It implements sdk.DataSourceFactory.

Types

type I2b2DataSource

type I2b2DataSource struct {
	sdk.DataSourceCore
	// contains filtered or unexported fields
}

I2b2DataSource is an i2b2 data source for the TI Note. It implements the data source interface.

func (*I2b2DataSource) AddCohort

func (ds *I2b2DataSource) AddCohort(userID string, params *models.AddDeleteCohortParameters) error

AddCohort adds a cohort.

func (*I2b2DataSource) AddCohortHandler

func (ds *I2b2DataSource) AddCohortHandler(userID string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (_ []byte, _ []gecosdk.DataObject, err error)

AddCohortHandler is the OperationHandler for the addCohort Operation.

func (*I2b2DataSource) Close

func (ds *I2b2DataSource) Close() (err error)

Close closes the i2b2 datasource

func (*I2b2DataSource) Config

func (ds *I2b2DataSource) Config(logger logrus.FieldLogger, config map[string]interface{}) (err error)

Config configures the datasource. Configuration keys: - I2b2: i2b2.api.url, i2b2.api.domain, i2b2.api.project, i2b2.api.wait-time, i2b2.api.ont-max-elements - Database: db.host, db.port, db.db-name, db.schema-name

func (*I2b2DataSource) ConfigFromDB

func (ds *I2b2DataSource) ConfigFromDB(logger logrus.FieldLogger) (err error)

ConfigFromDB configures the data source retrieved from the DB.

func (*I2b2DataSource) Data

func (ds *I2b2DataSource) Data() map[string]interface{}

Data returns all the data to be stored in the TI Note object storage.

func (*I2b2DataSource) DeleteCohort

func (ds *I2b2DataSource) DeleteCohort(userID string, params *models.AddDeleteCohortParameters) error

DeleteCohort deletes a cohort.

func (*I2b2DataSource) DeleteCohortHandler

func (ds *I2b2DataSource) DeleteCohortHandler(userID string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (_ []byte, _ []gecosdk.DataObject, err error)

DeleteCohortHandler is the OperationHandler for the deleteCohort Operation.

func (*I2b2DataSource) ExploreQuery

func (ds *I2b2DataSource) ExploreQuery(userID string, params *models.ExploreQueryParameters) (patientSetID string, patientCount int64, err error)

ExploreQuery makes an explore query, i.e. an i2b2 CRC (PSM) query.

func (*I2b2DataSource) ExploreQueryHandler

func (ds *I2b2DataSource) ExploreQueryHandler(userID string, jsonParameters []byte, outputDataObjectsSharedIDs map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, outputDataObjects []gecosdk.DataObject, err error)

ExploreQueryHandler is the OperationHandler for the OperationExploreQuery Operation.

func (*I2b2DataSource) GetCohorts

func (ds *I2b2DataSource) GetCohorts(userID string, params *models.GetCohortsParameters) (results *models.CohortResults, err error)

GetCohorts retrieves the list of cohorts of the user.

func (*I2b2DataSource) GetCohortsHandler

func (ds *I2b2DataSource) GetCohortsHandler(userID string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, _ []gecosdk.DataObject, err error)

GetCohortsHandler is the OperationHandler for the getCohorts Operation.

func (*I2b2DataSource) GetContext

func (ds *I2b2DataSource) GetContext() *context.Context

GetContext return of context of the data source

func (*I2b2DataSource) GetDataSourceConfig

func (ds *I2b2DataSource) GetDataSourceConfig() map[string]interface{}

GetDataSourceConfig gets the data source config.

func (*I2b2DataSource) GetDataSourceCustomData

func (ds *I2b2DataSource) GetDataSourceCustomData() map[string]interface{}

GetDataSourceCustomData returns a map of the data values stored along this data source

func (*I2b2DataSource) Query

func (ds *I2b2DataSource) Query(userID string, params map[string]interface{}, resultKeys ...string) (map[string]interface{}, error)

Query implements the data source interface Query function.

func (*I2b2DataSource) SearchConcept

func (ds *I2b2DataSource) SearchConcept(params *models.SearchConceptParameters) (*models.SearchResult, error)

SearchConcept retrieves the info about or the children of the concept identified by the params.

func (*I2b2DataSource) SearchConceptHandler

func (ds *I2b2DataSource) SearchConceptHandler(_ string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, _ []gecosdk.DataObject, err error)

SearchConceptHandler is the OperationHandler for the OperationSearchConcept Operation.

func (*I2b2DataSource) SearchModifier

func (ds *I2b2DataSource) SearchModifier(params *models.SearchModifierParameters) (*models.SearchResult, error)

SearchModifier retrieves the info about or the children of the modifier identified by params.

func (*I2b2DataSource) SearchModifierHandler

func (ds *I2b2DataSource) SearchModifierHandler(_ string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, _ []gecosdk.DataObject, err error)

SearchModifierHandler is the OperationHandler for the OperationSearchModifier Operation.

func (*I2b2DataSource) SearchOntology

func (ds *I2b2DataSource) SearchOntology(params *models.SearchOntologyParameters) (*models.SearchResult, error)

SearchOntology retrieves the info about the concepts and modifiers identified by params.

func (*I2b2DataSource) SearchOntologyHandler

func (ds *I2b2DataSource) SearchOntologyHandler(_ string, jsonParameters []byte, _ map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, _ []gecosdk.DataObject, err error)

SearchOntologyHandler is the OperationHandler for the OperationSearchOntology Operation.

func (*I2b2DataSource) SetContext

func (ds *I2b2DataSource) SetContext(ctx *context.Context)

SetContext sets a context of the data source

func (*I2b2DataSource) SetDataSourceConfig

func (ds *I2b2DataSource) SetDataSourceConfig(config map[string]interface{}) error

SetDataSourceConfig sets the data source config.

func (*I2b2DataSource) StatisticsQuery

func (ds *I2b2DataSource) StatisticsQuery(userID string, params *models.StatisticsQueryParameters) (statResults []*models.StatsResult, err error)

StatisticsQuery makes a statistics query.

func (*I2b2DataSource) StatisticsQueryHandler

func (ds *I2b2DataSource) StatisticsQueryHandler(
	userID string,
	jsonParameters []byte,
	outputDataObjectsSharedIDs map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID,
) (jsonResults []byte, outputDataObjects []gecosdk.DataObject, err error)

StatisticsQueryHandler is the OperationHandler for the OperationStatisticsQuery Operation.

func (*I2b2DataSource) StatisticsQueryThroughPDOQuery

func (ds *I2b2DataSource) StatisticsQueryThroughPDOQuery(userID string, params *models.StatisticsQueryParameters) (statResults []*i2b2clientmodels.StatsResult, err error)

StatisticsQueryThroughPDOQuery makes a statistics query retrieves the observation through an i2b2 PDO query. It works (it should be better tested though) but it is not used at the moment because it takes much longer than the version that access the database directly.

func (*I2b2DataSource) SurvivalQuery

func (ds *I2b2DataSource) SurvivalQuery(userID string, params *models.SurvivalQueryParameters) (survivalQueryResult []int64, err error)

SurvivalQuery makes a survival query. The returned @survivalQuery result is a slice containing the sorted and flattened EventGroups.

func (*I2b2DataSource) SurvivalQueryHandler

func (ds *I2b2DataSource) SurvivalQueryHandler(userID string, jsonParameters []byte, outputDataObjectsSharedIDs map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID) (jsonResults []byte, outputDataObjects []gecosdk.DataObject, err error)

SurvivalQueryHandler is the OperationHandler for the OperationSurvivalQuery Operation.

type Operation

type Operation string

Operation is an operation of the data source supported by I2b2DataSource.Query.

const (
	OperationSearchConcept   Operation = "searchConcept"
	OperationSearchModifier  Operation = "searchModifier"
	OperationSearchOntology  Operation = "searchOntology"
	OperationExploreQuery    Operation = "exploreQuery"
	OperationGetCohorts      Operation = "getCohorts"
	OperationAddCohort       Operation = "addCohort"
	OperationDeleteCohort    Operation = "deleteCohort"
	OperationSurvivalQuery   Operation = "survivalQuery"
	OperationStatisticsQuery Operation = "statisticsQuery"
)

Enumerated values for Operation.

type OperationHandler

type OperationHandler func(
	userID string, jsonParameters []byte, outputDataObjectsSharedIDs map[gecosdk.OutputDataObjectName]gecomodels.DataObjectSharedID,
) (
	jsonResults []byte, outputDataObjects []gecosdk.DataObject, err error,
)

OperationHandler is a handler function for an operation of the data source supported by I2b2DataSource.Query.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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