2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 52

GIS TEST BANK

_______________

A Thesis

Presented to the

Faculty of

San Diego State University

_______________

In Partial Fulfillment

of the Requirements for the Degree

Master of Science

in

Computer Science

_______________

by

Cheena Garg

Spring 2013
iii

Copyright © 2013
by
Cheena Garg
All Rights Reserved
iv

DEDICATION

I would like to dedicate this thesis to my parents, sisters and my husband who have
been very supportive throughout my education.
v

ABSTRACT OF THE THESIS

GIS Test Bank


by
Cheena Garg
Master of Science in Computer Science
San Diego State University, 2013

At San Diego State University about 10 years ago a certificate in GIS was established
requiring 27 units distributed almost equally between Geography and Computer Science.
A few years later a San Diego Consortium made up of SDSU, Mesa College and San
Diego city schools was awarded a grant by NSF-ATE (National Science Foundation-
Advanced Technological Education) to develop a scalable skills certification program,
articulate curriculum between institutions, and increase community awareness of GIS as a
discipline and as a career.
The GIS Test Bank is developed primarily to promote GIS education and career
advancement. It is a web based application which can be accessed anywhere with an internet
facility. It consists of various essay type and multiple choice questions with graphics from
different GIS categories. The user has to provide login information in order to access the
application. Once authenticated, based on the role as an administrator, faculty, teaching
assistant or student, the user will be able to use the application based on the permissions
given to them. Test bank can be used to prepare class tests, prepare for exams, give tests
online whose scores will be automatically reported to the faculty, upload or access class
lectures or handouts etc. The test bank initially emphasizes a class articulated between SDSU
and community colleges.
vi

TABLE OF CONTENTS

PAGE

ABSTRACT ...............................................................................................................................v
LIST OF FIGURES ................................................................................................................. ix
ACKNOWLEDGEMENTS ..................................................................................................... xi
CHAPTER
1 INTRODUCTION .........................................................................................................1 
1.1 NSF-ATE Program ............................................................................................1 
1.2 GIS Test Bank ....................................................................................................2 
1.3 Architecture of GIS Test Bank ..........................................................................3 
1.4 Application Flow ...............................................................................................4 
1.5 Challenges Faced ...............................................................................................5 
1.5.1 Keeping Up with Rails ..............................................................................5 
1.5.2 Choosing a Database .................................................................................5 
1.5.3 Database Creation .....................................................................................5 
1.5.4 Plug-ins .....................................................................................................5 
2 GEOGRAPHIC INFORMATION SCIENCE ...............................................................7 
2.1 Definition ...........................................................................................................7 
2.2 Components of GIS............................................................................................7 
2.3 Applications of GIS ...........................................................................................8 
2.3.1 Government...............................................................................................8 
2.3.2 Business ....................................................................................................8 
2.3.3 Emergency Services ..................................................................................8 
2.3.4 Environment and Conservation.................................................................9 
2.3.5 Education and Science ..............................................................................9 
3 GIS TEST BANK ........................................................................................................10 
3.1 Advantages of the Test Bank ...........................................................................10 
3.2 What the Test Bank Covers?............................................................................11 
3.2.1 Multiple Choice Questions .....................................................................11 
vii

3.2.2 Multiple Choice Questions with Image ..................................................11 


3.2.3 Essay Type Questions .............................................................................13 
3.2.4 List of Categories ....................................................................................13 
3.3 Usage................................................................................................................14 
4 RUBY ON RAILS .......................................................................................................15 
4.1 Introduction ......................................................................................................15 
4.2 Devise ..............................................................................................................15 
4.3 Migrations ........................................................................................................16 
4.4 Validations .......................................................................................................17 
5 TEST BANK DEPLOYMENT....................................................................................18 
5.1 Generating Skeleton .........................................................................................18 
5.2 Generating Controllers .....................................................................................19 
5.3 Generating Models ...........................................................................................19 
5.4 Connection with Database ...............................................................................20 
5.5 Database Design...............................................................................................20 
6 APPLICATION FLOW CONTROL ...........................................................................26 
6.1 Authentication ..................................................................................................26 
6.2 List of Permissions for an Administrator, Faculty, Teaching Assistant
and Student.............................................................................................................27 
6.3 Users ................................................................................................................28 
6.3.1 Add New User.........................................................................................29 
6.3.2 Editing and Listing Details .....................................................................29 
6.3.3 View Student Score Sheet .......................................................................29 
6.3.4 Change User Password ...........................................................................30 
6.4 Questions..........................................................................................................31 
6.4.1 Add New Question..................................................................................32 
6.4.2 Edit, Remove and Search Question ........................................................32 
6.5 Answers............................................................................................................32 
6.6 Category ...........................................................................................................33 
6.7 Lecture .............................................................................................................33 
6.8 Class Test .........................................................................................................34 
6.9 Student Features ...............................................................................................35 
viii

6.9.1. Online Test .............................................................................................36 


6.9.2 Self Study ................................................................................................37 
6.9.3 Access Lectures ......................................................................................37 
6.9.4 Student Profile Details ............................................................................38 
7 FUTURE DEVELOPMENT .......................................................................................39 
REFERENCES ........................................................................................................................40 
ix

LIST OF FIGURES

PAGE

Figure 1.1. Model-View-Controller architecture diagram. ........................................................4 


