GithubHelp home page GithubHelp logo

marcodifrancesco / calendaranalyzer Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 1.0 2.24 MB

Dashboard to visualize your Google Calendar events.

Home Page: http://raspberry.gleeze.com:8501

License: BSD 3-Clause "New" or "Revised" License

Python 95.89% Dockerfile 0.38% Shell 3.73%
hacktoberfest python

calendaranalyzer's Introduction

Hi ๐Ÿ‘‹, I'm Marco Di Francesco

About me

โ€ข Specializing in Online Machine Learning for Robotics @ ABB โฐ
โ€ข Msc Student at Aalto university + Twente University ๐Ÿ‘จโ€๐ŸŽ“
โ€ข Finance and Geopolitics nerd ๐Ÿค“
โ€ข No Pineapple on Pizza pls ๐Ÿฉท

Contacts

linkedin telegram

calendaranalyzer's People

Contributors

dependabot[bot] avatar evanzhang008 avatar marcodifrancesco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

evanzhang008

calendaranalyzer's Issues

Remove week view

KeyError: 'Activity'

Traceback:
File "/usr/local/lib/python3.9/site-packages/streamlit/script_runner.py", line 354, in _run_script
    exec(code, module.__dict__)
File "/app/app.py", line 207, in <module>
    main()
File "/app/app.py", line 181, in main
    df = get_df(calendar, group_by, fm)
File "/app/app.py", line 54, in get_df
    df = calendar.by_week(fm, sel_cal)
File "/app/utils/Calendar.py", line 101, in by_week
    return self._by_period(df, "W", filter)
File "/app/utils/Calendar.py", line 155, in _by_period
    df = df.groupby(["Period", "Activity"]).sum()
