From 375f6a52067ba614ee0ae51795acf03a817ca1a9 Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Thu, 9 Feb 2023 11:49:06 -0800 Subject: [PATCH 1/5] Implement fallback --- server/lib/nl/detection.py | 24 +++++- server/lib/nl/fulfillment/base.py | 6 +- server/lib/nl/fulfillment/comparison.py | 4 +- server/lib/nl/fulfillment/containedin.py | 10 +-- server/lib/nl/fulfillment/correlation.py | 5 +- server/lib/nl/fulfillment/event.py | 6 +- server/lib/nl/fulfillment/overview.py | 2 +- .../nl/fulfillment/ranking_across_places.py | 11 +-- .../lib/nl/fulfillment/ranking_across_vars.py | 1 - server/lib/nl/fulfillment/simple.py | 16 +--- server/lib/nl/fulfillment/time_delta.py | 1 - server/lib/nl/fulfillment_next.py | 83 ++++++++++++++----- server/lib/nl/page_config_next.py | 3 - server/routes/nl_interface_next.py | 17 ---- server/tests/lib/nl/fulfillment_next_test.py | 3 +- server/tests/lib/nl/test_utterance.py | 2 +- 16 files changed, 102 insertions(+), 92 deletions(-) diff --git a/server/lib/nl/detection.py b/server/lib/nl/detection.py index 41d6ca4a0b..3c9cb6e8c3 100644 --- a/server/lib/nl/detection.py +++ b/server/lib/nl/detection.py @@ -255,6 +255,29 @@ class ClassificationType(IntEnum): ClassificationType.OVERVIEW, ] +QUERY_TYPE_FALLBACK = { + # No fallback + ClassificationType.OVERVIEW: + None, + ClassificationType.SIMPLE: + None, + + ClassificationType.EVENT: + ClassificationType.SIMPLE, + ClassificationType.TIME_DELTA: + ClassificationType.RANKING, + ClassificationType.RANKING: + ClassificationType.CONTAINED_IN, + ClassificationType.CONTAINED_IN: + ClassificationType.SIMPLE, + + # Not fully sure about this fallback. + ClassificationType.CORRELATION: + ClassificationType.COMPARISON, + ClassificationType.COMPARISON: + ClassificationType.CONTAINED_IN, +} + @dataclass class NLClassifier: @@ -271,4 +294,3 @@ class Detection: places_detected: PlaceDetection svs_detected: SVDetection classifications: List[NLClassifier] - query_type: ClassificationType = ClassificationType.UNKNOWN diff --git a/server/lib/nl/fulfillment/base.py b/server/lib/nl/fulfillment/base.py index 0d9c216141..7a529d1e45 100644 --- a/server/lib/nl/fulfillment/base.py +++ b/server/lib/nl/fulfillment/base.py @@ -42,7 +42,7 @@ class PopulateState: uttr: Utterance main_cb: any - fallback_cb: any + fallback_cb: any = None place_type: ContainedInPlaceType = None ranking_types: List[RankingType] = field(default_factory=list) time_delta_types: List[TimeDeltaType] = field(default_factory=list) @@ -141,7 +141,9 @@ def populate_charts_for_places(state: PopulateState, logging.info('Doing fallback for %s - %s', ', '.join(_get_place_names(places)), ', '.join(state.uttr.svs)) utils.update_counter(state.uttr.counters, 'num_populate_fallbacks', 1) - return state.fallback_cb(state, places, ChartOriginType.PRIMARY_CHART) + if state.fallback_cb: + return state.fallback_cb(state, places, ChartOriginType.PRIMARY_CHART) + return False # Add charts given a place and a list of stat-vars. diff --git a/server/lib/nl/fulfillment/comparison.py b/server/lib/nl/fulfillment/comparison.py index 3a9d8bc495..60f3d3b6d2 100644 --- a/server/lib/nl/fulfillment/comparison.py +++ b/server/lib/nl/fulfillment/comparison.py @@ -32,9 +32,7 @@ def populate(uttr: Utterance) -> bool: # NOTE: The COMPARISON attribute has no additional parameters. So start # by directly inferring the list of places to compare. - state = PopulateState(uttr=uttr, - main_cb=_populate_cb, - fallback_cb=overview_fallback) + state = PopulateState(uttr=uttr, main_cb=_populate_cb) place_comparison_candidates = places_for_comparison_from_context(uttr) for places_to_compare in place_comparison_candidates: dcids = [p.dcid for p in places_to_compare] diff --git a/server/lib/nl/fulfillment/containedin.py b/server/lib/nl/fulfillment/containedin.py index 54fd84e71b..6909d6393d 100644 --- a/server/lib/nl/fulfillment/containedin.py +++ b/server/lib/nl/fulfillment/containedin.py @@ -42,10 +42,7 @@ def populate(uttr: Utterance) -> bool: continue place_type = classification.attributes.contained_in_place_type if populate_charts( - PopulateState(uttr=uttr, - main_cb=_populate_cb, - fallback_cb=overview_fallback, - place_type=place_type)): + PopulateState(uttr=uttr, main_cb=_populate_cb, place_type=place_type)): return True else: utils.update_counter(uttr.counters, @@ -54,10 +51,7 @@ def populate(uttr: Utterance) -> bool: # TODO: poor default; should do this based on main place place_type = ContainedInPlaceType.COUNTY result = populate_charts( - PopulateState(uttr=uttr, - main_cb=_populate_cb, - fallback_cb=overview_fallback, - place_type=place_type)) + PopulateState(uttr=uttr, main_cb=_populate_cb, place_type=place_type)) if not result: utils.update_counter(uttr.counters, 'containedin_failed_populate_fallback', place_type.value) diff --git a/server/lib/nl/fulfillment/correlation.py b/server/lib/nl/fulfillment/correlation.py index c32153e7c9..d9c2013cfb 100644 --- a/server/lib/nl/fulfillment/correlation.py +++ b/server/lib/nl/fulfillment/correlation.py @@ -51,10 +51,7 @@ def populate(uttr: Utterance) -> bool: continue place_type = classification.attributes.contained_in_place_type if _populate_correlation_for_place_type( - PopulateState(uttr=uttr, - main_cb=None, - fallback_cb=None, - place_type=place_type)): + PopulateState(uttr=uttr, main_cb=None, place_type=place_type)): return True else: utils.update_counter(uttr.counters, diff --git a/server/lib/nl/fulfillment/event.py b/server/lib/nl/fulfillment/event.py index 5ca11cd758..5b13a3a11f 100644 --- a/server/lib/nl/fulfillment/event.py +++ b/server/lib/nl/fulfillment/event.py @@ -46,10 +46,8 @@ def populate(uttr: nl_uttr.Utterance) -> bool: ranking_types = ranking_classification[0].attributes.ranking_type return _populate_event( - base.PopulateState(uttr=uttr, - main_cb=None, - fallback_cb=None, - ranking_types=ranking_types), event_types) + base.PopulateState(uttr=uttr, main_cb=None, ranking_types=ranking_types), + event_types) def _populate_event(state: base.PopulateState, diff --git a/server/lib/nl/fulfillment/overview.py b/server/lib/nl/fulfillment/overview.py index eef06aeda3..83a98c2b67 100644 --- a/server/lib/nl/fulfillment/overview.py +++ b/server/lib/nl/fulfillment/overview.py @@ -37,7 +37,7 @@ def populate(uttr: Utterance) -> bool: def _add_place_overview(place: Place, uttr: Utterance): - state = PopulateState(uttr=uttr, main_cb=None, fallback_cb=None) + state = PopulateState(uttr=uttr, main_cb=None) state.block_id += 1 chart_vars = ChartVars(svs=[], block_id=state.block_id, diff --git a/server/lib/nl/fulfillment/ranking_across_places.py b/server/lib/nl/fulfillment/ranking_across_places.py index 9f377c4477..48e89abb6b 100644 --- a/server/lib/nl/fulfillment/ranking_across_places.py +++ b/server/lib/nl/fulfillment/ranking_across_places.py @@ -43,7 +43,6 @@ def populate(uttr: Utterance): if populate_charts( PopulateState(uttr=uttr, main_cb=_populate_cb, - fallback_cb=overview_fallback, place_type=place_type, ranking_types=ranking_types)): return True @@ -52,15 +51,7 @@ def populate(uttr: Utterance): 'ranking-across-places_failed_populate_placetype', place_type.value) - # Fallback - ranking_types = [RankingType.HIGH] - place_type = ContainedInPlaceType.COUNTY - return populate_charts( - PopulateState(uttr=uttr, - main_cb=_populate_cb, - fallback_cb=overview_fallback, - place_type=place_type, - ranking_types=ranking_types)) + return False def _populate_cb(state: PopulateState, chart_vars: ChartVars, diff --git a/server/lib/nl/fulfillment/ranking_across_vars.py b/server/lib/nl/fulfillment/ranking_across_vars.py index e0c40d729b..5191ee170d 100644 --- a/server/lib/nl/fulfillment/ranking_across_vars.py +++ b/server/lib/nl/fulfillment/ranking_across_vars.py @@ -45,7 +45,6 @@ def populate(uttr: Utterance): if populate_charts( PopulateState(uttr=uttr, main_cb=_populate_cb, - fallback_cb=overview_fallback, ranking_types=ranking_types)): return True else: diff --git a/server/lib/nl/fulfillment/simple.py b/server/lib/nl/fulfillment/simple.py index cef7147b6d..8d57c31013 100644 --- a/server/lib/nl/fulfillment/simple.py +++ b/server/lib/nl/fulfillment/simple.py @@ -30,8 +30,7 @@ def populate(uttr: Utterance) -> bool: - return populate_charts( - PopulateState(uttr=uttr, main_cb=_populate_cb, fallback_cb=_fallback_cb)) + return populate_charts(PopulateState(uttr=uttr, main_cb=_populate_cb)) def _populate_cb(state: PopulateState, chart_vars: ChartVars, @@ -66,15 +65,4 @@ def _populate_cb(state: PopulateState, chart_vars: ChartVars, chart_vars.include_percapita = True return add_chart_to_utterance(chart_type, state, chart_vars, places, - chart_origin) - - -def _fallback_cb(state: PopulateState, places: List[Place], - chart_origin: ChartOriginType) -> bool: - # If NO SVs were found, then this is a OVERVIEW chart, added to a new block. - state.block_id += 1 - chart_vars = ChartVars(svs=[], - block_id=state.block_id, - include_percapita=False) - return add_chart_to_utterance(ChartType.PLACE_OVERVIEW, state, chart_vars, - places, chart_origin) + chart_origin) \ No newline at end of file diff --git a/server/lib/nl/fulfillment/time_delta.py b/server/lib/nl/fulfillment/time_delta.py index 496eaee86d..980861712e 100644 --- a/server/lib/nl/fulfillment/time_delta.py +++ b/server/lib/nl/fulfillment/time_delta.py @@ -38,7 +38,6 @@ def populate(uttr: Utterance): return populate_charts( PopulateState(uttr=uttr, main_cb=_populate_cb, - fallback_cb=overview_fallback, ranking_types=ranking_types, time_delta_types=time_delta)) diff --git a/server/lib/nl/fulfillment_next.py b/server/lib/nl/fulfillment_next.py index 397bd54a59..930f9d1ccc 100644 --- a/server/lib/nl/fulfillment_next.py +++ b/server/lib/nl/fulfillment_next.py @@ -16,8 +16,12 @@ import logging from typing import List +from server.lib.nl import utils from server.lib.nl.detection import ClassificationType from server.lib.nl.detection import Detection +from server.lib.nl.detection import NLClassifier +from server.lib.nl.detection import QUERY_TYPE_FALLBACK +from server.lib.nl.detection import RANKED_CLASSIFICATION_TYPES from server.lib.nl.fulfillment import comparison from server.lib.nl.fulfillment import containedin from server.lib.nl.fulfillment import context @@ -47,7 +51,7 @@ def fulfill(query_detection: Detection, # Construct Utterance datastructure. uttr = Utterance(prev_utterance=currentUtterance, query=query_detection.original_query, - query_type=query_detection.query_type, + query_type=ClassificationType.UNKNOWN, detection=query_detection, places=[], classifications=query_detection.classifications, @@ -57,59 +61,98 @@ def fulfill(query_detection: Detection, answerPlaces=[]) uttr.counters['filtered_svs'] = filtered_svs - # If we could not detect query_type from user-query, infer from past context. - if (uttr.query_type == ClassificationType.UNKNOWN): - uttr.query_type = context.query_type_from_context(uttr) - # Add detected places. if (query_detection.places_detected): uttr.places.append(query_detection.places_detected.main_place) + query_type = None + while True: + query_type = _get_next_query_type(query_detection.classifications, + query_type) + if query_type == None: + break + if fulfill_for_query_type(query_detection, uttr, query_type): + rank_charts(uttr) + break + return uttr + + +def fulfill_for_query_type(query_detection: Detection, uttr: Utterance, + query_type: ClassificationType) -> bool: logging.info('Handled query_type: %d', uttr.query_type.value) - fulfillment_type = 'UNHANDLED - ' + str(uttr.query_type.value) + # Reset previous state + uttr.query_type = query_type + uttr.chartCandidates = [] + # If we could not detect query_type from user-query, infer from past context. + if (uttr.query_type == ClassificationType.UNKNOWN): + uttr.query_type = context.query_type_from_context(uttr) + + found = False # Each query-type has its own handler. Each knows what arguments it needs and # will call on the *_from_context() routines to obtain missing arguments. if (uttr.query_type == ClassificationType.OVERVIEW): - if not filtered_svs: + if not uttr.svs: # We detected some overview words ("tell me about") *and* there were # no SVs in current utterance, so consider it a place overview. fulfillment_type = 'OVERVIEW' - overview.populate(uttr) + found = overview.populate(uttr) else: fulfillment_type = 'SIMPLE' - simple.populate(uttr) + found = simple.populate(uttr) elif (uttr.query_type == ClassificationType.SIMPLE): fulfillment_type = 'SIMPLE' - simple.populate(uttr) + found = simple.populate(uttr) elif (uttr.query_type == ClassificationType.CORRELATION): fulfillment_type = 'CORRELATION' - correlation.populate(uttr) + found = correlation.populate(uttr) elif (uttr.query_type == ClassificationType.CONTAINED_IN): fulfillment_type = 'CONTAINED_IN' - containedin.populate(uttr) + found = containedin.populate(uttr) elif (uttr.query_type == ClassificationType.RANKING): current_contained_classification = context.classifications_of_type_from_utterance( uttr, ClassificationType.CONTAINED_IN) if current_contained_classification: fulfillment_type = 'RANKING_ACROSS_PLACES' - ranking_across_places.populate(uttr) + found = ranking_across_places.populate(uttr) else: fulfillment_type = 'RANKING_ACROSS_VARS' - ranking_across_vars.populate(uttr) + found = ranking_across_vars.populate(uttr) elif (uttr.query_type == ClassificationType.COMPARISON): fulfillment_type = 'COMPARISON' - comparison.populate(uttr) + found = comparison.populate(uttr) elif (uttr.query_type == ClassificationType.EVENT): fulfillment_type = 'EVENT' - event.populate(uttr) + found = event.populate(uttr) elif (uttr.query_type == ClassificationType.TIME_DELTA): fulfillment_type = 'TIME_DELTA' - time_delta.populate(uttr) + found = time_delta.populate(uttr) - uttr.counters['fulfillment_type'] = fulfillment_type - rank_charts(uttr) - return uttr + utils.update_counter(uttr.counters, 'fulfillment_type', fulfillment_type) + return found + + +def _get_next_query_type(classifications: List[NLClassifier], + query_type: ClassificationType) -> ClassificationType: + if query_type == None: + return _query_type_from_classifications(classifications) + else: + return QUERY_TYPE_FALLBACK.get(query_type, ClassificationType.SIMPLE) + + +def _query_type_from_classifications(classifications): + ans = ClassificationType.SIMPLE + for cl in classifications: + if (_classification_rank_order(cl.type) > _classification_rank_order(ans)): + ans = cl.type + return ans + + +def _classification_rank_order(cl: ClassificationType) -> int: + if cl in RANKED_CLASSIFICATION_TYPES: + return RANKED_CLASSIFICATION_TYPES.index(cl) + 1 + else: + return 0 # diff --git a/server/lib/nl/page_config_next.py b/server/lib/nl/page_config_next.py index 48781b672b..160c5cc560 100644 --- a/server/lib/nl/page_config_next.py +++ b/server/lib/nl/page_config_next.py @@ -501,9 +501,6 @@ def _event_chart_block(metadata, block, column, place: Place, top_event.display_prop.append('name') top_event.show_start_date = True top_event.show_end_date = True - else: - tile.type = Tile.DISASTER_EVENT_MAP - tile.disaster_event_map_tile_spec.event_type_keys.append(event_id) tile = block.columns.add().tiles.add() tile.type = Tile.DISASTER_EVENT_MAP tile.disaster_event_map_tile_spec.event_type_keys.append(event_id) diff --git a/server/routes/nl_interface_next.py b/server/routes/nl_interface_next.py index 780a46c366..41857cc624 100644 --- a/server/routes/nl_interface_next.py +++ b/server/routes/nl_interface_next.py @@ -32,7 +32,6 @@ from server.lib.nl.detection import NLClassifier from server.lib.nl.detection import Place from server.lib.nl.detection import PlaceDetection -from server.lib.nl.detection import RANKED_CLASSIFICATION_TYPES from server.lib.nl.detection import SimpleClassificationAttributes from server.lib.nl.detection import SVDetection import server.lib.nl.fulfillment_next as fulfillment @@ -309,25 +308,9 @@ def _detection(orig_query, cleaned_query) -> Detection: cleaned_query=cleaned_query, places_detected=place_detection, svs_detected=sv_detection, - query_type=_query_type_from_classifications(classifications), classifications=classifications) -def _query_type_from_classifications(classifications): - ans = ClassificationType.SIMPLE - for cl in classifications: - if (_classification_rank_order(cl.type) > _classification_rank_order(ans)): - ans = cl.type - return ans - - -def _classification_rank_order(cl: ClassificationType) -> int: - if cl in RANKED_CLASSIFICATION_TYPES: - return RANKED_CLASSIFICATION_TYPES.index(cl) + 1 - else: - return 0 - - @bp.route('/', strict_slashes=True) def page(): if (os.environ.get('FLASK_ENV') == 'production' or diff --git a/server/tests/lib/nl/fulfillment_next_test.py b/server/tests/lib/nl/fulfillment_next_test.py index 1ce4cff755..c1311da587 100644 --- a/server/tests/lib/nl/fulfillment_next_test.py +++ b/server/tests/lib/nl/fulfillment_next_test.py @@ -429,7 +429,7 @@ def test_counters_simple(self, mock_sv_existence, mock_single_datapoint, self.maxDiff = None _COUNTERS = { 'filtered_svs': ['Count_Person_Male', 'Count_Person_Female'], - 'fulfillment_type': 'SIMPLE', + 'fulfillment_type': ['SIMPLE'], 'num_chart_candidates': 2, 'stat_var_extensions': [{}] } @@ -458,7 +458,6 @@ def _detection(place: str, svs_to_sentences={}, sv_dcids=svs, sv_scores=scores)) - detection.query_type = query_type if query_type == ClassificationType.COMPARISON: # Set comparison classifier detection.classifications = [ diff --git a/server/tests/lib/nl/test_utterance.py b/server/tests/lib/nl/test_utterance.py index ec5516bf5c..aae7243545 100644 --- a/server/tests/lib/nl/test_utterance.py +++ b/server/tests/lib/nl/test_utterance.py @@ -29,7 +29,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.SIMPLE, + 'query_type': ClassificationType.OVERVIEW, 'ranked_charts': [{ 'attr': { 'block_id': 1, From 1785669633696f4759da0d8720048d36486d1411 Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Fri, 10 Feb 2023 00:37:44 -0800 Subject: [PATCH 2/5] Handle fallback --- server/integration_tests/nlnext_test.py | 11 + .../demo_fallback/query_1/chart_config.json | 34 + .../demo_fallback/query_1/debug_info.json | 185 + .../demo_fallback/query_2/chart_config.json | 451 +++ .../demo_fallback/query_2/debug_info.json | 2990 +++++++++++++++++ .../demo_feb2023/query_1/debug_info.json | 4 +- .../demo_feb2023/query_2/debug_info.json | 8 +- .../demo_feb2023/query_3/debug_info.json | 10 +- .../demo_feb2023/query_4/debug_info.json | 10 +- .../demo_feb2023/query_5/debug_info.json | 12 +- .../demo_feb2023/query_6/debug_info.json | 14 +- .../demo_feb2023/query_7/debug_info.json | 14 +- .../demo_feb2023/query_8/debug_info.json | 14 +- .../demo_feb2023/query_9/debug_info.json | 14 +- .../textbox_sample/query_1/debug_info.json | 4 +- server/lib/nl/detection.py | 36 - server/lib/nl/fulfillment_next.py | 194 +- server/lib/nl/page_config_next.py | 4 +- server/lib/nl/utterance.py | 56 + server/tests/lib/nl/fulfillment_next_test.py | 2 +- server/tests/lib/nl/test_utterance.py | 29 +- static/js/apps/nl_interface/debug_info.tsx | 12 +- 22 files changed, 3941 insertions(+), 167 deletions(-) create mode 100644 server/integration_tests/test_data/demo_fallback/query_1/chart_config.json create mode 100644 server/integration_tests/test_data/demo_fallback/query_1/debug_info.json create mode 100644 server/integration_tests/test_data/demo_fallback/query_2/chart_config.json create mode 100644 server/integration_tests/test_data/demo_fallback/query_2/debug_info.json diff --git a/server/integration_tests/nlnext_test.py b/server/integration_tests/nlnext_test.py index a8f6ea6a48..cdadf27f98 100644 --- a/server/integration_tests/nlnext_test.py +++ b/server/integration_tests/nlnext_test.py @@ -120,3 +120,14 @@ def test_demo_feb2023(self): 'Which counties in the USA have the highest levels of blood pressure', 'How does this correlate with income', ]) + + def test_demo_fallback(self): + self.run_sequence( + 'demo_fallback', + [ + # We have no stats on this, so we should return Palo Alto overview. + 'Number of Shakespeare fans in Palo Alto', + # We have no crime at county-level in CA, so we should fall back as: + # RANKING_ACROSS_PLACES -> CONTAINED_IN -> SIMPLE + 'counties in California with highest crime', + ]) diff --git a/server/integration_tests/test_data/demo_fallback/query_1/chart_config.json b/server/integration_tests/test_data/demo_fallback/query_1/chart_config.json new file mode 100644 index 0000000000..2aa3cd1166 --- /dev/null +++ b/server/integration_tests/test_data/demo_fallback/query_1/chart_config.json @@ -0,0 +1,34 @@ +{ + "config": { + "categories": [ + { + "blocks": [ + { + "columns": [ + { + "tiles": [ + { + "type": "PLACE_OVERVIEW" + } + ] + } + ], + "title": "Palo Alto" + } + ] + } + ], + "metadata": { + "placeDcid": [ + "geoId/0655282" + ] + } + }, + "context": {}, + "debug": {}, + "place": { + "dcid": "geoId/0655282", + "name": "Palo Alto", + "place_type": "City" + } +} \ No newline at end of file diff --git a/server/integration_tests/test_data/demo_fallback/query_1/debug_info.json b/server/integration_tests/test_data/demo_fallback/query_1/debug_info.json new file mode 100644 index 0000000000..71c92e9611 --- /dev/null +++ b/server/integration_tests/test_data/demo_fallback/query_1/debug_info.json @@ -0,0 +1,185 @@ +{ + "clustering_classification": "", + "comparison_classification": "", + "contained_in_classification": "", + "correlation_classification": "", + "counters": { + "failed_populate_main_place": [ + "geoId/0655282" + ], + "filtered_svs": [], + "num_chart_candidates": 1, + "num_populate_fallbacks": 1, + "processed_fulfillment_types": [ + "simple", + "overview" + ] + }, + "data_spec": [ + { + "classifications": [ + { + "type": 11 + } + ], + "places": [ + { + "dcid": "geoId/0655282", + "name": "Palo Alto", + "place_type": "City" + } + ], + "query": "Number of Shakespeare fans in Palo Alto", + "query_type": 9, + "ranked_charts": [ + { + "attr": { + "block_id": 1, + "chart_type": "", + "class": 0, + "description": "", + "include_percapita": false, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 4, + "event": null, + "places": [ + { + "dcid": "geoId/0655282", + "name": "Palo Alto", + "place_type": "City" + } + ], + "svs": [] + } + ], + "svs": [] + } + ], + "event_classification": "", + "main_place_dcid": "geoId/0655282", + "main_place_name": "Palo Alto", + "original_query": "Number of Shakespeare fans in Palo Alto", + "overview_classification": "", + "places_detected": [ + "palo alto" + ], + "query_with_places_removed": "number of shakespeare fans", + "ranking_classification": "", + "status": "", + "sv_matching": { + "CosineScore": [ + 0.3691325783729553, + 0.29036542773246765, + 0.2894546687602997, + 0.2783313989639282, + 0.272920161485672, + 0.2691501975059509, + 0.2653329074382782, + 0.26523518562316895, + 0.2610829472541809, + 0.2539288103580475 + ], + "SV": [ + "Count_HeavySnowEvent", + "Count_Person_Male", + "Count_CriminalIncidents_IsHateCrime", + "Count_EarthquakeEvent", + "Count_Person_5To9Years", + "Count_CriminalActivities_Robbery", + "Count_HeavyRainEvent", + "Count_Worker_NAICSArtsEntertainmentRecreation", + "Count_DroughtEvent", + "Count_FloodEvent" + ], + "SV_to_Sentences": { + "Count_CriminalActivities_Robbery": [ + "Number of heists (0.2691501975059509)" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Number of hate crimes (0.2894546687602997)", + "Number of Hate Crime Incidents (0.25507885217666626)", + "Number of hate crime incidents (0.25507885217666626)" + ], + "Count_DroughtEvent": [ + "Number of Droughts (0.2610829472541809)", + "Number of droughts (0.2610829174518585)" + ], + "Count_EarthquakeEvent": [ + "Number of tremors (0.2783313989639282)", + "Number of temblors (0.27476659417152405)", + "Number of quakes (0.27175652980804443)", + "Number of Earthquakes (0.25374898314476013)" + ], + "Count_FloodEvent": [ + "Number of Floods (0.2539288103580475)", + "Number of floods (0.2539288103580475)" + ], + "Count_HeavyRainEvent": [ + "Number of heavy rains (0.2653329074382782)", + "Number of Heavy Rains (0.2653329074382782)" + ], + "Count_HeavySnowEvent": [ + "Number of blizzards (0.3691325783729553)" + ], + "Count_Person_5To9Years": [ + "Number of 5 to 9 year old people (0.272920161485672)" + ], + "Count_Person_Male": [ + "Number of Males (0.29036542773246765)" + ], + "Count_Worker_NAICSArtsEntertainmentRecreation": [ + "Employment numbers in entertainment and recreation (0.26523518562316895)", + "number of arts, entertainment, and recreation workers (0.25554004311561584)", + "Population of Person: Arts, Entertainment, And Recreation (NAICS/71) (0.25426241755485535)" + ] + } + }, + "svs_to_sentences": { + "Count_CriminalActivities_Robbery": [ + "Number of heists (0.2691501975059509)" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Number of hate crimes (0.2894546687602997)", + "Number of Hate Crime Incidents (0.25507885217666626)", + "Number of hate crime incidents (0.25507885217666626)" + ], + "Count_DroughtEvent": [ + "Number of Droughts (0.2610829472541809)", + "Number of droughts (0.2610829174518585)" + ], + "Count_EarthquakeEvent": [ + "Number of tremors (0.2783313989639282)", + "Number of temblors (0.27476659417152405)", + "Number of quakes (0.27175652980804443)", + "Number of Earthquakes (0.25374898314476013)" + ], + "Count_FloodEvent": [ + "Number of Floods (0.2539288103580475)", + "Number of floods (0.2539288103580475)" + ], + "Count_HeavyRainEvent": [ + "Number of heavy rains (0.2653329074382782)", + "Number of Heavy Rains (0.2653329074382782)" + ], + "Count_HeavySnowEvent": [ + "Number of blizzards (0.3691325783729553)" + ], + "Count_Person_5To9Years": [ + "Number of 5 to 9 year old people (0.272920161485672)" + ], + "Count_Person_Male": [ + "Number of Males (0.29036542773246765)" + ], + "Count_Worker_NAICSArtsEntertainmentRecreation": [ + "Employment numbers in entertainment and recreation (0.26523518562316895)", + "number of arts, entertainment, and recreation workers (0.25554004311561584)", + "Population of Person: Arts, Entertainment, And Recreation (NAICS/71) (0.25426241755485535)" + ] + }, + "temporal_classification": "", + "time_delta_classification": "" +} \ No newline at end of file diff --git a/server/integration_tests/test_data/demo_fallback/query_2/chart_config.json b/server/integration_tests/test_data/demo_fallback/query_2/chart_config.json new file mode 100644 index 0000000000..eab6239e86 --- /dev/null +++ b/server/integration_tests/test_data/demo_fallback/query_2/chart_config.json @@ -0,0 +1,451 @@ +{ + "config": { + "categories": [ + { + "blocks": [ + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_CombinedCrime" + ], + "title": "Criminal Activities in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_CombinedCrime_pc" + ], + "title": "Per Capita Criminal Activities in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_LarcenyTheft" + ], + "title": "Larceny Theft Cases in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_LarcenyTheft_pc" + ], + "title": "Per Capita Larceny Theft Cases in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "comparisonPlaces": [ + "geoId/06" + ], + "statVarKey": [ + "Count_CriminalActivities_AggravatedAssault_multiple_place_bar_block", + "Count_CriminalActivities_Burglary_multiple_place_bar_block", + "Count_CriminalActivities_ForcibleRape_multiple_place_bar_block", + "Count_CriminalActivities_LarcenyTheft_multiple_place_bar_block", + "Count_CriminalActivities_MotorVehicleTheft_multiple_place_bar_block", + "Count_CriminalActivities_PropertyCrime_multiple_place_bar_block", + "Count_CriminalActivities_Robbery_multiple_place_bar_block", + "Count_CriminalActivities_ViolentCrime_multiple_place_bar_block" + ], + "title": "Compared with Other Variables in California", + "type": "BAR" + }, + { + "comparisonPlaces": [ + "geoId/06" + ], + "statVarKey": [ + "Count_CriminalActivities_AggravatedAssault_multiple_place_bar_block_pc", + "Count_CriminalActivities_Burglary_multiple_place_bar_block_pc", + "Count_CriminalActivities_ForcibleRape_multiple_place_bar_block_pc", + "Count_CriminalActivities_LarcenyTheft_multiple_place_bar_block_pc", + "Count_CriminalActivities_MotorVehicleTheft_multiple_place_bar_block_pc", + "Count_CriminalActivities_PropertyCrime_multiple_place_bar_block_pc", + "Count_CriminalActivities_Robbery_multiple_place_bar_block_pc", + "Count_CriminalActivities_ViolentCrime_multiple_place_bar_block_pc" + ], + "title": "Per Capita Compared with Other Variables in California", + "type": "BAR" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_MotorVehicleTheft" + ], + "title": "Motor Vehicle Thefts in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_MotorVehicleTheft_pc" + ], + "title": "Per Capita Motor Vehicle Thefts in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalIncidents_IsHateCrime" + ], + "title": "Hate Crime Incidents in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalIncidents_IsHateCrime_pc" + ], + "title": "Per Capita Hate Crime Incidents in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_Robbery" + ], + "title": "Robberies in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_Robbery_pc" + ], + "title": "Per Capita Robberies in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_ViolentCrime" + ], + "title": "Violent Crimes in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_ViolentCrime_pc" + ], + "title": "Per Capita Violent Crimes in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_ForcibleRape" + ], + "title": "Forcible Rapes in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_ForcibleRape_pc" + ], + "title": "Per Capita Forcible Rapes in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_PropertyCrime" + ], + "title": "Property Related Crimes in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_PropertyCrime_pc" + ], + "title": "Per Capita Property Related Crimes in California", + "type": "LINE" + } + ] + } + ] + }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_CriminalActivities_Burglary" + ], + "title": "Burglaries in California", + "type": "LINE" + }, + { + "statVarKey": [ + "Count_CriminalActivities_Burglary_pc" + ], + "title": "Per Capita Burglaries in California", + "type": "LINE" + } + ] + } + ] + } + ], + "statVarSpec": { + "Count_CriminalActivities_AggravatedAssault_multiple_place_bar_block": { + "name": "Aggravated Assault Cases", + "statVar": "Count_CriminalActivities_AggravatedAssault" + }, + "Count_CriminalActivities_AggravatedAssault_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Aggravated Assault Cases", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_AggravatedAssault", + "unit": "%" + }, + "Count_CriminalActivities_Burglary": { + "name": "Burglaries", + "statVar": "Count_CriminalActivities_Burglary" + }, + "Count_CriminalActivities_Burglary_multiple_place_bar_block": { + "name": "Burglaries", + "statVar": "Count_CriminalActivities_Burglary" + }, + "Count_CriminalActivities_Burglary_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Burglaries", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_Burglary", + "unit": "%" + }, + "Count_CriminalActivities_Burglary_pc": { + "denom": "Count_Person", + "name": "Burglaries", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_Burglary", + "unit": "%" + }, + "Count_CriminalActivities_CombinedCrime": { + "name": "Criminal Activities", + "statVar": "Count_CriminalActivities_CombinedCrime" + }, + "Count_CriminalActivities_CombinedCrime_pc": { + "denom": "Count_Person", + "name": "Criminal Activities", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_CombinedCrime", + "unit": "%" + }, + "Count_CriminalActivities_ForcibleRape": { + "name": "Forcible Rapes", + "statVar": "Count_CriminalActivities_ForcibleRape" + }, + "Count_CriminalActivities_ForcibleRape_multiple_place_bar_block": { + "name": "Forcible Rapes", + "statVar": "Count_CriminalActivities_ForcibleRape" + }, + "Count_CriminalActivities_ForcibleRape_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Forcible Rapes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_ForcibleRape", + "unit": "%" + }, + "Count_CriminalActivities_ForcibleRape_pc": { + "denom": "Count_Person", + "name": "Forcible Rapes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_ForcibleRape", + "unit": "%" + }, + "Count_CriminalActivities_LarcenyTheft": { + "name": "Larceny Theft Cases", + "statVar": "Count_CriminalActivities_LarcenyTheft" + }, + "Count_CriminalActivities_LarcenyTheft_multiple_place_bar_block": { + "name": "Larceny Theft Cases", + "statVar": "Count_CriminalActivities_LarcenyTheft" + }, + "Count_CriminalActivities_LarcenyTheft_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Larceny Theft Cases", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_LarcenyTheft", + "unit": "%" + }, + "Count_CriminalActivities_LarcenyTheft_pc": { + "denom": "Count_Person", + "name": "Larceny Theft Cases", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_LarcenyTheft", + "unit": "%" + }, + "Count_CriminalActivities_MotorVehicleTheft": { + "name": "Motor Vehicle Thefts", + "statVar": "Count_CriminalActivities_MotorVehicleTheft" + }, + "Count_CriminalActivities_MotorVehicleTheft_multiple_place_bar_block": { + "name": "Motor Vehicle Thefts", + "statVar": "Count_CriminalActivities_MotorVehicleTheft" + }, + "Count_CriminalActivities_MotorVehicleTheft_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Motor Vehicle Thefts", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_MotorVehicleTheft", + "unit": "%" + }, + "Count_CriminalActivities_MotorVehicleTheft_pc": { + "denom": "Count_Person", + "name": "Motor Vehicle Thefts", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_MotorVehicleTheft", + "unit": "%" + }, + "Count_CriminalActivities_PropertyCrime": { + "name": "Property Related Crimes", + "statVar": "Count_CriminalActivities_PropertyCrime" + }, + "Count_CriminalActivities_PropertyCrime_multiple_place_bar_block": { + "name": "Property Related Crimes", + "statVar": "Count_CriminalActivities_PropertyCrime" + }, + "Count_CriminalActivities_PropertyCrime_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Property Related Crimes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_PropertyCrime", + "unit": "%" + }, + "Count_CriminalActivities_PropertyCrime_pc": { + "denom": "Count_Person", + "name": "Property Related Crimes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_PropertyCrime", + "unit": "%" + }, + "Count_CriminalActivities_Robbery": { + "name": "Robberies", + "statVar": "Count_CriminalActivities_Robbery" + }, + "Count_CriminalActivities_Robbery_multiple_place_bar_block": { + "name": "Robberies", + "statVar": "Count_CriminalActivities_Robbery" + }, + "Count_CriminalActivities_Robbery_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Robberies", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_Robbery", + "unit": "%" + }, + "Count_CriminalActivities_Robbery_pc": { + "denom": "Count_Person", + "name": "Robberies", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_Robbery", + "unit": "%" + }, + "Count_CriminalActivities_ViolentCrime": { + "name": "Violent Crimes", + "statVar": "Count_CriminalActivities_ViolentCrime" + }, + "Count_CriminalActivities_ViolentCrime_multiple_place_bar_block": { + "name": "Violent Crimes", + "statVar": "Count_CriminalActivities_ViolentCrime" + }, + "Count_CriminalActivities_ViolentCrime_multiple_place_bar_block_pc": { + "denom": "Count_Person", + "name": "Violent Crimes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_ViolentCrime", + "unit": "%" + }, + "Count_CriminalActivities_ViolentCrime_pc": { + "denom": "Count_Person", + "name": "Violent Crimes", + "scaling": 100.0, + "statVar": "Count_CriminalActivities_ViolentCrime", + "unit": "%" + }, + "Count_CriminalIncidents_IsHateCrime": { + "name": "Hate Crime Incidents", + "statVar": "Count_CriminalIncidents_IsHateCrime" + }, + "Count_CriminalIncidents_IsHateCrime_pc": { + "denom": "Count_Person", + "name": "Hate Crime Incidents", + "scaling": 100.0, + "statVar": "Count_CriminalIncidents_IsHateCrime", + "unit": "%" + } + } + } + ], + "metadata": { + "placeDcid": [ + "geoId/06" + ] + } + }, + "context": {}, + "debug": {}, + "place": { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } +} \ No newline at end of file diff --git a/server/integration_tests/test_data/demo_fallback/query_2/debug_info.json b/server/integration_tests/test_data/demo_fallback/query_2/debug_info.json new file mode 100644 index 0000000000..2791cc1faa --- /dev/null +++ b/server/integration_tests/test_data/demo_fallback/query_2/debug_info.json @@ -0,0 +1,2990 @@ +{ + "clustering_classification": "", + "comparison_classification": "", + "contained_in_classification": "ContainedInPlaceType.COUNTY", + "correlation_classification": "", + "counters": { + "child_places_result": [ + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + }, + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + }, + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/06", + "result": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + }, + { + "place": "geoId/0655282", + "result": [], + "type": "County" + } + ], + "containedin_failed_populate_fallback": [ + "County" + ], + "containedin_failed_populate_placetype": [ + "County" + ], + "failed_existence_check": [ + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_MotorVehicleTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Robbery" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ViolentCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_PropertyCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Burglary" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Arson" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_MotorVehicleTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Robbery" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ViolentCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_PropertyCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Burglary" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Arson" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_MotorVehicleTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Robbery" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ViolentCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_PropertyCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Burglary" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_Arson" + ] + }, + { + "places": [ + "geoId/06" + ], + "svs": [ + "Count_CriminalActivities_Arson" + ] + } + ], + "failed_existence_check_extended_svs": [ + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "places": [ + "geoId/06001", + "geoId/06003", + "geoId/06005", + "geoId/06007", + "geoId/06009", + "geoId/06011", + "geoId/06013", + "geoId/06015", + "geoId/06017", + "geoId/06019", + "geoId/06021", + "geoId/06023", + "geoId/06025", + "geoId/06027", + "geoId/06029", + "geoId/06031", + "geoId/06033", + "geoId/06035", + "geoId/06037", + "geoId/06039" + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_LarcenyTheft" + ] + } + ], + "failed_populate_context_place": [ + "geoId/0655282", + "geoId/0655282", + "geoId/0655282" + ], + "failed_populate_context_svs": [ + [], + [], + [], + [], + [], + [] + ], + "failed_populate_main_place": [ + "geoId/06", + "geoId/06", + "geoId/06" + ], + "failed_populate_main_svs": [ + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ] + ], + "filtered_svs": [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + "num_chart_candidates": 10, + "num_populate_fallbacks": 6, + "processed_fulfillment_types": [ + "ranking_across_places", + "containedin", + "simple" + ], + "ranking-across-places_failed_populate_placetype": [ + "County" + ], + "stat_var_extensions": [ + { + "Count_CriminalActivities_Arson": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Burglary": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Count_CriminalActivities_CombinedCrime" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Robbery": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + {}, + { + "Count_CriminalActivities_Arson": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Burglary": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Count_CriminalActivities_CombinedCrime" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Robbery": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + {}, + { + "Count_CriminalActivities_Arson": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Burglary": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Count_CriminalActivities_CombinedCrime" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Robbery": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + {}, + { + "Count_CriminalActivities_Arson": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Burglary": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Count_CriminalActivities_CombinedCrime" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_Robbery": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Arson", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Count_CriminalIncidents_IsHateCrime" + ] + } + ] + }, + "data_spec": [ + { + "classifications": [ + { + "ranking_type": [ + 1 + ], + "type": 2 + }, + { + "contained_in_place_type": "County", + "type": 4 + } + ], + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "query": "counties in California with highest crime", + "query_type": 1, + "ranked_charts": [ + { + "attr": { + "block_id": 1, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime" + ] + }, + { + "attr": { + "block_id": 2, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_LarcenyTheft" + ] + }, + { + "attr": { + "block_id": 3, + "chart_type": "bar chart", + "class": 1, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 3, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_AggravatedAssault", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime" + ] + }, + { + "attr": { + "block_id": 4, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_MotorVehicleTheft" + ] + }, + { + "attr": { + "block_id": 5, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalIncidents_IsHateCrime" + ] + }, + { + "attr": { + "block_id": 6, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_Robbery" + ] + }, + { + "attr": { + "block_id": 7, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_ViolentCrime" + ] + }, + { + "attr": { + "block_id": 8, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_ForcibleRape" + ] + }, + { + "attr": { + "block_id": 9, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_PropertyCrime" + ] + }, + { + "attr": { + "block_id": 10, + "chart_type": "timeline", + "class": 0, + "description": "", + "include_percapita": true, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 0, + "event": null, + "places": [ + { + "dcid": "geoId/06", + "name": "California", + "place_type": "State" + } + ], + "svs": [ + "Count_CriminalActivities_Burglary" + ] + } + ], + "svs": [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ] + }, + { + "classifications": [ + { + "type": 11 + } + ], + "places": [ + { + "dcid": "geoId/0655282", + "name": "Palo Alto", + "place_type": "City" + } + ], + "query": "Number of Shakespeare fans in Palo Alto", + "query_type": 9, + "ranked_charts": [ + { + "attr": { + "block_id": 1, + "chart_type": "", + "class": 0, + "description": "", + "include_percapita": false, + "place_type": null, + "ranking_types": [], + "source_topic": "", + "title": "" + }, + "chart_type": 4, + "event": null, + "places": [ + { + "dcid": "geoId/0655282", + "name": "Palo Alto", + "place_type": "City" + } + ], + "svs": [] + } + ], + "svs": [] + } + ], + "event_classification": "", + "main_place_dcid": "geoId/06", + "main_place_name": "California", + "original_query": "counties in California with highest crime", + "overview_classification": "", + "places_detected": [ + "california" + ], + "query_with_places_removed": "counties with highest crime", + "ranking_classification": "[]", + "status": "", + "sv_matching": { + "CosineScore": [ + 0.6829185485839844, + 0.6189736127853394, + 0.5930737257003784, + 0.5889496803283691, + 0.5793907642364502, + 0.557040274143219, + 0.5402758717536926, + 0.5143426060676575, + 0.5142109394073486, + 0.5070270299911499 + ], + "SV": [ + "Count_CriminalActivities_CombinedCrime", + "Count_CriminalActivities_LarcenyTheft", + "Count_CriminalActivities_MotorVehicleTheft", + "Count_CriminalIncidents_IsHateCrime", + "Count_CriminalActivities_Robbery", + "Count_CriminalActivities_ViolentCrime", + "Count_CriminalActivities_ForcibleRape", + "Count_CriminalActivities_PropertyCrime", + "Count_CriminalActivities_Burglary", + "Count_CriminalActivities_Arson" + ], + "SV_to_Sentences": { + "Count_CriminalActivities_Arson": [ + "Count of Criminal Activities: Arson (0.5070270299911499)" + ], + "Count_CriminalActivities_Burglary": [ + "Count of Criminal Activities: Burglary (0.5142109394073486)" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Crime statistics (0.6829185485839844)", + "Crime rate (0.6390458941459656)", + "Rate of crime (0.6103023290634155)", + "Number of crime cases (0.5476557612419128)", + "Number of Criminal Activities (0.526296854019165)", + "Number of criminal activities (0.526296854019165)" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count of Criminal Activities: Forcible Rape (0.5402758717536926)" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count of Criminal Activities: Larceny Theft (0.6189736127853394)", + "Number of crimes counted as Larceny Theft (0.539699375629425)", + "Number of larceny theft crimes (0.5368750691413879)" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count of Criminal Activities: Motor Vehicle Theft (0.5930737257003784)" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Number of property crimes (0.5143426060676575)", + "Number of Property Related Crimes (0.5140829682350159)" + ], + "Count_CriminalActivities_Robbery": [ + "Count of Criminal Activities: Robbery (0.5793907642364502)" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count of Criminal Activities: Violent (0.557040274143219)", + "Number of violent crimes (0.5358309745788574)", + "Number of Violent Crimes (0.5358309745788574)" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Hate crime incidents (0.5889496803283691)" + ] + } + }, + "svs_to_sentences": { + "Count_CriminalActivities_Arson": [ + "Count of Criminal Activities: Arson (0.5070270299911499)" + ], + "Count_CriminalActivities_Burglary": [ + "Count of Criminal Activities: Burglary (0.5142109394073486)" + ], + "Count_CriminalActivities_CombinedCrime": [ + "Crime statistics (0.6829185485839844)", + "Crime rate (0.6390458941459656)", + "Rate of crime (0.6103023290634155)", + "Number of crime cases (0.5476557612419128)", + "Number of Criminal Activities (0.526296854019165)", + "Number of criminal activities (0.526296854019165)" + ], + "Count_CriminalActivities_ForcibleRape": [ + "Count of Criminal Activities: Forcible Rape (0.5402758717536926)" + ], + "Count_CriminalActivities_LarcenyTheft": [ + "Count of Criminal Activities: Larceny Theft (0.6189736127853394)", + "Number of crimes counted as Larceny Theft (0.539699375629425)", + "Number of larceny theft crimes (0.5368750691413879)" + ], + "Count_CriminalActivities_MotorVehicleTheft": [ + "Count of Criminal Activities: Motor Vehicle Theft (0.5930737257003784)" + ], + "Count_CriminalActivities_PropertyCrime": [ + "Number of property crimes (0.5143426060676575)", + "Number of Property Related Crimes (0.5140829682350159)" + ], + "Count_CriminalActivities_Robbery": [ + "Count of Criminal Activities: Robbery (0.5793907642364502)" + ], + "Count_CriminalActivities_ViolentCrime": [ + "Count of Criminal Activities: Violent (0.557040274143219)", + "Number of violent crimes (0.5358309745788574)", + "Number of Violent Crimes (0.5358309745788574)" + ], + "Count_CriminalIncidents_IsHateCrime": [ + "Hate crime incidents (0.5889496803283691)" + ] + }, + "temporal_classification": "", + "time_delta_classification": "" +} \ No newline at end of file diff --git a/server/integration_tests/test_data/demo_feb2023/query_1/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_1/debug_info.json index cbf10e478e..4d3d48d4ee 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_1/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_1/debug_info.json @@ -97,8 +97,10 @@ "dc/topic/ProjectedClimateExtremes", "Count_HeatEvent" ], - "fulfillment_type": "RANKING_ACROSS_PLACES", "num_chart_candidates": 2, + "processed_fulfillment_types": [ + "ranking_across_places" + ], "stat_var_extensions": [ { "Count_HeatEvent": [ diff --git a/server/integration_tests/test_data/demo_feb2023/query_2/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_2/debug_info.json index bfd4ee636a..1f3ae84f2a 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_2/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_2/debug_info.json @@ -7,8 +7,10 @@ "filtered_svs": [ "Count_WildfireEvent" ], - "fulfillment_type": "EVENT", - "num_chart_candidates": 1 + "num_chart_candidates": 1, + "processed_fulfillment_types": [ + "event" + ] }, "data_spec": [ { @@ -28,7 +30,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_3/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_3/debug_info.json index 643cfc69fc..d117cce7c6 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_3/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_3/debug_info.json @@ -5,8 +5,10 @@ "correlation_classification": "", "counters": { "filtered_svs": [], - "fulfillment_type": "OVERVIEW", - "num_chart_candidates": 1 + "num_chart_candidates": 1, + "processed_fulfillment_types": [ + "overview" + ] }, "data_spec": [ { @@ -23,7 +25,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -68,7 +70,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_4/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_4/debug_info.json index 8f0a240677..0733e3f265 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_4/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_4/debug_info.json @@ -13,8 +13,10 @@ "dc/g/Person_Industry-NAICS/11", "dc/g/Person_Industry-NAICS/451" ], - "fulfillment_type": "RANKING_ACROSS_VARS", "num_chart_candidates": 1, + "processed_fulfillment_types": [ + "ranking_across_vars" + ], "ranking-across-vars_failed_cb_notpeergroup": [ [ "Count_Worker_NAICSTotalAllIndustries", @@ -224,7 +226,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -294,7 +296,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -339,7 +341,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_5/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_5/debug_info.json index c39cfbc579..4d147f06a3 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_5/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_5/debug_info.json @@ -7,8 +7,10 @@ "filtered_svs": [ "dc/topic/Jobs" ], - "fulfillment_type": "TIME_DELTA", "num_chart_candidates": 15, + "processed_fulfillment_types": [ + "time_delta" + ], "stat_var_extensions": [ {} ], @@ -109,7 +111,7 @@ ], "places": [], "query": "Which jobs have grown the most", - "query_type": 8, + "query_type": 7, "ranked_charts": [ { "attr": { @@ -532,7 +534,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -602,7 +604,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -647,7 +649,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_6/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_6/debug_info.json index 95077bc2a7..5ccec69e4d 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_6/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_6/debug_info.json @@ -12,8 +12,10 @@ "dc/g/Person_MedicalCondition-PhysicalHealthNotGood", "Percent_Person_18To64Years_ReceivedNoHealthInsurance" ], - "fulfillment_type": "RANKING_ACROSS_VARS", "num_chart_candidates": 1, + "processed_fulfillment_types": [ + "ranking_across_vars" + ], "ranking-across-vars_failed_cb_notpeergroup": [ [ "Percent_Person_WithArthritis", @@ -132,7 +134,7 @@ ], "places": [], "query": "What are the most common health issues there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -197,7 +199,7 @@ ], "places": [], "query": "Which jobs have grown the most", - "query_type": 8, + "query_type": 7, "ranked_charts": [ { "attr": { @@ -620,7 +622,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -690,7 +692,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -735,7 +737,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_7/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_7/debug_info.json index 83d43efbcc..0014bf4551 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_7/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_7/debug_info.json @@ -37,8 +37,10 @@ "dc/g/Person_MedicalCondition-HighBloodPressure", "dc/g/Person_MedicalCondition-HighBloodPressure_PreventiveHealth-TakingBloodPressureMedication" ], - "fulfillment_type": "RANKING_ACROSS_PLACES", "num_chart_candidates": 2, + "processed_fulfillment_types": [ + "ranking_across_places" + ], "stat_var_extensions": [ { "Percent_Person_WithHighBloodPressure": [ @@ -166,7 +168,7 @@ ], "places": [], "query": "What are the most common health issues there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -231,7 +233,7 @@ ], "places": [], "query": "Which jobs have grown the most", - "query_type": 8, + "query_type": 7, "ranked_charts": [ { "attr": { @@ -654,7 +656,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -724,7 +726,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -769,7 +771,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_8/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_8/debug_info.json index c401e05718..3b0d389663 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_8/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_8/debug_info.json @@ -37,8 +37,10 @@ "dc/g/Person_MedicalCondition-HighBloodPressure", "dc/g/Person_MedicalCondition-HighBloodPressure_PreventiveHealth-TakingBloodPressureMedication" ], - "fulfillment_type": "RANKING_ACROSS_PLACES", "num_chart_candidates": 2, + "processed_fulfillment_types": [ + "ranking_across_places" + ], "stat_var_extensions": [ { "Percent_Person_WithHighBloodPressure": [ @@ -261,7 +263,7 @@ ], "places": [], "query": "What are the most common health issues there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -326,7 +328,7 @@ ], "places": [], "query": "Which jobs have grown the most", - "query_type": 8, + "query_type": 7, "ranked_charts": [ { "attr": { @@ -749,7 +751,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -819,7 +821,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -864,7 +866,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/demo_feb2023/query_9/debug_info.json b/server/integration_tests/test_data/demo_feb2023/query_9/debug_info.json index c3b1c7e6c8..e1465e0669 100644 --- a/server/integration_tests/test_data/demo_feb2023/query_9/debug_info.json +++ b/server/integration_tests/test_data/demo_feb2023/query_9/debug_info.json @@ -64,8 +64,10 @@ "WagesTotal_Worker_NAICSManagementOfCompaniesEnterprises", "WagesTotal_Worker_NAICSUtilities" ], - "fulfillment_type": "CORRELATION", "num_chart_candidates": 5, + "processed_fulfillment_types": [ + "correlation" + ], "topics_processed": [ { "dc/topic/Income": { @@ -455,7 +457,7 @@ ], "places": [], "query": "What are the most common health issues there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -520,7 +522,7 @@ ], "places": [], "query": "Which jobs have grown the most", - "query_type": 8, + "query_type": 7, "ranked_charts": [ { "attr": { @@ -943,7 +945,7 @@ ], "places": [], "query": "What were the most common jobs there", - "query_type": 2, + "query_type": 3, "ranked_charts": [ { "attr": { @@ -1013,7 +1015,7 @@ } ], "query": "Tell me about Placer County", - "query_type": 10, + "query_type": 9, "ranked_charts": [ { "attr": { @@ -1058,7 +1060,7 @@ ], "places": [], "query": "Where were the major fires in the last year", - "query_type": 9, + "query_type": 8, "ranked_charts": [ { "attr": { diff --git a/server/integration_tests/test_data/textbox_sample/query_1/debug_info.json b/server/integration_tests/test_data/textbox_sample/query_1/debug_info.json index 74b548f556..3ba7ac9ae1 100644 --- a/server/integration_tests/test_data/textbox_sample/query_1/debug_info.json +++ b/server/integration_tests/test_data/textbox_sample/query_1/debug_info.json @@ -12,8 +12,10 @@ "Median_Income_Household_MarriedCoupleFamilyHousehold", "Median_Income_Household" ], - "fulfillment_type": "SIMPLE", "num_chart_candidates": 7, + "processed_fulfillment_types": [ + "simple" + ], "stat_var_extensions": [ { "Mean_Income_Household_FamilyHousehold": [ diff --git a/server/lib/nl/detection.py b/server/lib/nl/detection.py index 3c9cb6e8c3..fc8b763654 100644 --- a/server/lib/nl/detection.py +++ b/server/lib/nl/detection.py @@ -243,42 +243,6 @@ class ClassificationType(IntEnum): UNKNOWN = 11 -# The supported classifications in order. Later entry is preferred. -RANKED_CLASSIFICATION_TYPES = [ - ClassificationType.SIMPLE, - ClassificationType.COMPARISON, - ClassificationType.CONTAINED_IN, - ClassificationType.RANKING, - ClassificationType.CORRELATION, - ClassificationType.TIME_DELTA, - ClassificationType.EVENT, - ClassificationType.OVERVIEW, -] - -QUERY_TYPE_FALLBACK = { - # No fallback - ClassificationType.OVERVIEW: - None, - ClassificationType.SIMPLE: - None, - - ClassificationType.EVENT: - ClassificationType.SIMPLE, - ClassificationType.TIME_DELTA: - ClassificationType.RANKING, - ClassificationType.RANKING: - ClassificationType.CONTAINED_IN, - ClassificationType.CONTAINED_IN: - ClassificationType.SIMPLE, - - # Not fully sure about this fallback. - ClassificationType.CORRELATION: - ClassificationType.COMPARISON, - ClassificationType.COMPARISON: - ClassificationType.CONTAINED_IN, -} - - @dataclass class NLClassifier: """Classifier.""" diff --git a/server/lib/nl/fulfillment_next.py b/server/lib/nl/fulfillment_next.py index 930f9d1ccc..331f57fa2c 100644 --- a/server/lib/nl/fulfillment_next.py +++ b/server/lib/nl/fulfillment_next.py @@ -20,8 +20,6 @@ from server.lib.nl.detection import ClassificationType from server.lib.nl.detection import Detection from server.lib.nl.detection import NLClassifier -from server.lib.nl.detection import QUERY_TYPE_FALLBACK -from server.lib.nl.detection import RANKED_CLASSIFICATION_TYPES from server.lib.nl.fulfillment import comparison from server.lib.nl.fulfillment import containedin from server.lib.nl.fulfillment import context @@ -32,11 +30,75 @@ from server.lib.nl.fulfillment import ranking_across_vars from server.lib.nl.fulfillment import simple from server.lib.nl.fulfillment import time_delta +from server.lib.nl.utterance import QueryType from server.lib.nl.utterance import Utterance # We will ignore SV detections that are below this threshold _SV_THRESHOLD = 0.5 +QUERY_TYPE_HANDLERS = { + QueryType.SIMPLE: simple, + QueryType.COMPARISON: comparison, + QueryType.CONTAINED_IN: containedin, + QueryType.RANKING_ACROSS_VARS: ranking_across_vars, + QueryType.RANKING_ACROSS_PLACES: ranking_across_places, + QueryType.CORRELATION: correlation, + QueryType.TIME_DELTA: time_delta, + QueryType.EVENT: event, + QueryType.OVERVIEW: overview, +} + +# The supported rankings in order. Later entry is preferred. +RANKED_QUERY_TYPES = [ + QueryType.SIMPLE, + QueryType.COMPARISON, + QueryType.CONTAINED_IN, + QueryType.RANKING_ACROSS_VARS, + QueryType.RANKING_ACROSS_PLACES, + QueryType.CORRELATION, + QueryType.TIME_DELTA, + QueryType.EVENT, + QueryType.OVERVIEW, +] + +# The ClassificationTypes not in this map rely on additional fields of detection. +DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE = { + ClassificationType.SIMPLE: + QueryType.SIMPLE, + ClassificationType.CONTAINED_IN: + QueryType.CONTAINED_IN, + ClassificationType.CORRELATION: + QueryType.CORRELATION, + ClassificationType.COMPARISON: + QueryType.COMPARISON, + ClassificationType.TIME_DELTA: + QueryType.TIME_DELTA, + ClassificationType.EVENT: + QueryType.EVENT, + + # Unsupported classification-types. Map them to SIMPLE for now. + # TODO: Handle this better. + ClassificationType.UNKNOWN: + QueryType.SIMPLE, + ClassificationType.OTHER: + QueryType.SIMPLE, + ClassificationType.TEMPORAL: + QueryType.SIMPLE, + ClassificationType.CLUSTERING: + QueryType.SIMPLE, +} + +DIRECT_QUERY_TYPE_FALLBACK = { + # No fallback + QueryType.OVERVIEW: None, + QueryType.SIMPLE: QueryType.OVERVIEW, + QueryType.EVENT: QueryType.SIMPLE, + QueryType.CONTAINED_IN: QueryType.SIMPLE, + QueryType.RANKING_ACROSS_VARS: QueryType.SIMPLE, + QueryType.RANKING_ACROSS_PLACES: QueryType.CONTAINED_IN, + QueryType.TIME_DELTA: QueryType.CONTAINED_IN, +} + # # Compute a new Utterance given the classifications for a user query @@ -65,94 +127,94 @@ def fulfill(query_detection: Detection, if (query_detection.places_detected): uttr.places.append(query_detection.places_detected.main_place) - query_type = None - while True: - query_type = _get_next_query_type(query_detection.classifications, - query_type) - if query_type == None: - break - if fulfill_for_query_type(query_detection, uttr, query_type): - rank_charts(uttr) + query_types = [first_query_type(uttr)] + while query_types[-1] != None: + if fulfill_query_type(uttr, query_types[-1]): break + query_types.append(next_query_type(query_types)) + + rank_charts(uttr) return uttr -def fulfill_for_query_type(query_detection: Detection, uttr: Utterance, - query_type: ClassificationType) -> bool: +def fulfill_query_type(uttr: Utterance, query_type: QueryType) -> bool: logging.info('Handled query_type: %d', uttr.query_type.value) # Reset previous state uttr.query_type = query_type uttr.chartCandidates = [] # If we could not detect query_type from user-query, infer from past context. - if (uttr.query_type == ClassificationType.UNKNOWN): + if (uttr.query_type == QueryType.UNKNOWN): uttr.query_type = context.query_type_from_context(uttr) found = False + # Each query-type has its own handler. Each knows what arguments it needs and # will call on the *_from_context() routines to obtain missing arguments. - if (uttr.query_type == ClassificationType.OVERVIEW): + handler = QUERY_TYPE_HANDLERS.get(query_type, None) + if handler: + found = handler.populate(uttr) + utils.update_counter(uttr.counters, 'processed_fulfillment_types', + handler.__name__.split('.')[-1]) + + return found + + +# The first query_type to try for the given utterance. If there are multiple +# classifications, we pick from among them. +def first_query_type(uttr: Utterance): + query_types = [QueryType.SIMPLE] + for cl in uttr.classifications: + query_types.append(_classification_to_query_type(cl, uttr)) + + query_types = sorted(query_types, key=(lambda q: RANKED_QUERY_TYPES.index(q))) + if query_types: + return query_types[-1] + return None + + +# Given the list of previous query_types, decides the next query_type to fallback to. +def next_query_type(query_types: List[QueryType]) -> QueryType: + + next = None + prev = query_types[-1] + if prev in DIRECT_QUERY_TYPE_FALLBACK: + next = DIRECT_QUERY_TYPE_FALLBACK[prev] + elif prev == QueryType.COMPARISON: + if QueryType.CORRELATION not in query_types: + next = QueryType.CORRELATION + else: + next = QueryType.CONTAINED_IN + elif prev == QueryType.CORRELATION: + if QueryType.COMPARISON not in query_types: + next = QueryType.COMPARISON + else: + next = QueryType.CONTAINED_IN + return next + + +def _classification_to_query_type(cl: NLClassifier, + uttr: Utterance) -> QueryType: + if cl.type in DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE: + query_type = DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE[cl.type] + elif cl.type == ClassificationType.OVERVIEW: if not uttr.svs: # We detected some overview words ("tell me about") *and* there were # no SVs in current utterance, so consider it a place overview. - fulfillment_type = 'OVERVIEW' - found = overview.populate(uttr) + query_type = QueryType.OVERVIEW else: - fulfillment_type = 'SIMPLE' - found = simple.populate(uttr) - elif (uttr.query_type == ClassificationType.SIMPLE): - fulfillment_type = 'SIMPLE' - found = simple.populate(uttr) - elif (uttr.query_type == ClassificationType.CORRELATION): - fulfillment_type = 'CORRELATION' - found = correlation.populate(uttr) - elif (uttr.query_type == ClassificationType.CONTAINED_IN): - fulfillment_type = 'CONTAINED_IN' - found = containedin.populate(uttr) - elif (uttr.query_type == ClassificationType.RANKING): + query_type = QueryType.SIMPLE + elif cl.type == ClassificationType.RANKING: current_contained_classification = context.classifications_of_type_from_utterance( uttr, ClassificationType.CONTAINED_IN) if current_contained_classification: - fulfillment_type = 'RANKING_ACROSS_PLACES' - found = ranking_across_places.populate(uttr) + query_type = QueryType.RANKING_ACROSS_PLACES else: - fulfillment_type = 'RANKING_ACROSS_VARS' - found = ranking_across_vars.populate(uttr) - elif (uttr.query_type == ClassificationType.COMPARISON): - fulfillment_type = 'COMPARISON' - found = comparison.populate(uttr) - elif (uttr.query_type == ClassificationType.EVENT): - fulfillment_type = 'EVENT' - found = event.populate(uttr) - elif (uttr.query_type == ClassificationType.TIME_DELTA): - fulfillment_type = 'TIME_DELTA' - found = time_delta.populate(uttr) - - utils.update_counter(uttr.counters, 'fulfillment_type', fulfillment_type) - return found - - -def _get_next_query_type(classifications: List[NLClassifier], - query_type: ClassificationType) -> ClassificationType: - if query_type == None: - return _query_type_from_classifications(classifications) + query_type = QueryType.RANKING_ACROSS_VARS else: - return QUERY_TYPE_FALLBACK.get(query_type, ClassificationType.SIMPLE) - - -def _query_type_from_classifications(classifications): - ans = ClassificationType.SIMPLE - for cl in classifications: - if (_classification_rank_order(cl.type) > _classification_rank_order(ans)): - ans = cl.type - return ans - + query_type = None -def _classification_rank_order(cl: ClassificationType) -> int: - if cl in RANKED_CLASSIFICATION_TYPES: - return RANKED_CLASSIFICATION_TYPES.index(cl) + 1 - else: - return 0 + return query_type # @@ -173,7 +235,7 @@ def filter_svs(sv_list: List[str], sv_score: List[float]) -> List[str]: i = 0 ans = [] while (i < len(sv_list)): - if (sv_score[i] > _SV_THRESHOLD): + if (sv_score[i] >= _SV_THRESHOLD): ans.append(sv_list[i]) i = i + 1 return ans diff --git a/server/lib/nl/page_config_next.py b/server/lib/nl/page_config_next.py index 61412b2b15..3cfeaf18e7 100644 --- a/server/lib/nl/page_config_next.py +++ b/server/lib/nl/page_config_next.py @@ -544,8 +544,10 @@ def _event_chart_block(metadata, block, column, place: Place, top_event.show_end_date = True else: tile.title = _decorate_chart_title(title=tile.title, place=place) + tile = block.columns.add().tiles.add() + else: + tile = column.tiles.add() - tile = block.columns.add().tiles.add() tile.type = Tile.DISASTER_EVENT_MAP tile.disaster_event_map_tile_spec.event_type_keys.append(event_id) tile.title = event_title diff --git a/server/lib/nl/utterance.py b/server/lib/nl/utterance.py index 786b6cab11..62b797e30b 100644 --- a/server/lib/nl/utterance.py +++ b/server/lib/nl/utterance.py @@ -52,6 +52,62 @@ class ChartOriginType(IntEnum): SECONDARY_CHART = 1 +# This often has 1:1 correspondence with ClassificationType, but a single +# classification like RANKING might correspond to different query types +# (ranking across vars vs. ranking across places). +class QueryType(IntEnum): + OTHER = 0 + SIMPLE = 1 + RANKING_ACROSS_PLACES = 2 + RANKING_ACROSS_VARS = 3 + CONTAINED_IN = 4 + CORRELATION = 5 + COMPARISON = 6 + TIME_DELTA = 7 + EVENT = 8 + OVERVIEW = 9 + UNKNOWN = 11 + + +# The supported rankings in order. Later entry is preferred. +RANKED_QUERY_TYPES = [ + QueryType.SIMPLE, + QueryType.COMPARISON, + QueryType.CONTAINED_IN, + QueryType.RANKING_ACROSS_VARS, + QueryType.RANKING_ACROSS_PLACES, + QueryType.CORRELATION, + QueryType.TIME_DELTA, + QueryType.EVENT, + QueryType.OVERVIEW, +] + +# The ClassificationTypes not in this map rely on additional fields of detection. +DIRECT_CLASSIFICATION_TO_QUERY_TYPE = { + ClassificationType.SIMPLE: + QueryType.SIMPLE, + ClassificationType.CONTAINED_IN: + QueryType.CONTAINED_IN, + ClassificationType.CORRELATION: + QueryType.CORRELATION, + ClassificationType.COMPARISON: + QueryType.COMPARISON, + ClassificationType.TIME_DELTA: + QueryType.TIME_DELTA, + ClassificationType.EVENT: + QueryType.EVENT, + # Unsupported classification-types + ClassificationType.UNKNOWN: + QueryType.UNKNOWN, + ClassificationType.OTHER: + QueryType.UNKNOWN, + ClassificationType.TEMPORAL: + QueryType.UNKNOWN, + ClassificationType.CLUSTERING: + QueryType.UNKNOWN, +} + + # Type of chart. class ChartType(IntEnum): TIMELINE_CHART = 0 diff --git a/server/tests/lib/nl/fulfillment_next_test.py b/server/tests/lib/nl/fulfillment_next_test.py index c1311da587..9e30946e96 100644 --- a/server/tests/lib/nl/fulfillment_next_test.py +++ b/server/tests/lib/nl/fulfillment_next_test.py @@ -429,7 +429,7 @@ def test_counters_simple(self, mock_sv_existence, mock_single_datapoint, self.maxDiff = None _COUNTERS = { 'filtered_svs': ['Count_Person_Male', 'Count_Person_Female'], - 'fulfillment_type': ['SIMPLE'], + 'processed_fulfillment_types': ['simple'], 'num_chart_candidates': 2, 'stat_var_extensions': [{}] } diff --git a/server/tests/lib/nl/test_utterance.py b/server/tests/lib/nl/test_utterance.py index aae7243545..fd8513eb82 100644 --- a/server/tests/lib/nl/test_utterance.py +++ b/server/tests/lib/nl/test_utterance.py @@ -18,6 +18,7 @@ from server.lib.nl.detection import RankingType from server.lib.nl.utterance import ChartOriginType from server.lib.nl.utterance import ChartType +from server.lib.nl.utterance import QueryType from server.lib.nl.utterance import TimeDeltaType # Utterance for Place Overview. @@ -29,7 +30,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.OVERVIEW, + 'query_type': QueryType.OVERVIEW, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -65,7 +66,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.OVERVIEW, + 'query_type': QueryType.OVERVIEW, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -99,7 +100,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.SIMPLE, + 'query_type': QueryType.SIMPLE, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -153,7 +154,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.SIMPLE, + 'query_type': QueryType.SIMPLE, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -207,7 +208,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.SIMPLE, + 'query_type': QueryType.SIMPLE, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -284,7 +285,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.COMPARISON, + 'query_type': QueryType.COMPARISON, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -346,7 +347,7 @@ }], 'places': [], 'query': 'foo sv in place', - 'query_type': ClassificationType.CONTAINED_IN, + 'query_type': QueryType.CONTAINED_IN, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -399,7 +400,7 @@ }], 'places': [], 'query': 'foo sv in place', - 'query_type': ClassificationType.CORRELATION, + 'query_type': QueryType.CORRELATION, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -452,11 +453,11 @@ 'type': ClassificationType.RANKING }, { 'contained_in_place_type': 'County', - 'type': ClassificationType.CONTAINED_IN, + 'type': QueryType.CONTAINED_IN, }], 'places': [], 'query': 'foo sv in place', - 'query_type': ClassificationType.RANKING, + 'query_type': QueryType.RANKING_ACROSS_PLACES, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -489,7 +490,7 @@ }], 'places': [], 'query': 'foo sv in place', - 'query_type': ClassificationType.RANKING, + 'query_type': QueryType.RANKING_ACROSS_VARS, 'ranked_charts': [{ 'attr': { 'block_id': 2, @@ -526,7 +527,7 @@ }], 'places': [], 'query': 'foo sv in place', - 'query_type': ClassificationType.TIME_DELTA, + 'query_type': QueryType.TIME_DELTA, 'ranked_charts': [{ 'attr': { 'block_id': 2, @@ -600,7 +601,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.SIMPLE, + 'query_type': QueryType.SIMPLE, 'ranked_charts': [{ 'attr': { 'block_id': 1, @@ -659,7 +660,7 @@ 'place_type': 'State' }], 'query': 'foo sv in place', - 'query_type': ClassificationType.EVENT, + 'query_type': QueryType.EVENT, 'ranked_charts': [{ 'attr': { 'block_id': 1, diff --git a/static/js/apps/nl_interface/debug_info.tsx b/static/js/apps/nl_interface/debug_info.tsx index 84ee95d11c..b3e79a1d7f 100644 --- a/static/js/apps/nl_interface/debug_info.tsx +++ b/static/js/apps/nl_interface/debug_info.tsx @@ -66,7 +66,7 @@ const matchScoresElement = (svScores: SVScores): JSX.Element => { - + @@ -145,7 +145,7 @@ export function DebugInfo(props: DebugInfoProps): JSX.Element { Original Query: {debugInfo.originalQuery} - Query used for SV detection: + Query used for variable detection: {debugInfo.queryWithoutPlaces} @@ -200,16 +200,14 @@ export function DebugInfo(props: DebugInfoProps): JSX.Element { - All SVs Matched (with scores): - - - Note: SVs with scores less than 0.4 are not used. + All Variables Matched (with scores): + Note: Variables with scores less than 0.5 are not used. {matchScoresElement(debugInfo.svScores)} - SV Sentences Matched (with scores): + Variable Sentences Matched (with scores): From 9b74ec56d045a715634df37a25a48bf49f8a3b20 Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Fri, 10 Feb 2023 00:47:24 -0800 Subject: [PATCH 3/5] Cleanup fallback --- server/lib/nl/fulfillment/base.py | 14 ------- server/lib/nl/fulfillment/comparison.py | 1 - server/lib/nl/fulfillment/containedin.py | 1 - .../nl/fulfillment/ranking_across_places.py | 3 -- .../lib/nl/fulfillment/ranking_across_vars.py | 1 - server/lib/nl/fulfillment/time_delta.py | 1 - server/lib/nl/utterance.py | 39 ------------------- 7 files changed, 60 deletions(-) diff --git a/server/lib/nl/fulfillment/base.py b/server/lib/nl/fulfillment/base.py index 7a529d1e45..1cfc1a2751 100644 --- a/server/lib/nl/fulfillment/base.py +++ b/server/lib/nl/fulfillment/base.py @@ -42,7 +42,6 @@ class PopulateState: uttr: Utterance main_cb: any - fallback_cb: any = None place_type: ContainedInPlaceType = None ranking_types: List[RankingType] = field(default_factory=list) time_delta_types: List[TimeDeltaType] = field(default_factory=list) @@ -141,8 +140,6 @@ def populate_charts_for_places(state: PopulateState, logging.info('Doing fallback for %s - %s', ', '.join(_get_place_names(places)), ', '.join(state.uttr.svs)) utils.update_counter(state.uttr.counters, 'num_populate_fallbacks', 1) - if state.fallback_cb: - return state.fallback_cb(state, places, ChartOriginType.PRIMARY_CHART) return False @@ -258,17 +255,6 @@ def _add_charts(state: PopulateState, places: List[Place], return found -def overview_fallback(state: PopulateState, places: List[Place], - chart_origin: ChartOriginType) -> bool: - # Overview chart is a safe fallback. - state.block_id += 1 - chart_vars = ChartVars(svs=[], - block_id=state.block_id, - include_percapita=False) - return add_chart_to_utterance(ChartType.PLACE_OVERVIEW, state, chart_vars, - places, chart_origin) - - def _get_place_dcids(places: List[Place]) -> List[str]: dcids = [] for p in places: diff --git a/server/lib/nl/fulfillment/comparison.py b/server/lib/nl/fulfillment/comparison.py index 60f3d3b6d2..3b1c150ddf 100644 --- a/server/lib/nl/fulfillment/comparison.py +++ b/server/lib/nl/fulfillment/comparison.py @@ -19,7 +19,6 @@ from server.lib.nl.detection import Place from server.lib.nl.fulfillment.base import add_chart_to_utterance from server.lib.nl.fulfillment.base import ChartVars -from server.lib.nl.fulfillment.base import overview_fallback from server.lib.nl.fulfillment.base import populate_charts_for_places from server.lib.nl.fulfillment.base import PopulateState from server.lib.nl.fulfillment.context import \ diff --git a/server/lib/nl/fulfillment/containedin.py b/server/lib/nl/fulfillment/containedin.py index 6909d6393d..2ba99ebc41 100644 --- a/server/lib/nl/fulfillment/containedin.py +++ b/server/lib/nl/fulfillment/containedin.py @@ -22,7 +22,6 @@ from server.lib.nl.detection import Place from server.lib.nl.fulfillment.base import add_chart_to_utterance from server.lib.nl.fulfillment.base import ChartVars -from server.lib.nl.fulfillment.base import overview_fallback from server.lib.nl.fulfillment.base import populate_charts from server.lib.nl.fulfillment.base import PopulateState from server.lib.nl.fulfillment.context import \ diff --git a/server/lib/nl/fulfillment/ranking_across_places.py b/server/lib/nl/fulfillment/ranking_across_places.py index 48e89abb6b..7de642ed7e 100644 --- a/server/lib/nl/fulfillment/ranking_across_places.py +++ b/server/lib/nl/fulfillment/ranking_across_places.py @@ -16,12 +16,9 @@ from typing import List from server.lib.nl import utils -from server.lib.nl.detection import ContainedInPlaceType from server.lib.nl.detection import Place -from server.lib.nl.detection import RankingType from server.lib.nl.fulfillment.base import add_chart_to_utterance from server.lib.nl.fulfillment.base import ChartVars -from server.lib.nl.fulfillment.base import overview_fallback from server.lib.nl.fulfillment.base import populate_charts from server.lib.nl.fulfillment.base import PopulateState from server.lib.nl.utterance import ChartOriginType diff --git a/server/lib/nl/fulfillment/ranking_across_vars.py b/server/lib/nl/fulfillment/ranking_across_vars.py index 5191ee170d..8456a680dd 100644 --- a/server/lib/nl/fulfillment/ranking_across_vars.py +++ b/server/lib/nl/fulfillment/ranking_across_vars.py @@ -19,7 +19,6 @@ from server.lib.nl.detection import Place from server.lib.nl.fulfillment.base import add_chart_to_utterance from server.lib.nl.fulfillment.base import ChartVars -from server.lib.nl.fulfillment.base import overview_fallback from server.lib.nl.fulfillment.base import populate_charts from server.lib.nl.fulfillment.base import PopulateState from server.lib.nl.utterance import ChartOriginType diff --git a/server/lib/nl/fulfillment/time_delta.py b/server/lib/nl/fulfillment/time_delta.py index 980861712e..05374ddac1 100644 --- a/server/lib/nl/fulfillment/time_delta.py +++ b/server/lib/nl/fulfillment/time_delta.py @@ -19,7 +19,6 @@ from server.lib.nl.detection import Place from server.lib.nl.fulfillment.base import add_chart_to_utterance from server.lib.nl.fulfillment.base import ChartVars -from server.lib.nl.fulfillment.base import overview_fallback from server.lib.nl.fulfillment.base import populate_charts from server.lib.nl.fulfillment.base import PopulateState from server.lib.nl.utterance import ChartOriginType diff --git a/server/lib/nl/utterance.py b/server/lib/nl/utterance.py index 62b797e30b..47bfde21fa 100644 --- a/server/lib/nl/utterance.py +++ b/server/lib/nl/utterance.py @@ -69,45 +69,6 @@ class QueryType(IntEnum): UNKNOWN = 11 -# The supported rankings in order. Later entry is preferred. -RANKED_QUERY_TYPES = [ - QueryType.SIMPLE, - QueryType.COMPARISON, - QueryType.CONTAINED_IN, - QueryType.RANKING_ACROSS_VARS, - QueryType.RANKING_ACROSS_PLACES, - QueryType.CORRELATION, - QueryType.TIME_DELTA, - QueryType.EVENT, - QueryType.OVERVIEW, -] - -# The ClassificationTypes not in this map rely on additional fields of detection. -DIRECT_CLASSIFICATION_TO_QUERY_TYPE = { - ClassificationType.SIMPLE: - QueryType.SIMPLE, - ClassificationType.CONTAINED_IN: - QueryType.CONTAINED_IN, - ClassificationType.CORRELATION: - QueryType.CORRELATION, - ClassificationType.COMPARISON: - QueryType.COMPARISON, - ClassificationType.TIME_DELTA: - QueryType.TIME_DELTA, - ClassificationType.EVENT: - QueryType.EVENT, - # Unsupported classification-types - ClassificationType.UNKNOWN: - QueryType.UNKNOWN, - ClassificationType.OTHER: - QueryType.UNKNOWN, - ClassificationType.TEMPORAL: - QueryType.UNKNOWN, - ClassificationType.CLUSTERING: - QueryType.UNKNOWN, -} - - # Type of chart. class ChartType(IntEnum): TIMELINE_CHART = 0 From 6aaa7c02b21e1c417f9c15406b056cd2ab3a7524 Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Fri, 10 Feb 2023 18:41:49 -0800 Subject: [PATCH 4/5] Add a QueryHandler class and move to a new file. --- server/lib/nl/fulfillment_next.py | 142 ++--------------------- server/lib/nl/query_handlers.py | 180 ++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 135 deletions(-) create mode 100644 server/lib/nl/query_handlers.py diff --git a/server/lib/nl/fulfillment_next.py b/server/lib/nl/fulfillment_next.py index 331f57fa2c..2a9bbb0b88 100644 --- a/server/lib/nl/fulfillment_next.py +++ b/server/lib/nl/fulfillment_next.py @@ -13,92 +13,21 @@ # limitations under the License. """Module for NL page data spec""" +from dataclasses import dataclass import logging from typing import List from server.lib.nl import utils from server.lib.nl.detection import ClassificationType from server.lib.nl.detection import Detection -from server.lib.nl.detection import NLClassifier -from server.lib.nl.fulfillment import comparison -from server.lib.nl.fulfillment import containedin from server.lib.nl.fulfillment import context -from server.lib.nl.fulfillment import correlation -from server.lib.nl.fulfillment import event -from server.lib.nl.fulfillment import overview -from server.lib.nl.fulfillment import ranking_across_places -from server.lib.nl.fulfillment import ranking_across_vars -from server.lib.nl.fulfillment import simple -from server.lib.nl.fulfillment import time_delta +import server.lib.nl.query_handlers as handlers from server.lib.nl.utterance import QueryType from server.lib.nl.utterance import Utterance # We will ignore SV detections that are below this threshold _SV_THRESHOLD = 0.5 -QUERY_TYPE_HANDLERS = { - QueryType.SIMPLE: simple, - QueryType.COMPARISON: comparison, - QueryType.CONTAINED_IN: containedin, - QueryType.RANKING_ACROSS_VARS: ranking_across_vars, - QueryType.RANKING_ACROSS_PLACES: ranking_across_places, - QueryType.CORRELATION: correlation, - QueryType.TIME_DELTA: time_delta, - QueryType.EVENT: event, - QueryType.OVERVIEW: overview, -} - -# The supported rankings in order. Later entry is preferred. -RANKED_QUERY_TYPES = [ - QueryType.SIMPLE, - QueryType.COMPARISON, - QueryType.CONTAINED_IN, - QueryType.RANKING_ACROSS_VARS, - QueryType.RANKING_ACROSS_PLACES, - QueryType.CORRELATION, - QueryType.TIME_DELTA, - QueryType.EVENT, - QueryType.OVERVIEW, -] - -# The ClassificationTypes not in this map rely on additional fields of detection. -DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE = { - ClassificationType.SIMPLE: - QueryType.SIMPLE, - ClassificationType.CONTAINED_IN: - QueryType.CONTAINED_IN, - ClassificationType.CORRELATION: - QueryType.CORRELATION, - ClassificationType.COMPARISON: - QueryType.COMPARISON, - ClassificationType.TIME_DELTA: - QueryType.TIME_DELTA, - ClassificationType.EVENT: - QueryType.EVENT, - - # Unsupported classification-types. Map them to SIMPLE for now. - # TODO: Handle this better. - ClassificationType.UNKNOWN: - QueryType.SIMPLE, - ClassificationType.OTHER: - QueryType.SIMPLE, - ClassificationType.TEMPORAL: - QueryType.SIMPLE, - ClassificationType.CLUSTERING: - QueryType.SIMPLE, -} - -DIRECT_QUERY_TYPE_FALLBACK = { - # No fallback - QueryType.OVERVIEW: None, - QueryType.SIMPLE: QueryType.OVERVIEW, - QueryType.EVENT: QueryType.SIMPLE, - QueryType.CONTAINED_IN: QueryType.SIMPLE, - QueryType.RANKING_ACROSS_VARS: QueryType.SIMPLE, - QueryType.RANKING_ACROSS_PLACES: QueryType.CONTAINED_IN, - QueryType.TIME_DELTA: QueryType.CONTAINED_IN, -} - # # Compute a new Utterance given the classifications for a user query @@ -127,11 +56,11 @@ def fulfill(query_detection: Detection, if (query_detection.places_detected): uttr.places.append(query_detection.places_detected.main_place) - query_types = [first_query_type(uttr)] + query_types = [handlers.first_query_type(uttr)] while query_types[-1] != None: if fulfill_query_type(uttr, query_types[-1]): break - query_types.append(next_query_type(query_types)) + query_types.append(handlers.next_query_type(query_types)) rank_charts(uttr) return uttr @@ -151,72 +80,15 @@ def fulfill_query_type(uttr: Utterance, query_type: QueryType) -> bool: # Each query-type has its own handler. Each knows what arguments it needs and # will call on the *_from_context() routines to obtain missing arguments. - handler = QUERY_TYPE_HANDLERS.get(query_type, None) + handler = handlers.QUERY_HANDLERS.get(query_type, None) if handler: - found = handler.populate(uttr) + found = handler.module.populate(uttr) utils.update_counter(uttr.counters, 'processed_fulfillment_types', - handler.__name__.split('.')[-1]) + handler.module.__name__.split('.')[-1]) return found -# The first query_type to try for the given utterance. If there are multiple -# classifications, we pick from among them. -def first_query_type(uttr: Utterance): - query_types = [QueryType.SIMPLE] - for cl in uttr.classifications: - query_types.append(_classification_to_query_type(cl, uttr)) - - query_types = sorted(query_types, key=(lambda q: RANKED_QUERY_TYPES.index(q))) - if query_types: - return query_types[-1] - return None - - -# Given the list of previous query_types, decides the next query_type to fallback to. -def next_query_type(query_types: List[QueryType]) -> QueryType: - - next = None - prev = query_types[-1] - if prev in DIRECT_QUERY_TYPE_FALLBACK: - next = DIRECT_QUERY_TYPE_FALLBACK[prev] - elif prev == QueryType.COMPARISON: - if QueryType.CORRELATION not in query_types: - next = QueryType.CORRELATION - else: - next = QueryType.CONTAINED_IN - elif prev == QueryType.CORRELATION: - if QueryType.COMPARISON not in query_types: - next = QueryType.COMPARISON - else: - next = QueryType.CONTAINED_IN - return next - - -def _classification_to_query_type(cl: NLClassifier, - uttr: Utterance) -> QueryType: - if cl.type in DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE: - query_type = DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE[cl.type] - elif cl.type == ClassificationType.OVERVIEW: - if not uttr.svs: - # We detected some overview words ("tell me about") *and* there were - # no SVs in current utterance, so consider it a place overview. - query_type = QueryType.OVERVIEW - else: - query_type = QueryType.SIMPLE - elif cl.type == ClassificationType.RANKING: - current_contained_classification = context.classifications_of_type_from_utterance( - uttr, ClassificationType.CONTAINED_IN) - if current_contained_classification: - query_type = QueryType.RANKING_ACROSS_PLACES - else: - query_type = QueryType.RANKING_ACROSS_VARS - else: - query_type = None - - return query_type - - # # Rank candidate charts in the given Utterance. # diff --git a/server/lib/nl/query_handlers.py b/server/lib/nl/query_handlers.py new file mode 100644 index 0000000000..5f8a940f2f --- /dev/null +++ b/server/lib/nl/query_handlers.py @@ -0,0 +1,180 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Module for representing all fulfillment handlers.""" + +from dataclasses import dataclass +from typing import List + +from server.lib.nl.detection import ClassificationType +from server.lib.nl.detection import NLClassifier +from server.lib.nl.fulfillment import comparison +from server.lib.nl.fulfillment import containedin +from server.lib.nl.fulfillment import context +from server.lib.nl.fulfillment import correlation +from server.lib.nl.fulfillment import event +from server.lib.nl.fulfillment import overview +from server.lib.nl.fulfillment import ranking_across_places +from server.lib.nl.fulfillment import ranking_across_vars +from server.lib.nl.fulfillment import simple +from server.lib.nl.fulfillment import time_delta +from server.lib.nl.utterance import QueryType +from server.lib.nl.utterance import Utterance + + +# Represents a query type handler. +@dataclass +class QueryHandlerConfig: + module: any + # Higher is better. + rank: int + # Fallback candidate if set. If not set, there custom + # logic to decide on the fallback, coded in next_query_type(). + # Note: If there is no fallback, direct_fallback matches the QueryType. + direct_fallback: QueryType = None + + +QUERY_HANDLERS = { + QueryType.SIMPLE: + QueryHandlerConfig(module=simple, + rank=1, + direct_fallback=QueryType.OVERVIEW), + + # Comparison has a more complex fallback logic captured in next_query_type(). + QueryType.COMPARISON: + QueryHandlerConfig(module=comparison, rank=2), + QueryType.CONTAINED_IN: + QueryHandlerConfig(module=containedin, + rank=3, + direct_fallback=QueryType.SIMPLE), + QueryType.RANKING_ACROSS_VARS: + QueryHandlerConfig(module=ranking_across_vars, + rank=4, + direct_fallback=QueryType.SIMPLE), + QueryType.RANKING_ACROSS_PLACES: + QueryHandlerConfig(module=ranking_across_places, + rank=5, + direct_fallback=QueryType.CONTAINED_IN), + + # Correlation has a more complex fallback logic captured in next_query_type(). + QueryType.CORRELATION: + QueryHandlerConfig(module=correlation, rank=6), + QueryType.TIME_DELTA: + QueryHandlerConfig(module=time_delta, + rank=7, + direct_fallback=QueryType.CONTAINED_IN), + QueryType.EVENT: + QueryHandlerConfig(module=event, + rank=8, + direct_fallback=QueryType.SIMPLE), + + # Overview trumps everything else ("tell us about"), and + # has no fallback. + QueryType.OVERVIEW: + QueryHandlerConfig(module=overview, + rank=9, + direct_fallback=QueryType.OVERVIEW), +} + +# The ClassificationTypes not in this map rely on additional fields of detection. +DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE = { + ClassificationType.SIMPLE: + QueryType.SIMPLE, + ClassificationType.CONTAINED_IN: + QueryType.CONTAINED_IN, + ClassificationType.CORRELATION: + QueryType.CORRELATION, + ClassificationType.COMPARISON: + QueryType.COMPARISON, + ClassificationType.TIME_DELTA: + QueryType.TIME_DELTA, + ClassificationType.EVENT: + QueryType.EVENT, + + # Unsupported classification-types. Map them to SIMPLE for now. + # TODO: Handle this better. + ClassificationType.UNKNOWN: + QueryType.SIMPLE, + ClassificationType.OTHER: + QueryType.SIMPLE, + ClassificationType.TEMPORAL: + QueryType.SIMPLE, + ClassificationType.CLUSTERING: + QueryType.SIMPLE, +} + + +# The first query_type to try for the given utterance. If there are multiple +# classifications, we pick from among them. +def first_query_type(uttr: Utterance): + query_types = [QueryType.SIMPLE] + for cl in uttr.classifications: + query_types.append(_classification_to_query_type(cl, uttr)) + + default_config = QueryHandlerConfig(module=None, rank=-1) # Ranks the lowest + query_types = sorted( + query_types, key=(lambda q: QUERY_HANDLERS.get(q, default_config).rank)) + if query_types: + return query_types[-1] + return None + + +def _classification_to_query_type(cl: NLClassifier, + uttr: Utterance) -> QueryType: + if cl.type in DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE: + query_type = DIRECT_CLASSIFICATION_TYPE_TO_QUERY_TYPE[cl.type] + elif cl.type == ClassificationType.OVERVIEW: + if not uttr.svs: + # We detected some overview words ("tell me about") *and* there were + # no SVs in current utterance, so consider it a place overview. + query_type = QueryType.OVERVIEW + else: + query_type = QueryType.SIMPLE + elif cl.type == ClassificationType.RANKING: + current_contained_classification = context.classifications_of_type_from_utterance( + uttr, ClassificationType.CONTAINED_IN) + if current_contained_classification: + query_type = QueryType.RANKING_ACROSS_PLACES + else: + query_type = QueryType.RANKING_ACROSS_VARS + else: + query_type = None + + return query_type + + +# Given the list of previous query_types, decides the next query_type to fallback to. +def next_query_type(query_types: List[QueryType]) -> QueryType: + next = None + prev = query_types[-1] + config = QUERY_HANDLERS.get(prev, None) + if not config: + return None + + if prev == config.direct_fallback: + # No fallback + next = None + elif config.direct_fallback != None: + next = config.direct_fallback + elif prev == QueryType.COMPARISON: + if QueryType.CORRELATION not in query_types: + next = QueryType.CORRELATION + else: + next = QueryType.CONTAINED_IN + elif prev == QueryType.CORRELATION: + if QueryType.COMPARISON not in query_types: + next = QueryType.COMPARISON + else: + next = QueryType.CONTAINED_IN + + return next From a32aa6b7c2ebe217cdf29b948c87f9a60105543a Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Fri, 10 Feb 2023 18:49:13 -0800 Subject: [PATCH 5/5] Fix codacy warnings --- server/lib/nl/fulfillment_next.py | 1 - server/lib/nl/query_handlers.py | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/server/lib/nl/fulfillment_next.py b/server/lib/nl/fulfillment_next.py index 2a9bbb0b88..cce6f19807 100644 --- a/server/lib/nl/fulfillment_next.py +++ b/server/lib/nl/fulfillment_next.py @@ -13,7 +13,6 @@ # limitations under the License. """Module for NL page data spec""" -from dataclasses import dataclass import logging from typing import List diff --git a/server/lib/nl/query_handlers.py b/server/lib/nl/query_handlers.py index 5f8a940f2f..6d5a9e4069 100644 --- a/server/lib/nl/query_handlers.py +++ b/server/lib/nl/query_handlers.py @@ -155,26 +155,26 @@ def _classification_to_query_type(cl: NLClassifier, # Given the list of previous query_types, decides the next query_type to fallback to. def next_query_type(query_types: List[QueryType]) -> QueryType: - next = None - prev = query_types[-1] - config = QUERY_HANDLERS.get(prev, None) + next_type = None + prev_type = query_types[-1] + config = QUERY_HANDLERS.get(prev_type, None) if not config: return None - if prev == config.direct_fallback: + if prev_type == config.direct_fallback: # No fallback - next = None + next_type = None elif config.direct_fallback != None: - next = config.direct_fallback - elif prev == QueryType.COMPARISON: + next_type = config.direct_fallback + elif prev_type == QueryType.COMPARISON: if QueryType.CORRELATION not in query_types: - next = QueryType.CORRELATION + next_type = QueryType.CORRELATION else: - next = QueryType.CONTAINED_IN - elif prev == QueryType.CORRELATION: + next_type = QueryType.CONTAINED_IN + elif prev_type == QueryType.CORRELATION: if QueryType.COMPARISON not in query_types: - next = QueryType.COMPARISON + next_type = QueryType.COMPARISON else: - next = QueryType.CONTAINED_IN + next_type = QueryType.CONTAINED_IN - return next + return next_type
SVVariable Cosine Score (Best/Max) [0, 1]