Figure 2.1. Components of GIS. ................................................................................................7 
Figure 3.1. Format of multiple choice questions used in the test bank. ...................................11 
Figure 3.2. Example of a select all correct answers in a multiple choice question. ................12 
Figure 3.3. Example of a multiple choice questions with image. ............................................12 
Figure 3.4. Example of an essay type question. .......................................................................13 
Figure 5.1. Users table. ............................................................................................................21 
Figure 5.2. Roles table. ............................................................................................................22 
Figure 5.3. Entries in roles table. .............................................................................................22 
Figure 5.4. Roles_Users table. .................................................................................................22 
Figure 5.5. Categories table. ....................................................................................................23 
Figure 5.6. Levels table. ...........................................................................................................23 
Figure 5.7. Entries in levels table.............................................................................................23 
Figure 5.8. Questions table. .....................................................................................................23 
Figure 5.9. Answers table. .......................................................................................................24 
Figure 5.10. Image table. .........................................................................................................24 
Figure 5.11. Subquestions table. ..............................................................................................24 
Figure 5.12. Documents table. .................................................................................................25 
Figure 5.13. Scores table..........................................................................................................25 
Figure 6.1. Login page of GIS Test Bank. ...............................................................................26 
Figure 6.2. Homepage of an admin user. .................................................................................27 
Figure 6.3. Homepage of a faculty user. ..................................................................................27 
Figure 6.4. Homepage of a teaching assistant user. .................................................................28 
Figure 6.5. Homepage of a student user. .................................................................................28 
Figure 6.6. New user form. ......................................................................................................29 
Figure 6.7. Edit user details form.............................................................................................30 
Figure 6.8. List of all students user. .........................................................................................30 
x

Figure 6.9. Score details of a student user. ..............................................................................31 


Figure 6.10. Change user password form. ...............................................................................31 
Figure 6.11. New question form. .............................................................................................32 
Figure 6.12. List of all the multiple choice questions of a chosen category. ...........................33 
Figure 6.13. Showing question details. ....................................................................................33 
Figure 6.14. List of answers to all the questions of a chosen category....................................34 
Figure 6.15. List of all categories along with edit and remove options. ..................................34 
Figure 6.16. Snapshot of document/lecture upload page. ........................................................35 
Figure 6.17. Snapshot of generated class test. .........................................................................35 
Figure 6.18. Snapshot of question displayed during online test. .............................................36 
Figure 6.19. Snapshot of result is displayed after the online test. ...........................................36 
Figure 6.20. Snapshot of choosing a category for self-study. ..................................................37 
Figure 6.21. Snapshot of questions displayed during self-study. ............................................37 
Figure 6.22. Snapshot of student profile information. .............................................................38 
Figure 6.23. Snapshot of change password form available to all the users. ............................38 
xi

ACKNOWLEDGEMENTS

My foremost thanks to my thesis advisor Dr. Carl Eckberg, whose guidance and
support has been very valuable.
Thanks are also due to Dr. Ming-Hsiang Tsou for being very kind and extending
every form of help whenever needed, for giving me the opportunity to work for the NSF-
ATE program which led to this Thesis.
And of course, Thanks go to my family for their invaluable support through all times
and also for test running the application.
1

CHAPTER 1

INTRODUCTION

1.1 NSF-ATE PROGRAM


San Diego GIS Consortium comprising of San Diego State University, San Diego
Mesa College and San Diego City schools was awarded a grant by the NSF-ATE (National
Science Foundation-Advanced Technological Education) to develop a scalable skills
certification program which could help students in the field of GIS to prepare for jobs and
career advancement. The Objective of the National Science Foundation-Advanced
Technological Education is to provide technological education by supporting curriculum
development, preparation and professional development, internships, field works and other
activities for faculty, teachers and students. This program includes collaboration between
academic institutions and employers to promote improvement in the education of science and
engineering technicians at the undergraduate and secondary school levels [4, 12].
The certificate in GIS at San Diego State University can be achieved by enrolling in
27 units distributed between the Department of Geography and the Department of Computer
Science as follows:
Department of Geography:
 Geog 104 - Geographic Information Science and Spatial Reasoning
 Geog 381 - Computerized Map Design
 Geog 484 - Geographic Information Systems (Required)
 Geog 581 - Cartographic Design
 Geog 583 - Internet Mapping and Distributed GIServices
 Geog 584 - Geographic Information Systems Applications
 Geog 585 - Quantitative Methods in Geographic Research
 Geog 587 - Remote Sensing of the Environment
 Geog 588 - Intermediate Remote Sensing of the Environment
 Geog 589 - GIS-Based Decision Support Methods
 Geog 596 - Advanced Topics in GIScience
2

Department of Computer Science:


 CS 105 - Visual Basic Programming
 CS 107 - Introduction to Computer Programming (Required)
 CS 108 - Intermediate Computer Programming (Required)
 CS 220 - UNIX and the C Programming Language
 CS 310 - Data Structures
 CS 320 - Programming Languages
 CS 503 - Scientific Database Techniques
 CS 514 - Database Theory and Inplementation
 CS 520 - Advanced Programming Languages
 CS 535 - Object-Oriented Programming and Design
 CS 537 - Component GIS Architecture
 CS 551 - User Interface Environments
 CS 575 - Super Computing for the Sciences
 CS 596 - Advanced Topics in Geocomputation
 CS 615 - Spatial Databases
The certificate program is independent of the NSF-ATE grant but shares the goal of
preparing trained workers in GIS. Certificate earners complete four classes in one
department, and five in the other.

1.2 GIS TEST BANK


The title of my project is GIS test bank. It is a web based application designed with
the purpose for GIS users of helping them improve their GIS skills and knowledge Different
question categories of GIS like projections, GPS, remote sensing etc. from Geog 104 class
are covered in this application [20]. Administrators, faculty members, appointed teaching
assistants and registered students can use this application. Each of these roles has a
predefined set of permissions. This application contains two types of questions, namely
multiple choice and essay type questions. Multiple choice questions are divided into three
levels: beginner, intermediate and advanced. Student users can take a test consisting of
multiple choice questions with one or more than one correct answer. The questions of the test
are selected randomly by the application. The scores obtained by each student while taking
the test can be viewed by faculty members at any time. Faculty members can also generate
3