File "/usr/local/lib/python3.9/site-packages/pandas/core/frame.py", line 7631, in groupby
    return DataFrameGroupBy(
File "/usr/local/lib/python3.9/site-packages/pandas/core/groupby/groupby.py", line 889, in __init__
    grouper, exclusions, obj = get_grouper(
File "/usr/local/lib/python3.9/site-packages/pandas/core/groupby/grouper.py", line 862, in get_grouper
    raise KeyError(gpr)

Pyramid chart

Pyramid chart (link)

"Should increase" "Should reduce"

  • Should increase: bottom of the plot
  • Should reduce: top of the plot

Screenshot_2022-03-16-09-48-18-78_3aea4af51f236e4932235fdada7d1643~3.jpg

Result:

Image

2020 vs 2021

Archived: Not scalable to multiple years

Plot only 2020 in the left, 2021 in the right.

Compare for instance:

  • Entertainment
  • Study

Maybe with a transparent bar chart like #78

Healthy vs Unhealthy

Archived: The healthy data may be way more than entertainment. Then there is anyway the problem of not spotting a non existing pattern.

Plot with healthy spare time in the right and left entertainment, and look if there is a trend.

Divide spare time in:

  • Healthy: walk - talk - study - personal dev
  • Unhealthy: entertainment

Spare time vs Study

Archived: Does not really give useful information

Compare healthy spare time with study and see if I walk more when I study more (I'm at the library).

Average workout duration

Remove average workout duration. It's misleading since 36 minutes in average do not mean anything.

Get by week/month

In "List of all the activities" add checkboxes below text box with "by month", "by week"

Data checks

Checks - Easy ones

  • Check if recurring tasks are not counted
  • Activities start at 15 or 45 instead of 0 or 30
  • Check for minutes different than 00 and 30
  • Look if there is the same activity in 2 different categories, like data mining both in study and spare time in order to move them Replace by check on each category

Checks - Hard ones

  • Activities overlap, do this by checking if 2 activities start at the same time, if they don't then it's detected by the gap check The gap check does it, no need for it
  • 2 consequent activities are the same, like Phone at 10:00 and Phone at 10:30
  • Day has empty parts, in case it's difficult make a grid plot and look at the color

Meals order

If meals are ordered during the day: Breakfast -> Lunch -> Dinner

  • Fix timezone problem
  • Implement it Too difficult, don't know how to implement it

Problem: Implemented and removed because does not really make sense.

  • Eat time
    • Breakfast: brunch, snack (if <12:00)
    • Lunch: snack (if <= 4:00)
    • Dinner: snack (if > 4:00)

def _check_meal_day(df: pd.DataFrame) -> None:
"""Check for meals time start, snacks are included in one of those meals
TODO: replace with meal order, there are cases in which I want to have a breakfast
at 12:30 and other days with lunch at 12:00
e.g. Breakfast can start at 11:30 but cannot start at 12:00
"""
meals = {
"Breakfast": {"start": "00:00", "end": "11:59"},
"Lunch": {"start": "12:00", "end": "15:59"},
"Dinner": {"start": "16:00", "end": "23:59"},
}
for meal, times in meals.items():
df_meal = df[df["SUMMARY"].isin(meals.keys())]
index = pd.DatetimeIndex(df_meal["DTSTART"])
idx_b = index.indexer_between_time(times["start"], times["end"])
df_b = df_meal.iloc[idx_b]
df_b = df_b.loc[df_b["SUMMARY"] != meal]
df.loc[
df["DTSTART"].isin(df_b["DTSTART"]), "Error"
] = f"Is {meal} (<{times['end']})"

Add Sentry

Add sentry logged to project to see how many people use it

Total number of activities

Write something like

f"In total there are {total_count} activities over 2 years and {montly_average} in average each month"

Clear cache

  • Understand why there isn't clear cache
  • Maybe hide it inside the password tab

Screenshot_20211122-233035_Firefox.png

Activities < 1h

Remove filter for these type of activities, otherwise you'll never clean data.

Link to edit activity

Link is composed by:

  • UID: present in the ics
  • calendar id: present in the download link

Calendar ID

In the downloaded ics:

UID:64xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxco@google.com

The UID is: 64xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxco.

UID

In the download link:

https://calendar.google.com/calendar/ical/t2xxxxxxxxxxxxxxxxxxxxx64%40group.calendar.google.com/private-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/basic.ics

The calendar id is t2xxxxxxxxxxxxxxxxxxxxx64@g.

Base64

Needs to be encoded in base64 as UID+space+IDCAL. For instance:

FROM:
64xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxco t2xxxxxxxxxxxxxxxxxxxxx64@g
TO:
Yzhzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc0Bn

Create link

Then placed in the link:

https://calendar.google.com/calendar/u/0/r/eventedit/Yzhzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc0Bn

Sort by date

Get an average time of the day during the different months of the various activities. For example when I started having breakfast on average in a specific month.

Strip spaces

Data cleaning

  • Strip spaces and tabs from data

Beginning of the day

Meals time by day of the week

Done: with meals due to bad results

Result (of the new one):

Original:

Get average time I start:

  • Study (useful to get insights about if I would be able to study past a certain time)
  • Meal (should always be breakfast)

Type: strip plot (https://altair-viz.github.io/gallery/stripplot.html)

Result: looks like shit

Average time in months

Get average time I start meals

Result:

Activity

Archived: too difficult and does not give a lot of information. I'm afraid it looks like the commute/transports one.

  • create plot with end of the day activities

Image

Errors box

  • Make a box for errors like for admin
  • Make it open by default (maybe)

Screenshot_2021-12-12-20-23-04-14_3aea4af51f236e4932235fdada7d1643.jpg

Longest activities overall

Make barplot with all the activities:

  • select the 10/20 longest
  • make plot vertical
  • add labels (like in #51)
  • add it under 'All activities normalized bar plot'

image

Commute time

Value somehow the times I traveled instead of the hours spent on it, indeed most of the times commuting is way less than half an hour, but it's written always.

  • consider bus, walk, maybe bike (not train and car)
  • compare times, not time taken
  • only activities of 1 hour or less
  • y axis in percentage

Image

Result

Image

Average activity duration

Box plot

Problem: data is segmented in half hours, so most of it is going to be between 30 and 60 minutes. Maybe it's useful to make it and remove the y axis labels in order only to compare activities.

141614844-8e9e8e97-442c-4835-9eb1-4adf58d0c98e

Add calendar

  • Remove calendar FBK
  • Add calendar Work
  • Order calendars list by name

Productiveness

Check out how many hours I study work during the weekdays and the weekend in average

Entertainment trend

Look if YouTube activities are becoming shorter and more frequent, more than one half an hour a day. This may be due to YouTube Shorts.

Longest activity with pauses

Make a plot like "Longest non-stop activities" but also with pauses in the middle.

How

Can be done using a new data frame with Day, Activity Name, Duration. After summing everything just order by duration.

Archived: Problems:

  • how do I represent it showing the separation with Non-stop activities? All day should be visualized, and it would take too much time to implement.
  • does it make sense to see that I talked for 12 hours in a day for instance? Sรฌ

Start study time

Get the average time during the day in which I start studying. Useful to get insights about if I would be able to study past a certain time.

Fix activities

To Fix

Mouse (warranty)
Fix phone/computer CHORES
Keyboard LINUX
Account management
Trip organization (Chores)
Help dad -> Fix car
If I sleep/study in the train is it Sleep (Spare time) or Commute?
Packing up -> PERSONAL CARE OR CHORES???
Sim management
Apply film wrap -> HOUSE???

Solved

Shop ikea -> Shop (Chores)
Help Alessandro -> Linux (Personal development)
Fix phone -> Phone (Chores)
Call -> Talk (Spare time)
Beach -> Relax (Spare time)
Boat -> Relax (Spare time)
Spa -> Relax (Spare time)
Wash dishes -> Tidy up (Chores)

Show all activity in table

Show all activities when looking at the whole view and add the last month constrain just in the month and week views (in the charts)

Screenshot_20210831-071437_Firefox.png

Split day at 5 am

A new day should start at 5 of the morning, so group by data at 5 of the morning instead of midnight.

Idea: add a delta of -5 hours before selecting the day.

GitHub Actions caching

Look if it's possible to use caching for pip installation. Then add -U to pip install.

Change exam name

Software engineering -> Software engineering 1

So it matches with SE2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.