IT360 Spring 2012
The
New Facebook
This is a
Programming Project. For this project, midshipmen will work in
groups of three or four. The individual grade for the project will be based on the
team grade and the individual performance on completing the project. You may
not discuss the project with anyone outside of your group. You may seek
clarifications pertaining to system requirements from Dr. Crainiceanu.
Honor
·
No collaboration
between teams is allowed.
Submission
requirements (each team will have one submission):
·
Electronic submission: The team leader should upload the files created for each part of the
project to Final Project on
Blackboard
·
Hard copy: Hard copy of the project report which includes the answers to all
intermediate parts of the project.
1.
Choose
a project leader. The project leader will be the instructor’s point of contact
with your team. The project leader is also responsible for ensuring that work
is distributed in a fair manner to each team member and that the work is
getting done.
2.
Read
through the project description and divide up the project in sections of
responsibility (ex. ER Diagram, Normalization, Signup, Login, Friends, PhotoAlbum, etc). Each team
member should be responsible* for some section of the project. Each team
member should be responsible for both
some section in the design part (1-4) and some section on the web interface
part (5).
*Responsibility for a section of
the project does not mean that the team member is to do that section of the
project alone; it simply means that the member will supervise that section.
3.
Record
the name of the project leader, the sections of responsibility, and the team
member responsible for each section.
Send
email to your instructor with information in Point 3 above. Turn in a hard copy
with the same information. This section of the project is due Thursday March 22, 2012 1200
In first
part of the project, you will design a relational database for storing
information about your Facebook social network.
You will begin with a detailed description of the content. Then, you will need to systematically go
through the conceptual and logical database design process you learned about in
class.
For the
second part of the project, you will create the web interface to allow creation
of new users, adding friends, uploading photos, tagging, and you will generate
some reports from the data.
As a
starting point, we have done the initial “requirements analysis” for you. The following is a brief description of the
data that you will store in your database.
(In real life, you would ordinarily begin with much fuzzier
information.)
There
can be an unlimited number of users. Each user has the following information:
1.1
Login
information
This includes the username and password. The password
must be stored in encrypted form (char(40)).
1.2
Profile
information
This includes the following attributes: first name,
last name, year of birth, month of birth, date of birth, gender.
1.3
Hometown
Location
A user’s hometown includes the following attributes:
city, state, country.
1.4
Current Location
Exactly the same attributes as hometown location.
1.5
Education History
Education history is for college programs and above. A user could have
participated in multiple such programs, and each one will have the following
attributes: name of the institution (e.g., US Naval Academy), year of
graduation, primary major (e.g. IT, CS, EE, etc.), and degree (e.g., BS, MS,
PhD, etc.).
1.6
Friendship information
Each user can have any number of friends. Each friend
must also be a Facebook user.
“Photos” is an important Facebook
application. Each photo has the following associated information:
2.1 Album
information
Each photo MUST belong to an album.
An album has the following associated attributes:
album_ID, owner_ID (this
refers to the owner’s Facebook ID), album_name, cover_photo_ID (this refers to a photo ID), album_created_time, album_modified_time
, album_link and album_visibility.
2.2 Other
information
Each photo has the following additional attributes: photo_ID, photo_caption, photo_created_time, photo_modified_time,
and photo_ link.
A photo tag identifies a Facebook
user in a photo. It has the following associated attributes:
3.1 Tag
subject
tag_subject_id (this refers to a Facebook user ID)
3.2 Tag
coordinates
tag_x_coordinate and tag_y_coordinate
3.3 Time
created
tag_created_time
Note that there can be multiple
tags at exactly the same (x, y) location. However, there can be only ONE tag
for each subject in the photo; Facebook doesn’t allow multiple tags for the
same subject in a single photo. For example, you cannot tag Lady Gaga twice in
a photo, even if she appears at two different locations (whatever that means).
Your
task in Part 1 is to perform “Conceptual Database Design” using ER Diagrams.
While there are many ER variants, for this project, we expect you to use the
Crow’s foot notation (Information Engineering notation) used during lecture.
You can use pen-and-paper or ERWin to draw the ER
diagram.
To
receive full points for this part, you need to identify all the entities and
relationships in a reasonable way. We
expect there to be multiple correct solutions.
(Remember that ER design is subjective.) Your goal should be to capture
the given information. You should use the features of ER modeling that you have
learned in class (minimum and maximum cardinalities, identifying and
non-identifying relationships, IS-A hierarchies) as necessary.
For the
entity names, relationships names and attribute names that you will be using in
your ER diagram, you can use the ones we have provided here, or you may also
choose your own names, provided that they are intuitive and unambiguous.
ER
diagram created for Part 1. If there are some requirements you could not
capture in the ER diagram, specify so.
For the
second part of the project, your task is to convert your ER diagrams into
relational tables. You are required to
write SQL Data Definition Language statements for this part to create all
tables, and to drop the tables. You should turn in two files:
createTables.sql and dropTables.sql
You
should capture as many constraints from your ER diagrams as possible in your createTables.sql file. In your dropTables.sql,
you should write the DROP TABLE statements necessary to destroy the tables you
have created.
Each team has a new
database IT360teamX on cardhu.cs.usna.edu. Use your database to test your
scripts.
For each table identified in part 2:
1) Ensure the table is in 1st Normal
Form. If the table is not in 1St Normal Form, re-design the table,
so the resulting tables are in 1st Normal Form.
2) For each table, list all the functional
dependencies (rules of the type X->Y) that are true for that table. Remember
that each table has at least one functional dependency.
3) For each table, say whether the table is in
Boyce-Codd Normal Form or not. If a table is not in
Boyce-Codd Normal Form, decompose the table such that
the result tables are in Boyce-Codd Normal Form.
4) If needed, update the createTables.sql
and dropTables.sql created in Part 2 to contain the
new tables.
The next
part of this project is actually populating your database. For this part, we will provide you with some
fake data.
For
your convenience, we will provide you with Facebook data (fake) in a set of
MySQL database tables. These
tables actually give you some hints on the previous parts of the assignment.
However, these tables are highly denormalized, and
without any table constraints.
The
table names are:
USER_INFORMATION
ARE_FRIENDS
PHOTO_INFORMATION
TAG_INFORMATION
The fields of those tables are
described as follows:
USER_INFORMATION table:
1. USER_ID
This is the Facebook unique ID for users
2. PASSWORD
This is the encrypted Facebook
password (fake!!)
3. FIRST_NAME
Every user MUST have a first name on file
4. LAST_NAME
Every user MUST have a last name on file
5. YEAR_OF_BIRTH
Some user may not provide this information
6. MONTH_OF_BIRTH
Some user may not provide this information
7. DAY_OF_BIRTH
Some user may not provide this information
8. GENDER
Some user may not provide this information
9. HOMETOWN_CITY
Some user may not provide this information
10. HOMETOWN_STATE
Some user may not provide this information
11. HOMETOWN_COUNTRY
Some user may not provide this information
12. CURRENT_CITY
Some user may not provide this information
13. CURRENT_STATE
Some user may not provide this information
14. CURRENT_COUNTRY
Some user may not provide this information
15. INSTITUTION_NAME
Some user may not provide this information.
A single person may have studied in multiple institutions (college and above).
16. PROGRAM_YEAR
Some user may not provide this information.
A single person may have enrolled in multiple programs.
17. PROGRAM_CONCENTRATION
Some user may not provide this information.
This is like a short description of the program.
18. PROGRAM_DEGREE
Some user may not provide this information.
ARE_FRIENDS table
1. USER1_ID
2. USER2_ID
Both
USER1_ID and USER2_ID refer to the values in the USER_ID field of the
USER_INFORMATION table. If two users appear in the same row (a relation), it
means they are friends, otherwise they are not friends.
PHOTO_INFORMATION table
1. ALBUM_ID
ALBUM_ID is the Facebook unique ID for albums.
2. COVER_PHOTO_ID
Each album MUST have a cover photo. The values are the Facebook unique IDs for
photos.
3. ALBUM_NAME
4. ALBUM_CREATED_TIME
5. ALBUM_MODIFIED_TIME
6. ALBUM_LINK
The URL directly to the album
7. ALBUM_VISIBILITY
One of the following values: EVERYONE, FRIENDS_OF_FRIENDS, FRIENDS, ONLY _ME,
CUSTOM
8. PHOTO_ID
This is the Facebook unique ID for photos.
9. PHOTO_CAPTION
An arbitrary string describing the photo.
10. PHOTO_CREATED_TIME
11. PHOTO_LINK
The URL directly to the photo
TAG_INFORMATION table
1. PHOTO_ID
Unique Id of the corresponding photo
2. TAG_SUBJECT_ID
Unique Id of the corresponding user
3. TAG_CREATED_TIME
4. TAG_X_COORDINATE
5. TAG_Y_COORDINATE
Fake data (guaranteed)
Whether
you have a Facebook account or not, everyone will have access to an artificial
(fake) data set. The fake data includes five tables with exactly the same
schema as those above, just the names have PUBLIC_ as
prefix. These tables are stored in the it360data database on cardhu.
PUBLIC_USER_INFORMATION
PUBLIC_ARE_FRIENDS
PUBLIC_PHOTO_INFORMATION
PUBLIC_TAG_INFORMATION
You can access the public tables with
the fake data by prefixing the table name with the database name (it360data).
For example, to access the PUBLIC_USER_INFORMATION table, you need to refer
to the table name as it360data.PUBLIC_USER_INFORMATION.
For this
part of the project, you will populate your database with the Facebook data we
just described. You should turn in the
set of SQL statements (DML) to load data from the public tables (e.g., PUBLIC_USER_INFORMATION,
etc.) into your normalized tables. You should put all the statements into a
file called “loadData.sql”.
loadData.sql file containing the insert
statements to get the data from public tables into your own tables designed in
part 2,3.
You need
to turn in the following files via Blackboard:
(Please
put all your files in a single zip file and submit a single file per team)
You should
add now a web interface for your database. There are no specific requirements
for the website design, but the overall website should be tasteful and
appropriate for USNA. The look among pages should be consistent (use CSS). When
finished, your system should support the following functionality:
·
One
of the friends is female, and the other is male
·
Their
age difference is within “yearDiff”
·
They
are not friends with one another
·
They
should be tagged together in at least one photo
Write a
project report, explaining your work in this project. Include any extra credit,
and any requirements that you did not meet. Include a description of your
innovative feature. For testing purposes, include
the user name and password for one user. The project report should also
serve as a user manual on how to use the software you wrote, so screen shots
and step-by-step instructions should be included. The project report should be
clear and well organized: have an introduction, main content, and conclusions.
Include the up-to-date ER model and the SQL statements to create your tables in
the report. See more details in the Deliverables section.
Your
project must meet the basic requirements, with the extra "innovative"
feature. Then do any of the following for additional credit. You
may also propose other ideas; talk to your instructor.
·
Create
a poster that showcases the course
and/or the project, and can be used as advertisement for the IT major. If
multiple posters are created, we will vote on the best poster, and the winning
team will receive an extra-extra credit. More information about how you can
create a poster is available at http://www.usna.edu/Users/cs/needham/ProjectPosters/ProjectPosters.htm
For
each intermediate deadlines, there is a -2% (of overall grade) penalty for each
business day being late. The complete project has to be submitted on time. No
late submission accepted for the final project.
Thanks
to Kristen LeFevre for providing the idea and the
initial partial requirements for this project.
All
items due at start of class unless otherwise noted.
·
Thursday
March 22 noon.
Email and hard-copy to instructor: The name of the project leader, the sections
of responsibility, and the team member responsible for each section. When
dividing the work amongst yourselves, remember that each team member should be
responsible for both some section in
the design part (1-4) and some section on the web interface part (5).
·
Thursday
March 29, before lab.
Parts 1-4 are due. Only one submission per team is required. Both electronic
(Blackboard) and paper submissions are required.
Presentation:
The members of
your group should be prepared to demonstrate your system to the class. Be
sure to mention your required innovative feature and any extra credit. You’re
not expected to prepare Powerpoint slides but if you
wish place them in your team web directory for easy access.
Report: You will submit a single-spaced
written project report, which includes
§ A cover sheet with your team
number and project members. Describe your innovative feature, any extra
credit, and any requirements that you did not meet.
§ A description of what each person
did – who created each file, who tested?
§ Username and password for two
users on your site.
§ A technical report of how the
overall system works from a coding standpoint. We want to know how you use
files, server-side scripts, etc. This should be no more than a few pages.
This should serve as manual for someone who wants to modify your code.
§ User manual: a description on how
your system should be used by the end users (include screen shots and
step-by-step instructions)
§ All of your files should also be
well documented (see Clarifications section)
§ Updated ER diagram and createTables.sql with the create table statements
Feedback
and Peer Grading:
You will be provided with an online form for giving feedback and grading the members
of your team. You will submit this individually – peer grades are
confidential. Check
your email for more info.
·
This
project is to be done using PHP, HTML, CSS, and optionally, JavaScript. All
server-side programming should be done in PHP, using object-oriented
programming style.
·
Documentation:
good documentation is expected for your code. The code should be well organized
and well documented. At the very least, all PHP scripts and class files should
have the author(s) name and a short description on top. All non-trivial
methods/ functions should have a short description explaining the purpose of
the method/function.
·
Sub-part
4 (Update profile, Change Password) of the web interface is not required for
teams of 3 people.
·
March 29, 2012:
Updated description for part 9 Statistics/reports
·
April 9, 2012:
Updated deliverables and changed due date for the project.
·
April 9, 2012:
W3Schools has an easy tutorial for how to upload a file to the web server: http://www.w3schools.com/php/php_file_upload.asp