class tests consisting of essay type questions for each category. The number of questions on
the test is decided by the faculty. Different sets of question papers can be created in order to
prevent plagiarism. Apart from testing features like uploading lectures online, self-study help
for students etc. are also included in this application. The test bank is created using Ruby on
Rails which follows the Model View Controller (MVC) paradigm. The MVC architecture
allows clean separation of business logic (the controller), data (the model) and the formatting
of data for display and user interaction (the view). This test bank has a feature of role based
authentication which allows a user to access the system as an administrator, faculty, teaching
assistant or a student user. Each role has a predefined set of permissions, access and control
over the application. MySQL is used as a database though Rails works with many other
databases like PostgreSQL, Oracle, SQLite 3 etc.

1.3 ARCHITECTURE OF GIS TEST BANK


GIS test bank is created using Ruby on Rails and all Rails applications are
implemented using the Model-View-Controller (MVC) architecture (see Figure 1.1). In the
MVC pattern, the model represents the data, the view represents the user interface, and the
controller directs all the action. Each entity of the MVC—the model, view, and controller—is
separate and is capable of being developed and tested individually [3]. The model can be
changed without affecting the views; likewise, a view can be changed without affecting the
model. This means the changes in each part of an MVC application are local and have low
impact on other parts, which helps in easing the maintenance considerably, while increasing
the level of reusability among components [3]. Rails is a collection of libraries which are
assembled together [1]. Each library had a specific task associated with it. Among several
libraries, three libraries mapped directly to the MVC pattern which can be used
independently [1]. The three libraries are given below:
 ActiveRecord: It handles database interaction [1].
 ActionView: It generates the HTML documents that the user receives as response
based on the request to a Rails application [1].
 ApplicationController: It manipulates the flow of an application along with the data
received from the database that is displayed in a view [1].
4

Browser

Web Controller

View Model Database

Figure 1.1. Model-View-Controller architecture diagram.

These libraries together make up the Rails Model-View-Controller development


stack. In Rails all the components are integrated together without any need to set up a manual
bridge between them. This makes Rails a “full-stack” framework [1].

1.4 APPLICATION FLOW


The GIS Skill test bank application follows the Model-View-Controller Paradigm.
The MVC paradigm allows clean separation of business logic (the controller), data (the
model) and the formatting of data for display and user interaction (the view). The application
begins with the login page where the user has to enter his login id and password. Based on
the login information, the application finds out the role of the user and the user will
automatically be redirected to the welcome page with predefined permissions. Each user can
have one of the roles: administrator, faculty, teaching assistant or student. An administrator
user has all the administrative powers of the application. These users can add/edit/remove
any user. An administrator can also add/edit/remove all the essay type and multiple choice
questions and answers, upload and delete a lecture, generate an essay type question class test,
view each student user score sheet and can also change any user’s password. Faculty users
can add/edit/remove a TA or a student user. A faculty member can also add/edit/remove all
the essay type and multiple choice questions and answers, upload and delete a lecture,
generate subjective question based class tests , view each student user score sheet. Teaching
Assistants can add or view only student’s information. They can view a list of all questions,
answer keys, upload documents, and delete documents. Student users can take an online quiz
consisting of multiple choice questions. They can also prepare for tests using the self-study
5

option from given GIS categories. Students have access to all the lectures and class handouts
uploaded by the faculty and can view all the scores attained by them.

1.5 CHALLENGES FACED


A web application framework is a rapidly growing technology. Some of the
challenges faced during the development of the Test Bank are mentioned in the following
sections.

1.5.1 Keeping Up with Rails


Rails is a continuously evolving technology. It is important to keep updated with the
latest announcements. Hence it is necessary to follow new Rails documents and software
releases. Some Rails articles explore what is coming in the future and if that actually turns
into the next release.

1.5.2 Choosing a Database


Rails works with MySQL, Oracle, PostgreSQL, SQL Server and SQLite databases.
For all databases other than MySQL, a database driver and a library that Rails can use to
connect and use the database engine need to be installed. As each of the databases has its
pros and cons, it was crucial to choose a database which could meet all the requirements with
the least amount of time being consumed in database setup and connection with Rails. I have
used MySQL as it is easy to install and Rails comes with a built in driver for MySQL
databases [8, 9].

1.5.3 Database Creation


This test bank is a database driven application. As a database is one of the most
important phases of any software development life cycle, it was important for me to properly
design/plan and perform normalization of the database while considering all the
functionalities to be included in the application.

1.5.4 Plug-ins
Rails provide one of the fastest ways to add functionality in an application using
Plug-ins. Plug-ins are easy to install and easy to use. As Rails is growing rapidly, many
different kinds of plug-ins can be used to do same kind of function. For example, to add an
6

authentication feature in an application there are many plug-ins available like


restful_authentication, act_as_authenticated, Authlogic etc. As each of the available plug-ins
has some advantages and disadvantages it is difficult to choose the best plug-in in a given
situation.
7

CH
HAPTER
R2

GEOGR
RAPHIC INFORMA
ATION SC
CIENCE

