Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9fc0db5
test
hermosillajelmy May 13, 2025
1b05c11
fix year dimension in onet cubes
hermosillajelmy May 13, 2025
7ae3a1f
update faf
hermosillajelmy May 13, 2025
3a04076
Refactor measure definitions by removing redundant aggregator attribu…
estevalenz May 16, 2025
9b0bd6d
adds debug auth token
frabarz May 19, 2025
9858862
add topk and filters in pums endpoint
hermosillajelmy May 20, 2025
a132b8a
update LL-complexity
hermosillajelmy May 22, 2025
137e552
add time parameter
hermosillajelmy May 22, 2025
a2b23a7
Add new XML schema files for ACS gender by industry data (1-year and …
estevalenz May 22, 2025
b96c81f
Add new XML schema for ACS renters by income percentage data
estevalenz May 22, 2025
ee060fb
Add hide_in_ui annotation to ACS renters by income percentage schema …
estevalenz May 22, 2025
2a9aa45
Add new XML schema files for ACS gender by occupation (1-year and 5-y…
estevalenz May 23, 2025
ec184e4
Merge pull request #41 from DataUSA/valenz_migration
estevalenz May 23, 2025
3514994
partial migration of chr cube
hermosillajelmy May 26, 2025
f7212a1
fix ethenicity filter
hermosillajelmy May 27, 2025
64bd0dc
Merge pull request #42 from DataUSA/chr
hermosillajelmy May 27, 2025
0302d31
add calculated measures to chr
hermosillajelmy May 27, 2025
8c36306
fix acs cubes
hermosillajelmy May 29, 2025
16bad12
fix acs industry dimension
hermosillajelmy May 29, 2025
02934b7
fix PUMS Degree dimension
hermosillajelmy May 30, 2025
3b705c5
upgrades tesseract-olap to 0.19.0
frabarz May 30, 2025
8db3f23
upgrades logiclayer-complexity to 0.6.16
frabarz May 30, 2025
54a80fe
minor change
hermosillajelmy Jun 3, 2025
07740b7
add university cube
hermosillajelmy Jun 9, 2025
eb35b00
fix pums endpoint
hermosillajelmy Jun 10, 2025
90e7aba
minor change
hermosillajelmy Jun 10, 2025
b36d66a
add merge endpoint
hermosillajelmy Jun 10, 2025
82a58bd
add new measures
hermosillajelmy Jun 10, 2025
cf6cec3
+ measures
hermosillajelmy Jun 10, 2025
de10068
+ measures in chr cube
hermosillajelmy Jun 10, 2025
6308a50
more measures in chr
hermosillajelmy Jun 11, 2025
1a26cbf
+ calculated measures
hermosillajelmy Jun 11, 2025
af1b28b
+ calculated measures
hermosillajelmy Jun 11, 2025
e96346b
add last measures in chr cube
hermosillajelmy Jun 11, 2025
adeed66
Merge pull request #43 from DataUSA/chr
hermosillajelmy Jun 11, 2025
6ac4120
change of measures to dimensions
hermosillajelmy Jun 11, 2025
e23bf9f
restart
hermosillajelmy Jun 23, 2025
5133777
update tesseract to 19.1
hermosillajelmy Jun 24, 2025
887df78
update LL complexity to 0.7.0
hermosillajelmy Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tesseract_olap import OlapServer
from tesseract_olap.logiclayer import TesseractModule

from datausa.auth import StaticAuthProvider
from datausa.calculations import CalculationsModule

logger = logging.getLogger(__name__)
Expand All @@ -19,23 +20,24 @@

# These parameters are optional
olap_cache = os.environ.get("TESSERACT_CACHE", "")
app_debug = os.environ.get("TESSERACT_DEBUG", None)
commit_hash = os.environ.get("GIT_HASH", "")
debug_token = os.environ.get("TESSERACT_DEBUG_TOKEN")
app_debug = os.environ.get("TESSERACT_DEBUG")

app_debug = bool(app_debug)

# ASGI app =====================================================================
olap = OlapServer(backend=olap_backend, schema=olap_schema, cache=olap_cache)
auth = StaticAuthProvider(debug_token) if debug_token else None

layer = LogicLayer(debug=app_debug)

mod_tsrc = TesseractModule(olap, debug=app_debug)
mod_tsrc = TesseractModule(olap, auth=auth, debug=app_debug)
layer.add_module("/tesseract", mod_tsrc)

mod_cmplx = EconomicComplexityModule(olap, debug=app_debug)
mod_cmplx = EconomicComplexityModule(olap, auth=auth, debug=app_debug)
layer.add_module("/complexity", mod_cmplx)

mod_calcs = CalculationsModule(olap, debug=app_debug)
mod_calcs = CalculationsModule(olap, auth=auth, debug=app_debug)
layer.add_module("/calcs", mod_calcs)

layer.add_static("/ui", "./etc/static/", html=True)
Expand Down
8 changes: 7 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
WORKERS=${UVICORN_WORKERS:-1} # Default to 1 if not set, for the cluster.
MAX_CONCURRENCY=${MAX_CONCURRENCY:-300}

#exec granian --interface asgi --host 0.0.0.0 --port 7777 --log-config ./etc/logging.json --respawn-failed-workers app:layer
# Check if TESSERACT_DEBUG_TOKEN is set; if not, generate it
if [ -z "$TESSERACT_DEBUG_TOKEN" ]; then
export TESSERACT_DEBUG_TOKEN=$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
fi

echo $TESSERACT_DEBUG_TOKEN

exec uvicorn --workers $WORKERS --limit-concurrency $MAX_CONCURRENCY --host 0.0.0.0 --port 7777 --log-config ./etc/logging.json app:layer
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_health_care_coverage_overall_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<Annotation name="ui_default_drilldown">Kaiser Health Coverage</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Health Insurance Policies Moe" visible="true">
<Measure key_column="moe" name="Health Insurance Policies Moe" visible="true">
<Annotation name="error_for_measure">Health Insurance Policies</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_health_care_coverage_overall_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Annotation name="ui_default_drilldown">Kaiser Health Coverage</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Health Insurance Policies Moe" visible="true">
<Measure key_column="moe" name="Health Insurance Policies Moe" visible="true">
<Annotation name="error_for_measure">Health Insurance Policies</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Annotation name="units_of_measurement">Housing Units</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Homeowners by Mortgage Moe" visible="true">
<Measure key_column="moe" name="Homeowners by Mortgage Moe" visible="true">
<Annotation name="error_for_measure">Homeowners by Mortgage</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Annotation name="units_of_measurement">Housing Units</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Homeowners by Mortgage Moe" visible="true">
<Measure key_column="moe" name="Homeowners by Mortgage Moe" visible="true">
<Annotation name="error_for_measure">Homeowners by Mortgage</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645"/>
Expand Down
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_households_with_no_internet_2016_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Annotation name="units_of_measurement">Households</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Internet Access Moe" visible="true">
<Measure key_column="moe" name="Households by Internet Access Moe" visible="true">
<Annotation name="error_for_measure">Households by Internet Access</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645"/>
Expand Down
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_households_with_no_internet_2016_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Annotation name="units_of_measurement">Households</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Internet Access Moe" visible="true">
<Measure key_column="moe" name="Households by Internet Access Moe" visible="true">
<Annotation name="error_for_measure">Households by Internet Access</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<Annotation name="units_of_measurement">Households</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Kitchen Type Moe" visible="true">
<Measure key_column="moe" name="Households by Kitchen Type Moe" visible="true">
<Annotation name="error_for_measure">Households by Kitchen Type</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Annotation name="hide_in_map">true</Annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Annotation name="units_of_measurement">Households</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Kitchen Type Moe" visible="true">
<Measure key_column="moe" name="Households by Kitchen Type Moe" visible="true">
<Annotation name="error_for_measure">Households by Kitchen Type</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Annotation name="hide_in_map">true</Annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Annotation name="ui_default_drilldown">Plumbing Facilities</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Plumbing Type Moe"
<Measure key_column="moe" name="Households by Plumbing Type Moe"
visible="true">
<Annotation name="error_for_measure">Households by Plumbing Type</Annotation>
<Annotation name="error_type">MOE</Annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Annotation name="ui_default_drilldown">Plumbing Facilities</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Households by Plumbing Type Moe"
<Measure key_column="moe" name="Households by Plumbing Type Moe"
visible="true">
<Annotation name="error_for_measure">Households by Plumbing Type</Annotation>
<Annotation name="error_type">MOE</Annotation>
Expand Down
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_renters_by_income_percentage_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<Annotation name="units_of_measurement">People</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Renters by Income Percentage Moe" visible="true">
<Measure key_column="moe" name="Renters by Income Percentage Moe" visible="true">
<Annotation name="error_for_measure">Renters by Income Percentage</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
2 changes: 1 addition & 1 deletion etc/schema/acs_ygh_renters_by_income_percentage_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<Annotation name="units_of_measurement">People</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Renters by Income Percentage Moe" visible="true">
<Measure key_column="moe" name="Renters by Income Percentage Moe" visible="true">
<Annotation name="error_for_measure">Renters by Income Percentage</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
63 changes: 63 additions & 0 deletions etc/schema/acs_ygh_renters_by_income_percentage_c_1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<Schema name="datausa" default_locale="en">

<Cube name="acs_ygh_renters_by_income_percentage_c_1">
<Annotation name="source_name">Census Bureau</Annotation>
<Annotation name="source_description">The American Community Survey (ACS) is conducted by the US Census and sent to a portion of the population every year.</Annotation>
<Annotation name="dataset_name">ACS 1-year Estimate</Annotation>
<Annotation name="dataset_link">http://www.census.gov/programs-surveys/acs/</Annotation>
<Annotation name="table_id">C25074</Annotation>
<Annotation name="topic">Housing &amp; Living</Annotation>
<Annotation name="subtopic">Housing</Annotation>
<Annotation name="hide_in_ui">true</Annotation>

<Table name="acs_ygh_renters_by_income_percentage_c_1"/>

<DimensionUsage foreign_key="geoid" name="Geography" source="Geography" />

<Dimension name="Year" foreign_key="year" type="time">
<Annotation name="dim_type">TIME</Annotation>
<Hierarchy name="Year" primary_key="year">
<Level name="Year" key_column="year" key_type="u16" />
</Hierarchy>
</Dimension>

<Dimension foreign_key="dim_0" name="Household Income">
<Hierarchy name="Household Income">
<InlineTable name="dim_0_table" format="tuples">
<Row>("member_0_code", "member_0")</Row>
<Row>(0, "Less Than $10,000")</Row>
<Row>(1, "$10,000 to $19,999")</Row>
<Row>(2, "$20,000 to $34,999")</Row>
<Row>(3, "$35,000 to $49,999")</Row>
<Row>(4, "$50,000 to $74,999")</Row>
<Row>(5, "$75,000 or More")</Row>
</InlineTable>
<Level key_column="member_0_code" name="Household Income" name_column="member_0" key_type="u8"/>
</Hierarchy>
</Dimension>

<Dimension foreign_key="dim_1" name="Gross Rent Percent of Income">
<Hierarchy name="Gross Rent Percent of Income">
<InlineTable name="dim_1_table" format="tuples">
<Row>("member_0_code", "member_0")</Row>
<Row>(0, "Less Than 30.0 Percent")</Row>
<Row>(1, "30.0 Percent or More")</Row>
<Row>(2, "Not Computed")</Row>
</InlineTable>
<Level key_column="member_0_code" name="Gross Rent Percent of Income" name_column="member_0" key_type="u8"/>
</Hierarchy>
</Dimension>

<Measure aggregator="sum" key_column="mea" name="Renters by Income Percentage" visible="true">
<Annotation name="aggregation_method">SUM</Annotation>
<Annotation name="units_of_measurement">People</Annotation>
</Measure>

<Measure name="Renters by Income Percentage Moe" key_column="moe" visible="true">
<Annotation name="error_for_measure">Workforce by Industry and Gender</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
</Measure>

</Cube>
</Schema>
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<Annotation name="hide_in_ui">true</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Health Insurance by Gender and Age Moe" visible="true">
<Measure key_column="moe" name="Health Insurance by Gender and Age Moe" visible="true">
<Annotation name="error_for_measure">Health Insurance by Gender and Age</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<Annotation name="hide_in_ui">true</Annotation>
</Measure>

<Measure aggregator="None" key_column="moe" name="Health Insurance by Gender and Age Moe" visible="true">
<Measure key_column="moe" name="Health Insurance by Gender and Age Moe" visible="true">
<Annotation name="error_for_measure">Health Insurance by Gender and Age</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
Expand Down
83 changes: 83 additions & 0 deletions etc/schema/acs_yghsa_health_coverage_type_by_gender_by_age_1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<Schema name="datausa" default_locale="en">

<Cube name="acs_yghsa_health_coverage_type_by_gender_by_age_1" subset_table="true">
<Annotation name="source_name">Census Bureau</Annotation>
<Annotation name="source_description">The American Community Survey (ACS) is conducted by the US Census and sent to a portion of the population every year.</Annotation>
<Annotation name="dataset_name">ACS 1-year Estimate</Annotation>
<Annotation name="dataset_link">http://www.census.gov/programs-surveys/acs/</Annotation>
<Annotation name="table_id">B27001,B27002,B27003,B27004,B27005,B27006,B27007,B27008,B27009</Annotation>
<Annotation name="topic">Health</Annotation>
<Annotation name="subtopic">Healthcare Coverage</Annotation>

<Table name="acs_yghsa_health_coverage_type_by_gender_by_age_1" />

<DimensionUsage foreign_key="geoid" name="Geography" source="Geography" />

<Dimension name="Year" foreign_key="year" type="time">
<Annotation name="dim_type">TIME</Annotation>
<Hierarchy name="Year" primary_key="year">
<Level name="Year" key_column="year" key_type="u16" />
</Hierarchy>
</Dimension>

<Dimension foreign_key="dim_0" name="Gender">
<Hierarchy name="Gender">
<InlineTable name="dim_inline_gender" format="tuples">
<Row>("id", "description")</Row>
<Row>(0, "Male")</Row>
<Row>(1, "Female")</Row>
</InlineTable>
<Level key_column="id" name="Gender" name_column="description" key_type="u8"/>
</Hierarchy>
</Dimension>

<Dimension foreign_key="dim_1" name="Age">
<Hierarchy name="Age">
<InlineTable name="dim_inline_age" format="tuples">
<Row>("id", "description")</Row>
<Row>(0, "Under 6 Years")</Row>
<Row>(1, "6 to 17 Years")</Row>
<Row>(2, "18 to 24 Years")</Row>
<Row>(3, "25 to 34 Years")</Row>
<Row>(4, "35 to 44 Years")</Row>
<Row>(5, "45 to 54 Years")</Row>
<Row>(6, "55 to 64 Years")</Row>
<Row>(7, "65 to 74 Years")</Row>
<Row>(8, "75 Years &amp; Over")</Row>
</InlineTable>
<Level key_column="id" name="Age" name_column="description" key_type="u8"/>
</Hierarchy>
</Dimension>

<Dimension foreign_key="health" name="Health Coverage">
<Annotation name="is_aggregatable">false</Annotation>
<Annotation name="is_required">true</Annotation>
<Hierarchy name="Health Coverage" >
<InlineTable name="dm_health_coverage" format="tuples">
<Row>("health_code", "health")</Row>
<Row>(0, "Private")</Row>
<Row>(1, "Public")</Row>
<Row>(2, "Employer")</Row>
<Row>(3, "Direct")</Row>
<Row>(4, "Medicare")</Row>
<Row>(5, "Medicaid")</Row>
<Row>(6, "Military")</Row>
<Row>(7, "VA")</Row>
</InlineTable>
<Level key_column="health_code" name="Health Coverage" name_column="health" key_type="u8"/>
</Hierarchy>
</Dimension>

<Measure aggregator="sum" key_column="mea" name="Health Insurance by Gender and Age" visible="true">
<Annotation name="aggregation_method">SUM</Annotation>
<Annotation name="units_of_measurement">People</Annotation>
</Measure>

<Measure name="Health Insurance by Gender and Age Moe" key_column="moe" visible="true">
<Annotation name="error_for_measure">Health Insurance by Gender and Age</Annotation>
<Annotation name="error_type">MOE</Annotation>
<Aggregation type="moe" critical_value="1.645" />
</Measure>
</Cube>

</Schema>
Loading