# AttendanceScanning
## Problem

An engineering seminar is attended by over 70 students. The previous class exits 10 minutes before the next class enters. The room holds over 100 students. Calling out student names takes too much time. Asking students to find their name on a sheet and put a check by it works, but a line forms. Some students would rather find a seat near their friend than wait in line. They begin signing in for each other. And the slippery slope results in starting a seminar with a head count of 30, but 50 people signed in.

## Conceive

Making seminar attendance part of one's grade is necessary to get community college students to attend. Otherwise, it becomes an optional club. Maybe in the future, the seminar will be so valued, that everyone will want to attend. But to get to that point, to figure out what works and doesn't work in the seminar means that students need additional motivation.

## Implement

CSV file processing :
Processing code that reads a CSV file downloaded from Canvas gradebook .. that ignores columns and rows, finds just three rows and sets up the major variables for the overall program
This program was built by looking through the processing.org. Started off with getting loadTable to run. Biggest problem was figuring out that the csv file had to be in the data folder. Kept getting "null pointer" error messages when it was not.
The next step was storing everything in a several string arrays. The array reference shows integer and number arrays, but not strings. But the description talks about string arrays so seemed possible. When the word string did not change color in the IDE, String was tried. Capitalizing S was the difference.
Could not figure out how to find the number of students and then set the array size, so made 120 the max number of students ... arbitrarily. If the number is fewer, the program works. If roster.csv has more students in it, then probably will get an error message when it runs. just change the size in ScanGUI16 at the top where the variables are defined.
Comparing strings was difficult. Tried == but didn't work. The .equals method is not on the reference page.
The "while" command to pad the student id with leading 0's because they were lost in canvas worked correctly the first time.
Tried saveStrings to save the drop down list, but saved the word "null" for the 120-class size students. So had to go with PrintWrite which is more verbose. Had to add path to the data file so the actual file is created in the data directory where the GUI drop down will look for it.
csvTest
Table table;
String sis = new String[120];
String name = new String[120];
String section = new String[120];
int NumStudents = 0;
PrintWriter output;
void setup {
int i=0; //is going to count rows in roster.csv
table = loadTable("roster.csv", "header");//roster.csv is downloaded from canvas gradebook course megasite
for (TableRow row : table.rows) {
int j; // is going to count rows of students, skipping header, second line and hopefully default, test students
if (i>0) {
if (!(row.getString("Student").equals("Student, Test"))) {
j = i-1;
sis[j] = row.getString("ID");//using only three columns of canvas gradebook
name[j] = row.getString("Student");
String q = split(row.getString("Section"),'-');
section[j] = q[3];//hcc naming convention is 2013-ENES-100-501, want just the section 501
while (sis[j].length < 7) {
sis[j] = "0" + sis[j];//canvas strips leading zero's off the student's sis, so putting back on
println(j + " " + sis[j] + " " + name[j] + " " + section[j]);//debugging line
i++;
NumStudents = i-2;
println ("number of students is " + NumStudents);
output = createWriter("data/rosterList.txt");//creating drop down student list for main application
for (int k=0; k<NumStudents; k++) {
output.println(name[k]+" "+section[k]+" "+sis[k]);
output.flush;
output.close;

## Demo

Presentation
video

## Next Steps

* Design state diagram for arriving, leaving and clicker status .. that meets expectations for all possible failure modes (program restarts forcing restore of state information) and multiple attendance events on the same day with the same machine. Currently same machine only works as expected through one attendance event per day. Multiple attendance events on the same day will cause previous event problems to impact current events ... such as not being able to arrive at a second event because already arrived at the first.
* Make fileOutput generic to all OS .. right now it has become windows specific through the use of batch files
* Add a leaving & barcode option to the event activity list and support this in processEvent and recordAttendance tabs
* Add students picture to the instructors window
* Figure out how to print directly to an OS printer from Processing/Java rather than use batch file and third party software
* Add code to list all webcam modes in a drop down box so that each can be tried by an end user rather than the programmer try "by hand" and enter hardware specific information into the code.