Skip to content

Tool to auto-fill the EMS paperwork for the Ohio Union AV managers

License

Notifications You must be signed in to change notification settings

samyun/Ohio-Union-EMS-Autofill-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ohio Union EMS Autofill Tool

This is a tool to auto-fill the EMS paperwork for the Ohio Union AV managers. This tool is provided as-is and is under no longer under active development, due to graduation.

Table of Contents

Installation

Mac users: See macOS Installation Script for an automated installation, or follow the manual steps below.

Python3

Python is the scripting language that the autofill tool is written in. There are two versions of Python: Python 2.x and Python 3.x which are incompatible with each other. This tool is written in Python 3. It's been tested with version 3.4 and later.

  1. Download and install the latest version of Python 3
    • (Windows):
      1. I recommend installing to C:\python3 instead of the installer default
      2. Check the box to install for all users and Add to PATH.
    • (macOS):
      1. Install normally
  2. Ensure Python is added to PATH
    • Windows:
      1. Launch Command Prompt
      2. Type python --version
      3. If the output is not Python 3.x.x (e.g. 'python' is not recognized as an internal or external command, operable program or batch file. or Python 2.7.x):
        1. Click Start, type environment variables and click on "Edit environment variables for your account"
        2. Under System variables, look for Path, and double click on it
        3. Add a new entry with path C:\python3 and another with path C:\python3\Scripts or the other installation path from Step 1.
        4. Move those entries to the top.
        5. If double-clicking on Path launched a box with a single text box, type C:\python3;C:\python3\Scripts; to the beginning of the text box. Make sure the ; is at the end.
        6. NOTE: If the output of python --version was Python 2.7.x, this may cause any application that uses Python 2 to have issues. Consider renaming python.exe in C:\python3 to python3.exe and pythonw.exe to pythonw3.exe. This will preserve compatibility with Python 2 applications, while Python 3 commands below will need to be run with python3 instead of python
        7. Exit and relaunch Command Prompt, and verify python --version returns Python 3.x.x. If it doesn't, double check your steps.
    • macOS:
      1. Launch Terminal
      2. Type python3 --version
      3. If the output is not Python 3.x.x (e.g. -bash: python: command not found), type the following commands in Terminal:
        1. Type cd ~
        2. Type nano .bash_profile
        3. If there's a line starting with export PATH=, right after export PATH=, type /usr/local/bin/:, so the line now looks like export PATH=/usr/local/bin:[...]
        4. Otherwise, on a new blank line, type export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
        5. Inside the Terminal window with nano .bash_profile open, type ctrl + X to exit nano, then Enter to save, then Enter to save that file name.
        6. Type source .bash_profile to apply changes from .bash_profile
        7. Verify python3 is in the correct path by typing python3 --version and verify the output says Python 3.x.x. If it doesn't, double check your steps.
Pip3

Pip is a Python package installer. It is used to install Python packages, specifically Selenium.

  1. Launch Command Prompt/Terminal
  2. Type python3 -m pip install -U pip.
  3. Resolve any errors before continuing
Selenium

Selenium (WebDriver) is a web-application testing tool that automates actions on a web browser. Selenium provides the interface between the Python commands and the actual websites.

  1. Launch Command Prompt/Terminal
  2. Type python3 -m pip install -U selenium.
  3. Resolve any errors before continuing

Google Chrome is a popular web browser, and is the only browser supported by this tool. Other browsers could be used after minor modifications to the script, but that has not been tested.

  • Install the regular version of Google Chrome (not Google Chrome Canary or Chromium or Google Chrome Channels)

ChromeDriver is a server that provides the interface for Selenium Webdriver to work with Google Chrome.

  1. Download the latest version of Chromedriver from link above.
  2. Extract into
    • Windows: C:\chromedriver\
    • macOS: /Users/%USERNAME%/chromedriver/ where %USERNAME% is your username - can be found at the top of the Terminal window
  3. Only file inside chromedriver/ should be chromedriver
  4. Add chromedriver/ to PATH:
    • Windows:
      1. Click Start, type environment variables and click on "Edit environment variables for your account"
      2. Under System variables, look for Path, and double click on it
      3. Add a new entry with path C:\chromedriver
      4. Move the entry to the top.
      5. If double-clicking on Path launched a box with a single text box, type C:\chromedriver; to the beginning of the text box. Make sure the ; is at the end.
      6. Exit and relaunch Command Prompt
    • macOS:
      1. cd ~
      2. nano .bash_profile
      3. If there's a line starting with export PATH=, right after export PATH=, type /Users/%USERNAME%/chromedriver/:, so the line now looks like export PATH=/Users/%USERNAME%/chromedriver:[...]. Replace %USERNAME% as above.
      4. Otherwise, on a new blank line, type export PATH=/Users/%USERNAME%/chromedriver:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
      5. Inside the Terminal window with nano .bash_profile open, type ctrl + X to exit nano, then Enter to save, then Enter to save that file name.
      6. Type source .bash_profile to apply changes from .bash_profile
  5. Verify chromedriver is in the correct path by typing chromedriver --version and verify it returns ChromeDriver x.x[...]. If it doesn't, double check your steps.
