cmpe 295b final project report-qa-signed

88
Real Time Question and Answer Platform A Project Report Presented to The Faculty of the College of Engineering San Jose State University In Partial Fulfillment Of the Requirements for the Degree Master of Science in Computer Engineering Master of Science in Software Engineering By Bingyu Li Kwun Fung Ng Feiyu Yin Junchen Zhu December 2015

Upload: daniel-ng

Post on 14-Feb-2017

102 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: CMPE 295B Final Project Report-QA-signed

Real Time Question and Answer Platform

A Project Report Presented to

The Faculty of the College of Engineering

San Jose State University In Partial Fulfillment

Of the Requirements for the Degree Master of Science in Computer Engineering Master of Science in Software Engineering

By Bingyu Li

Kwun Fung Ng Feiyu Yin

Junchen Zhu

December 2015

Page 2: CMPE 295B Final Project Report-QA-signed

Copyright © 2015 Bingyu Li

Kwun Fung Ng Feiyu Yin

Junchen Zhu

ALL RIGHTS RESERVED

Page 3: CMPE 295B Final Project Report-QA-signed

APPROVED FOR COMPUTER ENGINEERING DEPARTMENT Dr. Charles Zhang, Project Advisor Professor Donald Hung, Director, MS Computer Engineering Dan Harkey, Director, MS Software Engineering Professor Xiao Su, Department Chair

Page 4: CMPE 295B Final Project Report-QA-signed

ABSTRACT

Real Time Question and Answer Platform By Bingyu Li, Kwun Fung Ng, Feiyu Yin, Junchen Zhu

In our daily life, there are situations that we have questions or problems that needs

to be solved immediately. For example, college students may run into academic problems

that need to be answered right away, but it is not easy to find appropriate answers or a

person for help. There are other situations where a software engineer may struggle with a

compilation error. For this scenario, the solution can be found online, but advice from a

more experienced engineer must be much more helpful.

Even though there are various media available to help people with their daily

questions, it is not guaranteed that their questions can be solved interactively and in real-

time. Also, traditional knowledge sharing media such as textual-based websites are not

clear enough for explaining certain complicated cases. Pictures, audios and videos are

easier for people to read and understand. Thus, multimedia communication with

immediate responses will be a new trend for people to solve their questions.

This project aims on building an application to offer a multimedia communication

platform for users to ask and answer questions instantly via text messages, voice

messages, videos and images, etc. It can route questions to potential experts according to

their categories. The receiver who first offers an accepted answer will get the reward

from the questioner. In this way, the more people involved in using this platform the

Page 5: CMPE 295B Final Project Report-QA-signed

more efficiently questions can be answered. This platform also includes user's reputation

management module to ensure the quality of the service and to fight against spams.

Page 6: CMPE 295B Final Project Report-QA-signed

vi

ACKNOWLEDGEMENTS

We would like to express our gratitude to certain individuals who provided many

help, inputs and kind support for this excellent project.

First, we would like to deeply thank towards our advisor Dr. Charles Zhang who

have helped and shared his experience to us. Dr. Zhang gave us a great idea to start with

this Real Time Question and Answer Platform and he guided us to overcome all kinds of

problems. Also, he provided us a lot of resources especially his experience.

Moreover, we would also like to thank the Department of Computer and Software

Engineering at San Jose State University who provided us all resources we needed to

build this project. And the Department of Computer and Software introduced us a group

of world-class professors who lead us and our lovely San Jose State University, to

become highly ranked among the national universities.

Last but not least, we are graduating after completing this project and we would

like to give special thanks to our families who have given us all support including mental,

financial and other valuable support. Without them, our project and the way we achieve

our master’s degree will be much more difficult. We also want to give thanks to all

friends who, in these past two years, have fought with us and worked together toward this

final goal.

Page 7: CMPE 295B Final Project Report-QA-signed

vii

Table of Contents

Chapter 1   Introduction .................................................................................................. 1  1.1   Project goals and objectives .............................................................................. 1  1.2   Problem and motivation .................................................................................... 2  1.3   Project application and impact .......................................................................... 4  1.4   Project results and expected deliverables .......................................................... 5  1.5   Market research ................................................................................................. 6  1.6   Project report Structure ...................................................................................... 7  

Chapter 2   Background and Related Work .................................................................. 8  2.1   Background and used technologies ................................................................... 8  2.2   State-of-the-art technologies ............................................................................. 8  

2.2.1   Video/audio transcription ....................................................................... 8  2.2.2   Parser ...................................................................................................... 8  2.2.3   Crowdsourcing ....................................................................................... 9  2.2.4   Routing ................................................................................................... 9  2.2.5   Categorization ........................................................................................ 9  2.2.6   Billing ................................................................................................... 10  

2.3   Literature survey .............................................................................................. 10  

Chapter 3   System Requirements and Analysis ......................................................... 13  3.1   Domain and business requirements ................................................................. 13  3.2   Customer-oriented requirements ..................................................................... 19  3.3   System (or component) functional requirements ............................................ 23  3.4   System performance and non-functional requirements ................................... 24  3.5   System behavior requirements ........................................................................ 25  3.6   Context and interface requirements ................................................................. 25  3.7   Technology and resource requirements ........................................................... 26  

Chapter 4   System Design ............................................................................................. 28  4.1   System architecture design .............................................................................. 28  

4.1.1   Architecture diagram ............................................................................ 28  4.1.2   Play server ............................................................................................ 28  4.1.3   Meteor JS client .................................................................................... 31  4.1.4   Meteor JS server ................................................................................... 32  4.1.5   Communication between client and servers ......................................... 33  

4.2   System data and database design ..................................................................... 33  4.3   System interface and connectivity design ....................................................... 35  

4.3.1   External interfaces to systems/components .......................................... 35  4.4   System user interface design ........................................................................... 35  

4.4.1   User interface design ............................................................................ 35  4.4.2   User interface operation flow ............................................................... 43  

4.5   System component API and logic design ........................................................ 43  4.5.1   Play server API ..................................................................................... 43  

Page 8: CMPE 295B Final Project Report-QA-signed

viii

4.6   Design problems, solutions, and patterns ........................................................ 62  

Chapter 5   System Implementation ............................................................................. 64  5.1   System implementation summary ................................................................... 64  5.2   System implementation issues and resolutions ............................................... 64  5.3   Used technologies and tools ............................................................................ 65  

Chapter 6   System Testing and Experiment ............................................................... 67  6.1   Testing and experiment scope ......................................................................... 67  6.2   Testing and experimental approaches ............................................................. 68  6.3   Testing and experiment ................................................................................... 68  

6.3.1   Testing preparation ............................................................................... 68  6.3.2   Testing summary .................................................................................. 69  

Chapter 7   Conclusion and Future Work ................................................................... 73  7.1   Project summary .............................................................................................. 73  7.2   Future work ..................................................................................................... 74  

References ........................................................................................................................ 76  

Page 9: CMPE 295B Final Project Report-QA-signed

ix

List of Figures

Figure 1 Activity diagram ................................................................................................. 13  Figure 2 Process decomposition diagram overall ............................................................. 14  Figure 3 Process decomposition diagram of posting a question ....................................... 14  Figure 4 Process decomposition diagram of posting an answer ....................................... 15  Figure 5 Process decomposition diagram of changing personal setting ........................... 16  Figure 6 Class diagram ..................................................................................................... 17  Figure 7 State of machine diagram of posting a question ................................................. 18  Figure 8 State of machine diagram of posting an answer ................................................. 19  Figure 9 System architecture ............................................................................................ 28  Figure 10 ER diagram ....................................................................................................... 34  Figure 11 External interface diagrams .............................................................................. 35  Figure 12 Chatting page .................................................................................................... 36  Figure 13 Notifications page ............................................................................................. 36  Figure 14 Landing page .................................................................................................... 37  Figure 15 Questions asked page ....................................................................................... 37  Figure 16 Questions answered page ................................................................................. 38  Figure 17 Question creation page ..................................................................................... 38  Figure 18 Question detail page ......................................................................................... 39  Figure 19 Answer detail page ........................................................................................... 39  Figure 20 Closed question page ........................................................................................ 40  Figure 21 User profile page .............................................................................................. 40  Figure 22 User signup page .............................................................................................. 41  Figure 23 User login page ................................................................................................. 41  Figure 24 Notification on the top bar ................................................................................ 42  Figure 25 Notification in the notification list ................................................................... 42  Figure 26 GUI flow diagram ............................................................................................. 43  Figure 27 API diagram 1 ................................................................................................... 44  Figure 28 API diagram 2 ................................................................................................... 44  Figure 29 API diagram 3 ................................................................................................... 45  Figure 30 API diagram 4 ................................................................................................... 45  Figure 31 API diagram 5 ................................................................................................... 46  Figure 32 API diagram 6 ................................................................................................... 46  Figure 33 API diagram 7 ................................................................................................... 47  Figure 34 API diagram 8 ................................................................................................... 47  Figure 35 API diagram 9 ................................................................................................... 48  Figure 36 API diagram 10 ................................................................................................. 49  Figure 37 API diagram 11 ................................................................................................. 49  Figure 38 API diagram 12 ................................................................................................. 50  Figure 39 API diagram 13 ................................................................................................. 50  Figure 40 API diagram 14 ................................................................................................. 51  Figure 41 API diagram 15 ................................................................................................. 52  Figure 42 API diagram 16 ................................................................................................. 52  