1 DEFINITION
2.1
Geograph
hical informaation system
ms are used too explore thee fundamenttals of
graphy. Geog
Geog graphic inforrmation scieence is a systtem created tto work withh geographiccal
refereenced inform
mation i.e. in
nformation based on locaation. This ggeo-referencced data is
captu
ured, stored, analyzed an
nd displayed by a GIS syystem. GIS aallows us to eexplore the ddata
in thee form of maaps, globes, charts
c etc. to
o find the rellationships aand patterns in the data [[7,
24].

2.2 COM
MPONENTS OF GIS
GIS can be
b divided in ponents: Appplication, Data, Hardwaare, Softwaree,
nto five comp
and People
P (see Figure
F 2.1 [7
7]).

Figure
F 2.1. Components
C s of GIS. Soource: IT Trrends –
Latest/Recen
L nt Trends inn Informatioon Technology. GIS:
Geographica
G al Informatiion System,, 2010.
http://rtmnu
h uittrends.blo
ogspot.com//2010/11/gissgeographicc
al-informati
a on-system.hhtml, accesssed Jan. 20113.
8

 Application: Applications include how the data will be inputted, stored, analyzed and
presented as a final output. Application examples include water quality monitoring,
land use planning etc [6].
 Data: Data is one of the most important components of GIS. Geographic and tabular
data can be collected or purchased from a data provider. A DBMS is used to create
and maintain a database and help organize and maintain data [6].
 Hardware: Hardware is equipment like computers, scanners, digitizer, and plotters on
which GIS operates. The software runs on various hardware types including
centralized servers to desktop computers [23].
 Software: Software provides functions and tools to store, analyze and display
geographic data [23].
 People: GIS users are the people who design and maintain the system.

2.3 APPLICATIONS OF GIS


Geographic Information Systems are being used in variety of ways in our daily lives.
Lot of organizations are also using GIS to perform various tasks.

2.3.1 Government
GIS is helpful in planning and organizing geographic data for many government
organizations. GIS is being used by various government bodies which helps them to keep
track of description and ownership of properties, public works, roads, and more within their
jurisdiction. It also helps military defense for terrain analysis and many other critical
planning and operations [11, 2].

2.3.2 Business
GIS is beneficial to various businesses in a variety of ways. GIS can be used to track
properties, property value, tax information etc. for real estate agents and bankers. Health care
professionals use GIS to track the spread of disease [2].

2.3.3 Emergency Services


Various emergency departments like police departments, fire departments etc have
started using GIS to help in their daily operations. GIS software can assist them to track
crime, find the shortest route to emergencies and more [11].
9

2.3.4 Environment and Conservation


GIS is very helpful in managing and protecting species and their habitats. It also helps
in the study of animal populations in various areas. Marine GIS uses data from oceans and
seas to represent shores and phenomena like current, temperatures etc [2].

2.3.5 Education and Science


GIS helps many researchers to observer various phenomena and changes that have
taken place over time. GIS can also be used to create interactive maps for various places
which can help visitors to explore new places, events etc.
10

CHAPTER 3

GIS TEST BANK

3.1 ADVANTAGES OF THE TEST BANK


Test bank contains various features which are helpful for both students and faculty
members. Among these features, some are listed below:
It is independent of a particular teacher or even a particular campus, and thus:
a. It is valuable for articulation between two campuses.
b. It can more fairly be used as a requirement for certificates in the area or areas being
tested.
Test bank can be easily accessed from anyplace having an internet facility. The
components required for the application are available for free and can be easily downloaded
and installed. Test bank uses MySQL as its database which is an open source database [8].
Use of the application is very easy and does not require any tutorial. Anybody can use
it without any guidelines. Various tasks can be performed by just selecting any of the given
menu options.
One of the most important features of test bank is the online test [16]. Students can
take tests online consisting of multiple choice questions. Since the correct answer can be one
or more than one it increases the difficulty for students and helps them have a thorough
understanding of the subject. The scores obtained by each student can be viewed by faculty
whenever needed along with the date and time the test was taken by the student.
Faculty can generate surprise or class tests easily consisting of long answer type
questions. The number of questions to be included on the test is decided by the faculty.
Faculty can also use this feature more than once to have many different sets in order to
prevent plagiarism.
Students can also use the application to prepare for tests. They can view questions on
different topics and try to answer them. Scores of these tests are not recorded.
Faculty can upload documents, assignments, notes etc. just at one place which can be
used by all the students.
11

It should be noted that test banks of this kind are used for certification tests for Java,
Oracle, Microsoft (Certified Engineer), A +, Cisco etc.

3.2 WHAT THE TEST BANK COVERS?


GIS Test Bank contains various multiple choice and essay type questions based on
different categories.

3.2.1 Multiple Choice Questions


Test bank contains multiple choice questions for different categories and levels. Each
multiple choice question has four answer choices. More answer choices can also be added
later if needed. The format of multiple choice questions used to the test bank is shown in
Figure 3.1.

Category: Level:
Unit 2: Mapping the Earth Beginner

What is the decimal conversion of the binary number 100101?


Choices are:
 36.
 37
 38
 39
Figure 3.1. Format of multiple choice questions used in the test bank.

Each multiple choice question can have one or more correct answers. In this test bank,
students have to select all correct answers for each question. An example to show the select
all correct answers in a multiple choice question is shown in Figure 3.2. There are 50
multiple choice questions in the database so far and more can be added whenever needed.

3.2.2 Multiple Choice Questions with Image


As this is a geography based application, sometimes it is necessary to represent any
information with the help of graphical images (e.g. maps). Therefore, this application
contains many multiple choice questions with graphical images as shown in the Figure 3.3
[10].
12

Category: Level:
Unit 3: Network of Geographic Information, Intermediate
Georeference and Projection.

Which of the following is true about a great circle?

Choices are:
  It divide the earth into two equal hemisphere.
  Is the path with smallest curvature.
  On the earth, equator is a great circle.
  The center of great circle coincides with center of the earth.

Figure 3.2. Example of a select all correct answers in a multiple choice


question.

Category: Level:
Unit 3: Network of Geographic Information, Medium
Georeference and Projection.

What type of projection is shown in the image below?

Choices are:
 Peter projection
 Mercator projection
 Azimuthal distance projection
 Robinson projection

Figure 3.3. Example of a multiple choice questions with image. Source:


Nationalatlas.gov. Map Projections: From Spherical Earth to Flat Map,
n.d. http://www.nationalatlas.gov/articles/mapping/a_projections.html,
accessed Jan. 2013.
13

Answer to these kinds of questions can be answered only after carefully examining
the respective image.

3.2.3 Essay Type Questions


For any course work it is necessary for a student to answer any question in detail
rather than just choosing correct answers from few given choices. Test Bank contains essay
type questions as shown in Figure 3.4 for each category and level. There are 50 essay type
questions in the database so far and can be used to generate such a test for the students.

Category:
Unit 2: Mapping the Earth

What is the first law of Geography?


Figure 3.4. Example of an essay type question.

3.2.4 List of Categories


This test bank contains multiple choice and essay type questions from the Geog 104 -
Geographic Information Science and Spatial Reasoning class [20]. The lists of categories are
based on the lectures covered in that class. All Admin users of this application can add or
remove a category. List of categories in the initial database is given below:
 Unit 1: Overview of GIScience
 Unit 2: Mapping the Earth
 Unit 3: Network of Geographic Information, Georeference and Projection
 Unit 4: GIS Software and Data Format
 Unit 5: GPS Introduction and Mobile GIS
 Unit 6: GIS Data Collection and Processing
 Unit 7: Internet and Mobile GIS
 Remote Sensing
 Unit 10: Geospatial Visualization
 Spatial Analysis
 GIS and Society
14

3.3 USAGE
This test bank application can be used as one of the exercises during lab work in order
to help prepare students for exams. This will also help testing this application by geography
students.
15

CHAPTER 4

RUBY ON RAILS

4.1 INTRODUCTION
Rails is a web development framework written in the Ruby language. A web
framework is used to develop web applications and web services with ease. The overhead
associated with common activities of web development can be reduced by libraries,
templates, session management and other software tools provided by a web framework [25].
In the Rails framework all the layers are built to work together with less code and promote
“don’t repeat yourself” (DRY).
Rails is organized around the Model, View and Controller architecture, usually called
MVC. The MVC paradigm provides clean separation of business logic (the controller), data
(the model), and the data display format and user interaction (the view). This helps to
maintain, debug and extend web applications with ease.
Some of the other useful features of Ruby on Rails framework used in the GIS Skills
Certificate Test Bank are listed below.

4.2 DEVISE
An interactive application like test bank needs to use an authentication mechanism to
keep track of users. This can be achieved in Rails using a gem known as Devise. Devise is a
full featured Rack-based authentication solution based on Warden [5, 13].
Devise can be used by adding the devise gem in the Gemfile and installing the gem
by running the bundler. Devise Modules are generated using the following command:
rails generate devise_install
The authentication system requires User Model, view and controller which was generated
using:
rails generate devise User
16

A successful authentication routes the user to a welcome page while a failed login
brings back the user to the login page. The user session starts as soon as the authentication is
done.
Sometimes, successful authorization is required by some action with the controller or
all the action in the controller in order to be accessed. Filters like before_filter can be used to
implement such features.

4.3 MIGRATIONS
Database migrations can be defined using rails. Each migration represents a change
that has to be made to the database. These changes can update both the database schema and
the data in the database tables. You can also roll back to the previous database.
When a new model is created using a generator, rails automatically creates migration
in the \db\migrate folder that can be used to create the corresponding table. Blank migration
can be created using the following command:
Script/generate migration MigrationName
The class name is the same as that of the ruby migration file name. Methods like
self.up and self.down are used to migrate any new changes and roll back to previous
respectively [23].
Rails supports eleven data types, namely string, text, integer, float, decimal, datetime,
timestamp, time, date, binary and Boolean. An example of table creation is:
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :firstname, :string
t.column :lastname, :string
t.column :email, :string
t.column :login, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :string, :limit => 40
t.column :created_at, :datetime
t.column :updated_at, :datetime
17

t.column :remember_token, :string


t.column :remember_token_expires_at, :datetime
end
end

def self.down
drop_table "users"
end
end

To run migration on the rails application, the following command is used:


Rake db:migrate [15, 17, 22].

4.4 VALIDATIONS
Validations help to ensure that only valid data is saved into your database. This
includes database constraints, client-side validations, controller-level validations, and model-
level validations [14]. For example, it is important to this application to ensure that every
user provides a valid email address, a certain field should not be blank, password is within a
certain range etc [14]. An example of how validation can be used in rails application is
shown below:
 To validate that the specified attributes are not empty:
 validates_presence_of :user_name,: password
 To validate the uniqueness of a field:
 validates_uniqueness_of :email
 To validate length of a field:
 validates_length_of :name, :minimum => 4
18

CHAPTER 5

TEST BANK DEPLOYMENT

The GIS test bank application requires a Ruby interpreter, Rails framework and
MySQL as a database. Any version of Ruby later than 1.8.6 can be used. Ruby 1.8.6 and
earlier are not supported and neither is version 1.9.1. Ruby Gems are a standard package
manager for Ruby and will also need to be installed [18]. Bundler is used to install and
include the gems needed by the application. Once we have Gems, Rails and its dependencies
can easily be installed by executing the following command:
gem install rails
The database is used to store the different data used in the application which will be
used by rails to display on screen to the user. I have used MySQL database though other
databases like SQLite, PostgreSQL and Oracle can also be used.
 MySQL adapter is needed to use MySQL in Rails greater than 2.1:
 $ gem install mysql
 To create a new Rails application using the MySQL adapter:
 $ rails new gis_thesis -d mysql
Next, config/database.yml also needs to be edited accordingly. Example is given below [26]:
 development:
 adapter: mysql
 database: gis_thesis
 username: root
 password: cheena
 host: localhost
It is also easy to use other databases like PostgreSQL, SQLite, and Oracle with Rails.
Creation of skeleton, controllers, and model is done only once. This gis_thesis folder
can be copied in ruby/bin folder on the server and is now ready to use.

5.1 GENERATING SKELETON


In order to create an entire blank Rails project skeleton, the following line is used:
19

rails new gis_thesis


Once we have a skeleton, we need to create a controller, models and views.

5.2 GENERATING CONTROLLERS


Controllers contain the main business logic. Controllers receive events from the user
input, interact with the model, and display an appropriate view to the user [19].
Syntax to generate a controller is given below:
 rails generate controller controller_name
 rails generate controller controller_name method_name(s)
The controllers created for this application are:
 Answers Controller
 Categories Controller
 Documents Controller
 Images Controller
 Levels Controller
 Questions Controller
 Roles Controller
 Scores Controller
 Subquestions Controller
 User Controller
 Welcome Controller
The controllers created by Devise gem are:
 Passwords Controller
 Registrations Controller
 Sessions Controller

5.3 GENERATING MODELS


Model is responsible for maintaining the state of the application. A model is not just
data but it enforces all the business rules that apply to that data [21, 19].
Syntax to generate a model is given below:
 rails generate model model_name
 rails generate model user name:string hashed_password:string salt:string
20

The models created for this application are:


 Answer
 Category
 Document
 Image
 Question
 Level
 Role
 Score
 Subquestion
 User

5.4 CONNECTION WITH DATABASE


GIS test bank uses MySQL as its database. The Migrations feature of Rails was used
to create the database. I created a database named gis_thesis. Then, I edited the
config/database.yml file to establish the connection in the following way [26]:
 development:
 adapter: mysql
 database: gis_thesis
 username: root
 password: password
 host: localhost

5.5 DATABASE DESIGN


When models were created using a generator, the corresponding create table files
were created in the db/migrate folder. Here is the way we created the Users table:
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
21

t.trackable
t.column :email, :string
t.column :log
gin, :string
t.column :firsstname, :striing
t.column :lasttname, :strin
ng
t.timestamps
end
d

add
d_index :useers, :login, :unique => trrue
add
d_index :useers, :email, :uniique => truee
add ken, :unique => true
d_index :useers, :reset_paassword_tok
end

def self.down
op_table :useers
dro
end
end
The correesponding tab
ble created in
i the databaase is shown in Figure 5..1 Each Userr has
D, first name, last name, email addresss, login nam
an ID me and passw
word (at leasst 4 characteers)
fieldss.

Figuree 5.1. Users table.


t
22

Each Role has an ID, role name and role description field. There are only four entries
in the table namely administrator, faculty, teaching assistant and student. The role table is
shown in Figure 5.2 and 5.3.

Figure 5.2. Roles table.

Figure 5.3. Entries in roles table.

The Roles_Users table contains role ID and User ID fields. This table maps the roles
that are assigned to each user. The Roles_users table is shown in Figure 5.4.

Figure 5.4. Roles_Users table.

The Category table has ID and category name field as shown in Figure 5.5. Category
name fields consists of GIS topics covered in the test bank.
The Level table has ID and level name field. Level table have three entries of
beginner, intermediate and advanced. Description of level table is shown in Figure 5.6 and
5.7.
23

Figure 5.5. Categories table.

Figure 5.6. Levels table.

Figure 5.7. Entries in levels table.

The Questions table consists of four fields namely ID, question, category ID and level
ID. Category ID and Level ID shows the category and level a particular question belongs to.
Figure 5.8 shows the question table.

Figure 5.8. Questions table.

The Answers table consists of four fields namely ID, answer, question ID and
isCorrect. Question ID field indicates the question to which that answer belongs to while
24

isCorrrect fields teells whether that answerr choice is coorrect or not.. Figure 5.9 shows the
answ
wer table.

Figuree 5.9. Answeers table.

The Imag
ges table contains the imaage associateed with multtiple choice questions. T
This
table has an ID, title, content and question ID field. Im
mages table is shown inn Figure 5.100.

Figuree 5.10. Imag


ge table.

Subquestiion table reccords essay ty


ype questionns. This tablee has an ID, subquestionn and
categ
gory ID field
d. Category ID fields reco
ords the cateegory to whiich it belonggs. Descriptioon of
Subq
question tablee is shown in
n Figure 5.11.

Figuree 5.11. Subq


questions tab
ble.
25

The Docu
uments table is created to
o store the doocuments orr lectures uploaded by thhe
n or faculty member. Do
admin ocument tablle consists oof an ID, titlee and contennt field as shoown
in thee Figure 5.12
2.

Figuree 5.12. Docu


uments tablee.

ords the scorees achieved by all the stuudents durinng online test.
The Scorees table reco
Scoree table contaains an ID, User
U ID, totall questions, ccorrect answ
wers, incorreect answers, ttotal
numb
ber of correcct answers, percentage,
p and
a date and time test takken fields. D
Description oof
scorees table is sho
own in Figu
ure 5.13.

Figuree 5.13. Scorees table.


26

CH
HAPTER
R6

APP
PLICATIO
ON FLOW
W CONTR
ROL

The application begin


ns with the lo
ogin page. O
Only registereed users cann access this
application. Each
h user has to enter their login information.

6.1 AUTHENTICA
U ATION
Each userr who wishess to access th
he applicatioon has to entter their login ID and
word (see Fig
passw gure 6.1). On
nce the user informationn is authenticcated, the usser will be
redireected to the respective
r home page baased on theirr role. If a usser forgets hhis/her passw
word,
he caan contact thee application
n administraator to reset iit to another password. T
There are fouur
typess of users wh
ho can use th
his applicatio
on, namely aadministratorr, faculty, teaching assisstant
(TA) and studentt.

ure 6.1. Log


Figu gin page of GIS
G Test Ba
ank.
27

6.2
6 LIST OFF PERMISSSIONS FOR A
AN ADMIN R,
NISTRATOR
FACULTY
Y, TEACHIN NG ASSISTA
TANT AND STUDENT
The homeepage of the user indicattes the set off permissionss assigned too them. Figuures
6 6.4, & Figure 6.5 sho
6.2, 6.3, ows the hom
mepages of aan administraator, faculty,, TA and stuudent
respeectively.

Figuree 6.2. Homepage of an admin


a user..

Figuree 6.3. Homep


page of a fa
aculty user.
28

Figuree 6.4. Homep


page of a teeaching assisstant user.

Figuree 6.5. Homep


page of a student user.

6.3 USERSS
Test Bank
k contains vaarious users based on rolle assigned tto them. Bassed on the tyype of
role, a user can ad
dd, edit, rem
move or list all
a the users. An admin oor a faculty uuser can alsoo
view students sco
oresheet.
29

6.3.1 Add New User


An admin
nistrator has the power to
o add anotheer administraator, faculty,, teaching
assisttant and stud
dent user wh
hile a faculty member cann add TA annd student ussers. To creaate a
new user
u accountt, the admin or faculty haas to enter thhe user inforrmation like first name, llast
namee, login namee, email, passsword and role
r to be asssigned. A usser can be assigned only one
role at
a a time (seee Figure 6.6)).

