   q            Text;
   segment_name Text;
 BEGIN
+IF boundary_id IS NULL THEN
+ boundary_id = 'us.census.tiger.census_tract';
+END IF;
 target_cols := Array[
           'us.census.acs.B01001001_quantile',
           'us.census.acs.B01001002_quantile',


CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetSegmentSnapshot(
  geom geometry,
  geometry_level text DEFAULT 'us.census.tiger.census_tract'
)
RETURNS JSON 
AS $$

  data_table_info json[];
BEGIN

  IF time_span IS NULL THEN
    time_span = '2009 - 2013';
  END IF;

  IF boundary_id IS NULL THEN
    boundary_id = 'us.census.tiger.block_group';
  END IF;

  geom_table_name := cdb_observatory._OBS_GeomTable(geom, boundary_id);

  IF geom_table_name IS NULL
  THEN
