13 Commits
1.1.3 ... 1.1.5

Author SHA1 Message Date
Mario de Frutos
cbe7b6dd15 Merge pull request #225 from CartoDB/develop
Release 1.1.5
2016-11-29 17:58:08 +01:00
Mario de Frutos
603d26c674 Version 1.1.5 artifacts 2016-11-29 17:43:28 +01:00
Mario de Frutos
355f6281e5 Merge pull request #224 from CartoDB/release-v-1.1.5
Release v 1.1.5
2016-11-29 17:40:53 +01:00
John Krauss
70f4807139 update NEWS 2016-11-29 16:45:10 +00:00
john krauss
84794124fd Merge pull request #223 from CartoDB/fix-getmeasure-exc-out-of-bounds
return NULL when there is no data for a measure at a geometry according to raster
2016-11-29 11:35:19 -05:00
John Krauss
6c08681446 return NULL when there is no data for a measure at a geometry according to our raster. Fixes #220 2016-11-29 16:41:44 +00:00
Mario de Frutos
e5e0b39595 Merge pull request #219 from CartoDB/develop
Release 1.1.4
2016-11-22 11:11:17 +01:00
Mario de Frutos
713aacf535 Version 1.1.4 artifact 2016-11-22 10:03:22 +01:00
Mario de Frutos
9bf4b07be7 Merge pull request #218 from CartoDB/release-v-1.1.4
Release v 1.1.4
2016-11-22 10:01:35 +01:00
John Krauss
aaf580baca update NEWS 2016-11-21 22:32:14 +00:00
john krauss
6845d4361d Merge pull request #217 from CartoDB/fix-legacy-metadata-dupes
Fix legacy metadata dupes
2016-11-21 16:59:05 -05:00
John Krauss
fa778f4eb0 test for #216 2016-11-21 22:03:31 +00:00
John Krauss
22a413102b Fixes bug where multiple subsections returned from OBS_LegacyBuilderMetadata, #216 2016-11-21 21:50:56 +00:00
11 changed files with 5290 additions and 40 deletions

14
NEWS.md
View File