Figuree 6.6. New user


u form.

6.3.2 Editin
ng and Listting Detaiils
The differrence betweeen an admin
nistrator and faculty perm
mission here is that an addmin
user can
c edit the information,, remove and
d view detaills of all the rregistered ussers while a
faulty
y user can ed
dit, remove and
a view dettails of a tea ching assistaant and studeent user (seee
Figurre 6.7).

6.3.3
6 View Student S
Score Sheeet
Administrrators and faaculty memb w scores histtory of all thhe student users
bers can view
along
g with the daate and time at which theey gave the ttest (see Figuure 6.8 and 66.9).
30

Figuree 6.7. Edit user


u details form.
f

Figuree 6.8. List off all studentts user.

6.3.4 Cha
ange User P
Password
The administrator hass the capability to changee or reset thee password oof any existiing
user. So, In case any user forgets his/her password, thhey can conttact the adm
ministrator (seee
Figurre 6.10).
31

Figuree 6.9. Score details of a student useer.

Figuree 6.10. Chan


nge user passsword form
m.

6.4
4 QUESTIO
ONS
Test Bank
k contains tw
wo types of questions
q quuestions nam
mely multiplee choice and
essay
y type. Add, edit, delete or
o search cap
pabilities cann be perform
med on questtions based oon
the user role.
32

