SELECT event_id,disease,lat,lon,locality,country,region,location,observation_date,report_date,display_date,lower(animal_type) as animal_type,lower(animal_species) as animal_species,lower(species) as species,diagnosis_status,humans_affected,humans_deaths,diagnosis_source
FROM `fao-empres-re.empres_hih_views.vw_diseases`
where (case when observation_date is null then report_date else observation_date end >= @start_date and case when observation_date is null then report_date else observation_date end <= @end_date)
  and diagnosis_status= 'Confirmed' 
  and disease = 'Rift Valley fever'     
  and country in ( "United Republic of Tanzania", "Uganda", "Kenya", "Burundi", "Rwanda", "South Sudan", "Sudan" , "Mozambique", "Ethiopia",  "Somalia")
  and ( @animal_species = "all" or ifnull(`fao-maps-review.fao_bq_utils.f_normalize_col_name`(animal_species),'no_value') = @animal_species)
  and ( @animal_type = "all" or ifnull(`fao-maps-review.fao_bq_utils.f_normalize_col_name`(animal_type),'no_value') = @animal_type)
