Skip to content

Commit

Permalink
refactor: Reflect hlldb design decision to rename date_hll to pud_hll…
Browse files Browse the repository at this point in the history
… (Picture or Post User Days)
  • Loading branch information
Sieboldianus committed May 11, 2021
1 parent 184c604 commit 4f6d578
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lbsntransform/output/hll/base/social.py
Expand Up @@ -22,7 +22,7 @@ def __init__(self):
super().__init__()
self.metrics['latlng_hll'] = set()
self.metrics['place_hll'] = set()
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()


class UserBase(SocialBase):
Expand Down
6 changes: 3 additions & 3 deletions lbsntransform/output/hll/base/spatial.py
Expand Up @@ -28,7 +28,7 @@ def __init__(self, record: lbsn.Post = None):
self.attrs['latlng_geom'] = None
# init additional metrics
# beyond those defined inHllBase
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
self.metrics['utl_hll'] = set()
if record is None:
# init empty
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, record: Union[
self.attrs['geom_center'] = None
self.attrs['geom_area'] = None
self.attrs['name'] = None
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
self.metrics['utl_hll'] = set()
if record is None:
return
Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self, record: Union[
self.attrs['name'] = None
self.attrs['geom_center'] = None
self.attrs['geom_area'] = None
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
self.metrics['utl_hll'] = set()
self.metrics['latlng_hll'] = set()
if record is None:
Expand Down
10 changes: 5 additions & 5 deletions lbsntransform/output/hll/base/topical.py
Expand Up @@ -21,7 +21,7 @@ def __init__(self):
super().__init__()
self.metrics['latlng_hll'] = set()
self.metrics['place_hll'] = set()
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()


class HashtagBase(TopicalBase):
Expand Down Expand Up @@ -128,7 +128,7 @@ def __init__(self, record: Union[
self.attrs['topic_attr2'] = None
self.attrs['topic_attr3'] = None
# TemplateBase inherits from TopicalBase
# thus, metrics latlng_hll, place_hll and date_hll
# thus, metrics latlng_hll, place_hll and pud_hll
# are already defined. Specify additional metrics below
# or remove inheritance and define from scratch
self.metrics['utl_hll'] = set()
Expand Down Expand Up @@ -169,7 +169,7 @@ def __init__(self, record: lbsn.Post = None, term: str = None):
self.key['longitude'] = None
self.key['term'] = None
self.attrs['latlng_geom'] = None
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
if term is None:
# init empty
return
Expand Down Expand Up @@ -208,7 +208,7 @@ def __init__(self, record: lbsn.Post = None, hashtag: str = None):
self.key['longitude'] = None
self.key['hashtag'] = None
self.attrs['latlng_geom'] = None
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
if hashtag is None:
# init empty
return
Expand Down Expand Up @@ -247,7 +247,7 @@ def __init__(self, record: lbsn.Post = None, emoji: str = None):
self.key['longitude'] = None
self.key['emoji'] = None
self.attrs['latlng_geom'] = None
self.metrics['date_hll'] = set()
self.metrics['pud_hll'] = set()
if emoji is None:
# init empty
return
Expand Down
4 changes: 2 additions & 2 deletions lbsntransform/output/hll/hll_bases.py
Expand Up @@ -22,7 +22,7 @@
key as Postgis Geometry, or a name for the place etc.
* a list of (hll) metrics that are measured for the base (the "overlay"), e.g.
a list of post_guids ("post_hll"), or user_guids ("user_hll"), or more
complex metrics such as date_hll (user days, as termed by [2]). These
complex metrics such as pud_hll (user days, as termed by [2]). These
lists will be transformed into a "hll shard".
Additional Notes:
Expand Down Expand Up @@ -69,7 +69,7 @@ class structures defined here, thus it is important that order of keys,
# named tuple of defined hll metrics
HllMetrics = namedtuple( # pylint: disable=C0103
'HllMetricsTuple',
'user_hll post_hll date_hll latlng_hll upl_hll utl_hll '
'user_hll post_hll pud_hll latlng_hll upl_hll utl_hll '
'upt_hll term_hll place_hll', defaults=(None,) * 9)

HllBaseRef = namedtuple('HllBaseRefTuple', 'facet base')
Expand Down
4 changes: 2 additions & 2 deletions lbsntransform/output/hll/hll_functions.py
Expand Up @@ -168,9 +168,9 @@ def hll_concat_userday(record: lbsn.Post) -> str:
"""Merge date and user pkey (guid) for measuring user days"""
date_merged = HLLFunctions.hll_concat_date(record)
user_merged = HLLFunctions.hll_concat_user(record)
date_hll = HLLFunctions.hll_concat(
pud_hll = HLLFunctions.hll_concat(
[user_merged, date_merged])
return date_hll
return pud_hll

@staticmethod
def hll_concat_yearmonth(record: lbsn.Post) -> str:
Expand Down
4 changes: 2 additions & 2 deletions lbsntransform/output/hll/shared_structure_proto_hlldb.py
Expand Up @@ -285,13 +285,13 @@ def get_post_metrics(record) -> hll.HllMetrics:
"""Get hll metrics from lbsn.Post record"""
post_hll = HLF.hll_concat_origin_guid(record)
user_hll = HLF.hll_concat_user(record)
date_hll = HLF.hll_concat_userday(record)
pud_hll = HLF.hll_concat_userday(record)
latlng_hll = HLF.hll_concat_latlng(record)
place_hll = HLF.hll_concat_place(record)
upt_hll = HLF.hll_concat_upt_hll(record)
hll_metrics = hll.HllMetrics(
post_hll=post_hll, user_hll=user_hll,
date_hll=date_hll, latlng_hll=latlng_hll,
pud_hll=pud_hll, latlng_hll=latlng_hll,
upt_hll=upt_hll, place_hll=place_hll)
return hll_metrics

Expand Down

0 comments on commit 4f6d578

Please sign in to comment.