@@ -13,7 +13,6 @@ type ConceptI interface {
13
13
RetrieveInfoBySourceIdAndConceptIds (sourceId int , conceptIds []int64 ) ([]* ConceptSimple , error )
14
14
RetrieveInfoBySourceIdAndConceptTypes (sourceId int , conceptTypes []string ) ([]* ConceptSimple , error )
15
15
RetrieveBreakdownStatsBySourceIdAndCohortId (sourceId int , cohortDefinitionId int , breakdownConceptId int64 ) ([]* ConceptBreakdown , error )
16
- RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (sourceId int , cohortDefinitionId int , filterConceptIds []int64 , filterCohortPairs []utils.CustomDichotomousVariableDef , breakdownConceptId int64 ) ([]* ConceptBreakdown , error )
17
16
RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptDefsPlusCohortPairs (sourceId int , cohortDefinitionId int , filterConceptDefsAndCohortPairs []interface {}, breakdownConceptId int64 ) ([]* ConceptBreakdown , error )
18
17
}
19
18
type Concept struct {
@@ -133,50 +132,16 @@ func (h Concept) RetrieveBreakdownStatsBySourceIdAndCohortId(sourceId int, cohor
133
132
return h .RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptDefsPlusCohortPairs (sourceId , cohortDefinitionId , filterConceptDefsAndCohortPairs , breakdownConceptId )
134
133
}
135
134
136
- // DEPRECATED - use RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptDefsPlusCohortPairs instead.
137
135
// Basically same goal as described in function above, but only count persons that have a non-null value for each
138
- // of the ids in the given filterConceptIds . So, using the example documented in the function above, it will
136
+ // of the given filters . So, using the example documented in the function above, it will
139
137
// return something like:
140
138
//
141
139
// {ConceptValue: "A", NPersonsInCohortWithValue: M-X},
142
140
// {ConceptValue: "B", NPersonsInCohortWithValue: N-M-X},
143
141
//
144
- // where X is the number of persons that have NO value or just a "null" value for one or more of the ids in the given filterConceptIds.
145
- func (h Concept ) RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (sourceId int , cohortDefinitionId int , filterConceptIds []int64 , filterCohortPairs []utils.CustomDichotomousVariableDef , breakdownConceptId int64 ) ([]* ConceptBreakdown , error ) {
146
-
147
- var dataSourceModel = new (Source )
148
- omopDataSource := dataSourceModel .GetDataSource (sourceId , Omop )
149
- resultsDataSource := dataSourceModel .GetDataSource (sourceId , Results )
150
-
151
- // count persons, grouping by concept value:
152
- var conceptBreakdownList []* ConceptBreakdown
153
- query := QueryFilterByCohortPairsHelper (filterCohortPairs , resultsDataSource , cohortDefinitionId , "unionAndIntersect" ).
154
- Select ("observation.value_as_concept_id, count(distinct(observation.person_id)) as npersons_in_cohort_with_value" ).
155
- Joins ("INNER JOIN " + omopDataSource .Schema + ".observation_continuous as observation" + omopDataSource .GetViewDirective ()+ " ON unionAndIntersect.subject_id = observation.person_id" ).
156
- Where ("observation.observation_concept_id = ?" , breakdownConceptId ).
157
- Where (GetConceptValueNotNullCheckBasedOnConceptType ("observation" , sourceId , breakdownConceptId ))
158
-
159
- query = QueryFilterByConceptIdsHelper (query , sourceId , filterConceptIds , omopDataSource , resultsDataSource .Schema , "unionAndIntersect.subject_id" )
160
-
161
- query , cancel := utils .AddTimeoutToQuery (query )
162
- defer cancel ()
163
- meta_result := query .Group ("observation.value_as_concept_id" ).
164
- Scan (& conceptBreakdownList )
165
-
166
- // Add concept value (coded value) and concept name for each of the value_as_concept_id values:
167
- for _ , conceptBreakdownItem := range conceptBreakdownList {
168
- conceptInfo , error := h .RetrieveInfoBySourceIdAndConceptId (sourceId , conceptBreakdownItem .ValueAsConceptId )
169
- if error != nil {
170
- return nil , error
171
- }
172
- conceptBreakdownItem .ConceptValue = conceptInfo .ConceptCode
173
- conceptBreakdownItem .ValueName = conceptInfo .ConceptName
174
- }
175
- return conceptBreakdownList , meta_result .Error
176
- }
177
-
178
- // Same as RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs above, but
179
- // applies transformations and filtering, if these items are specified for the given concept definitions.
142
+ // where X is the number of persons that have NO value or just a "null" value for one or more of the concepts in the given filters.
143
+ // Also supports cohort pairs in filters, filtering out persons that don't pass the cohort pair filter (drill down to that method for detais).
144
+ // Furthermore, this method also applies transformations and filtering, if these items are specified for the given concept definitions.
180
145
func (h Concept ) RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptDefsPlusCohortPairs (sourceId int , cohortDefinitionId int , filterConceptDefsAndCohortPairs []interface {}, breakdownConceptId int64 ) ([]* ConceptBreakdown , error ) {
181
146
var dataSourceModel = new (Source )
182
147
omopDataSource := dataSourceModel .GetDataSource (sourceId , Omop )
0 commit comments