// Query - Fetch all diceases for the given ITamalouQuery
Fetch all diceases for the given ITamalouQuery
// Query - Fetch all diceases for the given ITamalouQuery
func Query(query Queries.ITamalouQuery) ([]*Models.Disease, error) {
	switch query.Type() {
	case "or":
	case "and":
		var results []*Models.Disease
		for _, child := range query.Children() {
			subResults, err := Query(child)
			if err != nil {
				return nil, err
			}
			if len(results) > 0 {
				results = Models.Merge(results, subResults, string(query.Type()))
			} else {
				results = subResults
			}
		}
		return results, nil
	case "symptom":
		return getDiseaseByClinicalSign(query.Value().(string))
	default:
		return nil, fmt.Errorf("Error while querying Orpha:\n	==> Error in query format: %v", query)
	}
	return nil, nil
}
func Query ( query Queries . ITamalouQuery ) ( [ ] * Models . Disease , error ) { switch query . Type ( ) { case " " : case " " : var results [ ] * Models . Disease for _ , child := range query . Children ( ) { subResults , err := Query ( child ) if err != nil { return nil , err } if len ( results ) > 0 { results = Models . Merge ( results , subResults , string ( query . Type ( ) ) ) } else { results = subResults } } return results , nil case " " : return getDiseaseByClinicalSign ( query . Value ( ) . ( string ) ) default : return nil , fmt . Errorf ( " \n " , query ) } return nil , nil }
Fetch all diceases for the given ITamalouQuery
Fetch all diceases for the given ITamalouQuery
// Make a Query for all children of the AND node // Merge the results in order to only have the diseases shared by all clinicalSigns // Merge if necessary // Make a request to couchDB when the query's type is a symptom