diff --git a/simple/requirements.txt b/simple/requirements.txt index 97b45f84..55a8ffcf 100644 --- a/simple/requirements.txt +++ b/simple/requirements.txt @@ -9,6 +9,7 @@ idna==3.4 importlib-metadata==6.8.0 numpy==1.25.2 pandas==2.1.0 +parameterized==0.9.0 platformdirs==3.10.0 PyMySQL==1.1.0 python-dateutil==2.8.2 diff --git a/simple/stats/stat_var_hierarchy_generator.py b/simple/stats/stat_var_hierarchy_generator.py index fc68a090..81c6470d 100644 --- a/simple/stats/stat_var_hierarchy_generator.py +++ b/simple/stats/stat_var_hierarchy_generator.py @@ -120,11 +120,27 @@ def gen_svg_name(self): svg_name = f"{svg_name} With {pvs_str}" return svg_name + def gen_specialized_name(self, parent_pvs: Self) -> str: + parent_parts = parent_pvs._get_pv_parts() + child_parts = self._get_pv_parts() + parts = [part for part in child_parts if part not in parent_parts] + return ", ".join(map(lambda part: _capitalize_and_split(part), parts)) + # Creates and returns a new SVPropVals object with the same fields as this object # except for PVs which are set to the specified list. def with_pvs(self, pvs: list[PropVal]) -> Self: return replace(self, pvs=pvs) + # Returns an ordered set of PVs as a dict (since sets don't maintain order). + def _get_pv_parts(self) -> dict[str, bool]: + parts: dict[str, bool] = {} + for pv in self.pvs: + if pv.prop: + parts[pv.prop] = True + if pv.val: + parts[pv.val] = True + return parts + class SVG: @@ -136,7 +152,7 @@ def __init__(self, svg_id: str, svg_name: str) -> None: # Maintaining order maintains results consistency and helps with tests. self.sv_ids: dict[str, bool] = {} self.parent_svg_ids: dict[str, bool] = {} - self.child_svg_ids: dict[str, bool] = {} + self.child_svg_id_2_specialized_name: dict[str, str] = {} self.measured_properties: dict[str, bool] = {} self.parent_svgs_processed: bool = False @@ -171,6 +187,11 @@ def triples(self) -> list[Triple]: return triples + def gen_specialized_name(self, parent_svg: Self) -> str: + if self.sample_sv and parent_svg.sample_sv: + return self.sample_sv.gen_specialized_name(parent_svg.sample_sv) + return "" + # For testing. def json(self) -> dict: return { @@ -178,7 +199,7 @@ def json(self) -> dict: "svg_name": self.svg_name, "sv_ids": list(self.sv_ids.keys()), "parent_svg_ids": list(self.parent_svg_ids.keys()), - "child_svg_ids": list(self.child_svg_ids.keys()), + "child_svg_specialized_names": self.child_svg_id_2_specialized_name, "mprops": sorted(list(self.measured_properties.keys())) } @@ -210,7 +231,7 @@ def _attach_verticals(poptype2svg: dict[str, SVG], for vertical in vertical_spec.verticals: vertical_svg = _get_or_create_vertical_svg(vertical, vertical_svgs) vertical_svgs[vertical_svg.svg_id] = vertical_svg - vertical_svg.child_svg_ids[pop_type_svg.svg_id] = True + vertical_svg.child_svg_id_2_specialized_name[pop_type_svg.svg_id] = "" pop_type_svg.parent_svg_ids[vertical_svg.svg_id] = True for mprop in vertical_spec.measured_properties: vertical_svg.measured_properties[mprop] = True @@ -298,7 +319,8 @@ def _create_parent_svg(parent_sv: SVPropVals, svg: SVG, svgs: dict[str, SVG], # Add parent child relationships. svg.parent_svg_ids[parent_svg.svg_id] = True - parent_svg.child_svg_ids[svg.svg_id] = True + parent_svg.child_svg_id_2_specialized_name[ + svg.svg_id] = svg.gen_specialized_name(parent_svg) # Add child mprops to all parents recursively. _add_measured_properties_to_parent_svgs(svg.measured_properties, diff --git a/simple/tests/stats/stat_var_hierarchy_generator_test.py b/simple/tests/stats/stat_var_hierarchy_generator_test.py index 9b40d190..557a09c3 100644 --- a/simple/tests/stats/stat_var_hierarchy_generator_test.py +++ b/simple/tests/stats/stat_var_hierarchy_generator_test.py @@ -20,6 +20,7 @@ from kg_util import mcf_parser import pandas as pd +from parameterized import parameterized from stats.data import Triple from stats.stat_var_hierarchy_generator import * from stats.stat_var_hierarchy_generator import _extract_svs @@ -179,3 +180,28 @@ def test_extract_svs(self): svs = _extract_svs(input_triples) self.assertListEqual(svs, expected_svs) + + @parameterized.expand([ + (SVPropVals(sv_id="", + population_type="", + pvs=[PropVal("gender", ""), + PropVal("race", "Asian")], + measured_property=""), + SVPropVals(sv_id="", + population_type="", + pvs=[PropVal("gender", "Female"), + PropVal("race", "Asian")], + measured_property=""), "Female"), + (SVPropVals(sv_id="", + population_type="", + pvs=[PropVal("gender", "Female")], + measured_property=""), + SVPropVals(sv_id="", + population_type="", + pvs=[PropVal("gender", "Female"), + PropVal("race", "")], + measured_property=""), "Race") + ]) + def test_gen_specialized_name(self, parent: SVPropVals, child: SVPropVals, + expected: str): + self.assertEqual(child.gen_specialized_name(parent), expected) diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/basic_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/basic_svgs.json index 484a9b14..18bec082 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/basic_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/basic_svgs.json @@ -6,10 +6,10 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_Gender" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_Gender": "Gender" + }, "mprops": [] }, { @@ -19,9 +19,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female": "Female" + }, "mprops": [] }, { @@ -31,9 +31,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race": "Race" + }, "mprops": [] }, { @@ -43,9 +43,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Female" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -58,7 +58,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Female_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] }, { @@ -68,9 +68,9 @@ "parent_svg_ids": [ "c/g/Person_Race-Asian" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Female" + }, "mprops": [] }, { @@ -80,9 +80,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -92,9 +92,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_Gender_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender_Race-Asian": "Gender" + }, "mprops": [] } ] \ No newline at end of file diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/main_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/main_svgs.json index 847ad0be..460257df 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/main_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/main_svgs.json @@ -9,10 +9,10 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_PovertyStatus" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_PovertyStatus": "Poverty Status" + }, "mprops": [ "count", "unknownMProp" @@ -25,10 +25,10 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months", - "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months": "Below Poverty Level In The Past12 Months", + "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months": "Above Poverty Level In The Past12 Months" + }, "mprops": [ "count", "unknownMProp" @@ -41,9 +41,9 @@ "parent_svg_ids": [ "c/g/Person_PovertyStatus" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race": "Race" + }, "mprops": [ "count" ] @@ -55,9 +55,9 @@ "parent_svg_ids": [ "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race-WhiteAlone" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race-WhiteAlone": "White Alone" + }, "mprops": [ "count" ] @@ -72,7 +72,7 @@ "c/g/Person_PovertyStatus_Race-WhiteAlone", "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count" ] @@ -84,9 +84,9 @@ "parent_svg_ids": [ "c/g/Person_PovertyStatus" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race": "Race" + }, "mprops": [ "count", "unknownMProp" @@ -99,9 +99,9 @@ "parent_svg_ids": [ "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race-WhiteAlone" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race-WhiteAlone": "White Alone" + }, "mprops": [ "count", "unknownMProp" @@ -118,7 +118,7 @@ "c/g/Person_PovertyStatus_Race-WhiteAlone", "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count", "unknownMProp" @@ -131,10 +131,10 @@ "parent_svg_ids": [ "c/g/Person_Race-WhiteAlone" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race-WhiteAlone", - "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race-WhiteAlone" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus-BelowPovertyLevelInThePast12Months_Race-WhiteAlone": "Below Poverty Level In The Past12 Months", + "c/g/Person_PovertyStatus-AbovePovertyLevelInThePast12Months_Race-WhiteAlone": "Above Poverty Level In The Past12 Months" + }, "mprops": [ "count", "unknownMProp" @@ -147,9 +147,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-WhiteAlone" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-WhiteAlone": "White Alone" + }, "mprops": [ "count", "unknownMProp" @@ -164,9 +164,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_PovertyStatus_Race-WhiteAlone" - ], + "child_svg_specialized_names": { + "c/g/Person_PovertyStatus_Race-WhiteAlone": "Poverty Status" + }, "mprops": [ "count", "unknownMProp" diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/svs_with_mprops_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/svs_with_mprops_svgs.json index 84756e3c..ee116e3f 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/svs_with_mprops_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/svs_with_mprops_svgs.json @@ -6,10 +6,10 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_Gender" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_Gender": "Gender" + }, "mprops": [ "age", "count" @@ -22,10 +22,10 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female", - "c/g/Person_Gender-Male" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female": "Female", + "c/g/Person_Gender-Male": "Male" + }, "mprops": [ "age", "count" @@ -38,9 +38,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race": "Race" + }, "mprops": [ "count" ] @@ -52,9 +52,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Female" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Asian" + }, "mprops": [ "count" ] @@ -69,7 +69,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Female_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count" ] @@ -81,9 +81,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race": "Race" + }, "mprops": [ "age" ] @@ -95,9 +95,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Male" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race-Asian": "Asian" + }, "mprops": [ "age" ] @@ -112,7 +112,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Male_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "age" ] @@ -124,10 +124,10 @@ "parent_svg_ids": [ "c/g/Person_Race-Asian" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian", - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Female", + "c/g/Person_Gender-Male_Race-Asian": "Male" + }, "mprops": [ "age", "count" @@ -140,9 +140,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-Asian": "Asian" + }, "mprops": [ "age", "count" @@ -155,9 +155,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_Gender_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender_Race-Asian": "Gender" + }, "mprops": [ "age", "count" diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/three_unrelated_svs_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/three_unrelated_svs_svgs.json index 546ae90c..a708cf96 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/three_unrelated_svs_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/three_unrelated_svs_svgs.json @@ -6,9 +6,9 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Coal_EnergySource" - ], + "child_svg_specialized_names": { + "c/g/Coal_EnergySource": "Energy Source" + }, "mprops": [] }, { @@ -18,9 +18,9 @@ "parent_svg_ids": [ "c/g/Coal" ], - "child_svg_ids": [ - "c/g/Coal_EnergySource-CokeCoal" - ], + "child_svg_specialized_names": { + "c/g/Coal_EnergySource-CokeCoal": "Coke Coal" + }, "mprops": [] }, { @@ -32,7 +32,7 @@ "parent_svg_ids": [ "c/g/Coal_EnergySource" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] }, { @@ -42,10 +42,10 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_Gender" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_Gender": "Gender" + }, "mprops": [] }, { @@ -55,9 +55,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female": "Female" + }, "mprops": [] }, { @@ -67,9 +67,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race": "Race" + }, "mprops": [] }, { @@ -79,9 +79,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Female" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -94,7 +94,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Female_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] }, { @@ -104,9 +104,9 @@ "parent_svg_ids": [ "c/g/Person_Race-Asian" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Female" + }, "mprops": [] }, { @@ -116,9 +116,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -128,9 +128,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_Gender_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender_Race-Asian": "Gender" + }, "mprops": [] }, { @@ -142,7 +142,7 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] } ] \ No newline at end of file diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/two_related_svs_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/two_related_svs_svgs.json index bb897ad6..4f89aa09 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/two_related_svs_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/two_related_svs_svgs.json @@ -6,10 +6,10 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_Gender" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_Gender": "Gender" + }, "mprops": [] }, { @@ -19,10 +19,10 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female", - "c/g/Person_Gender-Male" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female": "Female", + "c/g/Person_Gender-Male": "Male" + }, "mprops": [] }, { @@ -32,9 +32,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race": "Race" + }, "mprops": [] }, { @@ -44,9 +44,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Female" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -59,7 +59,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Female_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] }, { @@ -69,9 +69,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race": "Race" + }, "mprops": [] }, { @@ -81,9 +81,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Male" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -96,7 +96,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Male_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [] }, { @@ -106,10 +106,10 @@ "parent_svg_ids": [ "c/g/Person_Race-Asian" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian", - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Female", + "c/g/Person_Gender-Male_Race-Asian": "Male" + }, "mprops": [] }, { @@ -119,9 +119,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-Asian": "Asian" + }, "mprops": [] }, { @@ -131,9 +131,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_Gender_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender_Race-Asian": "Gender" + }, "mprops": [] } ] \ No newline at end of file diff --git a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/verticals_svgs.json b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/verticals_svgs.json index d32ed4fb..603959bc 100644 --- a/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/verticals_svgs.json +++ b/simple/tests/stats/test_data/stat_var_hierarchy_generator/expected/verticals_svgs.json @@ -6,9 +6,9 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Coal" - ], + "child_svg_specialized_names": { + "c/g/Coal": "" + }, "mprops": [ "count" ] @@ -20,9 +20,9 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [ - "c/g/Person" - ], + "child_svg_specialized_names": { + "c/g/Person": "" + }, "mprops": [ "count" ] @@ -36,7 +36,7 @@ "parent_svg_ids": [ "c/g/CoalCountVertical" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count" ] @@ -48,10 +48,10 @@ "parent_svg_ids": [ "c/g/PersonCountVertical" ], - "child_svg_ids": [ - "c/g/Person_Race", - "c/g/Person_Gender" - ], + "child_svg_specialized_names": { + "c/g/Person_Race": "Race", + "c/g/Person_Gender": "Gender" + }, "mprops": [ "age", "count" @@ -64,10 +64,10 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female", - "c/g/Person_Gender-Male" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female": "Female", + "c/g/Person_Gender-Male": "Male" + }, "mprops": [ "age", "count" @@ -80,9 +80,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race": "Race" + }, "mprops": [ "count" ] @@ -94,9 +94,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Female" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Asian" + }, "mprops": [ "count" ] @@ -111,7 +111,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Female_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count" ] @@ -123,9 +123,9 @@ "parent_svg_ids": [ "c/g/Person_Gender" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race": "Race" + }, "mprops": [ "age" ] @@ -137,9 +137,9 @@ "parent_svg_ids": [ "c/g/Person_Gender-Male" ], - "child_svg_ids": [ - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Male_Race-Asian": "Asian" + }, "mprops": [ "age" ] @@ -154,7 +154,7 @@ "c/g/Person_Gender_Race-Asian", "c/g/Person_Gender-Male_Race" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "age" ] @@ -166,10 +166,10 @@ "parent_svg_ids": [ "c/g/Person_Race-Asian" ], - "child_svg_ids": [ - "c/g/Person_Gender-Female_Race-Asian", - "c/g/Person_Gender-Male_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender-Female_Race-Asian": "Female", + "c/g/Person_Gender-Male_Race-Asian": "Male" + }, "mprops": [ "age", "count" @@ -182,9 +182,9 @@ "parent_svg_ids": [ "c/g/Person" ], - "child_svg_ids": [ - "c/g/Person_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Race-Asian": "Asian" + }, "mprops": [ "age", "count" @@ -197,9 +197,9 @@ "parent_svg_ids": [ "c/g/Person_Race" ], - "child_svg_ids": [ - "c/g/Person_Gender_Race-Asian" - ], + "child_svg_specialized_names": { + "c/g/Person_Gender_Race-Asian": "Gender" + }, "mprops": [ "age", "count" @@ -214,7 +214,7 @@ "parent_svg_ids": [ "c/g/Root" ], - "child_svg_ids": [], + "child_svg_specialized_names": {}, "mprops": [ "count" ]