Merge pull request #98 from CartoDB/develop

Version 0.0.4
This commit is contained in:
Mario de Frutos 2016-05-25 15:48:30 +02:00
commit a7785bcae2
9 changed files with 13558 additions and 9613 deletions

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -435,7 +435,7 @@ BEGIN
JOIN observatory.obs_column_tag ct JOIN observatory.obs_column_tag ct
ON c.id = ct.column_id ON c.id = ct.column_id
WHERE cdb_observatory._OBS_StandardizeMeasureName(c.name) = $1 WHERE cdb_observatory._OBS_StandardizeMeasureName(c.name) = $1
AND ct.tag_id = 'us.census.acs.demographics' AND ct.tag_id ILIKE 'us.census%'
$string$ $string$
INTO measure_id INTO measure_id
USING standardized_name; USING standardized_name;

View File

@ -7,64 +7,9 @@ t|t
_obs_searchtables_timespan_does_not_match _obs_searchtables_timespan_does_not_match
t t
(1 row) (1 row)
id|description|name|aggregate|source _obs_searchtotalpop
us.census.acs.B01003001_quantile|The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates.|Quantile:Total Population|quantile| t
es.ine.total_pop|The total number of all people living in a geographic area.|Total Population|sum| (1 row)
us.census.acs.B01003001|The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates.|Total Population|sum| _obs_getavailableboundariesexist
us.census.acs.B19301001|Per capita income is the mean income computed for every man, woman, and child in a particular group. It is derived by dividing the total income of a particular group by the total population.|Per Capita Income in the past 12 Months|average| t
us.census.acs.B01001001_quantile|The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates.|Quantile:Total Population|quantile| (1 row)
(5 rows)
boundary_id|description|time_span|tablename
us.census.tiger.zcta5|ZCTAs are approximate area representations of U.S. Postal Service (USPS) five-digit ZIP Code service areas that the Census Bureau creates using whole blocks to present statistical data from censuses and surveys. The Census Bureau defines ZCTAs by allocating each block that contains addresses to a single ZCTA, usually to the ZCTA that reflects the most frequently occurring ZIP Code for the addresses within that tabulation block. Blocks that do not contain addresses but are completely surrounded by a single ZCTA (enclaves) are assigned to the surrounding ZCTA; those surrounded by multiple ZCTAs will be added to a single ZCTA based on limited buffering performed between multiple ZCTAs. The Census Bureau identifies five-digit ZCTAs using a five-character numeric code that represents the most frequently occurring USPS ZIP Code within that ZCTA, and this code may contain leading zeros.
There are significant changes to the 2010 ZCTA delineation from that used in 2000. Coverage was extended to include the Island Areas for 2010 so that the United States, Puerto Rico, and the Island Areas have ZCTAs. Unlike 2000, when areas that could not be assigned to a ZCTA were given a generic code ending in “XX” (land area) or “HH” (water area), for 2010 there is no universal coverage by ZCTAs, and only legitimate five-digit areas are defined. The 2010 ZCTAs will better represent the actual Zip Code service areas because the Census Bureau initiated a process before creation of 2010 blocks to add block boundaries that split polygons with large numbers of addresses using different Zip Codes.
Data users should not use ZCTAs to identify the official USPS ZIP Code for mail delivery. The USPS makes periodic changes to ZIP Codes to support more efficient mail delivery. The ZCTAs process used primarily residential addresses and was biased towards Zip Codes used for city-style mail delivery, thus there may be Zip Codes that are primarily nonresidential or boxes only that may not have a corresponding ZCTA.|2014|obs_144e8b4f906885b2e057ac4842644a553ae49c6e
whosonfirst.wof_continent_geom|Continents of the world.|2016|obs_9880042f935aab0d0e4b71fb6963d7726e64c534
whosonfirst.wof_country_geom| |2016|obs_1ea93bbc109c87c676b3270789dacf7a1430db6c
whosonfirst.wof_region_geom| |2016|obs_4fca4f060854cc3ae8c109999635a71bbde6964e
whosonfirst.wof_marinearea_geom| |2016|obs_5105018d57c69b8a7e064fc17a9485647b311a99
whosonfirst.wof_disputed_geom| |2016|obs_7dba9374b15fbab0c7bd7dca6dec6c4792fe86a3
us.census.tiger.congressional_district|Congressional districts are the 435 areas from which people are elected to the U.S. House of Representatives. After the apportionment of congressional seats among the states based on decennial census population counts, each state with multiple seats is responsible for establishing congressional districts for the purpose of electing representatives. Each congressional district is to be as equal in population to all other congressional districts in a state as practicable. For the District of Columbia, Puerto Rico, and each Island Area, a separate code is used to identify the entire areas of these state-equivalent entities as having a single nonvoting delegate.|2014|obs_01b608b3a4ca503ad7acc0b1f84817bc1da3e193
us.census.tiger.congressional_district_clipped|A cartography-ready version of US Congressional Districts|2014|obs_9d258128ff4288eb9a6d7e5c0adbef8ef0172a86
us.census.tiger.school_district_unified_clipped|A cartography-ready version of Unified School District|2014|obs_546285f2c636f5380e7bfbb0c0db67863f6ed41d
us.census.tiger.cbsa_clipped|A cartography-ready version of Core Based Statistical Area (CBSA)|2014|obs_3512a78ca8c7e9b5fbd5390c4ed1638b9938fcbf
us.census.tiger.block|Census blocks are statistical areas bounded by visible features, such as streets, roads, streams, and railroad tracks, and by nonvisible boundaries, such as selected property lines and city, township, school district, and county limits and short line-of-sight extensions of streets and roads. Generally, census blocks are small in area; for example, a block in a city bounded on all sides by streets. Census blocks in suburban and rural areas may be large, irregular, and bounded by a variety of features, such as roads, streams, and transmission lines. In remote areas, census blocks may encompass hundreds of square miles. Census blocks cover the entire territory of the United States, Puerto Rico, and the Island Areas. Census blocks nest within all other tabulated census geographic entities and are the basis for all tabulated data.|2014|obs_ffebc3eb689edab4faa757f75ca02c65d7db7327
us.census.tiger.school_district_elementary_clipped|A cartography-ready version of Elementary School District|2014|obs_41d99a86857c05f63320ea44419a68831e74ac3d
us.census.tiger.block_group_clipped|A cartography-ready version of US Census Block Groups|2014|obs_6c1309a64d8f3e6986061f4d1ca7b57743e75e74
us.census.tiger.census_tract_clipped|A cartography-ready version of US Census Tracts|2014|obs_fcd4e4f5610f6764973ef8c0c215b2e80bec8963
us.census.tiger.zcta5_clipped|A cartography-ready version of US Census Zip Code Tabulation Areas|2014|obs_7615e8622a68bfc5fe37c69c9880edfb40250103
us.census.tiger.place|Incorporated places are those reported to the Census Bureau as legally in existence as of January 1, 2010, as reported in the latest Boundary and Annexation Survey (BAS), under the laws of their respective states. An incorporated place is established to provide governmental functions for a concentration of people as opposed to a minor civil division, which generally is created to provide services or administer an area without regard, necessarily, to population. Places always are within a single state or equivalent entity, but may extend across county and county subdivision boundaries. An incorporated place usually is a city, town, village, or borough, but can have other legal descriptions. For Census Bureau data tabulation and presentation purposes, incorporated places exclude:
Boroughs in Alaska (treated as statistical equivalents of counties).
Towns in the New England states, New York, and Wisconsin (treated as MCDs).
Boroughs in New York (treated as MCDs).
Census Designated Places (CDPs) are the statistical counterparts of incorporated places, and are delineated to provide data for settled concentrations of population that are identifiable by name but are not legally incorporated under the laws of the state in which they are located. The boundaries usually are defined in cooperation with local or tribal officials and generally updated prior to each decennial census. These boundaries, which usually coincide with visible features or the boundary of an adjacent incorporated place or another legal entity boundary, have no legal status, nor do these places have officials elected to serve traditional municipal functions. CDP boundaries may change from one decennial census
to the next with changes in the settlement pattern; a CDP with the same name as in an earlier census does not necessarily have the same boundary. CDPs must be contained within a single state and may not extend into an incorporated place. There are no population size requirements for CDPs.
Hawaii is the only state that has no incorporated places recognized by the Census Bureau. All places shown in decennial census data products for Hawaii are CDPs. By agreement with the state of Hawaii, the Census Bureau does not show data separately for the city of Honolulu, which is coextensive with Honolulu County. In Puerto Rico, which also does not have incorporated places, the Census Bureau recognizes only CDPs and refers to them as comunidades or zonas urbanas. Guam also has only CDPs.|2014|obs_76a52df2018de8d064f1a99f93544473927cb7ae
us.census.tiger.place_clipped|A cartography-ready version of Incorporated Places|2014|obs_db91d46d317a4ffcf509efca8e5e3a42d29e0792
us.census.tiger.school_district_secondary_clipped|A cartography-ready version of Secondary School District|2014|obs_63b15ba742ccea136ddb88427cc37fee218702d4
us.census.tiger.cbsa|Core Based Statistical Areas (CBSAs) consist of the county or counties or equivalent entities associated with at least one core (urbanized area or urban cluster) of at least 10,000 population, plus adjacent counties having a high degree of social and economic integration with the core as measured through commuting ties with the counties associated with the core. The general concept of a CBSA is that of a
core area containing a substantial population nucleus, together with adjacent communities having a high degree of economic and social integration with that core. The term “core based statistical area” became effective in 2003 and refers collectively to metropolitan statistical areas and micropolitan statistical areas. The U.S. Office of Management and Budget (OMB) defines CBSAs to provide a nationally consistent set of geographic entities for the United States and Puerto Rico for use in tabulating and presenting statistical data. Current CBSAs are based on application of the 2000 standards (published in the Federal Register of December 27, 2000) with Census 2000 data. The first set of areas defined based on the 2000 standards were announced on June 6, 2003; subsequent updates have been made to the universe of CBSAs and related statistical areas. No CBSAs are defined in the Island Areas. Statistical areas related to CBSAs include metropolitan divisions, combined statistical areas (CSAs), New England city and town areas (NECTAs), NECTA divisions, and combined NECTAs.|2014|obs_c75be9ef45e87c789c3607dd9aeef6094d5e5109
us.census.tiger.puma_clipped|A cartography-ready version of US Census Public Use Microdata Areas|2014|obs_dc244bf520f62e4a09e290a02e55368fd0758f95
us.census.tiger.county|The primary legal divisions of most states are termed counties. In Louisiana, these divisions are known as parishes. In Alaska, which has no counties, the equivalent entities are the organized boroughs, city and boroughs, municipalities, and census areas; the latter of which are delineated cooperatively for statistical purposes by the state of Alaska and the Census Bureau. In four states (Maryland, Missouri, Nevada, and Virginia), there are one or more incorporated places that are independent of any county organization and thus constitute primary divisions of their states. These incorporated places are known as independent cities and are treated as equivalent entities for purposes of data presentation. The District of Columbia and Guam have no primary divisions, and each area is considered an equivalent entity for purposes of data presentation. All of the counties in Connecticut and Rhode Island and nine counties in Massachusetts were dissolved as functioning governmental entities; however, the Census Bureau continues to present data for these historical entities in order to provide comparable geographic units at the county level of the geographic hierarchy for these states and represents them as nonfunctioning legal entities in data products. The Census Bureau treats the following entities as equivalents of counties for purposes of data presentation: municipios in Puerto Rico, districts and islands in American Samoa, municipalities in the Commonwealth of the Northern Mariana Islands, and islands in the U.S. Virgin Islands. Each county or statistically equivalent entity is assigned a three-character numeric Federal Information Processing Series (FIPS) code based on alphabetical sequence that is unique within state and an eight-digit National Standard feature identifier.|2014|obs_1babf5a26a1ecda5fb74963e88408f71d0364b81
us.census.tiger.county_clipped|A cartography-ready version of US County|2014|obs_23cb5063486bd7cf36f17e89e5e65cd31b331f6e
us.census.tiger.school_district_unified|School Districts are geographic entities within which state, county, local officials, the Bureau of Indian Affairs, or the U.S. Department of Defense provide public educational services for the areas residents. The Census Bureau obtains the boundaries, names, local education agency codes, and school district levels for school districts from state and local school officials for the primary purpose of providing the U.S. Department of Education with estimates of the number of children “at risk” within each school district, county, and state. This information serves as the basis for the Department of Education to determine the annual allocation of Title I funding to states and school districts.
The Census Bureau tabulates data for three types of school districts: elementary, secondary, and unified. Each school district is assigned a five-digit code that is unique within state. School district codes are the local education agency number assigned by the Department of Education and are not necessarily in alphabetical order by school district name.
The elementary school districts provide education to the lower grade/age levels and the secondary school districts provide education to the upper grade/age levels. Unified school districts provide education to children of all school ages in their service areas. In general, where there is a unified school district, no elementary or secondary school district exists; and where there is an elementary school district, the secondary school district may or may not exist.
The Census Bureaus representation of school districts in various data products is based both on the grade range that a school district operates and also the grade range for which the school district is financially responsible. For example, a school district is defined as an elementary school district if its operational grade range is less than the full kindergarten through 12 or prekindergarten through 12 grade range (for example, K6 or pre-K8). These elementary school districts do not provide direct educational services for grades 712, 912, or similar ranges. Some elementary school districts are financially responsible for the education of all school-aged children within their service areas and rely on other school districts to provide service for those grade ranges that are not operated by these elementary school districts. In these situations, in order to allocate all school-aged children to these school districts, the secondary school district code field is blank. For elementary school districts where the operational grade range and financially responsible grade range are the same, the secondary school district code field will contain a secondary school district code. There are no situations where an elementary school district does not exist and a secondary school district exists in Census Bureau records.|2014|obs_c948b5b1e4fdaf3302d888d0dc4cc821d8857c96
us.census.tiger.census_tract|Census tracts are small, relatively permanent statistical subdivisions of a county or equivalent entity that are updated by local participants prior to each decennial census as part of the Census Bureaus Participant Statistical Areas Program. The Census Bureau delineates census tracts in situations where no local participant existed or where state, local, or tribal governments declined to participate. The primary purpose of census tracts is to provide a stable set of geographic units for the presentation of statistical data.
Census tracts generally have a population size between 1,200 and 8,000 people, with an optimum size of 4,000 people. A census tract usually covers a contiguous area; however, the spatial size of census tracts varies widely depending on the density of settlement. Census tract boundaries are delineated with the intention of being maintained over a long time so that statistical comparisons can be made from census to census. Census tracts occasionally are split due to population growth or merged as a result of substantial population decline.
Census tract boundaries generally follow visible and identifiable features. They may follow nonvisible legal boundaries, such as minor civil division (MCD) or incorporated place boundaries in some states and situations, to allow for census-tract-to-governmental-unit relationships where the governmental boundaries tend to remain unchanged between censuses. State and county boundaries always are census tract boundaries in the standard census geographic hierarchy. Tribal census tracts are a unique geographic entity defined within federally recognized American Indian reservations and off-reservation trust lands and can cross state and county boundaries. Tribal census tracts may be completely different from the census tracts and block groups defined by state and county (see “Tribal Census Tract”).|2014|obs_fc050f0b8673cfe3c6aa1040f749eb40975691b7
us.census.tiger.school_district_elementary|School Districts are geographic entities within which state, county, local officials, the Bureau of Indian Affairs, or the U.S. Department of Defense provide public educational services for the areas residents. The Census Bureau obtains the boundaries, names, local education agency codes, and school district levels for school districts from state and local school officials for the primary purpose of providing the U.S. Department of Education with estimates of the number of children “at risk” within each school district, county, and state. This information serves as the basis for the Department of Education to determine the annual allocation of Title I funding to states and school districts.
The Census Bureau tabulates data for three types of school districts: elementary, secondary, and unified. Each school district is assigned a five-digit code that is unique within state. School district codes are the local education agency number assigned by the Department of Education and are not necessarily in alphabetical order by school district name.
The elementary school districts provide education to the lower grade/age levels and the secondary school districts provide education to the upper grade/age levels. Unified school districts provide education to children of all school ages in their service areas. In general, where there is a unified school district, no elementary or secondary school district exists; and where there is an elementary school district, the secondary school district may or may not exist.
The Census Bureaus representation of school districts in various data products is based both on the grade range that a school district operates and also the grade range for which the school district is financially responsible. For example, a school district is defined as an elementary school district if its operational grade range is less than the full kindergarten through 12 or prekindergarten through 12 grade range (for example, K6 or pre-K8). These elementary school districts do not provide direct educational services for grades 712, 912, or similar ranges. Some elementary school districts are financially responsible for the education of all school-aged children within their service areas and rely on other school districts to provide service for those grade ranges that are not operated by these elementary school districts. In these situations, in order to allocate all school-aged children to these school districts, the secondary school district code field is blank. For elementary school districts where the operational grade range and financially responsible grade range are the same, the secondary school district code field will contain a secondary school district code. There are no situations where an elementary school district does not exist and a secondary school district exists in Census Bureau records.|2014|obs_62ba00831d7f65309d6d663e2a99a688d336539a
us.census.tiger.school_district_secondary|School Districts are geographic entities within which state, county, local officials, the Bureau of Indian Affairs, or the U.S. Department of Defense provide public educational services for the areas residents. The Census Bureau obtains the boundaries, names, local education agency codes, and school district levels for school districts from state and local school officials for the primary purpose of providing the U.S. Department of Education with estimates of the number of children “at risk” within each school district, county, and state. This information serves as the basis for the Department of Education to determine the annual allocation of Title I funding to states and school districts.
The Census Bureau tabulates data for three types of school districts: elementary, secondary, and unified. Each school district is assigned a five-digit code that is unique within state. School district codes are the local education agency number assigned by the Department of Education and are not necessarily in alphabetical order by school district name.
The elementary school districts provide education to the lower grade/age levels and the secondary school districts provide education to the upper grade/age levels. Unified school districts provide education to children of all school ages in their service areas. In general, where there is a unified school district, no elementary or secondary school district exists; and where there is an elementary school district, the secondary school district may or may not exist.
The Census Bureaus representation of school districts in various data products is based both on the grade range that a school district operates and also the grade range for which the school district is financially responsible. For example, a school district is defined as an elementary school district if its operational grade range is less than the full kindergarten through 12 or prekindergarten through 12 grade range (for example, K6 or pre-K8). These elementary school districts do not provide direct educational services for grades 712, 912, or similar ranges. Some elementary school districts are financially responsible for the education of all school-aged children within their service areas and rely on other school districts to provide service for those grade ranges that are not operated by these elementary school districts. In these situations, in order to allocate all school-aged children to these school districts, the secondary school district code field is blank. For elementary school districts where the operational grade range and financially responsible grade range are the same, the secondary school district code field will contain a secondary school district code. There are no situations where an elementary school district does not exist and a secondary school district exists in Census Bureau records.|2014|obs_7b120df094ad943984b820d83ced7392af3a551a
us.census.tiger.block_group|Block groups (BGs) are statistical divisions of census tracts, are generally defined to contain between 600 and 3,000 people, and are used to present data and control block numbering. A block group consists of clusters of blocks within the same census tract that have the same first digit of their four-digit census block number. For example, blocks 3001, 3002, 3003, ..., 3999 in census tract 1210.02 belong to BG 3 in that census tract. Most BGs were delineated by local participants in the Census Bureaus Participant Statistical Areas Program. The Census Bureau delineated BGs only where a local or tribal government declined to participate, and a regional organization or State Data Center was not available to participate.
A BG usually covers a contiguous area. Each census tract contains at least one BG, and BGs are uniquely numbered within the census tract. Within the standard census geographic hierarchy, BGs never cross state, county, or census tract boundaries but may cross the boundaries of any other geographic entity. Tribal census tracts and tribal BGs are separate and unique geographic areas defined within federally recognized American Indian reservations and can cross state and county boundaries (see “Tribal Census Tract” and “Tribal Block Group”). The tribal census tracts and tribal block groups may be completely different from the census tracts and block groups defined by state and county.|2014|obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308
us.census.tiger.state|States and Equivalent Entities are the primary governmental divisions of the United States. In addition to the 50 states, the Census Bureau treats the District of Columbia, Puerto Rico, American Samoa, the Commonwealth of the Northern Mariana Islands, Guam, and the U.S. Virgin Islands as the statistical equivalents of states for the purpose of data presentation.|2014|obs_624e5d2362e08aaa5463d7671e7748432262719c
us.census.tiger.state_clipped|A cartography-ready version of US States|2014|obs_f39f1d7cd5a22b87140860cbd58539f1591a1810
us.census.tiger.puma|PUMAs are geographic areas for which the Census Bureau provides selected extracts of raw data from a small sample of census records that are screened to protect confidentiality. These extracts are referred to as public use microdata sample (PUMS) files.
For the 2010 Census, each state, the District of Columbia, Puerto Rico, and some Island Area participants delineated PUMAs for use in presenting PUMS data based on a 5 percent sample of decennial census or American Community Survey data. These areas are required to contain at least 100,000 people. This is different from Census 2000 when two types of PUMAs were defined: a 5 percent PUMA as for 2010 and an additional super-PUMA designed to provide a 1 percent sample. The PUMAs are identified by a five-digit census code unique within state.|2014|obs_7c9493c41fa8f4bd178ab993ea3d5891c1977667
(30 rows)

