A Python library for analyzing Google Calendar data.
Project description
Google Calendar Analytics
This Python program allows you to perform analytics on your Google Calendar events. With this program, you can visualize the total duration of your events, compare the length of events across different time periods, and gain insights into which events take up the most time.
Features
- Extract events from your Google Calendar
- Compute the total duration of events in a specified time range
- Visualize the duration of events in a pie chart, bar chart, or line chart
- Limit the number of events displayed in the charts
- Wide chart customization. For example, dark mode and transparent background
Usage
To use the Google Calendar Analytics program, first install the dependencies by running the following command:
pip install google-calendar-analytics
You can then import the AnalyzerFacade class and create an instance with your Google Calendar credentials:
from datetime import datetime
from google.oauth2.credentials import Credentials
from google_calendar_analytics import AnalyzerFacade
# Example of creds dictionary. (You can get it from Google OAuth2 in you web app)
creds = {
"token": "ya29.a0AVvZVsoH4qZcrGK25VwsXspJv-r9K-",
"refresh_token": "1//0hwlhrtalKgeRCgYIARAAGBESNwF-",
"token_uri": "https://oauth2.googleapis.com/token",
"client_id": "395np.apps.googleusercontent.com",
"client_secret": "GOCSPXFqoucE03VRVz",
"scopes": ["https://www.googleapis.com/auth/calendar"],
"expiry": "2023-02-18T15:30:15.674219Z"
}
creds = Credentials.from_authorized_user_info(creds)
analyzer = AnalyzerFacade(creds=creds)
Once you have an AnalyzerFacade instance, you can use its analyze_one and analyze_many methods to generate charts. For example, to analyze a single event and generate a chart, you can use the following code:
start_time = datetime(2023, 2, 1)
end_time = datetime(2023, 2, 15)
event_name = "Meeting"
plot_type = "Line"
fig = analyzer.analyze_one(start_time, end_time, event_name, plot_type)
fig.show()
To analyze multiple events and generate a chart, you can use the following code:
start_time = datetime(2023, 2, 1)
end_time = datetime(2023, 2, 15)
max_events = 5
plot_type = "Pie"
fig = analyzer.analyze_many(start_time, end_time, plot_type, max_events)
fig.show()
Contribution
If you would like to contribute to this project, please feel free to submit a pull request. Some areas where contributions are particularly welcome include:
- Adding new features
- Improving existing features
- Debugging and fixing bugs
- Adding tests to ensure the program is working as expected
Weekly analytics example:
Pie plot | Bar plot |
---|---|
Line plot |
---|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for google_calendar_analytics-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 373eb8c8b9f8faa0eba4a5fd5357fba9a4bde0cccdcbd0e3b9aa645fd9c5390a |
|
MD5 | 7a78aff312389207c38fb1effd265774 |
|
BLAKE2b-256 | 76bc11010a1981b248d38511c55c284188c1c5b3b63bdb878b046eda4a0f2a76 |