6.4.1 Ad
dd New Q
Question
An admin
nistrator or a faculty mem
mber can addd two types of questionss namely muultiple
choicce and essay type. Essay type questio
on can be addded by enterring the question statement
along
g with the caategory to wh
hich it belon
ngs. To add a multiple chhoice questioon, user musst
proviide the questtion statemen
nt, category,, level, answ
wer choices aand the correect answer(s))
amon
ng them. Useer can also upload
u an image with thee multiple chhoice questioon (see Figurre
6.11)).

Figuree 6.11. New question forrm.

6.4.2 Edit,
E Rem
move and S
Search Question
ministrator an
Both adm nd faculty haave permissioons to edit, rremove and view a list oof all
questtions. They can
c also searrch for a queestion from tthe database (see Figuress 6.12 and 6.13).

6..5 ANSWER
RS
The administrator or a faculty meember can addd a new ansswer to an exxisting questtion
in thee database. They
T can alsso edit, remo
ove or changge the answeer choices. Prrint key optiion is
also available
a to them,
t wheree they can view all the quuestions of a category w
with their corrrect
answ
wers (see Figu
ure 6.14).
33

Figuree 6.12. List of


o all the mu
ultiple choicce questionss of a chosen
n category.

Figuree 6.13. Show


wing questio
on details.