Page 10: CMPE 295B Final Project Report-QA-signed

x

Figure 43 API diagram 17 ................................................................................................. 53  Figure 44 API diagram 18 ................................................................................................. 53  Figure 45 API diagram 19 ................................................................................................. 54  Figure 46 API diagram 20 ................................................................................................. 55  Figure 47 API diagram 21 ................................................................................................. 55  Figure 48 API diagram 22 ................................................................................................. 56  Figure 49 API diagram 23 ................................................................................................. 56  Figure 50 API diagram 24 ................................................................................................. 57  Figure 51 API diagram 25 ................................................................................................. 57  Figure 52 API diagram 26 ................................................................................................. 58  Figure 53 API diagram 27 ................................................................................................. 58  Figure 54 API diagram 28 ................................................................................................. 59  Figure 55 API diagram 29 ................................................................................................. 59  Figure 56 API diagram 30 ................................................................................................. 60  Figure 57 API diagram 31 ................................................................................................. 60  Figure 58 API diagram 32 ................................................................................................. 61  Figure 59 API diagram 33 ................................................................................................. 62  Figure 60 API diagram 34 ................................................................................................. 62  

Page 11: CMPE 295B Final Project Report-QA-signed

xi

List of Tables

Table 1 Comparison with traditional Q&A ........................................................................ 4  Table 2 User login ............................................................................................................. 20  Table 3 User enrollment .................................................................................................... 20  Table 4 Change personal setting ....................................................................................... 20  Table 5 Post a question ..................................................................................................... 21  Table 6 View post question ............................................................................................... 21  Table 7 Message chat with expert ..................................................................................... 21  Table 8 Video chat with expert ......................................................................................... 22  Table 8 Post an answer to a question ................................................................................ 22  Table 10 View post answers ............................................................................................. 22  Table 11 Choose best answer ............................................................................................ 23  Table 12 Functional requirements .................................................................................... 24  Table 13 Non-functional requirements ............................................................................. 25  Table 14 System behavior requirements ........................................................................... 25  Table 15 UI requirement design ....................................................................................... 26  Table 16 Environments ..................................................................................................... 26  Table 17 Server technologies ............................................................................................ 27  Table 18 Client technologies ............................................................................................ 27  Table 19 Development tools ............................................................................................. 27  Table 20 System implementation issues and resolutions .................................................. 65  Table 21 Used server technologies ................................................................................... 65  Table 22 Used client technologies .................................................................................... 66  Table 23 Development tools ............................................................................................. 66  Table 24 Testing scope ..................................................................................................... 67  Table 25 Testing approaches ............................................................................................ 68  

Page 12: CMPE 295B Final Project Report-QA-signed

1

Chapter 1 Introduction

This project is to design and develop a new question and answer (Q&A)

web/mobile application for users to communicate with experts and to get a best answer

for their questions. This chapter depicts goals and objectives of our project, and describes

the problems we have met and how we solved as well as motivation and needs. It also

presents the application and result of our project. Last, market research and report

structure is mentioned in this chapter.

1.1 Project goals and objectives

This project aims to offer a platform for users to ask and answer questions and

communicate with experts in concerned areas. It can cover topics from a homework

question of a course at San Jose State University to an auto repair problem, as long as

there are users experienced in different fields. Users can students, professors, patients,

doctors, engineers, and workers, etc. In a word, users can be anyone who has a

smartphone or a computer. Instead of looking for experts to solve their questions, users

only need to post their questions on our platform with any form they prefer, voice

message, text message, or an image, and wait for their answer. Our achievements can be

succeed while users can obtain the benefits from the Q&A applications as the following:

• Instant notification for users (experts) after other users posted their

questions. The questions will first enter into our routing system and they

will be sent to certain users (expert). This can decrease responses times

and users (expert) who know the solutions can post their comments and

Page 13: CMPE 295B Final Project Report-QA-signed

2

answers immediately. Thus, the users who ask questions can obtain the

most suitable answers in shorter time.

• When users are discussing some complicating questions, they cannot only

use text but also drawing and videos to explain and answer their questions.

Graphics and videos can reduce the degree of abstract for the questions

and users can have higher efficiency to understand concepts.

• Our application is integrated with famous drawing and videoconference

API such as Google hangout. Thus, most users will find it is very easy to

use and they can just install, register and ask their questions in our

application.

1.2 Problem and motivation

The Real Time Question and Answer Platform is an efficient system for users to

post their questions and sharing their thoughts and answers. Users can ask any categories

questions such as academic, medical or any problems happens in their daily life. For

each question, it may involve couple categories and there could be multiple solutions for

that question.

An efficient system can enhance users’ life quality and also reduce their waiting

time. About twenty years ago, Yahoo and Google just started, these two search engines

were most reliable and efficient system in our world. These two search engines changed

people's life style. People who used to search their problems from books or mailed their

questions to some experts with hours to week’s response time became typing their

problems on their computers with less than a second response time. What we want to do

Page 14: CMPE 295B Final Project Report-QA-signed

3

is similar to this concept and we would like to deliver an efficient Q&A system to users

and they can have less waiting time and more comments and answers to their problems.

An efficient system can be described in one word “fast”. We need to create a

system fast enough for users and they would feel comfortable to ask. Since we have many

categories and each category might correlate to the others, we needed to figure out how to

do a better routing job. For example, after an user asked his question, our system need to

route his question to other expert users who subscribed to related categories in a very

short period so that the user would not need to wait for long time for his answers.

When most developers start their development for mobile applications, they

would have the same question that if they should build Android or iOS application first.

Both Android and iOS are popular in the mobile devices market. If they don’t have

sufficient resources to build both together, they might lose the other side customers.

Thus, we have found that we need to choose a better way to take care both OS users.

Finally, we chose Meteor as our system framework and it can create web service while it

can also provide both mobile applications at the same time.

On the other hand, there may be thousands questions may be posted on traditional

webs or forums. As we are frequent users of couple forums, we noticed that some

questions we may miss due to huge volume of questions may show on the same page and

that means our expert users may miss some questions they may be interested in or

experienced with. So this could finally lead to fewer answers and longer wait time for our

users. So as to solve this problem, we have developed a routing system for our expert

users. Expert users can subscribe to their expertise categories or keywords and our system

Page 15: CMPE 295B Final Project Report-QA-signed

4

will send notifications to them so they can answer or view the questions immediately.

This can also reduce their time to search on our web site.

Real Time Q&A Traditional Q&A

(e.g. Stack Overflow)

User interface Android, iOS, Web browsers

Only Web browsers

Text reply questions Yes Yes Pictures upload Yes Only a couple of websites support Instant chat Yes No Video call Yes No Notification for new questions

Yes, actively send to users’ mobile devices

No

Notification for new answers

Yes, actively send to users’ mobile devices

Yes but is passively that users have to login to see them

Communication media 4 different ways 1 or may be 2 different ways

Efficiency for waiting answers Fastest

Slow and have to wait and check by users

Rating answers system Yes Yes

Rating for expert users Yes Some websites may have it

Table 1 Comparison with traditional Q&A

1.3 Project application and impact

The purpose of this project is to provide an efficient solution for an individual

user who has a question that is expected to answer instantly. It is easy for users to install

this app on their smartphone or open it on their computer. Once the user registers an

account, they can start asking questions. It is very convenient since users do not need to

go to visit someone who may know the answer. It not only saves time but also collects

Page 16: CMPE 295B Final Project Report-QA-signed

5

more comprehensive answers to a question from different experts. It plays like users go

anywhere with helpers in hand as long as they have data access or Internet connection.

This application can greatly improve users’ productivity and efficiency working

on a certain topic. They do not need to make an appointment with people who they want

to get an answer. And the experts can answer questions during their spare time with a

reward from who ask the question once theirs are picked as best answer. So it is a win-

win game for both users who ask questions and answer questions.

The platform is designed in a scalable and extensible way so that anyone can

configure and add new features easily to improve this application. In addition, the bigger

users database it has, the more benefits and popularity can be gained by the users.

1.4 Project results and expected deliverables

Our project delivers a question and answer platform which can be used on a

computer as a website or on a Android or iOS smartphone as a mobile application. No

technical skill is required for using this platform.

The project has following deliverables:

• A project report that describes project plan and background, system

requirements and analysis, system design and implementation, and system

testing.

• Well-designed mobile application for Android and iOS.