@@ -1,3 +1,17 @@
1.1.5 (2016-11-29)
__Bugfixes__
* Return `NULL` instead of raising an exception when a measure is requested for
a geometry where it does not exist ([#220](https://github.com/CartoDB/observatory-extension/issues/220)).
1.1.4 (2016-11-21)
__Bugfixes__
* Fix duplicate subsections with only a partial set of measures appearing from
`OBS_GetLegacyMetadata` ([#216](https://github.com/CartoDB/observatory-extension/issues/216)).
1.1.3 (2016-11-15)
* Temporarily ignore EU data for the sake of testing

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
comment = 'CartoDB Observatory backend extension'
default_version = '1.1.3'
default_version = '1.1.5'
requires = 'postgis, postgres_fdw'
superuser = true
schema = cdb_observatory

View File

@@ -1,5 +1,5 @@
comment = 'CartoDB Observatory backend extension'
default_version = '1.1.3'
default_version = '1.1.5'
requires = 'postgis, postgres_fdw'
superuser = true
schema = cdb_observatory

View File

@@ -410,7 +410,12 @@ BEGIN
ELSE geom
END;
raise notice 'Using boundary %', geom_id;
IF geom_id IS NULL THEN
RAISE NOTICE 'No boundary found for geom';
RETURN NULL;
ELSE
RAISE NOTICE 'Using boundary %', geom_id;
END IF;
IF normalize ILIKE 'area' AND numer_aggregate ILIKE 'sum' THEN
map_type := 'areaNormalized';

View File

@@ -374,41 +374,39 @@ BEGIN
END IF;
RETURN QUERY
EXECUTE format($string$
WITH expanded_subsections AS (
SELECT numer_id,
numer_name,
numer_tags,
jsonb_each_text(numer_tags) as subsection_tag_id_name
FROM cdb_observatory.OBS_GetAvailableNumerators()
WHERE numer_weight > 0 %s
), expanded_sections AS (
SELECT JSONB_Agg(JSONB_Build_Object(
'f1', JSONB_Build_Object('id', numer_id, 'name', numer_name))) columns,
SUBSTR((subsection_tag_id_name).key, 12) subsection_id,
(subsection_tag_id_name).value subsection_name,
jsonb_each_text(numer_tags) as section_tag_id_name
FROM expanded_subsections
WHERE (subsection_tag_id_name).key LIKE 'subsection/%%'
GROUP BY (subsection_tag_id_name).key, (subsection_tag_id_name).value,
numer_tags
), full_expansion AS (
SELECT columns, subsection_id, subsection_name,
SUBSTR((section_tag_id_name).key, 9) section_id,
(section_tag_id_name).value section_name
FROM expanded_sections
WHERE (section_tag_id_name).key LIKE 'section/%%'
)
SELECT section_name AS name, JSONB_Agg(
JSONB_Build_Object(
'f1', JSONB_Build_Object(
'name', subsection_name,
'id', subsection_id,
'columns', columns
WITH expanded AS (
SELECT JSONB_Build_Object('id', numer_id, 'name', numer_name) "column",
SUBSTR((sections).key, 9) section_id, (sections).value section_name,
SUBSTR((subsections).key, 12) subsection_id, (subsections).value subsection_name
FROM (
SELECT numer_id, numer_name,
jsonb_each_text(numer_tags) as sections,
jsonb_each_text as subsections
FROM (SELECT numer_id, numer_name, numer_tags,
jsonb_each_text(numer_tags)
FROM cdb_observatory.obs_getavailablenumerators()
WHERE numer_weight > 0 %s
) foo
) bar
WHERE (sections).key LIKE 'section/%%'
AND (subsections).key LIKE 'subsection/%%'
), grouped_by_subsections AS (
SELECT JSONB_Agg(JSONB_Build_Object('f1', "column")) AS columns,
section_id, section_name, subsection_id, subsection_name
FROM expanded
GROUP BY section_id, section_name, subsection_id, subsection_name
)
)
) as subsection
FROM full_expansion
GROUP BY section_name
SELECT section_name as name, JSONB_Agg(
JSONB_Build_Object(
'f1', JSONB_Build_Object(
'name', subsection_name,
'id', subsection_id,
'columns', columns
)
)
) as subsection
FROM grouped_by_subsections
GROUP BY section_name
$string$, aggregate_condition);
RETURN;
END

View File

@@ -66,7 +66,10 @@ t
obs_getmeasure_bad_geometry
t
(1 row)
obs_getmeasure_null
obs_getmeasure_null_geometry
t
(1 row)
obs_getmeasure_out_of_bounds_geometry
t
(1 row)
obs_getcategory_point

View File

@@ -198,3 +198,6 @@ t
_median_income_not_in_legacy_builder_metadata_sums
t
(1 row)
_no_dupe_subsections_in_legacy_builder_metadata
t
(1 row)

View File

@@ -203,10 +203,15 @@ SELECT abs(cdb_observatory.OBS_GetMeasure(
cdb_observatory._ProblemTestArea(),
'us.census.acs.B01003001') - 96230.2929825897) / 96230.2929825897 < 0.001 As OBS_GetMeasure_bad_geometry;
-- OBS_GetMeasure with NULL Input
-- OBS_GetMeasure with NULL Input geometry
SELECT cdb_observatory.OBS_GetMeasure(
NULL,
'us.census.acs.B01003001') IS NULL As OBS_GetMeasure_null;
'us.census.acs.B01003001') IS NULL As OBS_GetMeasure_null_geometry;
-- OBS_GetMeasure where there is no data
SELECT cdb_observatory.OBS_GetMeasure(
ST_SetSRID(st_point(0, 0), 4326),
'us.census.acs.B01003001') IS NULL As OBS_GetMeasure_out_of_bounds_geometry;
-- Point-based OBS_GetCategory
SELECT cdb_observatory.OBS_GetCategory(

View File

@@ -494,3 +494,12 @@ SELECT 'us.census.acs.B19013001' NOT IN (SELECT
(jsonb_array_elements(((jsonb_array_elements(subsection))->'f1')->'columns')->'f1')->>'id' AS id
FROM cdb_observatory.OBS_LegacyBuilderMetadata('sum')
) AS _median_income_not_in_legacy_builder_metadata_sums;
SELECT COUNT(*) = 0 _no_dupe_subsections_in_legacy_builder_metadata FROM (
SELECT name, subsection, count(*) FROM
(SELECT name, ((JSONB_Array_Elements(subsection))->'f1')->>'id' subsection
FROM cdb_observatory.obs_legacybuildermetadata()) foo
GROUP BY name, subsection
HAVING count(*) > 1
) bar;