6.6
6 CATEGOR
RY
Administrrator and facculty membeer can add, eedit details annd view all ccategories inn the
system
m. An admin
n has a poweer to removee a category (see Figure 6.15).

6..7 LECTUR
RE
Lectures, handouts, cllass notes caan be uploadded by an adm
min or a facuulty memberr.
Studeents have acccess to thesee documents (see Figure 6.16).
34

Figuree 6.14. List of


o answers to
t all the qu
uestions of a chosen cattegory.

Figuree 6.15. List of


o all catego
ories along with
w edit an
nd remove ooptions.

6.8
8 CLASS TEEST
An admin
nistrator or a faculty mem
mber can gennerate a classs test consissting of essayy
type questions.
q The
T number of
o questions on the test iis decided byy the admin or faculty buut the
questtions are randomly selected by the ap
pplication. A
Admin or facculty can creeate many
differrent sets of same
s numberr of question
ns to be distrributed in thee class to avvoid plagiarissm
(see Figure
F 6.17).
35

Figuree 6.16. Snap


pshot of docu
ument/lectu
ure upload p
page.

Figuree 6.17. Snap


pshot of geneerated classs test.

6.9 STU
UDENT FEA
ATURES
GIS Test Bank provid
des various functionalitie
f es to the studdents. They can take thee test
onlin
ne, access thee uploaded documents
d orr use self stuudy feature tto prepare thhemselves for
exam
ms.
36