• Well-designed website.

• Application user guide.

Page 17: CMPE 295B Final Project Report-QA-signed

6

• Environment setup guide.

• RESTful APIs specification.

1.5 Market research

Nowadays, there are many choices for us to solve our problems such as watching

online tutorial videos, posting their questions online and waiting for replies. For general

questions, we may be able to search the online such as YouTube where people already

posted their solutions. However, for some specific questions or some questions required

professional knowledge, we would need to post on some forums or Q&A websites and

wait for replies.

The first Q&A online service was invented in 1992. After a decade, numbers of

popular Q&A websites increased from less than 10 to more than 40 sites today. The rapid

increment of websites also brought a huge number increased in users side. The most

popular like Ask.com, Stack Exchange Network and Yahoo! Answer use crowdsourcing

to solve users’ questions posted. After users posted their problem on the Q&A forum or

websites, other users can view the questions and post their solutions under the questions

they are answering. Some websites such as Yahoo! Answer and Stackoverflow.com have

a feature that all users can rate the best answers and give scores (rewards) for the

solutions.

Although all Q&A websites can provide convenient platforms for users to solve

their problems, there are some improvements can enhance the system efficiency. After

users posted their questions, users have to wait for replies and also wait for other user

rating the solutions. For some urgent cases, users would like to get immediate responses

Page 18: CMPE 295B Final Project Report-QA-signed

7

such as their cars have weird sound coming out from the engine while driving. On the

other hand, most Q&A websites are textual base websites which user can only input text

but not graphics or videos. For some complicated questions such as logical questions, text

may not be sufficient for explanation.

1.6 Project report Structure

This report begins with brief introduction of our project, and background research

like studies on market share and existing technologies as well as literature review of

related subjects. Then system requirements and analysis are specified in Chapter 3,

including both business and customer sides, functional, behavioral and performance

aspects, and interface and technology viewpoint. Chapter 4 presents system architecture

design and database schema, followed by interface design, API components and logic

design. Problems and solutions of system design are also mentioned in this section.

Chapter 5 describes system implementation and used technologies and tools for this

project. Chapter 6 reports relevant testing and experiment we have done for this project to

make sure the platform works well on different operating systems. Last chapter shows

our project achievements and conclusions, and potential future work to improve this

project.

Page 19: CMPE 295B Final Project Report-QA-signed

8

Chapter 2 Background and Related Work

This chapter describes the background of our project and current technologies and

literature that have been used and studied in the area of question and answer platform.

2.1 Background and used technologies

Q&A websites are very popular and many people are using them for solving their

daily questions. These Q&A websites can provide convenient platforms for users to ask

their questions. Thus, what are the precious things our application provided to achieve the

goals we set? Time is precious and valuable for everyone, so we will focus on efficiency.

And we focus on some technical techniques used for our project, transcription, parser,

crowdsourcing, routing, categorization and billing.

2.2 State-of-the-art technologies

2.2.1 Video/audio transcription

Video/ audio transcription or speech recognition software component assists in

the dialogue or conversion of human speech into text transcript. So users only need to

hold their phones and record voice or video instead of typing text, which saves them a lot

of time and brings convenience. Users can still talk to their phone even with their hands

full with other work. There are some popular transcription tools in the market like

Dragon Dictation, Evernote for Android, and Voice Assistant.

2.2.2 Parser

A parser is a software component that receives input data, then analyzes its

syntactic structure and breaks them up into units that can be managed by other software

components. Stanford University [1] has done a lot of research on natural language

Page 20: CMPE 295B Final Project Report-QA-signed

9

parsers and has released several types of parsers, such as shift-reduce constituency parser

[2], compositional vector grammar parser [3] and neural-network dependency parser [4].

2.2.3 Crowdsourcing

Crowdsourcing describes a new web-based business model that harnesses the

creative solutions of a distributed network of individuals through what amounts to an

open call for proposals [5]. Crowdsourcing model significantly reduces business cost by

gathering expertise as labor powers so that they can help users to solve their questions.

Taking the t-shirt selling website Threadless as an example, its sales in 2006 hit $18

million with profits occupying one third and the number of its employees was less than

20.

2.2.4 Routing

Routing is the process of selecting the best paths in a network to move a packet of

data from source to destination. The efficiency of processing questions to experts high

depends on routing technology used for our project. It transfers a question among experts

in search of the potential answers to solve the question.

2.2.5 Categorization

Categorization is used for categorize questions into different classification.

Categorization can increase the efficiency for searching answers and reduce the response

time. We will implement this part for users choose their questions categories and our

backend system will do further categorization such as using questions keywords.

Page 21: CMPE 295B Final Project Report-QA-signed

10

2.2.6 Billing

Mobile billing software component makes it easier and more convenient for users

to purchase merchandise, make payments and track their transaction history on their

smartphones. There are various commercial applications such as Android in-app billing

API, Apple Pay, PayPal Mobile SDKs, etc.

2.3 Literature survey

The explosion of data has motivated the demand for efficient and cost-effective

strategies for knowledge discovery and data mining. Question answering technologies

has gained lots of attention because of the improvement on machines technologies,

natural language and cloud computing [6-8].

A question and answering system aims to “extract” the best matching answer to a

question from all kinds of resources. Traditionally, answering systems do not directly

answer a question but find a matched answer in their database or from Internet resources

by certain algorithm. This is not an easy task of mapping an answer to a question, for

example, users may ask a question in different ways but the answer is going to be the

same. People who are working in this area have come up with various solutions such as

dictionaries, syntactic parsing, semantic relations, entity extraction and so on [9-11].

START natural language question and answering system is the world's first web-based

question answering system. Till now START develops to answer millions of questions in

English in the fields of geography, science and reference, arts and entertainment, and

history and culture. Kwok et al. [12] stated MULDER as the first general purpose, fully

automated question-answering system available on the Internet. It sends users’ queries to

Page 22: CMPE 295B Final Project Report-QA-signed

11

Google search engine and retrieves high-quality answers from search results by using

several language parsers and heuristics [13]. Major components of a document-

collection-based automated Q&A system were mentioned by Kwok, which included

retrieval engine, query formulation and answer extraction.

It is hard to guarantee the accuracy of answers even though many solutions have

been applied. Question answering websites are an alternative for people to look for

answers especially more complicated ones. Viewers can answer posted questions, and all

answers are evaluated. Answer evaluated with highest score is chosen as the best answer.

Question answering website has better accuracy on results and can handle more

complicated and professional questions comparing to question answering system, but the

trade off is longer waiting time. Stack Overflow is a Q&A website built for programmers.

Categories are classified into different programming languages and programming related

fields. Majority users are programmers or people who are learning programming. Users

are rewarded with reputation and badges, so others can review their activity level on this

platform. Low quality questions are closed to improve. As of April 2014, Stack Overflow

has over 2,700,000 registered users and more than 7,100,000 questions.

Now new question answering websites provide real-time answer services.

Registered users may select one expertise from the website (who are not website

employees but also users) and start a one-to-one texture, audio or video question and

answering section. The user can pay certain amount of money. These websites are built

for people with more complicated or professional questions since billing is involved in

Page 23: CMPE 295B Final Project Report-QA-signed

12

this kind of system model. Codementor is another coding Q&A website that provides

one to one service with a mentor expert for debugging, code review services through

screen shard video and text chat. Typically a mentor’s service rate starts at $10/ 15 min.

Baidu Knows is a Q&A website provided by Baidu.com, the top one search

engine in China. Benefited from Baidu search engine, Baidu knows is the most widely

used Q&A website. The business model that combine search engine and Q&A website

makes each member a supplier and consumer of the knowledge which is called collective

intelligence.

Page 24: CMPE 295B Final Project Report-QA-signed

13

Chapter 3 System Requirements and Analysis

3.1 Domain and business requirements

Our application aims to users who have questions that needed to be solved

immediately and also expertise who want to help others solving their problems. In order

to connect question askers and expertise we developed this Q&A platform.

Base on our requirements, we designed our application the way below.

Figure 1 Activity diagram

Page 25: CMPE 295B Final Project Report-QA-signed

14

Figure 2 Process decomposition diagram overall

Figure 3 Process decomposition diagram of posting a question

Page 26: CMPE 295B Final Project Report-QA-signed

15

Figure 4 Process decomposition diagram of posting an answer

Page 27: CMPE 295B Final Project Report-QA-signed

16

Figure 5 Process decomposition diagram of changing personal setting

Page 28: CMPE 295B Final Project Report-QA-signed

17

Figure 6 Class diagram

Page 29: CMPE 295B Final Project Report-QA-signed

18

Figure 7 State of machine diagram of posting a question

Page 30: CMPE 295B Final Project Report-QA-signed

19

Figure 8 State of machine diagram of posting an answer

3.2 Customer-oriented requirements

Use Case Tables are shown here.

Page 31: CMPE 295B Final Project Report-QA-signed

