Documentation ¶
Index ¶
- Constants
- func AddSpecificTimeoutToQuery(query *gorm.DB, timeout time.Duration) (*gorm.DB, context.CancelFunc)
- func AddTimeoutToQuery(query *gorm.DB) (*gorm.DB, context.CancelFunc)
- func Contains(list []int, value int) bool
- func ContainsNonNil(errors []error) bool
- func ContainsString(list []string, value string) bool
- func FreedmanDiaconis(values []float64) float64
- func GenerateDsn(sourceConnectionString string) string
- func GetBinsAndWidthAndSortValues(values []float64) (int, float64)
- func GetCohortPairKey(firstCohortDefinitionId int, secondCohortDefinitionId int) string
- func GetUniqueCohortDefinitionIdsList(cohortDefinitionIds []int, filterCohortPairs []CustomDichotomousVariableDef) []int
- func IQR(values []float64) float64
- func Intersect(list1 []int, list2 []int) []int
- func MakeUnique(input []int) []int
- func ParseBigNumericArg(c *gin.Context, paramName string) (int64, error)
- func ParseConceptIdsAndDichotomousDefsAsSingleList(c *gin.Context) ([]interface{}, error)
- func ParseInt64(strValue string) int64
- func ParseNumericArg(c *gin.Context, paramName string) (int, error)
- func ParseSourceAndCohortId(c *gin.Context) (int, int, error)
- func ParseSourceIdAndCohortIdAndConceptIds(c *gin.Context) (int, int, []int64, error)
- func ParseSourceIdAndCohortIdAndVariablesAsSingleList(c *gin.Context) (int, int, []interface{}, error)
- func ParseSourceIdAndConceptIds(c *gin.Context) (int, []int64, error)
- func ParseSourceIdAndConceptTypes(c *gin.Context) (int, []string, error)
- func Pos(value int64, list []int64) int
- func SliceAtoi(stringValues []string) ([]int64, error)
- func Subtract(list1 []int, list2 []int) []int
- type ConceptIds
- type ConceptTypes
- type CustomDichotomousVariableDef
- func GetConceptIdsAndCohortPairsAsSeparateLists(conceptIdsAndCohortPairs []interface{}) ([]int64, []CustomDichotomousVariableDef)
- func ParseConceptIdsAndDichotomousDefs(c *gin.Context) ([]int64, []CustomDichotomousVariableDef, error)
- func ParseSourceIdAndCohortIdAndVariablesList(c *gin.Context) (int, int, []int64, []CustomDichotomousVariableDef, error)
- type DbAndSchema
- type HistogramColumn
Constants ¶
const MAX_NUM_BINS = 50
Variables ¶
This section is empty.
Functions ¶
func AddSpecificTimeoutToQuery ¶
func AddSpecificTimeoutToQuery(query *gorm.DB, timeout time.Duration) (*gorm.DB, context.CancelFunc)
Adds a specific timeout to a query
func AddTimeoutToQuery ¶
Adds a default timeout to a query
func ContainsNonNil ¶
func ContainsString ¶
func FreedmanDiaconis ¶
This function returns the bin width upon the Freedman Diaconis formula: https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule Can return 0 if IQR(values) is 0.
func GenerateDsn ¶
func GetBinsAndWidthAndSortValues ¶
Sorts the given values, and returns the number of bins, the width of the bins using FreedmanDiaconis
func GetCohortPairKey ¶
func GetUniqueCohortDefinitionIdsList ¶
func GetUniqueCohortDefinitionIdsList(cohortDefinitionIds []int, filterCohortPairs []CustomDichotomousVariableDef) []int
Utility function to parse out the cohort definition ids from a specific structure in which they can be found (in this case deep inside CustomDichotomousVariableDef items) and concatenate them with another given list of ids, removing duplicate ids (if any).
func MakeUnique ¶
func ParseConceptIdsAndDichotomousDefsAsSingleList ¶
This method expects a request body with a payload similar to the following example: {"variables": [
{variable_type: "concept", concept_id: 2000000324}, {variable_type: "concept", concept_id: 2000006885}, {variable_type: "custom_dichotomous", provided_name: "name1", cohort_ids: [cohortX_id, cohortY_id]}, {variable_type: "custom_dichotomous", provided_name: "name2", cohort_ids: [cohortM_id, cohortN_id]}, ...
]} It returns the list with all concept_id values and custom dichotomous variable definitions.
func ParseInt64 ¶
func ParseSourceIdAndCohortIdAndVariablesAsSingleList ¶
func ParseSourceIdAndCohortIdAndVariablesAsSingleList(c *gin.Context) (int, int, []interface{}, error)
returns sourceid, cohortid, list of variables (formed by concept ids and/or of cohort tuples which are also known as custom dichotomous variables)
Types ¶
type ConceptIds ¶
type ConceptIds struct {
ConceptIds []int64
}
type ConceptTypes ¶
type ConceptTypes struct {
ConceptTypes []string
}
type CustomDichotomousVariableDef ¶
type CustomDichotomousVariableDef struct { CohortDefinitionId1 int CohortDefinitionId2 int ProvidedName string }
fields that define a custom dichotomous variable:
func GetConceptIdsAndCohortPairsAsSeparateLists ¶
func GetConceptIdsAndCohortPairsAsSeparateLists(conceptIdsAndCohortPairs []interface{}) ([]int64, []CustomDichotomousVariableDef)
separates a conceptIdsAndCohortPairs into a conceptIds list and a cohortPairs list
func ParseConceptIdsAndDichotomousDefs ¶
func ParseConceptIdsAndDichotomousDefs(c *gin.Context) ([]int64, []CustomDichotomousVariableDef, error)
deprecated: for backwards compatibility
func ParseSourceIdAndCohortIdAndVariablesList ¶
func ParseSourceIdAndCohortIdAndVariablesList(c *gin.Context) (int, int, []int64, []CustomDichotomousVariableDef, error)
deprecated: returns the conceptIds and cohortPairs as separate lists (for backwards compatibility)
type DbAndSchema ¶
func GetDataSourceDB ¶
func GetDataSourceDB(sourceConnectionString string, dbSchema string) *DbAndSchema
func (DbAndSchema) GetViewDirective ¶
func (h DbAndSchema) GetViewDirective() string
Returns extra DB dialect specific directives to optimize performance when using views:
type HistogramColumn ¶
type HistogramColumn struct { Start float64 `json:"start"` End float64 `json:"end"` NumberOfPeople int `json:"personCount"` }
func GenerateHistogramData ¶
func GenerateHistogramData(conceptValues []float64) []HistogramColumn