6.9.1
1. Online T
Test
Any studeent user can take a test consisting off multiple choice questioons. Each
questtion can havee one or morre than one correct
c answ
wer choice. N
Negative marrking is enabbled
with every incorrrect answer or
o missed an
nswer. Stude nt can view all the questtions with
correct answers at
a the end alo
ong with their grades. Thhis grade will also be repported to thee
facultty member (see
( Figures 6.18 and 6.1
19).

Figuree 6.18. Snap ayed during online test..


pshot of quesstion displa

Figuree 6.19. Snap


pshot of resu
ult is display
yed after the online testt.
37

6.9.2 Self Stu


udy
This featu
ure helps stu
udents to prep
pare for an eexam. A studdent can deccide a categoory on
h they want to practice. However, co
which orrect answeers will not bbe shown to them. The scores
of thiis test will no
ot be reporteed to the facu
ulty (see Figgures 6.20 annd 6.21).

Figuree 6.20. Snap


pshot of choo
osing a cateegory for sellf-study.

Figuree 6.21. Snap


pshot of questions displayed duringg self-studyy.

6.9.3 Access
A Lecctures
Student users
u can view
w all the lecttures, handoouts, class nootes or assignnments uplooaded
by the faculty meembers.
38

6.9.4 Stud
dent Profiile Details
All studen
nt users can view their own
o profile ddetails and chhange their eexisting
word. A stud
passw dent can also
o view all thee scores histoory (see Figuures 6.22 annd 6.23).

Figuree 6.22. Snap


pshot of stud
dent profile information.

Figuree 6.23. Snap


pshot of change password form avaailable to alll the users.
39

CHAPTER 7

FUTURE DEVELOPMENT

The Test Bank can be further developed which may include the enhancements given
below.
Test Bank can be extended to cover all the courses of Department of Geography and
Department of Computer Science necessary for GIS certificate. These courses can then be
accessed by the student based on their registered courses.
Test bank can be further enhanced by using essay type questions not only to produce
class test but online test as well. Grading of essay type questions can also be provided based
on matching keyword.
Timers can be introduced for online test in which certain time limit will be given to
students to answer all the questions in one test.
Features where student can also upload their assignments online can be implemented.
Format of online test can be enhanced by displaying radio buttons for unique answer
question to enforce students to give only one answer where as displaying check boxes for
select all correct answer questions.
40

REFERENCES

[1] Beginning Rails 3. The Libraries that Make Up Rails, n.d. https://s3-ap-northeast-
1.amazonaws.com/booksikindle/html/Beginning%20Rails%203%20(Expert's%20Voic
e%20in%20Web%20Development)1/dummy_split_021.html, accessed Jan. 2013.
[2] Center for Research Computing. What is GIS, 2011. http://crc.nd.edu/index.php/
cyberinfrastructure/gal/93, accessed Mar. 2013.
[3] Dev Articles. Ruby-on-Rails: The MVC Pattern in the Rails Framework, 2009.
http://www.devarticles.com/c/a/Ruby-on-Rails/The-MVC-Pattern-in-the-Rails-
Framework/, accessed Jan. 2013.
[4] GIS Career & Education Awareness Website. Home Page, n.d.
http://geoinfo.sdsu.edu/hightech/index.htm, accessed Jan. 2013.
[5] GitHub. Devise, n.d. https://github.com/plataformatec/devise, accessed Apr. 2011.
[6] High Point. Geographic Information Services, n.d.
http://www.highpointnc.gov/gis/what_is_gis.cfm, accessed July 2012.
[7] IT Trends – Latest/Recent Trends in Information Technology. GIS: Geographical
Information System, 2010. http://rtmnuittrends.blogspot.com/2010/11/gisgeographical-
information-system.html, accessed Jan. 2013.
[8] MySQL. Home Page, n.d. http://www.mysql.com/, accessed Mar. 2011.
[9] MySQL. Using MySQL with Ruby, n.d. http://dev.mysql.com/usingmysql/ruby/,
accessed Mar. 2011.
[10] Nationalatlas.gov. Map Projections: From Spherical Earth to Flat Map, n.d.
http://www.nationalatlas.gov/articles/mapping/a_projections.html, accessed Jan. 2013.
[11] NC State University College of Education. Where is GIS Used?, 2004.
http://www.ncsu.edu/gisined/where.html, accessed Jan. 2013.
[12] G. D. Pavagada. GIS Skills Certificate Test Bank. Master’s thesis, San Diego State
University, San Diego, CA, 2008.
[13] Rails Casts. #209 Introducing Devise, 2010. http://railscasts.com/episodes/209-
introducing-devise, accessed Jan. 2013.
[14] Rails Guides. Active Record Validations and Callbacks, 2009.
http://guides.rubyonrails.org/v2.3.11/activerecord_validations_callbacks.html, accessed
Jan. 2013.
[15] Rails Guides. Getting Started with Rails, n.d.
http://guides.rubyonrails.org/getting_started.html, accessed Jan. 2011.
[16] S. Ramaiah. Enhanced Framework for Computer Based Testing. Master’s thesis, San
Diego State University, San Diego, CA, 2005.
41

[17] Ruby on Rails. Active Record Migrations, n.d.


http://api.rubyonrails.org/classes/ActiveRecord/Migration.html, accessed Mar. 2011.
[18] Ruby on Rails. Get Ruby on Rails in no time, n.d. http://rubyonrails.org/download,
accessed Mar. 2013.
[19] S. Ruby, D. Thomas, and D. H. Hansson. Agile Web Development with Rails.
Pragmatic Bookshelf, Raleigh, NC, 2010.
[20] San Diego State University Department of Geography. Web Mapping Services for San
Diego 2007 Wildfires, n.d. http://map.sdsu.edu/, accessed Aug. 2008.
[21] B. Tate and C. Hibbs. Ruby on Rails: Up and Running. O’Reilly Media, Sebastopol,
CA, 2006.
[22] Tutorials Point. Rails Migrations, n.d. http://www.tutorialspoint.com/ruby-on-
rails/rails-migrations.htm, accessed Jan. 2013.
[23] Westminster College. Geographical Information Systems, n.d.
http://www.westminster.edu/staff/athrock/GIS/GIS.pdf, accessed Jan. 2013.
[24] Wikipedia. Geographic Information System, 2013.
http://en.wikipedia.org/wiki/Geographic_information_system, accessed Sept. 2012.
[25] Wikipedia. Web Application Framework, 2013.
http://en.wikipedia.org/wiki/Web_application_framework, accessed Jan. 2013.
[26] ZetCode. MySQL Ruby Tutorial, 2011. http://zetcode.com/db/mysqlrubytutorial/,
accessed May 2011.

You might also like