20

Use case name User login

Use case id 1

Actors All users

Description Users use email and password to login to System.

Alternative If user is not enrolled, account enrollment is required. If email and password combination is not right login process prohibited.

Table 2 User login

Use case name User enrollment

Use case id 2

Actors All users

Description User needs to provide email, first name, last name and password to create user account.

Alternative If email is duplicated from other users, enrollment fails. User needs to provide another email address.

Table 3 User enrollment

Use case name Change personal setting

Use case id 3

Actors Logged in users

Description User may change first name, last name, password and tags

Alternative Null

Table 4 Change personal setting

Page 32: CMPE 295B Final Project Report-QA-signed

21

Use case name Post a question

Use case id 4

Actors Logged in users with question

Description User provides question title, content, upload images, and take pictures to post a question.

Alternative Null

Table 5 Post a question

Table 6 View post question

Table 7 Message chat with expert

Use case name View posted questions

Use case id 5

Actors Logged users with posted questions

Description Select posted questions to view details and answers

Alternative Null

Use case name Message chat with expert

Use case id 6

Actors Logged users with posted questions

Description User select an expert that answered the question to start a message chat

Alternative Expert declines the message chat request.

Page 33: CMPE 295B Final Project Report-QA-signed

22

Use case name Video chat with answerer

Use case id 7

Actors Logged users with posted questions

Description User select expert that answered question to start a video chat

Alternative Expert declines the video chat request.

Table 8 Video chat with expert

Use case name Post answer to a question

Use case id 8

Actors Logged in Pro

Description Pro answers a question with providing textual messages, uploading image or take picture to answer question.

Alternative Null

Table 9 Post an answer to a question

Use case name View posted answers

Use case id 9

Actors Logged in Pro

Description Pro views posted answers from a list.

Alternative No posted answers.

Table 10 View post answers

Page 34: CMPE 295B Final Project Report-QA-signed

23

Use case name Choose best answer

Use case id 10

Actors Logged in question asker

Description Question asker chooses one best answer from posted answer list.

Alternative No answer posted or no satisfied answer.

Table 11 Choose best answer

3.3 System (or component) functional requirements

ID Description Input Output

FR1 The system shall provide user login functionality

User email address and matching password

If error, returns login fails; if succeed, response user information.

FR2 The system shall provide user account creation functionality

User email address, password, first name, last name

If email duplicates, enroll fails, if successes account is created.

FR3 The system shall provide user personal setting update functionality

User updates personal information

If error, update fails; If successes profile is updated.

FR4 The system shall provide question review functionality

User selects question to review

Display selected question details.

FR5 The system shall provide question post functionality

Question title, question content, credit, uploaded images and take pictures

If succeed, redirects to posted question details.

FR6 The system shall provide message chat between question poster and answerer

Question poster request message with answerer

If answerer accepted, request starts chatting, if rejected, request fails.

Page 35: CMPE 295B Final Project Report-QA-signed

24

FR6 The system shall provide video chat between question poster and answerer

Question poster request video chat with answerer

If answerer accepted, request starts chatting, if rejected, request fails.

FR7 The system shall provide question routing to proper specialist.

Posting questions Posted question is routed to proper specialist

FR8 The system shall provide answer post functionality.

Answering content, uploading images, taking pictures.

If successes redirects to posted answer details.

FR9 The system shall provide all answers

User selects answer to review

Display selected answer details.

FR10 The system shall provide push notification

When question is posted, new answer is posted, answer is selected as best answer; when message chat request is posted, video chat request is posted.

Notification is pushed to client.

Table 12 Functional requirements

3.4 System performance and non-functional requirements

NFR01 Response time After users post their questions, the dispatching process should take less than 1 second. After users post questions, the question shall be routed to expertise within 5s.

NF02 Accuracy

The percentage that questions be routed to proper users is greater than 99.9%.

NFR03 Reliability

The platform should ensure that users’ questions and answers are dispatched without any information losing. The platform should be still available when server load is heavy.

NFR04 Security The platform should keep users’ personal information secure. The platform should keep every question and

Page 36: CMPE 295B Final Project Report-QA-signed

25

answer confidential.

NFR05 Capability The system server should provide more than 1000 users to post questions and answers at same time without fails.

Table 13 Non-functional requirements

3.5 System behavior requirements

System Consistency System should provide consistency that do not shut down and response all requests properly

Error Handling System should cache errors and exceptions and errors and hand each of them properly

Error logging System should log unhandled errors and exceptions

Database backup System should backup database periodically

Activities logging System should log main activities

Table 14 System behavior requirements

3.6 Context and interface requirements

User interface is an important part of our application. We want to make our

application user friendly, so that all users can have simple pages but with sophisticated

functionalities. In order to achieve this goal, we designed our UI based on below

requirements.

UI Requirement Description

Suitability

Layout of each page should appropriately display functions both effectively and efficiently.

Controllability User should be able to fully control of this application that all functions are well described.

Page 37: CMPE 295B Final Project Report-QA-signed

26

Conformity All pages are designed simple and direct that users can find needed functions easily and feel comfort to use this application.

Suitability Ignoring the differences of each user, this application is suitable for all users.

Table 15 UI requirement design

Environment

Local / EC2 Java environment Play framework runtime environment

Local / EC2 MySQL environment MySQL database environment

Local / EC2 MongoDB environment MongoDB environment

Local / EC2 Android development toolkit environment

Client development /test environment

Table 16 Environments

3.7 Technology and resource requirements

Server Technologies Description

AWS EC2 Both play server and meteor are implemented on Amazon EC2 cloud servers. AWS EC2 provides on demand host configuration.

MySQL MySQL is used for play server database, since it’s an open source storage and provides lots of great features.

Play Framework Play Framework makes it easy to build web applications with Java.

MeteorJS Provides full stack development for both server and client with JavaScript.

Page 38: CMPE 295B Final Project Report-QA-signed

27

MongoDB Database associated with meteor server.

Table 17 Server technologies

Client Technologies Description

HTML5/CSS Thanks to MeteorJS and Cordova, Html5 and CSS can be used to development mobile app user interface

jQuery JavaScript library to provide client-side activities.

Cordova JavaScript app development platform which build JavaScript app into mobile native app

Ionic

Beautiful and well developed open source front-end SDK for developing mobile apps with web technologies

PhoneGap push notification Implement push notification for Android app, iOS app, and web app using JavaScript.

Table 18 Client technologies

Development Tools Description

Eclipse IDE for java development

IntelliJ IDE for both java and JavaScript development

Sublime Popular text editor

Android SKD Studio Android emulator and package management

Table 19 Development tools

Page 39: CMPE 295B Final Project Report-QA-signed

28

Chapter 4 System Design

4.1 System architecture design

4.1.1 Architecture diagram

Below is the architecture of our system:

Figure 9 System architecture

Generally, there are two servers and one client in our system. Each server and

client has a dedicated database.

4.1.2 Play server

Play is the server that handles the main logic and data modeling of the system. It

is written in Java. The reason why we choose Play is that it is an asynchronized server

which will not be blocked on IO requests, and it has many built in Java modules that we

are familiar with such as JPA, Ebean, Global settings and so on. There are basically eight

components in this server: user component, question component, answer component,

Page 40: CMPE 295B Final Project Report-QA-signed

29

notification component, question routing component, category component, authentication

component and common utility component.

• User component:

User component manages user profiles, and user status such as online or offline.

• Question component:

Question component manages all the questions in the system, such question

creation, question update, question deletion, question status management and so on.

• Answer component:

Answer component manages all the answer in the system, such as answer

creation, answer update, answer deletion, answer status management and so on.

• Notification component:

Notification component manages all the notifications in the system. There are four

kinds of notifications: new question notification (which tells users they get new

questions), new answer notification (which tells users they get new answers), best answer

notification (which tells users their answers are chosen as the best answer) and chatting

request notification (which tells users that someone want to chat to them). This

component manages the notification creation, notification deletion, notification status

management and so on.

• Question routing component:

Question routing component routs the questions to the proper users. Every

question should fall into at least one category and users should have at least one

specialization. In the first step of question routing, the system will find the persons who

Page 41: CMPE 295B Final Project Report-QA-signed

30

has the specialization that falls into the questions categories. The next step is to filter out

the users who are not available currently, and the rest of the users will be the candidates

of the questions. Thirdly, system will rank the candidates according to their experience.

Experience is an integer field of User entity that keeps track of how active a user is in this

platform. Ask questions or answer questions both increase user’s experience. From the

ranked candidates, we get a certain number of them and rout the question to them.

• Category component:

Category component manages all categories in the system, such as category

creation, category update, category deletion and so on.

• Authentication component:

Authentication component authenticates the data transferred between client and

server. It also manages the functionalities such as user signup, user signin, user sign out,

client hear beat handling and so on.

• Common utility component:

Common utility component provides the functionalities that other components

