Skip to content

Commit

Permalink
allow incrementalCount and cumulativeCount (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
intrepiditee authored Oct 14, 2020
1 parent 3de704a commit f7584b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 9 additions & 3 deletions static/data/hierarchy_statsvar.json
Original file line number Diff line number Diff line change
Expand Up @@ -221645,7 +221645,9 @@
"e": "Negative",
"c": 1,
"cd": [],
"d": []
"d": [
"CumulativeCount_MedicalTest_ConditionCOVID_19"
]
},
{
"sv": [
Expand All @@ -221656,7 +221658,9 @@
"e": "Positive",
"c": 1,
"cd": [],
"d": []
"d": [
"CumulativeCount_MedicalTest_ConditionCOVID_19"
]
},
{
"sv": [
Expand All @@ -221667,7 +221671,9 @@
"e": "Ready",
"c": 1,
"cd": [],
"d": []
"d": [
"CumulativeCount_MedicalTest_ConditionCOVID_19"
]
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions tools/pv_tree_generator/build_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f7584b4

Please sign in to comment.