From c9f3f578a14477ad05251b88c1b8b36301c3346e Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Mon, 17 Jun 2024 18:45:07 -0700 Subject: [PATCH 1/2] Revert optimization for `toolformer` mode --- .../e2e_toolformer_rig_mode/chart_config.json | 45 +++++++++++++++++++ server/lib/nl/fulfillment/basic.py | 10 ++--- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/server/integration_tests/test_data/e2e_toolformer_rig_mode/chart_config.json b/server/integration_tests/test_data/e2e_toolformer_rig_mode/chart_config.json index f317bbade0..da2bdb3d9b 100644 --- a/server/integration_tests/test_data/e2e_toolformer_rig_mode/chart_config.json +++ b/server/integration_tests/test_data/e2e_toolformer_rig_mode/chart_config.json @@ -88,6 +88,36 @@ ], "title": "Count of Mortality Event: 1 Years or Less, Male (As Fraction of Count Birth Event Male)" }, + { + "columns": [ + { + "tiles": [ + { + "statVarKey": [ + "Count_Death_Upto1Years_CertainConditionsOriginatingInThePerinatalPeriod" + ], + "title": "Mortality Events (1 Years or Less): Certain Conditions Originating in the Perinatal Period) in Massachusetts", + "type": "LINE" + } + ] + }, + { + "tiles": [ + { + "description": "Mortality Events (1 Years or Less): Certain Conditions Originating in the Perinatal Period) in Massachusetts", + "statVarKey": [ + "Count_Death_Upto1Years_CertainConditionsOriginatingInThePerinatalPeriod" + ], + "title": "Mortality Events (1 Years or Less): Certain Conditions Originating in the Perinatal Period) in Massachusetts", + "type": "HIGHLIGHT" + } + ] + } + ], + "denom": "Count_Person", + "startWithDenom": true, + "title": "Mortality Events (1 Years or Less): Certain Conditions Originating in the Perinatal Period)" + }, { "columns": [ { @@ -100,6 +130,21 @@ "type": "MAP" } ] + }, + { + "tiles": [ + { + "rankingTileSpec": { + "rankingCount": 5, + "showHighestLowest": true + }, + "statVarKey": [ + "Count_Death_Upto1Years_CertainConditionsOriginatingInThePerinatalPeriod" + ], + "title": "Mortality Events (1 Years or Less): Certain Conditions Originating in the Perinatal Period) in Counties of Massachusetts (${date})", + "type": "RANKING" + } + ] } ], "denom": "Count_Person", diff --git a/server/lib/nl/fulfillment/basic.py b/server/lib/nl/fulfillment/basic.py index b902d6c0b2..aeae42a9c2 100644 --- a/server/lib/nl/fulfillment/basic.py +++ b/server/lib/nl/fulfillment/basic.py @@ -63,12 +63,10 @@ def populate(state: PopulateState, chart_vars: ChartVars, places: List[Place], [p.dcid for p in places]) return False - if (chart_vars.source_topic == PROJECTED_TEMP_TOPIC or - params.is_toolformer_mode(state.uttr.mode)): + if chart_vars.source_topic == PROJECTED_TEMP_TOPIC: # PROJECTED_TEMP_TOPIC has some very custom handling in config-builder, # that needs to be deprecated. - # For toolformer mode, where we return focussed charts based - # on query, additional charts are not very useful. + # TODO: Deprecate this flow completely! return _populate_specific(state, chart_vars, places, chart_origin, rank) else: return _populate_explore(state, chart_vars, places, chart_origin, rank) @@ -142,7 +140,7 @@ def _populate_specific(state: PopulateState, chart_vars: ChartVars, rank: int) -> bool: if state.ranking_types: # Ranking query - if state.place_type: + if state.place_type and not state.had_default_place_type: # This is ranking across places. if ranking_across_places.populate(state, chart_vars, places, chart_origin, rank): @@ -154,7 +152,7 @@ def _populate_specific(state: PopulateState, chart_vars: ChartVars, rank): return True - if state.place_type: + if state.place_type and not state.had_default_place_type: if containedin.populate(state, chart_vars, places, chart_origin, rank): _maybe_set_place_type_existence(state, rank) return True From a6e9e01181d14c9f17f302167e94f11ad8ac4c77 Mon Sep 17 00:00:00 2001 From: Prashanth Radhakrishnan Date: Mon, 17 Jun 2024 18:46:49 -0700 Subject: [PATCH 2/2] revert --- server/lib/nl/fulfillment/basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/nl/fulfillment/basic.py b/server/lib/nl/fulfillment/basic.py index aeae42a9c2..4cb3c2e454 100644 --- a/server/lib/nl/fulfillment/basic.py +++ b/server/lib/nl/fulfillment/basic.py @@ -140,7 +140,7 @@ def _populate_specific(state: PopulateState, chart_vars: ChartVars, rank: int) -> bool: if state.ranking_types: # Ranking query - if state.place_type and not state.had_default_place_type: + if state.place_type: # This is ranking across places. if ranking_across_places.populate(state, chart_vars, places, chart_origin, rank): @@ -152,7 +152,7 @@ def _populate_specific(state: PopulateState, chart_vars: ChartVars, rank): return True - if state.place_type and not state.had_default_place_type: + if state.place_type: if containedin.populate(state, chart_vars, places, chart_origin, rank): _maybe_set_place_type_existence(state, rank) return True