need in common, such current timestamp, logging, and so on.

• Database for Play server:

Play server has a dedicated MySQL database connected, which stores all the

information.

Page 42: CMPE 295B Final Project Report-QA-signed

31

4.1.3 Meteor JS client

Meteor JS client is the client part of our system. The reason why we choose

Meteor JS is that by using Meteor JS, we are able to build Android native app, iOS native

app and web app using a single source code written in JavaScript. There are mainly four

components in Meteor JS client: user authentication and profile settings component,

question component, answer component and notification component.

• User authentication and profile settings component:

User authentication and profile settings component manages user login, user

signup and user profile information logic from the client side. It also provides the GUI of

login page, and sign up page.

• Question component:

Question component manages all user questions logic such as question creation,

question update on client side. It also provides the GUI of all question page, question

creation page, question update page, question detail page.

• Answer component:

Answer component manages all user questions logic such as Answer creation,

Answer update on client side. It also provides all the GUI of Answer page, Answer

creation page, Answer update page, and Answer detail page.

• Notification component:

Notification component manages all user Notification logic such as notification

retrieving on client side. It also provides the GUI of all Notification page.

• Database for Meteor JS client:

Page 43: CMPE 295B Final Project Report-QA-signed

32

Play server has a Mongo DB database connected, which stores all temporary

information the client needs when running.

4.1.4 Meteor JS server

There is another server which is written using Meteor JS framework. The reason

we need another server is that it facilitates the image uploading functionality, push

notification functionality and live chatting functionality. It is more intuitive and

convenient to implement these functionalities using the same framework as the Meteor JS

client. There are three components in this server: image component, chatting component

and push notification component.

• Image component:

Image component provides the client with the image uploading, image

downloading functionality. These functionalities are used in questions and answers.

• Chatting component:

Chatting component provides the client with the live chatting functionality.

• Push notification component:

Push notification component provides the client with the push notification

functionality. There will be push notification when there is a new question for an user, or

an new answer for an user, or someone’s answer has been chosen as the best answer, or

one user wants to chat to another user. User can only get push notification when the app

is in background mode.

• Database for Meteor JS server:

Page 44: CMPE 295B Final Project Report-QA-signed

33

Play server has a Mongo DB database connected, which stores all the information

about images, chatting and push notifications.

4.1.5 Communication between client and servers

For the Communication between client and servers, the system is using RESTful

API, which send JSON data as the payload.

4.2 System data and database design

Below is the ER diagram of our system on Play server.

Page 45: CMPE 295B Final Project Report-QA-signed

34

Figure 10 ER diagram

Page 46: CMPE 295B Final Project Report-QA-signed

35

4.3 System interface and connectivity design

4.3.1 External interfaces to systems/components

Below is the diagram of the interfaces of our platform and APN and GCM. This

system only uses APN and GCM as third party component. APN and GCM help the push

notification functionality in the system.

Figure 11 External interface diagrams

4.4 System user interface design

4.4.1 User interface design

Because we used Meteor JS framework, there are totally three kinds of clients:

Android, iOS and web. The GUIs are all the same among these three clients. Here we

only show the GUI presenting on Android platform. Below are the GUI of all the pages

on the mobile app client.

Page 47: CMPE 295B Final Project Report-QA-signed

36

Figure 12 Chatting page

Figure 13 Notifications page

Page 48: CMPE 295B Final Project Report-QA-signed

37

Figure 14 Landing page

Figure 15 Questions asked page

Page 49: CMPE 295B Final Project Report-QA-signed

38

Figure 16 Questions answered page

Figure 17 Question creation page

Page 50: CMPE 295B Final Project Report-QA-signed

39

Figure 18 Question detail page

Figure 19 Answer detail page

Page 51: CMPE 295B Final Project Report-QA-signed

40

Figure 20 Closed question page

Figure 21 User profile page

Page 52: CMPE 295B Final Project Report-QA-signed

41

Figure 22 User signup page

Figure 23 User login page

Page 53: CMPE 295B Final Project Report-QA-signed

42

Figure 24 Notification on the top bar

Figure 25 Notification in the notification list

Page 54: CMPE 295B Final Project Report-QA-signed

43

4.4.2 User interface operation flow

Below diagram shows the flow of the above user interfaces.

Figure 26 GUI flow diagram

4.5 System component API and logic design

4.5.1 Play server API

We used the RESTful API as the main communication protocol between the Play

server and Meteor JS client. Below are the details about these APIs: HTTP Method: GET Request URL: / Request Data: Null Response: OK (200) for logged in user; bad request (400) for user not logged in. Comments: Request the main page; return login page if user is not logged in or landing page if user is logged in. Diagram:

Page 55: CMPE 295B Final Project Report-QA-signed

44

Figure 27 API diagram 1

HTTP Method: POST Request URL: /signin Request Data:

Format JSON Structure {“email” : (Long), “password”: (String) }

Response: OK (200) for correct credentials; bad request (400) for wrong credentials. Comments: Send this request to login. Data will be authenticated by the server. Diagram:

Figure 28 API diagram 2

HTTP Method: POST Request URL: /signup Request Data: Format: JSON Structure: {"email": (String), "password": (String), "firstName": (String) , "lastName": (String), "uMId": (String)} Response: OK (200) for signup successfully; bad request (400) for unsuccessful signup. Comments: Send this request to signup a new account. Data will be authenticated by the server.

Page 56: CMPE 295B Final Project Report-QA-signed

45

Diagram:

Figure 29 API diagram 3

HTTP Method: GET Request URL: /heartbeat/:userId Request Data: null Response: Bad request (404) if user does not exist. OK (200) for heartbeat received; bad request (400) for fail to receive the heartbeat. Comments: Send this request periodically to let server know the specific user is still online. Diagram:

Figure 30 API diagram 4

HTTP Method: GET Request URL: /logoff/:userId Request Data: null Response: Bad request (404) if user does not exist. OK (200) for logoff successfully; bad request (400) for fail to logoff the user. Comments: Send this request to log an user off. Diagram:

Page 57: CMPE 295B Final Project Report-QA-signed

46

Figure 31 API diagram 5

HTTP Method: GET Request URL: /isonline/:userId Request Data: null Response: Bad request (404) if user does not exist Format: JSON Structure: {“result”: (boolean)} Comments: Send this request to test if a user is still online or not. Diagram:

Figure 32 API diagram 6

HTTP Method: GET Request URL: /chat Request Data: Format: JSON Structure: {“fUId”: (String), “tUId”: (String), “uuid”: (String), “aId”: (String)} Response: OK (200) if chatting request is handled successfully; bad request (400) if fail to handle the chatting request.

Page 58: CMPE 295B Final Project Report-QA-signed

47

Comments: Send this request to start to send a chatting request to another user via the server. Diagram:

Figure 33 API diagram 7

HTTP Method: GET Request URL: /users/:userId Request Data: null Response: Bad request (404) if user does not exist. otherwise Format: JSON Structure: {“uId”: (String), “uMId”: (String), “firstName”: (String), “LastName”: (String), “email”: (String), “credit”: (Integer), “exp”: (Integer), “online”: (boolean), “lastActiveTime”: (Long)} Comments: Send this request to get the information of a specific user; Diagram:

Figure 34 API diagram 8

Page 59: CMPE 295B Final Project Report-QA-signed

48

HTTP Method: GET Request URL: /userbyumid/:umid Request Data: null Response:

Bad request (404) if user does not exist. otherwise Format: JSON Structure: {“uId”: (String), “uMId”: (String), “firstName”: (String), “LastName”: (String), “email”: (String), “credit”: (Integer), “exp”: (Integer), “online”: (boolean), “lastActiveTime”: (Long)} Comments: Send this request to retrieve user information based on the uMId provided. uMId is the Id that generated by the meteor client. Diagram:

Figure 35 API diagram 9

HTTP Method: PUT Request URL: /users/:userId Request Data: Format: JSON Structure: {"email": (String), "password": (String), "firstName": (String) , "lastName": (String), “cIds”: (Array of Integers), } Response: Resource not found (404) if user does not exist otherwise OK (200) if user information updated successfully; bad request (400) if fail to update the user information. Comments: Send this request to update the existing user information Diagram:

Page 60: CMPE 295B Final Project Report-QA-signed

49

Figure 36 API diagram 10

HTTP Method: DELETE Request URL: /users/:userId Request Data: null Response: Resource not found (404) if user does not exist otherwise OK (200) if delete user successfully; bad request (400) if fail to delete the user. Comments: Send this request to delete the user from the system. Diagram:

Figure 37 API diagram 11

HTTP Method: POST Request URL: /questions Request Data: Format: JSON Structure: {"uId": (Long), "title": (String), "content": (String), "credit": (Integer), "UUID": (String), "cIds": (JSON array of Integers), "imageUrls": (JSON array of Strings)}

Page 61: CMPE 295B Final Project Report-QA-signed