File diff suppressed because one or more lines are too long

View File

@ -65,12 +65,12 @@ SELECT
SELECT cdb_observatory._OBS_GetRelatedColumn( SELECT cdb_observatory._OBS_GetRelatedColumn(
Array[ Array[
'es.ine.pop_0_4', 'es.ine.t3_1',
'us.census.acs.B01003001', 'us.census.acs.B01003001',
'us.census.acs.B01001002' 'us.census.acs.B01001002'
], ],
'denominator' 'denominator'
) = '{es.ine.total_pop,NULL,us.census.acs.B01003001}' As _OBS_GetRelatedColumn_test; ) = '{es.ine.t1_1,NULL,us.census.acs.B01003001}' As _OBS_GetRelatedColumn_test;
-- should give back a standardized measure name -- should give back a standardized measure name
SELECT cdb_observatory._OBS_StandardizeMeasureName('test 343 %% 2 qqq }}{{}}') = 'test_343_2_qqq' As _OBS_StandardizeMeasureName_test; SELECT cdb_observatory._OBS_StandardizeMeasureName('test 343 %% 2 qqq }}{{}}') = 'test_343_2_qqq' As _OBS_StandardizeMeasureName_test;

View File

@ -150,7 +150,7 @@ SELECT abs(OBS_GetMeasure_total_pop_point - 10923.093200390833950) / 10923.09320
-- Poly-based OBS_GetMeasure, default normalization (none) -- Poly-based OBS_GetMeasure, default normalization (none)
-- is result within 0.1% of expected -- is result within 0.1% of expected
SELECT abs(OBS_GetMeasure_total_pop_polygon - 9833.47316573952) / 9833.47316573952 < 0.001 As OBS_GetMeasure_total_pop_polygon_test FROM SELECT abs(OBS_GetMeasure_total_pop_polygon - 12327.3133495107) / 12327.3133495107 < 0.001 As OBS_GetMeasure_total_pop_polygon_test FROM
cdb_observatory.OBS_GetMeasure( cdb_observatory.OBS_GetMeasure(
cdb_observatory._TestArea(), cdb_observatory._TestArea(),
'us.census.acs.B01003001' 'us.census.acs.B01003001'
@ -164,7 +164,7 @@ SELECT (abs(cdb_observatory.OBS_GetMeasure(
-- Poly-based OBS_GetMeasure with denominator normalization -- Poly-based OBS_GetMeasure with denominator normalization
SELECT abs(cdb_observatory.OBS_GetMeasure( SELECT abs(cdb_observatory.OBS_GetMeasure(
cdb_observatory._TestArea(), cdb_observatory._TestArea(),
'us.census.acs.B01001002', 'denominator') - 0.50597531462834994530) / 0.49026340444793965457 < 0.001 As OBS_GetMeasure_total_male_poly_denominator; 'us.census.acs.B01001002', 'denominator') - 0.49026340444793965457) / 0.49026340444793965457 < 0.001 As OBS_GetMeasure_total_male_poly_denominator;
-- Point-based OBS_GetCategory -- Point-based OBS_GetCategory
SELECT cdb_observatory.OBS_GetCategory( SELECT cdb_observatory.OBS_GetCategory(
@ -181,7 +181,7 @@ SELECT (abs(OBS_GetPopulation - 10923.093200390833950) / 10923.093200390833950)
) As m(OBS_GetPopulation); ) As m(OBS_GetPopulation);
-- Poly-based OBS_GetPopulation, default normalization (none) -- Poly-based OBS_GetPopulation, default normalization (none)
SELECT (abs(obs_getpopulation_polygon - 9833.47316573952) / 9833.47316573952) < 0.001 As obs_getpopulation_polygon_test SELECT (abs(obs_getpopulation_polygon - 12327.3133495107) / 12327.3133495107) < 0.001 As obs_getpopulation_polygon_test
FROM FROM
cdb_observatory.OBS_GetPopulation( cdb_observatory.OBS_GetPopulation(
cdb_observatory._TestArea() cdb_observatory._TestArea()
@ -193,7 +193,7 @@ SELECT (abs(cdb_observatory.obs_getuscensusmeasure(
-- Poly-based OBS_GetUSCensusMeasure, default normalization (none) -- Poly-based OBS_GetUSCensusMeasure, default normalization (none)
SELECT (abs(cdb_observatory.obs_getuscensusmeasure( SELECT (abs(cdb_observatory.obs_getuscensusmeasure(
cdb_observatory._testarea(), 'male population') - 4975.49467892449) / 4975.49467892449) < 0.001 As obs_getuscensusmeasure; cdb_observatory._testarea(), 'male population') - 6043.63061042765) / 6043.63061042765) < 0.001 As obs_getuscensusmeasure;
-- Point-based OBS_GetUSCensusCategory -- Point-based OBS_GetUSCensusCategory
SELECT cdb_observatory.OBS_GetUSCensusCategory( SELECT cdb_observatory.OBS_GetUSCensusCategory(

View File

@ -24,10 +24,13 @@ FROM cdb_observatory._OBS_SearchTables(
'1988' -- year before first tiger data was collected '1988' -- year before first tiger data was collected
) As t(table_name, timespan); ) As t(table_name, timespan);
SELECT * SELECT COUNT(*) > 0 AS _OBS_SearchTotalPop
FROM cdb_observatory.OBS_Search('total_pop'); FROM cdb_observatory.OBS_Search('total_pop')
AS t(id, description, name, aggregate, source);
SELECT * SELECT COUNT(*) > 0 AS _OBS_GetAvailableBoundariesExist
FROM cdb_observatory.OBS_GetAvailableBoundaries(cdb_observatory._TestPoint()); FROM cdb_observatory.OBS_GetAvailableBoundaries(
cdb_observatory._TestPoint()
) AS t(boundary_id, description, time_span, tablename);
\i test/fixtures/drop_fixtures.sql \i test/fixtures/drop_fixtures.sql