use obs_meta for tests

This commit is contained in:
John Krauss 2016-07-14 09:11:02 -04:00
parent 10a0dc9b26
commit 25f4dbc416

View File

@ -24,17 +24,18 @@ def query(q, is_meta=False, **options):
params['api_key'] = META_API_KEY if is_meta else API_KEY params['api_key'] = META_API_KEY if is_meta else API_KEY
return requests.get(url, params=params) return requests.get(url, params=params)
MEASURE_COLUMNS = [(r['id'], r['point_only'], ) for r in query(''' MEASURE_COLUMNS = [(r['numer_id'], r['point_only'], ) for r in query('''
SELECT id, aggregate NOT ILIKE 'sum' as point_only SELECT distinct numer_id, numer_aggregate NOT ILIKE 'sum' as point_only
FROM obs_column FROM obs_meta
WHERE type ILIKE 'numeric' WHERE numer_type ILIKE 'numeric'
AND weight > 0 AND numer_weight > 0
''', is_meta=True).json()['rows']] ''', is_meta=True).json()['rows']]
CATEGORY_COLUMNS = [(r['id'], ) for r in query(''' CATEGORY_COLUMNS = [(r['numer_id'], ) for r in query('''
SELECT id FROM obs_column SELECT distinct numer_id
WHERE type ILIKE 'text' FROM obs_meta
AND weight > 0 WHERE numer_type ILIKE 'text'
AND numer_weight > 0
''', is_meta=True).json()['rows']] ''', is_meta=True).json()['rows']]
BOUNDARY_COLUMNS = [(r['id'], ) for r in query(''' BOUNDARY_COLUMNS = [(r['id'], ) for r in query('''
@ -43,12 +44,12 @@ WHERE type ILIKE 'geometry'
AND weight > 0 AND weight > 0
''', is_meta=True).json()['rows']] ''', is_meta=True).json()['rows']]
US_CENSUS_MEASURE_COLUMNS = [(r['name'], ) for r in query(''' US_CENSUS_MEASURE_COLUMNS = [(r['numer_name'], ) for r in query('''
SELECT c.name FROM obs_column c, obs_column_tag ct SELECT distinct numer_name
WHERE type ILIKE 'numeric' FROM obs_meta
AND c.id = ct.column_id WHERE numer_type ILIKE 'numeric'
AND ct.tag_id LIKE 'us.census%' AND 'us.census.acs.acs' = ANY (subsection_tags)
AND weight > 0 AND numer_weight > 0
''', is_meta=True).json()['rows']] ''', is_meta=True).json()['rows']]