50

Response: OK (200) if question created successfully; bad request (400) if fail to create the question. Comments: Send this request to create a new quest based on the information provided. Diagram:

Figure 38 API diagram 12

HTTP Method: GET Request URL: /questions/:qId Request Data: null Response: Resource not found (404) if question does not exist otherwise Format: Json Structure: {“qId”: (Long), "uId": (Long), "title": (String), "content": (String), "credit": (Integer), "UUID": (String), "cIds": (JSON array of Integers), "imageUrls": (JSON array of Strings), “bestAnswer”: (Long), “isOpen”: (boolean), “hasImage”: (boolean), “hasVoice”: (boolean), “createdTime”: (String), “createdDate”: (String), “closeTime”: (String), “closeDate”: (String)} Comments: Send this request to retrieve the information of a specific question. Diagram:

Figure 39 API diagram 13

Page 62: CMPE 295B Final Project Report-QA-signed

51

HTTP Method: GET Request URL: /userquestions/:userId Request Data: null Response: Resource not found (404) if user does not exist otherwise Format: Json Structure: JSON array of {“qId”: (Long), "uId": (Long), "title": (String), "content": (String), "credit": (Integer), "UUID": (String), "cIds": (JSON array of Integers), "imageUrls": (JSON array of Strings), “bestAnswer”: (Long), “isOpen”: (boolean), “hasImage”: (boolean), “hasVoice”: (boolean), “createdTime”: (String), “createdDate”: (String), “closeTime”: (String), “closeDate”: (String)} Comments: Send this request to get all questions that are asked by the specific user. Diagram:

Figure 40 API diagram 14

HTTP Method: GET Request URL: /answerquestions/:userId Request Data: null Response: Resource not found (404) if user does not exist otherwise Format: Json Structure: JSON array of {“qId”: (Long), "uId": (Long), "title": (String), "content": (String), "credit": (Integer), "UUID": (String), "cIds": (JSON array of Integers), "imageUrls": (JSON array of Strings), “bestAnswer”: (Long), “isOpen”: (boolean), “hasImage”: (boolean), “hasVoice”: (boolean), “createdTime”: (String), “createdDate”: (String), “closeTime”: (String), “closeDate”: (String)}

Page 63: CMPE 295B Final Project Report-QA-signed

52

Comments: Send this request to get all questions answered by the user Diagram:

Figure 41 API diagram 15

HTTP Method: PUT Request URL: /questions/:qId Request Data: Format: JSON Structure: {"title": (String), "content": (String), "credit": (Integer), "cIds": (JSON array of Integers), "imageUrls": (JSON array of Strings), “bestAnswer”: (Long)} Response: Resource not found (404) if question does not exist. OK (200) if question is updated successfully, or bad request (400) if fail to update the question. Comments: Send this request to update an existing question. Diagram:

Figure 42 API diagram 16

HTTP Method: DELETE Request URL: /questions/:qId Request Data: null

Page 64: CMPE 295B Final Project Report-QA-signed

53

Response: Resource not found (404) if question does not exist; OK (200) if question deleted successfully; Bad request (400) if fail to delete the question. Comments: Send this request to delete an existing question. Diagram:

Figure 43 API diagram 17

HTTP Method: POST Request URL: /answers Request Data: Format: JSON Structure: {"uId": (Long), "qId": (Long), "content": (String), "isBest": (boolean), "views": (Integer), "likes": (Integer)} Response: OK(200) if answer created successfully or bad request (400) if fail to create the answer. Comments: Send this request to create an answer for a specific question. Diagram:

Figure 44 API diagram 18

HTTP Method: GET Request URL: /answers/:id Request Data: null

Page 65: CMPE 295B Final Project Report-QA-signed

54

Response: Resource not found (404) if answer does not exist otherwise Format: JSON Structure: {“aId”: (Long), “qId”: (Long), “content”: (String), “isBest”: (boolean), “likes”: (Integer), “views”: (Integer), “hasImage”: (boolean), “hasVoice”: (boolean), “uId”: (Long)} Comments: Send this request to retrieve the information about an answer. Diagram:

Figure 45 API diagram 19

HTTP Method: GET Request URL: /questionsanswer/:qId Request Data: Null Response: Resource not found (404) if question does not exist Format: JSON Structure: Array of {“aId”: (Long), “qId”: (Long), “content”: (String), “isBest”: (boolean), “likes”: (Integer), “views”: (Integer), “hasImage”: (boolean), “hasVoice”: (boolean), “uId”: (Long)} Comments: Send this request to get all answers to a particular question. Diagram:

Page 66: CMPE 295B Final Project Report-QA-signed

55

Figure 46 API diagram 20

HTTP Method: PUT Request URL: /answer/:aId Request Data: Format: JSON Structure: { "content": (String), "isBest": (boolean), "views": (Integer), "likes": (Integer)} Response: Resource not found (404) if answer does not exist, OK (200) if answer updated successfully, or bad request (400) if fail to update the answer. Comments: Send this request to update an existing answer. Diagram:

Figure 47 API diagram 21

HTTP Method: DELETE Request URL: /answers/:aId Request Data: Null Response: Resource not found (404) if answer does not exist, OK (200) if answer deleted successfully, or bad request (400) if fail to delete the answer. Comments: Send this request to delete an existing answer. Diagram:

Page 67: CMPE 295B Final Project Report-QA-signed

56

Figure 48 API diagram 22

HTTP Method: POST Request URL: /categories Request Data: Format: JSON Structure: {"cName": (String), "fNumber": (Integer)} Response: OK(200) if category created successfully, or bad request if failed to create the category. Comments: Send this request to create a category.

Diagram:

Figure 49 API diagram 23

HTTP Method: GET Request URL: /categories/:cId Request Data: Null Response: Resource not found (404) if category does not exist otherwise Format: JSON Structure: {“cId”: (Long), “cName”: (String), “fNuber”: (Integer), “createdDate”: (String), “createdTime”: (String)}

Page 68: CMPE 295B Final Project Report-QA-signed

57

Comments: Send this request to get the information of a particular category Diagram:

Figure 50 API diagram 24

HTTP Method: PUT Request URL: /categories/:cId Request Data: Format: JSON Structure: {“cName”: (String), “fNuber”: (Integer)} Response: Resource not found (404) if category does not exist; OK (200) if update category successfully or bad request (400) if fail to update the category. Comments: Send this request to update an existing category Diagram:

Figure 51 API diagram 25

HTTP Method: DELETE Request URL: /categories/:cId Request Data: Null Response: Resource not found (404) if category does not exist; OK (200) if delete category successfully or bad request (400) if fail to delete the category. Comments: Send this request to delete existing category. Diagram:

Page 69: CMPE 295B Final Project Report-QA-signed

58

Figure 52 API diagram 26

HTTP Method: GET Request URL: /notifications/:nId Request Data: Null Response: Resource not found (404) if notification does not exist otherwise Format: JSON Structure: {“nId”: (Long), “uId”: (Long), “qId”: (Long), “qTitle”: (String), “createdTime”: (String), “createdDate”: (String), “Status”: (String), “type”: (String), “comment”: (String)} Comments: Send this request to get the information of a notification. Diagram:

Figure 53 API diagram 27

HTTP Method: GET Request URL: /usernotification/:uId Request Data: Null Response: Resource not found (404) if user does not exist otherwise

Page 70: CMPE 295B Final Project Report-QA-signed

59

Format: JSON array Structure: Array of {“nId”: (Long), “uId”: (Long), “qId”: (Long), “qTitle”: (String), “createdTime”: (String), “createdDate”: (String), “Status”: (String), “type”: (String), “comment”: (String)} Comments: Send this request to get all notification of a particular user Diagram:

Figure 54 API diagram 28

HTTP Method: PUT Request URL: /notifications/:nId Request Data: Format: JSON Structure: {“Status”: (String), “type”: (String), “comment”: (String)} Response: Resource not found (404) if notification does does not exist, OK(200) if notification updated successfully, or bad request(400) if fail to update the notification Comments: Send this request to update an existing notification.

Diagram:

Figure 55 API diagram 29

HTTP Method: DELETE

Page 71: CMPE 295B Final Project Report-QA-signed

60

Request URL: /notifications/:nId Request Data: Null Response: Resource not found (404) if notification does not exist, OK (200) if notification deleted successfully, or bad request (400) if fail to delete the notification Comments: Send this request to delete an existing notification. Diagram:

Figure 56 API diagram 30

HTTP Method: GET Request URL: /userunreadnotification/:uId Request Data: Null Response: Resource not found (404) if user does not exist otherwise Format: JSON array Structure: Array of {“nId”: (Long), “uId”: (Long), “qId”: (Long), “qTitle”: (String), “createdTime”: (String), “createdDate”: (String), “Status”: (String), “type”: (String), “comment”: (String)} Comments: Send this request to get all unread notifications of a user Diagram:

Figure 57 API diagram 31

Page 72: CMPE 295B Final Project Report-QA-signed

61

4.5.2 Meteor JS server API We also use RESTful API as the communication protocol between the client and Meteor JS server. Below is the detail API of this server: HTTP Method: POST Request URL: /uploadimage Request Data: Format: JSON Structure: {“image64”: (String), “uuid”: (String)} Response: OK (200) if image uploaded successfully, or bad request (400) if fail to upload the image. Comments: Send this request to store images on the server. Images can either be picked up from user’s device or device’s camera. Diagram:

Figure 58 API diagram 32

HTTP Method: GET Request URL: /chat/:fuId/:tuId/uuid Request Data: Null Response: Resource not found (404) if user or the chat uuid does not exist otherwise Format: JSON Structure: {“content”: (String)} Comments: Send this request to retrieve the chatting content of a specific chatting. Diagram:

Page 73: CMPE 295B Final Project Report-QA-signed

62

Figure 59 API diagram 33

HTTP Method: POST Request URL: /pushnotification Request Data: Format: JSON Structure: {“tId”: (Long), “title”: (String), “content”: (String), “type”: (String)} Response: Resource not found (404) if the target user does not exist. OK (200) if push notification sent successfully, or bad request (400) if fail to send the push notification. Comments: Send this request to let server create a push notification for a specific user. Diagram:

Figure 60 API diagram 34

4.6 Design problems, solutions, and patterns

One problem we faced was that on one hand we wanted to accommodate as many

clients platform as possible such Android, iOS and web, and on the other hand we don’t

have enough resource to achieve that. The solution would be using Meteor JS server, but

Page 74: CMPE 295B Final Project Report-QA-signed

63

at that time we already had our server ready which is a Play server written in Java.

Ideally, we should either rewrite server using Meteor JS framework, or choose other

client side framework instead of Meteor JS. The decision was that keeping the old Play

server and coming up with a new Meteor JS server when it comes to new functionalities.

The result is that we managed to run our platform using two totally different servers at

the same time. Although it did bring us some overhead and redundant in the code, it

works fine.

Another problem we faced was that ideally we could store image data in image

format such as jpeg, png and so on. In this way we could store very large images. But

considering the fact that we don’t want to spend more on storage and we are not familiar

with AWS S3 API, we came up with a solution which is store the image data in its 64bit

String format, and we put the String representations of images into Mongo DB. In this

way we don’t need large storage and we are familiar with Mongo DB, so it really brought

us the benefit of fast development. On the other hand as the length of a String cannot be

too long in Mongo DB, we are not able to store very large images. This is not a big

problem as images taken by mobile devices are not that big. We still manage to make the

image uploading functionality work properly.

Page 75: CMPE 295B Final Project Report-QA-signed

64

Chapter 5 System Implementation

5.1 System implementation summary

1) Play server is established and all required functionalities APIs are

completed.

• User Authentication Model is completed.

• Question Model is completed

• Answer Model is completed

• Question routing Model is completed

• Categories Model is completed

• Notification Model is completed

2) Meteor server is established.

• Images uploading Model is completed

• Take pictures from camera Model is completed

• Message Chatting Model is completed

• Video Chatting Model 80% completed

3) Summary

Basic requirements are all completed. Optional requirements are almost finished

with high percentage. Server side work is all done. Recent work focuses on client side UI

improvements.

5.2 System implementation issues and resolutions

Page 76: CMPE 295B Final Project Report-QA-signed

65

Issue Resolution Since all members are new to Mobile Apps developments, it’s not easy to develop Mobile App within short time.

We use Cordova framework plus MeteorJS, which supports html, css and JavaScript to develop native app.

Since play server uses http API to post and get data, it’s hard to provide reactive chatting environments unless refresh current page.

In order to solve this issue, we use Meteor Server, which uses DDP portal to provide reactive chatting environment.

Table 20 System implementation issues and resolutions

5.3 Used technologies and tools

Server Technologies Description

AWS EC2

Both play server and meteor are implemented on Amazon EC2 cloud servers. AWS EC2 provides on demand host configuration.

MySQL MySQL is used for play server database, since it’s a open source storage and provides lots of great features.

Play Framework Play Framework makes it easy to build web applications with Java

MeteorJS Provides full stack development for both server and client with JavaScript

MongoDB Database associated with meteor server.

Table 21 Used server technologies

Page 77: CMPE 295B Final Project Report-QA-signed

66

Client Technologies Description

HTML5/CSS Thanks to MeteorJS and Cordova, Html5 and CSS can be used to development mobile app user interface

jQuery JavaScript library to provide client-side activities.

Cordova JavaScript app development platform which build JavaScript app into mobile native app

Ionic

Beautiful and well developed open source front-end SDK for developing mobile apps with web technologies

PhoneGap push notification Implement push notification for Android app, iOS app, and web app using JavaScript.

Table 22 Used client technologies

Development Tools Description

Eclipse IDE for java development

IntelliJ IDE for both java and JavaScript development

Sublime Popular text editor

Android SKD Studio Android emulator and package management

Table 23 Development tools

Page 78: CMPE 295B Final Project Report-QA-signed

67

Chapter 6 System Testing and Experiment

This section is going to show test of our project and make sure the system is

functioning 100% correct and no error as well as the UI is friendly enough for any type of

users; system running-time performance.

6.1 Testing and experiment scope

Our testing is mainly based on black box and white box testing. It is carried out at

both component level and system level.

Testing process Scope

Unit testing Individual or group of related units will be tested in this test. This test will be performed in each sprint. It is white box testing.

Component testing Functions of each component will be tested.

GUI testing All user interfaces will be tested manually, including text and buttons, etc.

Integration Testing We will test the combined output of a group of components in this part. Thus, we will do this test with several sprints. It is one of black box testing.

System Testing This test is going to test the system in different environments such as OS or devices. In this test, we will need to make sure our Android app is working on different models of devices. It is one of black box testing.

Compatibility testing The application working on web, Android and iOS simulators and devices is tested.

Performance Testing Speed and its efficiency are important to our product so this test is required so there is not unnecessary wait for users. It is one of black box testing.

Table 24 Testing scope

Page 79: CMPE 295B Final Project Report-QA-signed

68

6.2 Testing and experimental approaches

Testing methods and criteria are described in this section.

Testing process Testing method Testing criteria

GUI testing Black box test, manual All objects are clicked to test. All navigation windows are tested.

Component testing Black box test, manual All components are tested.

RESTful APIs Postman All RESTful APIs are tested.

Integration testing Bottom-up, top-down test

Component is tested one by one until all of them work together.

Compatibility GUI test Front-end GUI works well on web, Android and iOS system.

Performance Load test, usability test, response test

The system responses in a reasonable time.

Table 25 Testing approaches

6.3 Testing and experiment

Our product have been tested and verified all features and validate they are all in

function. We have set up a testing environment and tested our system with some tools.

6.3.1 Testing preparation

In this section, we will list all software and hardware requirements for our testing

cases.

Software Requirements: ● Testing target environment:

- Chrome Internet browser - iOS devices with Apple developer account - Android devices

Page 80: CMPE 295B Final Project Report-QA-signed

69

● JMeter Hardware Requirements: ● Laptops (Windows and Mac)

6.3.2 Testing summary

Testing results are the following: Play server API test

Test Case ID

Version Test Case Description Pass/ Fail

Tester Test Date

API-1 1.0 HTTP Method: GET Pass Feiyu Yin 10/30/2015

API-2 1.0 HTTP Method: POST (Signin) Pass Feiyu Yin 10/30/2015

API-3 1.0 HTTP Method: POST (Signup) Pass Feiyu Yin 10/30/2015

API-4 1.0 HTTP Method: GET (Heartbeat) Pass Feiyu Yin 10/30/2015

API-5 1.0 HTTP Method: GET (Logoff) Pass Feiyu Yin 10/30/2015

API-6 1.0 HTTP Method: GET (Isonline) Pass Feiyu Yin 10/30/2015

API-7 1.0 HTTP Method: GET (Chat) Pass Feiyu Yin 10/30/2015

API-8 1.0 HTTP Method: GET (Users) Pass Feiyu Yin 10/30/2015

API-9 1.0 HTTP Method: GET (userbyumid)

Pass Feiyu Yin 10/30/2015

API-10 1.0 HTTP Method: PUT (Users) Pass Feiyu Yin 10/30/2015

API-11 1.0 HTTP Method: DELETE (Users) Pass Feiyu Yin 10/30/2015

API-12 1.0 HTTP Method: POST (Questions)

Pass Junchen Zhu

10/30/2015

API-13 1.0 HTTP Method: GET (Questions) Pass Junchen Zhu

10/30/2015

API-14 1.0 HTTP Method: GET (Userquestion)

Pass Junchen Zhu

10/30/2015

Page 81: CMPE 295B Final Project Report-QA-signed

70

API-15 1.0 HTTP Method: GET (Answerquestion)

Pass Junchen Zhu

10/30/2015

API-16 1.0 HTTP Method: PUT (Questions) Pass Junchen Zhu

10/30/2015

API-17 1.0 HTTP Method: DELETE (Questions)

Pass Junchen Zhu

10/30/2015

API-18 1.0 HTTP Method: POST (Answer) Pass Junchen Zhu

10/30/2015

API-19 1.0 HTTP Method: GET (Answers) Pass Junchen Zhu

10/30/2015

API-20 1.0 HTTP Method: GET (Questionsanswer)

Pass Junchen Zhu

10/30/2015

API-21 1.0 HTTP Method: PUT (Answer) Pass Junchen Zhu

10/30/2015

API-22 1.0 HTTP Method: DELETE (Answers)

Pass Bingyu Li 10/30/2015

API-23 1.0 HTTP Method: POST (Categories)

Pass Bingyu Li 10/30/2015

API-24 1.0 HTTP Method: GET (Categories)

Pass Bingyu Li 10/30/2015

API-25 1.0 HTTP Method: PUT (Categories)

Pass Bingyu Li 10/30/2015

API-26 1.0 HTTP Method: DELETE (Categories)

Pass Bingyu Li 10/30/2015

API-27 1.0 HTTP Method: GET (Notifications)

Pass Bingyu Li 10/30/2015

API-28 1.0 HTTP Method: GET (Usernotification)

Pass Bingyu Li 10/30/2015

API-29 1.0 HTTP Method: PUT (Notification)

Pass Bingyu Li 10/30/2015

API-30 1.0 HTTP Method: DELETE (Notification)

Pass Bingyu Li 10/30/2015

Page 82: CMPE 295B Final Project Report-QA-signed

71

API-31 1.0 HTTP Method: GET (Userunreadnotification)

Pass Bingyu Li 10/30/2015

User Interface Test

Test Case ID

Version Test Case Description Pass/ Fail

Tester Test Date

UI-1 1.0 Login with username and password

Pass Daniel 11/1/2015

UI-2 1.0 Main page button testing Pass Daniel 11/1/2015

UI-3 1.0 Question post: Post Pass Daniel 11/1/2015

UI-4 1.0 Question post: Cancel Pass Daniel 11/1/2015

UI-5 1.0 Question post Tagging Pass Daniel 11/1/2015

UI-6 1.0 Question post: Assign credit Pass Daniel 11/1/2015

UI-7 1.0 Question post: Categories Pass Daniel 11/1/2015

UI-8 1.0 Answer post: Post Pass Daniel 11/1/2015

UI-9 1.0 Answer post: Cancel Pass Daniel 11/1/2015

UI-10 1.0 Answer post: showing correct question title

Pass Daniel 11/1/2015

UI-11 1.0 Answer post: Hidden answers Pass Daniel 11/1/2015

UI-12 1.0 Question: Go to detail Pass Feiyu Yin 11/1/2015

UI-13 1.0 Question: Next Page Pass Feiyu Yin 11/1/2015

UI-14 1.0 Question: Back Pass Feiyu Yin 11/1/2015

UI-15 1.0 Notifications Pass Feiyu Yin 11/1/2015

UI-16 1.0 Answers showing Pass Feiyu Yin 11/1/2015

UI-17 1.0 Pictures upload Pass Feiyu Yin 11/1/2015

UI-18 1.0 Picture showing Pass Feiyu Yin 11/1/2015

Page 83: CMPE 295B Final Project Report-QA-signed

72

Data Designed Test Case : 49 Executed Test Case: 49 Test Coverage: 100% No Bugs report.

Page 84: CMPE 295B Final Project Report-QA-signed

73

Chapter 7 Conclusion and Future Work

7.1 Project summary

Real Time Question and Answer Platform is basically a new revolutionary

product, which combine with traditional crowdsourcing Q&A problem solving

technology and integrated with high efficient routing and multi-OS interface system. It

can break the rule that users have to wait for some unwanted time. Also, it can reduce our

expert to search for their expertise question to answer since each subscribed categories

questions will automatically feed notifications to our expert devices or computers. On the

other hand, users can share their comments or knowledge more than just text. Users can

have instance videoconference and pictures sharing. Traditional Q&A system can allow

users just communicate with text, which is hard to share some complicated explanation.

At the beginning of this project, we have decided to work on Android application

first then create the iOS version. However, we have done some more research in May to

check the user's ratio for iOS or Android and how they affect users each other. We found

that if we deploy our application to iOS, we cannot only increase the users in iOS and

also in Android as well. So, we were looking for a better way to develop both

applications simultaneously. Luckily, we found that Meteor is a pretty great framework to

use for development. Also we have learned that, in order to get the best result for our

application, we need to cover most users platforms (Android and iOS). These two

platforms are correlated. For example, if an iOS user has some Android friends, then he

Page 85: CMPE 295B Final Project Report-QA-signed

74

can invite them to join our system. If either side application is not exist, we may lose both

sides users.

7.2 Future work

In the future, continuous development is needed for providing better services for

our users. The first work we need to do is collecting more comments and feedback from

our users. We need to collect more information such as what categories our users would

spend more time and how they find for the user interface. After collecting these “big

data”, we would adjust our system to be more user-friendly to our users.

Questions and Answers have no limit. We will develop more search function such

that users can search some solutions from our system to outside resources besides our

data bank. We can enhance our system to analyze specific words with categories to do

Google search. When we type in Google search, Google may reply us thousands of

results. Our goal is to reduce redundancy and show most important results to our users.

However, this feature would require more data such as how users would choose the best

answers, so this would take some time to develop.

Technology is developing everyday, so we would keep in touch with the new

technology such as new frameworks or new features. We would deploy new features

when we find these features such as “whiteboard” could help our users to use our system

and give them better service.

Page 86: CMPE 295B Final Project Report-QA-signed

75

Also, we will keep updating our system interface so our users would feel

refreshing when they use our system everyday. While we will update the interface, this

could also enhance the system response time as well.

Page 87: CMPE 295B Final Project Report-QA-signed

76

References

[1] LEX parser, 2014. Retrieved from http://nlp.stanford.edu/software/lex-parser.shtml

[2] Shift-reduce constituency parser. 2014. Retrieved from http://nlp.stanford.edu/software/lex-parser.shtml

[3] Richard Socher, John Bauer, Christopher D. Manning and Andrew Y. Ng. 2013. Parsing with compositional vector grammars. In Proceedings of the ACL Conference.

[4] Danqi Chen and Christopher D Manning. 2014. A fast and accurate dependency parser using neural networks. Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar. 740-750.

[5] Daren C. Brabham. 2008. Crowdsourcing as a model for problem solving an introduction and cases. University of Utah, USA. doi:10.1177/1354856507084420

[6] Symposium on mining answers from texts and knowledge bases. 2002. The 2002 AAAI Spring Symposium Series, Stanford University.

[7] E. Hovy, U. Hermjakob and C. Lin. 2002. The use of external knowledge in factoid QA. In Proceedings of the Tenth Text REtrieval Conference (TREC 2001), 644-652. Retrieved from http://trec.nist.gov/pubs/trec10/papers/TREC10-webclopedia.pdf

[8] Simon Ostermann, Alexandru Iosup, Nezih Yigitbas, Radu Prodan, Thomas Fahringe, and Dick Eperna. 2010. A Performance Analysis of EC2 Cloud Computing Services for Scientific Computing. Cloud computing, Springer, 115-131. Retrieved from http://link.springer.com/chapter/10.1007/978-3-642-12636-9_9#page-1

[9] S. Abney, M. Collins and A. Singhal. 2000. Answer extraction. In Proceedings of the 6th Applied Natural Language Processing Conference (ANLP 2000), 296-301.

[10] S. Harabagiu, D. Moldovan, M. Pasca, R. Mihalcea, M. Surdeanu, R. Bunescu, R. Girju, V. Rus and P. Morarescu. 2001. FALCON: Boosting knowledge for question answering. In Proceedings of the Ninth Text REtrieval Conference (TREC-9), 479-488.

[11] J. Chen, A. R. Diekema, M. D. Taffet, N. McCracken, N. E. Ozgencil, O. Yilmazel, E. D. Liddy. 2002. Question answering: CNLP at the TREC-10 question answering track. In Proceedings of the Tenth Text REtrieval Conference (TREC 2001).

Page 88: CMPE 295B Final Project Report-QA-signed

77

[12] C. Kwok, O. Etzioni and D. Weld. 2001. Scaling question answering to the Web. In Proceedings of the 10th World Wide Web Conference (WWW’10), 150-161.

[13] O. Etzioni. Moving up the information food chain: softbots as information carnivores. 1996. In Proceedings of the Thirteenth National Conference on Artificial Intelligence. Revised version reprinted in AI Magazine special issue, summer ’97.