diff --git a/static/data/hierarchy_statsvar.json b/static/data/hierarchy_statsvar.json index df0f5fe53..bcb5e741a 100644 --- a/static/data/hierarchy_statsvar.json +++ b/static/data/hierarchy_statsvar.json @@ -221645,7 +221645,9 @@ "e": "Negative", "c": 1, "cd": [], - "d": [] + "d": [ + "CumulativeCount_MedicalTest_ConditionCOVID_19" + ] }, { "sv": [ @@ -221656,7 +221658,9 @@ "e": "Positive", "c": 1, "cd": [], - "d": [] + "d": [ + "CumulativeCount_MedicalTest_ConditionCOVID_19" + ] }, { "sv": [ @@ -221667,7 +221671,9 @@ "e": "Ready", "c": 1, "cd": [], - "d": [] + "d": [ + "CumulativeCount_MedicalTest_ConditionCOVID_19" + ] } ] }, diff --git a/tools/pv_tree_generator/build_tree.py b/tools/pv_tree_generator/build_tree.py index 29e274a35..53240e474 100644 --- a/tools/pv_tree_generator/build_tree.py +++ b/tools/pv_tree_generator/build_tree.py @@ -131,7 +131,8 @@ def find_denominators(pop_obs: PopObsSpec, cpvs: Dict[str, str], a StatVar. The dpvs of "pop_obs" and "cpvs" are combined to form the final pv mapping. - A denominator is included if its pvs are a subset of the final pv mapping. + A denominator is included if its mprop is one of 'count', 'cumulativeCount', + and 'incrementalCount' and its pvs are a subset of the final pv mapping. E.g., if dpvs is {'age': '15YearsOnwards'} and cpvs is {'gender': 'female'}, the denominators are 'Count_Person_15OrMoreYears', 'Count_Person', 'Count_Person_Female', and 'Count_Person_Female_15OrMoreYears' returned in @@ -164,7 +165,8 @@ def find_denominators(pop_obs: PopObsSpec, cpvs: Dict[str, str], key = (pop_obs.pop_type,) + obs_prop.key + subset matching_statvars += tuple(stats_vars_all.get(key, ())) for sv in matching_statvars: - if sv.mprop != 'count' or sv.dcid in stats_vars_to_exclude: + if (sv.mprop not in ('count', 'cumulativeCount', 'incrementalCount') + or sv.dcid in stats_vars_to_exclude): continue sv_entries = set(sv.pv.items()) if sv_entries == dpv_entries: