Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zen-juen committed Dec 8, 2020
1 parent b20778b commit e5c1bea
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 1 deletion.
115 changes: 115 additions & 0 deletions autocalendar.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Metadata-Version: 2.1
Name: autocalendar
Version: 0.0.1
Summary: A Python automation scheduling system based on the Google Calendar API.
Home-page: https://github.com/zen-juen/AutoCalendar
Author: Zen Juen Lau
Author-email: lauzenjuen@gmail.com
License: MIT license
Download-URL: https://github.com/zen-juen/AutoCalendar/archive/v_01.tar.gz
Description: # AutoCalendar :calendar:
**AutoCalendar** is a Python scheduling automation system based on the Google Calendar API ideal for **scheduling research participants**.

Running `autocalendar.py` adds events into Google Calendar by extracting the relevant information from an excel sheet containing participants' details, such as *date*, *time*, and *location*.

Check out [AutoRemind](https://github.com/zen-juen/AutoRemind) too!

## Code Structure

- **Schedule Participants**: `autoallocate()`
- Parses a doodle poll spreadsheet and automatically allocates participants to an available slot (Useful if participants are told to choose as many available slots as they can)

- **Access Google API**: `setup_oauth()`
- Sets up OAuth 2.0
- You would need a `client_secret.json` file: you can do this by going to https://console.developers.google.com/apis/credentials. Click on the 'credentials' tab and then download the client secret file.
- **Extract event details and create event**:
- `preprocess_file()`: preprocesses the input excel sheet (containing participants' scheduled slots)
- `extract_info()`: extracts date, time and location based on header column names in the participants file. Argument `filter_column` can also be activated to select only some participants to be added into google calendar.
- `create_event()`: prepares event details ready for execution. Argument `calendar_id` (defaults to 'primary') can also be modified according to which active google calendar to use by simply specifying the name of the calendar.
- `add_event()`: executes adding of event into calendar.


## How to Use

### 1) Try it yourself: Automatic Scheduling of Participants

Download your doodle poll into an excel spreadsheet, like so:

![Screenshot1](images/pollxls.PNG)

```
import autocalendar as autocalendar

autocalendar.autoallocate('scheduled.xlsx')
All participants successfully allocated.
```
A 'scheduled.xlsx' file containing participants' final allocated slots is exported with one line of code.
Feedback is provided on whether participants are successfully allocated or not, and the name of any participant who is not allocated will be printed.

### 2) Try it yourself: Adding Events

You will first need to start with a xlsx file containing information on participants' scheduled slots. For example:

![Screenshot](images/inputxlsx.PNG)

```
import autocalendar as autocalendar

# Set up Oauth to access Google API
service = autocalendar.setup_oath(token_path='../../token.pkl',
client_path='../../client_secret.json')

# Read and tidy excel sheet
participants = autocalendar.preprocess_file('../../../Participants Scheduling/Master_Participant_List.xlsx', header_row=2)

# Extract info
dates, start_points, end_points, locations, to_add = autocalendar.extract_info(participants, date_col='Date_Session1', time_col='Timeslot_Session1', location_col='Location_Session1', filter_column='Calendar_Event', select='No')

# Execute
autocalendar.add_event(service, dates, start_points, end_points, locations, to_add,
event_name='MRI study Session 1', description='', timezone='Asia/Singapore',
creator_email='mristudy@gmail.com', calendar_id='NTU Calendar',
silent=False, name_col='Participant Name', date_col='Date_Session1',
location_col='Location_Session1', time_col='Timeslot_Session1')

```

If `silent` in `add_event()` is set to False, you will also get **printed output** on each participant's appointment that is added into Google Calendar!
```
Adding calendar event for Subject1 at 11-8-2020, 11.00am-11.30am, B1-26
Adding calendar event for Subject2 at 11-8-2020, 10.30am-11.00am, B1-26
Adding calendar event for Subject3 at 11-8-2020, 4.00pm-4.30pm, B1-26
Adding calendar event for Subject4 at 13-8-2020, 9.30am-10.00am, B1-26
Adding calendar event for Subject5 at 12-8-2020, 11.30am-12.00pm, B1-26
Adding calendar event for Subject6 at 12-8-2020, 12.00pm-12.30pm, B1-26

```




## Future Direction
- [x] Printed feedback on each event that has been successfully added into calendar
- [ ] Accessibility for longitudinal studies
- [ ] Greater functionality for customizing events by adding arguments from https://developers.google.com/calendar/v3/reference/events


News
-----


0.0.1 (2020-10-21)
^^^^^^^^^^^^^^^^^^^

* First release on PyPI.

Keywords: automation,calendar events,google calendar api,automatic scheduling,Python
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
12 changes: 12 additions & 0 deletions autocalendar.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
README.md
setup.cfg
setup.py
autocalendar/__init__.py
autocalendar/autocalendar.py
autocalendar/example.py
autocalendar.egg-info/PKG-INFO
autocalendar.egg-info/SOURCES.txt
autocalendar.egg-info/dependency_links.txt
autocalendar.egg-info/not-zip-safe
autocalendar.egg-info/requires.txt
autocalendar.egg-info/top_level.txt
1 change: 1 addition & 0 deletions autocalendar.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions autocalendar.egg-info/not-zip-safe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

9 changes: 9 additions & 0 deletions autocalendar.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
numpy
pandas
pickle
os
dateutil
datetime
apiclient
google
google_auth_oauthlib
1 change: 1 addition & 0 deletions autocalendar.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
autocalendar
Binary file added dist/autocalendar-0.0.1.tar.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def find_version():
name="autocalendar",
keywords="automation, calendar events, google calendar api, automatic scheduling, Python",
url="https://github.com/zen-juen/AutoCalendar",
download_url = 'https://github.com/zen-juen/AutoCalendar/zipball/master',
download_url = 'https://github.com/zen-juen/AutoCalendar/archive/v_01.tar.gz',
version=find_version(),
description="A Python automation scheduling system based on the Google Calendar API.",
long_description=readme + "\n\n" + history,
Expand Down

0 comments on commit e5c1bea

Please sign in to comment.