- 1 Overview
- 2 Objectives
- 3 Challenges
- 4 Gantt Chart
- 5 Budget
- 6 Design and Solutions
- 7 How our Project Runs
- 8 Results
- 9 Next Steps
- 10 Extra resources
A common problem at swim meets is the backup that occurs from timers having to record the times for each swim on paper. The times then have to be manually entered in case one of the touchpads in the water does not register the swimmers touch, resulting in a false time. The objective of our project is to create an IPhone app to assist with swim meets. We want timers at swim meets to be able to input the time they recorded for the swimmer, based on the event number, lane number, and heat number, into the app instead of writing it on paper. This will allow the times recorded to go directly into the database instead of having to be manually entered at the conclusion of each swim event.
Here is a link to the weekly log that will contain updates on our progress for the project: https://classes.engineering.wustl.edu/ese205/core/index.php?title=Swim_Sheets_Log
TA: Jack Robards
We want the IPhone app’s interface to prompt the user for the event number, heat number, and lane number. The app should then return the swimmer’s name based off the psych sheet for the overall meet. The user can then double check the accuracy of the name and override it if necessary. Once the swim is complete, a time will be entered and stored in an excel spreadsheet that could then be inputted into a swim database at a later time.
The main goals of this app are to:
1. Create a database that takes in the psych sheet and can report the swimmers name.
2. Prompt the user for event number, heat number, and lane number
3. Display data in an organized manner for overall meet results and analysis.
4. The database should take in an input of data, consisting of rosters, events, heat, and lane. These should be imported into the database from a .txt file that can be used by various teams to import into the database.
5. Results will be generated and be viewable from the database for the coaches use. These results can also be exported into a spreadsheet for viewing.
6. The data for each race will be received from inputs from the app, not an external source.
Learn how to:
- Create a public IP address to update the times.
- Create a database and PHP files.
- Use Apple’s IDE to create the application.
- Import the data from a document.
- Use the iCloud server.
- Override errors in the input process.
- Code in swift.
- Read and access information from the php file with swift .
- Limit the user input accepted in the UITextField .
- Send information from one page of the app to the next .
- Send the time input to the database from swift .
- Embed search in the tableview .
Tutorial on How to Import an Excel File into a Database
Blue Host: $5.95 per month for 12 months
Total cost: $71.40
Design and Solutions
The Swimsheets app was designed to...
- Allow coaches to fill out a simple Excel XML file
- Have the file be uploaded, and the entries entered into a datatable automatically
- Have an app read the datatable and display the swimmer for each specific event and heat to the corresponding lane on an app
- Allow timers to input the time for each swim
- Have the time data uploaded back into the datable
- Display the results in an organized manner that can be found on the Swimsheets.com website
- We used Xcode to write the swift app
- Created five pages for the app and a loading screen
- Eight different classes
AppDelegate.swift: auto generated class to make sure the app screen loads
ViewController.swift: Page One of SwimSheets App where you input the lane number; there is a button,"go" to transition to PageTwo.
PageTwo.swift: Second page of SwimSheets App with HomeModlel.swift as a protocol. This page displays the next input in the php file for the given lane and prints the event name, heat number, team name and the swimmer's first and last name. The page then asks for a confirmation for the swimmer's name where the timer can select either the "Yes" button that transitions to PageThree or the "No" Button which transitions to PageFive.
PageThree.swift: Third page of SwimSheets where timers can input time (MM:SS.MsMs). The UITextField only allows two digit inputs with the first input being no greater than six to ensure that timers enter a valid time. The timers can then confirm the time by pressing the "Yes" Button to transition to PageFour. If the time is not correct, the time keeper can select the "No" Button, clearing the time input by reloading the page.
PageFour.swift: When the page is loaded, it sends the time input to updateresult.php. It then displays data from PageTwo ( event name, heat number, team name and the swimmer's first and last name). However, if the name is incorrect, the timer can select a new name from PageFive ( swimmer's first and last name) and enter the time again from page three. The timer can then press the "Next Race" Button to transition back to PageTwo in order to read the next input for the lane number. The timer also has the option to press "Exit" to quit and segue back to ViewController (page one).
PageFive.swift: With HomeModlel.swift as a protocol. This page displays all possible swimmer names in a table view. The search bar can be used to find and select new swimmers name. After a name is picked, the "Go" Button segue to PageThree.
HomeModlel.swift: Connects app to getdata.php. This reads the file and sends each line of data to LocationModel as a jsonElement that can be read by classes with HomeModlel.swift as a protocol (PageTwo and PageFive).
LocationModel.swift: Stores all the data sent from HomeModlel one line at a time as an NSObject that can be called and read.
Server and Database
- We used Bluehost to set up an SQL database and a web domain (swimsheets.com)
- Used myphpadmin to design the data table that has columns consisting of: ID (an auto incremented number), Team, First Name, Last Name, Event Number, Event Name, Heat Number, Lane Number, Time (this value can be null)
- Data is inserted into this table when the coaches go online and download the excel XML file, fill it out, and upload it at swimsheets.com/upload.php based on the instructions listed on swimsheets.com
- Created various php files needed to execute our commands using sql queries:
upload.php: this is where coaches can submit the entries for the meet, once the submit button is hit, the page is directed to swimsheets.com/import.php
import.php: uploads the meet entry files into the datatable
getdata.php: establishes a connection with the SQL database, displays the entries table as an array that can be accessed using Xcode in swift
updateresult.php: takes in the time that is entered in the app and adds it to the entries table, if there is a blank time given for a Swimmer, "No Show" will be entered into the time field
displaybyevent.php: displays the entries table, sorted by event number and lane number
displaybyname.php: displays the entries table, sorted alphabetically by last name
displaybyteam.php: displays the entries table, sorted by team
emptydata.php: this php codes empties the entries datatable so that a new meet can be started with a clean database
newmeet.php: creates a button that allows the user to empty the database before beginning a new meet
How our Project Runs
Data flow in application
- Download the excel file from swimsheets.com
- Fill out the excel file for your individual team's events
- If you are the home team, follow the directions on swimsheets.com to begin a new meet in the database by emptying the previous meet entries. This involves going to http://swimsheets.com/newmeet.php and clicking the Clear Data button
- Each coach can now upload their individual team's meet files by going to http://swimsheets.com/upload.php and adding the file and pressing the upload button.
- Once the file is uploaded, the coaches will be automatically redirected to http://swimsheets.com/import.php This page will allow the coaches to view the entries that they just uploaded in a table format
- The app will then connect to the page http://swimsheets.com/getdata.php This connection allows the app to pull the entries that were just displayed on http://swimsheets.com/import.php and the entries are loaded into the app
- Once the data is loaded into the app, the users can enter the lane number that they are timing for. They will be directed to the first entry that takes place in that lane. The application will follow the format shown in the table attached below.
- The timer's will reach a screen on the application that allows them to input a time for the swimmer's race
- Once the timer enters the time, the time is sent back to http://swimsheets.com/updatetime.php
- The time will be loaded into the row that corresponds to that particular swimmer's event and time. This row is found based on the auto incremented ID that is generated when the files are initially uploaded into the table
- These results can be viewed on the various viewing pages shown on
Final App Layout
App page layout
Poster for final presentation
Comparison to Objectives
Objective: Create a database of swim entries that can be updated by the Swimsheets app
Our implementation: Successfully created a database that can take in a meet entries file and insert each entry into a new row of the entries datatable. Additionally, we created an auto incremented ID that is unique to each swim that each swimmer has in order to simplify keeping track of swims as the meet progresses and to streamline the process of finding where the time should be updated after each swim is swam.
Connection between Database and App
Objective: Allow the app to pull the entries from the database table "entries" and be able to update the time column for an individual swimmer's event
Our implementation: We created a php file called getdata.php that allows the Swimsheets app to pull all the information out of the table entries that is stored in the database. After the users of the app have entered a time, the time is then reinserted into the table entries in the database. Each individual swim entry has an auto generated ID number that allows the app to match the entered time to the right row and column in the table.
Objective: Show users how the app and database work together to create an updated version of the table entries that can be viewed online.
Our implementation: We used two different computers, one to show the app side of the project and one to show the database side of the project. The first computer showed people how we can upload an excel file and have it load into the database. We then have the second computer run through the swift application. The second computer inputs a time. We then transitioned back to the first computer to show how the time has now updated the entries table and can be viewed at one of the various viewing pages, which can be found at swimsheets.com
Objective: Allow the user to move smoothly between various app screens.
Our implementation: We created 7 different classes that allow the user to maneuver between different pages in the Swimsheets app. The diagram of how our classes interact can be found under the How our Project Runs section of this wikipage.
Objective: Allow the users to visually see the entries and updated results that are in the table entries.
Our Implementation: We created three different viewing screens to see the entries table. One view sorts the entries by name, another sorts the entries by team, and the third view sorts the entries by event. We also formatted these pages to have the background match that of swimsheets.com. We also added a hyperlink to allow users to smoothly transition between the viewing results page and the main website for the project.
One of the decisions we made was to simplify the structure of the database we created. Instead of doing multiple tables that are linked together as shown in the ERD, we created one data table called entries and used that to run all the php files and inputs/outputs from the app. The reason for this was that we lost a group member and needed to reassess how to finish the project in a timely manner. Given more time, the structure of the database would mimic that of the ERD, which would allow the app to be used in multiple swim meets more efficiently. The way we did it still allows for the app to be used, but the user must click a clear button on swimsheets.com to clear the data table before a new meet can be run.
We would perform extensive testing of both the App and the Database in order to deal with the delays in uploading to the database. This problem is possibly due to issues with cached versions of output being stored online; however, we would need to debug in order to know the exact problem. The delays in uploading were tied to the php files in bluehost file manager. We would also work to Implement privacy and security for App and Database in order to prevent people from being able to edit results for different swims or clear the database without the correct permissions.
Possible Database improvements
- Use multiple data tables to allow the app to work for multiple meets; this would mirror the ERD diagram that looks like this:
The purpose of this format, compared to a single table in the database, is to allow this app to store data for multiple meets without having to clear all the entered data before beginning a new meet.
Possible App improvements
- Require a secure login for time keepers
- Ability to access results table from the app as a time keeper and a meet observer
Code With Chris Learn how to connect your iOS app to a MySQL database! https://codewithchris.com/iphone-app-connect-to-mysql-database/. By Chris Ching
Simplified iOS Xcode Text Field Tutorial for iOS Application using Swift https://www.simplifiedios.net/xcode-text-field-tutorial-ios-using-swift/ By Belal Khan
Grok Swift Getting to Know UITextField https://grokswift.com/uitextfield/