// Job function to retrieve side effects information on matched compounds
Job function to retrieve side effects information on matched compounds
// Job function to retrieve side effects information on matched compounds
func ClinicalSignsFromCompoundId(drugs []*Models.Drug, clinicalSignsSQL string, wg *sync.WaitGroup, treated *int) ([]*Models.Drug, error) {
	defer wg.Done()
	var currentQuery = ""
	for _, drug := range drugs {
		currentQuery = "SELECT DISTINCT(meddra_freq.side_effect_name), meddra_freq.placebo, meddra_freq.frequency_description, meddra_freq.freq_lower_bound, meddra_freq.freq_upper_bound, (CASE " + clinicalSignsSQL
		currentQuery += "ELSE 0 END) as matched FROM meddra_freq WHERE meddra_freq.stitch_compound_id1 = '" + drug.STITCH_ID_SIDER + "'"
		rows, err := db.Query(currentQuery)
		if err != nil {
			return nil, fmt.Errorf("Error while querying sider (meddra): %v", err)
		}
		defer rows.Close()
		for rows.Next() {
			tmpMeddra := new(Models.SideEffect)
			err := rows.Scan(&tmpMeddra.SideEffectName, &tmpMeddra.Placebo, &tmpMeddra.Frequency, &tmpMeddra.FrequencyLowerBound, &tmpMeddra.FrequencyUpperBound, &tmpMeddra.Matched)
			if err != nil {
				return drugs, err
			}
			drug.SideEffects = append(drug.SideEffects, tmpMeddra)
			*treated += 1
		}
	}
	return drugs, nil
}
func ClinicalSignsFromCompoundId ( drugs [ ] * Models . Drug , clinicalSignsSQL string , wg * sync . WaitGroup , treated * int ) ( [ ] * Models . Drug , error ) { defer wg . Done ( ) var currentQuery = " " for _ , drug := range drugs { currentQuery = " " + clinicalSignsSQL currentQuery += " " + drug . STITCH_ID_SIDER + " " rows , err := db . Query ( currentQuery ) if err != nil { return nil , fmt . Errorf ( " " , err ) } defer rows . Close ( ) for rows . Next ( ) { tmpMeddra := new ( Models . SideEffect ) err := rows . Scan ( & tmpMeddra . SideEffectName , & tmpMeddra . Placebo , & tmpMeddra . Frequency , & tmpMeddra . FrequencyLowerBound , & tmpMeddra . FrequencyUpperBound , & tmpMeddra . Matched ) if err != nil { return drugs , err } drug . SideEffects = append ( drug . SideEffects , tmpMeddra ) * treated += 1 } } return drugs , nil }
Job function to retrieve side effects information on matched compounds
Job function to retrieve side effects information on matched compounds
// Start query // Retrieve results