Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datetime Interface #1

Open
melvintzw opened this issue Mar 6, 2020 · 0 comments
Open

Datetime Interface #1

melvintzw opened this issue Mar 6, 2020 · 0 comments
Assignees
Labels
good first issue Good for newcomers project information This issue details information about a specific Project.

Comments

@melvintzw
Copy link
Contributor

melvintzw commented Mar 6, 2020

Context:

Our overlap_finder.find_all_common_intervals is able to take in a list of labeled Datetime Intervals (labelled with userid), and return a dictionary where the key is a common datetime interval (which we refer to as overlaps) , and the value is the set of userids that associate with that overlap. An example printout is shown in the code snippet below.

Mission:

We need to specify how datetime interval information should be passed to the bot as a string. Broadly, the question is how should you chat with the bot to pass it datetime interval information? Next, we need to write a parser to parse the bot's representation of a datetime interval into Interval objects that contain Datetime objects. We also need to attach user data to the Interval object for identifying who the interval is associated with.

Some approaches: explore libraries that parse natural language into datetimes, find or build a Telegram keyboard for datetime input, specify a fixed quick-and-easy string format.

Long-term goal:

Calendar Integration - integrate parser with calendar files (e.g. .ics files)

"""
tc_9 = [
Interval(dt(year=2018, month=1, day=1, hour=10), dt(year=2018, month=1, day=1, hour=12), "user_1"),
Interval(dt(year=2018, month=1, day=3, hour=10), dt(year=2018, month=1, day=3, hour=12), "user_1"),
Interval(dt(year=2018, month=1, day=1, hour=11), dt(year=2018, month=1, day=1, hour=13), "user_2"),
Interval(dt(year=2018, month=1, day=3, hour=11), dt(year=2018, month=1, day=3, hour=13), "user_2"),
Interval(dt(year=2018, month=1, day=1, hour=8), dt(year=2018, month=1, day=1, hour=18), "user_3"),
Interval(dt(year=2018, month=1, day=2, hour=8), dt(year=2018, month=1, day=2, hour=18), "user_3"),
Interval(dt(year=2019, month=1, day=1, hour=8), dt(year=2019, month=1, day=1, hour=18), "user_4"),
Interval(dt(year=2019, month=1, day=5, hour=0), dt(year=2019, month=1, day=6, hour=0), "user_4"),
Interval(dt(year=2019, month=1, day=5, hour=0), dt(year=2019, month=1, day=6, hour=0), "user_5"),
Interval(dt(year=2019, month=1, day=5, hour=0), dt(year=2019, month=1, day=6, hour=0), "user_5"),
Interval(dt(year=2019, month=1, day=5, hour=0), dt(year=2019, month=1, day=6, hour=0), "user_6")
]

test_algo(tc_9, format_date=True)

--- OUTPUT : ---

available common datetime intervals:

2018-Jan-01 1000 - 2018-Jan-01 1200:
userids: {'user_3', 'user_1'}
2018-Jan-01 1100 - 2018-Jan-01 1200:
userids: {'user_2', 'user_3', 'user_1'}
2018-Jan-03 1100 - 2018-Jan-03 1200:
userids: {'user_2', 'user_1'}
2019-Jan-05 0000 - 2019-Jan-06 0000:
userids: {'user_6', 'user_5', 'user_4'}
2018-Jan-01 1100 - 2018-Jan-01 1300:
userids: {'user_2', 'user_3'}
"""

@melvintzw melvintzw added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 6, 2020
@melvintzw melvintzw added project information This issue details information about a specific Project. and removed help wanted Extra attention is needed labels Mar 7, 2020
@melvintzw melvintzw changed the title Datetime Interval Parser Datetime Interface Mar 7, 2020
@melvintzw melvintzw self-assigned this Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers project information This issue details information about a specific Project.
Projects
None yet
Development

No branches or pull requests

1 participant