datasource

package
v0.2.1-ti4health Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

README

Package pkg/datasource

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataSourceType sdk.DataSourceType = "i2b2-geco"

DataSourceType is the type of the data source.

Functions

func NewI2b2DataSource

func NewI2b2DataSource(id sdkmodels.DataSourceID, owner, name string, manager *sdk.DBManager) (plugin sdk.DataSource, err error)

NewI2b2DataSource creates an i2b2 data source. Implements sdk.DataSourceFactory.

Types

type I2b2DataSource

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

I2b2DataSource is an i2b2 data source for GeCo. 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.username, i2b2.api.password, i2b2.api.project, i2b2.api.wait-time, i2b2.api.ont-max-elements - Database: db.host, db.port, db.db-name, db.schema-name, db.user, db.password

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 a map of the data values stored along this data source

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 int64, patientCount int64, patientList []int64, err error)

ExploreQuery makes an explore query, i.e. two i2b2 CRC queries, a PSM and a PDO 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) FromModel

func (ds *I2b2DataSource) FromModel(model *sdk.DataSourceModel)

FromModel sets the fields of the local data source given a model.

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) GetData

func (ds *I2b2DataSource) GetData(query string) ([]string, [][]float64)

GetData returns the csv data stored in the data source.

func (*I2b2DataSource) LoadData

func (ds *I2b2DataSource) LoadData(_ []string, _ interface{}) error

LoadData loads a csv into the local data source, saving it in the datamanager and updating the data source.

func (*I2b2DataSource) Query

func (ds *I2b2DataSource) Query(userID string, operation string, jsonParameters []byte, outputDataObjectsSharedIDs map[sdk.OutputDataObjectName]sdkmodels.DataObjectSharedID) (jsonResults []byte, outputDataObjects []sdk.DataObject, err 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) 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) 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