EMS.Paperwork.Tool.zip

This zip folder contains the autofill tool and the configuration files to run it.

Download the latest EMS.Paperwork.Tool.zip from https://github.com/samyun/Ohio-Union-EMS-Autofill-Tool/releases/latest and extract it to a new folder.

macOS Installation Script

This installation script is for macOS only. It's been tested with a fresh installation of macOS Sierra 10.12.5.

  1. Download the latest installation.sh from https://github.com/samyun/Ohio-Union-EMS-Autofill-Tool/releases/latest and save it to a location of your drive (eg ~/)
  2. Launch Terminal and navigate to the directory containing installation.sh
    • e.g. cd ~/
  3. Type ./installation.sh [-flags]
    • Flags:
      • -d: Install the development environment
      • -i: Skip installations
      • -r: Reinstall dependencies
      • -v: verbose
      • -h: help
    • For a standard installation, type ./installation.sh and follow the prompts. This will check for components, install missing dependencies, and download and extract the latest release of EMS.Paperwork.Tool.zip
    • For a developer's installation, type ./installation.sh -d and follow the prompts. This run the same as the standard installation, but it will also clone the master branch of the source code.

Background

This tool was designed to allow Ohio Union AV Managers to quickly and easily complete the EMS paperwork for the next day. Using Python3 and Selenium, an open source web browser automation tool, this tool will launch an instance of Google Chrome, navigate to https://whentowork.com, log in, and pull the schedule for the day specified. Then the tool will navigate to https://ohiounion.osu.edu/ems and complete the scheduling assignments based on the schedule pulled from W2W. This tool may work with other Ohio Union manager positions by changing various settings.json attributes, such as Production, but it is not tested.

How to Run

  • Make sure dependencies are installed
  • Edit settings.json
    • Enter first name, last name, EMS credentials, WhenToWork credentials etc
  • In Terminal/Command Prompt, change directory to 'EMS Paperwork Tool/' and run: python3 autofill_tool.py

settings.json

  • current_manager_first_name: The current manager's first name. Used to assign early-morning setups that should be done the night before
  • current_manager_last_name: The current manager's last name. Used to assign early-morning setups that should be done the night before
  • ems_username: OSU name.#
  • ems_password: OSU password
  • w2w_username: WhenToWork username
  • w2w_password: WhenToWork password
  • use_w2w_manager_for_previous_day_setup: true to use the AV Manager for the previous evening for previous day setups, false to use "current_manager_first_name".
  • minutes_to_advance_setup: Amount of time prior to the event start time that setup should be scheduled. e.g: If event starts at 5:00 PM, "minutes_to_advance_setup" = 30 means setup time is 4:30 PM.
  • minutes_to_advance_checkin: Amount of time prior to the event start time that check-in should be scheduled. e.g: If event starts at 5:00 PM, "minutes_to_advance_checkin" = 15 means check-in time is 4:45 PM.
  • minutes_to_delay_teardown: Amount of time after the event end time that teardown should be scheduled. e.g: If event ends at 5:00 PM, "minutes_to_delay_teardown" = 30 means teardown time is 5:30 PM.
  • previous_day_setup_cutoff: The cut-off time to schedule the setup for the previous night. e.g.: If the cut-off time if 10:00 AM, an event that starts at 9:45 AM would be setup the night prior at "setup_time_night_before" time by "current_manager_last_name", "current_manager_first_name".
  • late_open_previous_day_setup_cutoff: The cut-off time to schedule the setup for the previous night on late opens
  • setup_time_night_before: The time to setup the event if it's set up the night prior. e.g: If the event starts prior to the "previous_day_setup_cutoff", and "setup_time_night_before" = 12:00 AM, the setup would be scheduled at 12:00 AM.
  • use_w2w: true to use WhenToWork to find the schedule. false to use a separate "schedule.json"
  • custom_date: false to use 'tomorrow's' date. true to have the script prompt for the date.
  • skip_already_scheduled: true to skip events that have either setup, check-in, or teardown already scheduled. false to schedule those anyways. NB: if this is set to false, it will add the schedules, even if they already exist.
  • skip_already_confirmed: true to skip events where the setup, check-in, or teardown are already scheduled. false to schedule those events anyways.
  • skip_checking_for_av: true to skip checking for AV equipment, false to check for AV equipment
  • skip_events_with_no_av: true to schedule events where the "A/V Equipment" section is "None Found". false to schedule those events anyways.
  • skip_rooms: true to skip events that are in one of the rooms in "skip_following_rooms". false to schedule those events anyways.
  • manager_position: The name of the manager position that appears in https://ohiounion.osu.edu/ems that should be used
  • order_to_assign_general_shift: The order to schedule events. These are the positions in the W2W headers. eg. If the order is "A", "B", "C", the script will try to schedule an "A" first. If there are no A's, it will try to schedule a "B". If there are no A's nor B's, the script will try to schedule a "C". If there are no A's, B's, nor C's, it will skip assignment for that time only.
  • skip_following_rooms: The rooms to skip if "skip_rooms" is true.

To-Do

  • create reports for shift-leads
  • better installation package
  • auto-confirm shifts