diff --git a/packages/client/package-lock.json b/packages/client/package-lock.json index 416ffcb651..b574a49b8b 100644 --- a/packages/client/package-lock.json +++ b/packages/client/package-lock.json @@ -43,7 +43,7 @@ "typedoc": "^0.25.4", "vega-embed": "^6.24.0", "vega-lite": "^5.16.3", - "vite": "^5.2.10" + "vite": "^5.2.14" } }, "node_modules/@ampproject/remapping": { @@ -8438,9 +8438,9 @@ } }, "node_modules/vite": { - "version": "5.2.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", - "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "version": "5.2.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.14.tgz", + "integrity": "sha512-TFQLuwWLPms+NBNlh0D9LZQ+HXW471COABxw/9TEUBrjuHMo9BrYBPrN/SYAwIuVL+rLerycxiLT41t4f5MZpA==", "dev": true, "dependencies": { "esbuild": "^0.20.1", @@ -13995,9 +13995,9 @@ } }, "vite": { - "version": "5.2.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", - "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "version": "5.2.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.14.tgz", + "integrity": "sha512-TFQLuwWLPms+NBNlh0D9LZQ+HXW471COABxw/9TEUBrjuHMo9BrYBPrN/SYAwIuVL+rLerycxiLT41t4f5MZpA==", "dev": true, "requires": { "esbuild": "^0.20.1", diff --git a/packages/client/package.json b/packages/client/package.json index 99d73140cb..5bb40b3f96 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -59,7 +59,7 @@ "typedoc": "^0.25.4", "vega-embed": "^6.24.0", "vega-lite": "^5.16.3", - "vite": "^5.2.10" + "vite": "^5.2.14" }, "dependencies": { "lodash": "^4.17.21", diff --git a/server/integration_tests/test_data/detection_api_multivar/comparemalepopulationwithfemalepopulation/debug_info.json b/server/integration_tests/test_data/detection_api_multivar/comparemalepopulationwithfemalepopulation/debug_info.json index d4173d5c19..28d0c89534 100644 --- a/server/integration_tests/test_data/detection_api_multivar/comparemalepopulationwithfemalepopulation/debug_info.json +++ b/server/integration_tests/test_data/detection_api_multivar/comparemalepopulationwithfemalepopulation/debug_info.json @@ -63,8 +63,8 @@ }, { "CosineScore": [ - 0.9296979904174805, - 0.8847434520721436 + 0.9296978712081909, + 0.884743332862854 ], "QueryPart": "female population", "SV": [ @@ -80,7 +80,7 @@ "Parts": [ { "CosineScore": [ - 0.9117770791053772 + 0.9117770195007324 ], "QueryPart": "male population female", "SV": [ @@ -90,7 +90,7 @@ { "CosineScore": [ 0.8982378244400024, - 0.8723466396331787 + 0.8723466992378235 ], "QueryPart": "population", "SV": [ @@ -106,10 +106,10 @@ "Parts": [ { "CosineScore": [ - 0.8088871836662292, + 0.8088873028755188, 0.8034241199493408, 0.8017654418945312, - 0.7751556634902954 + 0.7751557230949402 ], "QueryPart": "male", "SV": [ diff --git a/server/integration_tests/test_data/detection_api_multivar/howarefactorslikeobesity,bloodpressureandasthmaimpactedbyclimatechange/debug_info.json b/server/integration_tests/test_data/detection_api_multivar/howarefactorslikeobesity,bloodpressureandasthmaimpactedbyclimatechange/debug_info.json index 58ab68c7ed..19b4b34389 100644 --- a/server/integration_tests/test_data/detection_api_multivar/howarefactorslikeobesity,bloodpressureandasthmaimpactedbyclimatechange/debug_info.json +++ b/server/integration_tests/test_data/detection_api_multivar/howarefactorslikeobesity,bloodpressureandasthmaimpactedbyclimatechange/debug_info.json @@ -45,7 +45,7 @@ "Parts": [ { "CosineScore": [ - 0.7997788786888123 + 0.7997788190841675 ], "QueryPart": "factors like obesity blood pressure asthma impacted", "SV": [ @@ -86,7 +86,7 @@ }, { "CosineScore": [ - 0.9999996423721313 + 0.9999995827674866 ], "QueryPart": "blood pressure", "SV": [ diff --git a/server/integration_tests/test_data/detection_api_multivar/showmetheimpactofclimatechangeondrought/debug_info.json b/server/integration_tests/test_data/detection_api_multivar/showmetheimpactofclimatechangeondrought/debug_info.json index 7a1207cfc7..f3f512834e 100644 --- a/server/integration_tests/test_data/detection_api_multivar/showmetheimpactofclimatechangeondrought/debug_info.json +++ b/server/integration_tests/test_data/detection_api_multivar/showmetheimpactofclimatechangeondrought/debug_info.json @@ -41,7 +41,7 @@ "Parts": [ { "CosineScore": [ - 0.8787487149238586 + 0.8787485361099243 ], "QueryPart": "show climate change", "SV": [ @@ -50,7 +50,7 @@ }, { "CosineScore": [ - 1.0 + 0.9999998807907104 ], "QueryPart": "drought", "SV": [ @@ -76,7 +76,7 @@ }, { "CosineScore": [ - 0.866512656211853 + 0.8665127754211426 ], "QueryPart": "change drought", "SV": [ diff --git a/server/integration_tests/test_data/e2e_date_range/populationincaliforniaafter2013/chart_config.json b/server/integration_tests/test_data/e2e_date_range/populationincaliforniaafter2013/chart_config.json index 695a809ee1..7d42a96f18 100644 --- a/server/integration_tests/test_data/e2e_date_range/populationincaliforniaafter2013/chart_config.json +++ b/server/integration_tests/test_data/e2e_date_range/populationincaliforniaafter2013/chart_config.json @@ -248,8 +248,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/06" diff --git a/server/integration_tests/test_data/e2e_single_date/hispanicwomenincaliforniain2001/chart_config.json b/server/integration_tests/test_data/e2e_single_date/hispanicwomenincaliforniain2001/chart_config.json index ec29661239..34c9efe7cc 100644 --- a/server/integration_tests/test_data/e2e_single_date/hispanicwomenincaliforniain2001/chart_config.json +++ b/server/integration_tests/test_data/e2e_single_date/hispanicwomenincaliforniain2001/chart_config.json @@ -75,8 +75,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/06" @@ -245,8 +244,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/06" diff --git a/server/integration_tests/test_data/e2e_single_date/whatwastheaveragehousepricefor2brhouseinmountainviewdecadeago/chart_config.json b/server/integration_tests/test_data/e2e_single_date/whatwastheaveragehousepricefor2brhouseinmountainviewdecadeago/chart_config.json index e2ea1e4310..a85decc345 100644 --- a/server/integration_tests/test_data/e2e_single_date/whatwastheaveragehousepricefor2brhouseinmountainviewdecadeago/chart_config.json +++ b/server/integration_tests/test_data/e2e_single_date/whatwastheaveragehousepricefor2brhouseinmountainviewdecadeago/chart_config.json @@ -11,8 +11,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/0649670" diff --git a/server/integration_tests/test_data/e2e_us_demo/whatisthedemographicbreakdownofeastcarrollparish,la/chart_config.json b/server/integration_tests/test_data/e2e_us_demo/whatisthedemographicbreakdownofeastcarrollparish,la/chart_config.json index f8bb9a25f6..70cc33dda1 100644 --- a/server/integration_tests/test_data/e2e_us_demo/whatisthedemographicbreakdownofeastcarrollparish,la/chart_config.json +++ b/server/integration_tests/test_data/e2e_us_demo/whatisthedemographicbreakdownofeastcarrollparish,la/chart_config.json @@ -11,8 +11,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/22035" @@ -108,8 +107,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/22035" diff --git a/server/integration_tests/test_data/filter_query_disabled/chart_config.json b/server/integration_tests/test_data/filter_query_disabled/chart_config.json index 6830939de9..a60e7ab664 100644 --- a/server/integration_tests/test_data/filter_query_disabled/chart_config.json +++ b/server/integration_tests/test_data/filter_query_disabled/chart_config.json @@ -213,8 +213,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/06" diff --git a/server/integration_tests/test_data/place_detection_e2e_dc/query_2/chart_config.json b/server/integration_tests/test_data/place_detection_e2e_dc/query_2/chart_config.json index c87027fa06..3a7ecd1077 100644 --- a/server/integration_tests/test_data/place_detection_e2e_dc/query_2/chart_config.json +++ b/server/integration_tests/test_data/place_detection_e2e_dc/query_2/chart_config.json @@ -210,8 +210,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "country/USA" diff --git a/server/integration_tests/test_data/place_detection_e2e_dc/query_3/chart_config.json b/server/integration_tests/test_data/place_detection_e2e_dc/query_3/chart_config.json index 7065383d6a..08748ba19f 100644 --- a/server/integration_tests/test_data/place_detection_e2e_dc/query_3/chart_config.json +++ b/server/integration_tests/test_data/place_detection_e2e_dc/query_3/chart_config.json @@ -149,8 +149,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/12" diff --git a/server/integration_tests/test_data/place_detection_e2e_dc/query_4/chart_config.json b/server/integration_tests/test_data/place_detection_e2e_dc/query_4/chart_config.json index 1962e9ce79..5cb3dca67e 100644 --- a/server/integration_tests/test_data/place_detection_e2e_dc/query_4/chart_config.json +++ b/server/integration_tests/test_data/place_detection_e2e_dc/query_4/chart_config.json @@ -64,8 +64,7 @@ { "barTileSpec": { "maxPlaces": 15, - "maxVariables": 15, - "sort": "DESCENDING" + "maxVariables": 15 }, "comparisonPlaces": [ "geoId/06", diff --git a/server/lib/nl/config_builder/bar.py b/server/lib/nl/config_builder/bar.py index 5ba0be52f8..723784c330 100644 --- a/server/lib/nl/config_builder/bar.py +++ b/server/lib/nl/config_builder/bar.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import re from typing import List from server.config.subject_page_pb2 import BarTileSpec @@ -32,6 +33,7 @@ _MAX_VARIABLE_LIMIT = 15 _MAX_PLACES_LIMIT = 15 +_SKIP_SORTING_SV_REGEX = r'\d+To\d+' # Get best date to use for an sv and list of places. @@ -120,8 +122,12 @@ def multiple_place_bar_block(column, def get_sort_order(state: PopulateState, cspec: ChartSpec): # Use no default sort_order for special DC, since UN # want the order to be as provided in variable groupings. - sort_order = None if is_special_dc(state.uttr.insight_ctx) \ - else BarTileSpec.DESCENDING + sort_order = None if is_special_dc( + state.uttr.insight_ctx) else BarTileSpec.DESCENDING + + # If any of the svs in the chart spec are a range, no default sort order + if any([re.search(_SKIP_SORTING_SV_REGEX, sv) for sv in cspec.svs]): + sort_order = None if (RankingType.LOW in cspec.ranking_types and RankingType.HIGH not in cspec.ranking_types): @@ -129,4 +135,4 @@ def get_sort_order(state: PopulateState, cspec: ChartSpec): elif RankingType.HIGH in cspec.ranking_types: sort_order = BarTileSpec.DESCENDING - return sort_order \ No newline at end of file + return sort_order diff --git a/server/routes/redirects/redirects.json b/server/routes/redirects/redirects.json index 44137cb00e..dcf5529d9d 100644 --- a/server/routes/redirects/redirects.json +++ b/server/routes/redirects/redirects.json @@ -13,5 +13,5 @@ "dc-coverage-aa2": "/tools/visualization#visType%3Dmap%26place%3DEarth%26placeType%3DCountry%26sv%3D%7B%22dcid%22%3A%22Count_Variable_AdministrativeArea2%22%7D", "video": "https://www.youtube.com/watch?v=O6iVsS-RDYI", "form": "https://forms.gle/C816TLMyp5fBdDt67", - "DataGemmaPaper": "https://docs.datacommons.org/papers/DataGemma-FullPaper.pdf" + "DataGemmaPaper": "https://arxiv.org/abs/2409.13741" } diff --git a/static/js/apps/explore/app.tsx b/static/js/apps/explore/app.tsx index 5afa8dac86..f594094aa2 100644 --- a/static/js/apps/explore/app.tsx +++ b/static/js/apps/explore/app.tsx @@ -45,7 +45,7 @@ import { } from "../../shared/ga_events"; import { QueryResult, UserMessageInfo } from "../../types/app/explore_types"; import { SubjectPageMetadata } from "../../types/subject_page_types"; -import { isPlaceOverviewOnly } from "../../utils/explore_utils"; +import { shouldSkipPlaceOverview } from "../../utils/explore_utils"; import { getUpdatedHash } from "../../utils/url_utils"; import { AutoPlay } from "./autoplay"; import { ErrorResult } from "./error_result"; @@ -209,14 +209,14 @@ export function App(props: { isDemo: boolean }): JSX.Element { exploreMore: relatedThings["exploreMore"], mainTopics: relatedThings["mainTopics"], sessionId: "session" in fulfillData ? fulfillData["session"]["id"] : "", + svSource: fulfillData["svSource"], }; if ( pageMetadata && pageMetadata.pageConfig && pageMetadata.pageConfig.categories ) { - // If the response is a single PLACE_OVERVIEW tile, redirect to the place explorer. - if (isPlaceOverviewOnly(pageMetadata)) { + if (shouldSkipPlaceOverview(pageMetadata)) { const placeDcid = pageMetadata.place.dcid; const url = `/place/${placeDcid}`; window.location.replace(url); diff --git a/static/js/apps/explore/success_result.tsx b/static/js/apps/explore/success_result.tsx index 4f5834cc45..979f51a047 100644 --- a/static/js/apps/explore/success_result.tsx +++ b/static/js/apps/explore/success_result.tsx @@ -36,7 +36,10 @@ import { } from "../../shared/context"; import { QueryResult, UserMessageInfo } from "../../types/app/explore_types"; import { SubjectPageMetadata } from "../../types/subject_page_types"; -import { isPlaceOverviewOnly } from "../../utils/explore_utils"; +import { + isPlaceOverviewOnly, + shouldSkipPlaceOverview, +} from "../../utils/explore_utils"; import { getPlaceTypePlural } from "../../utils/string_utils"; import { trimCategory } from "../../utils/subject_page_utils"; import { getUpdatedHash } from "../../utils/url_utils"; @@ -108,6 +111,7 @@ export function SuccessResult(props: SuccessResultPropType): JSX.Element { }; }, []); const placeOverviewOnly = isPlaceOverviewOnly(props.pageMetadata); + const emptyPlaceOverview = shouldSkipPlaceOverview(props.pageMetadata); return (