Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@

## /deliverables

A directory holding the documents/assignments requested by Dr. Elva.
A directory holding the documents/assignments requested by Dr. Elva. Currently contains Requirements Engineering Document (.docx, and .pdf).

### /deliverables/oldStatisticsProject

A directory holding documents/assignments submitted as part of the old satastics project
A directory holding documents/assignments submitted as part of the old satastics project.

## /documentation

A directory to hold project documents for analysis.
A directory to hold project documents for analysis. Currently contains use case diagrams.

### /documentation/oldStatisticsProject

A directory holding the old statistics project interview questions, and the final report from the last group (no security concerns).

## Narative

Computer Science students (or students taking computer science courses) who would like addition practice, are limited by the availablity of the computer science tutors. To provide students additional resources for practice and review independant of tutor availability, this project will create a slack bot to ask questions and review code snippets. This functionality will be handeled with a python3 program running in the cloud.
Students in CMS 120 have come to tutoring sessions with several consistent issues. For instance, students write algorithms with incorrect data types for the variables they use. This type of issue comes from how Python is formatted (not making programmers declare data types on assignment/declaration) and obfuscates details from programmers. Although the format of Python is oriented towards making programming easier, beginners do not inherently learn necessary concepts because the language covers up many aspects of programming complexity for the sake of ease of use.
Because CMS 120 is an introductory course, students are not expected to have prior knowledge of these concepts, however, it is good practice to teach students to code defensively and understand how the code they have written works. Since CMS 120 students are beginners coding in python – which allows them to program with more freedom than many other high-level languages – they may face more difficulty when they reach upper level CS classes if they never have a chance to develop a proper understanding of key programming concepts. This emphasizes the importance of having beginner students learn effective coding practices early on.
To combat this problem, there is a need for a web application that can read through student code snippets, give feedback, and ask questions. The program will not format the code for students, but it will ask related questions and challenge them to further their understanding of python. This would be a comprehensive way for CMS 120 students to exercise and reflect on their understanding of good coding practice taught in class while they are programming.


## other info

<img src="https://sat02pap001files.storage.live.com/y4mcKN0efleQEj8_eL4ywgrgq17lJRJ54tBgR13G9X5bfNCQfeI6BMYOGH4ZHJ6MqMBtpu-Yo2i5hkXKPqIkUTaBMVpLZHlPotOpWsbmxoPyKu6c3d1O-bbsPHR3TCFl7JBTDalriRaUUt0FYR4fkZEcpn2qdDKCr7mywABrCDZIO8usw6FC_UlTe2p2rgaPjer?width=4608&height=2592&cropmode=none" width="100%" />

Here be dragons...
Binary file not shown.
Binary file added deliverables/01.g2RequirementsEngineeringDoc.pdf
Binary file not shown.
Binary file removed documentation/00.useCaseDiagrams.pptx
Binary file not shown.
Binary file added documentation/UCDchatbotSystem.pptx
Binary file not shown.
Binary file not shown.
Binary file added documentation/tutorBot/CompDiagram_Final.pdf
Binary file not shown.
Binary file added documentation/tutorBot/Decomp_Final.pdf
Binary file not shown.
Binary file added documentation/tutorBot/UseCaseFinal.pdf
Binary file not shown.
1 change: 0 additions & 1 deletion tutorBot/.env

This file was deleted.

173 changes: 173 additions & 0 deletions tutorBot/Question_Test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import unittest
from tutor_Question import check_question, check_indent, create_iData_type, generate_questions


# UnitTesting for our components and its functions.

class Test_tutor_Question(unittest.TestCase):

def test_check_question_empty(self):

data = []

result = check_question(data)
self.assertEqual(result, [0])

def test_check_question_single(self):

data = list()
# example of question that could be created.
q = {'id': 1, 'Question': 'what is the data type of (variable name)?', 'A': 'int', 'B': 'float', 'C': 'str', 'D': 'bool', 'Answer': 'TBD', 'Link': 'http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12'}
data.append(q)

result = check_question(data)

self.assertEqual(result,[1])

def test_check_question_multiple(self):

data = []

# two examples of questions
q = {'id': 1, 'Question': 'what is the data type of (variable name)?', 'A': 'int', 'B': 'float', 'C': 'str', 'D': 'bool', 'Answer': 'TBD', 'Link': 'http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12'}
q2 = {'id': 10, 'Question': 'Is indentation important in Python?', 'A': 'Yes it is important because it would make my code look nicer', 'B': 'Yes it is very important so that we and python can identify code blocks', 'C': "No, Python doesn't care, they can handle anything", 'D': 'No, because we can use semicolons and parentheses', 'Answer': 'B', 'Link': ""}
data.append(q)
data.append(q2)

result = check_question(data)

self.assertEqual(result,[1,10])

def test_check_indent(self):

data = [ [0,'def','hello', '(',')',':'],
[4, 'print','(','"hello"',')']
]
result = check_indent(data)

self.assertEqual(result, True)

def test_check_indent_single_line(self):

data = [[0,'x', '=', '9']]
result = check_indent(data)

self.assertEqual(result, True)

def test_check_indent_flag_single(self):

data = [[2,'x', '=', '9']]
result = check_indent(data)
self.assertEqual(result, False)

def test_check_indent_flag(self):

data = [ [0,'def','hello', '(',')',':'],
[5, 'print','(','"hello"',')']
]

result = check_indent(data)
self.assertEqual(result, False)

def test_check_indent(self):

data = [ [0,'def','hello', '(',')',':'],
[4, 'print','(','"hello"',')']
]
result = check_indent(data)
self.assertEqual(result, True)

# check if the function really created the create_iData_type question.
# Given that the id of the only iData_type question is 1. we can test the function by checking the id of question generated.

def test_create_iData_type(self):

data = [0,'x', '=', '9']
result = create_iData_type(data, 2)

q_type = result['id']
self.assertEqual(q_type, 1)

def test_create_iData_type_int(self):

data = [0,'x', '=', '9']
result = create_iData_type(data, 2)

a_key = result['Answer']
answer = result[a_key]

self.assertEqual(answer, 'int')

# def test_create_iData_type_list(self):

# data

def test_create_iData_type_bool(self):

data = [0, 'x', '=', 'True']

result = create_iData_type(data, 2)

a_key = result['Answer']
answer = result[a_key]

self.assertEqual(answer, 'boolean')


# checking if it creates any questions at all.

def test_generate_questions(self):

data = [[0, 'def', 'function', '(',')',]
]

questions = generate_questions(data)

self.assertNotEqual(len(questions),0)


def test_generate_questions_syntax(self):

data = [[1, 'def', 'function', '(',')']]

questions = generate_questions(data)

syntax = False
for x in questions:

if x['id'] == 10:
syntax = True
self.assertEqual(syntax, True)

def test_generate_questions_iData(self):

data = [[0, 'x', '=', '5']]
questions = generate_questions(data)
idata = False

for x in questions:

if x['id'] == 1:
idata = True
self.assertEqual(idata, True)

def test_generate_questions_generic(self):

data = [[0, 'x', '=', '5']]

questions = generate_questions(data)
gqs = [11, 16]
generic = False

for x in questions:
if x['id'] in gqs:
generic = True
self.assertEqual(generic, True)


if __name__ == '__main__':
unittest.main()




37 changes: 37 additions & 0 deletions tutorBot/Question_psudo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


the structure of the Qeustion component: Function Generate Questions.

Input: a two dimensional list

Objective of generate question, create a question
There are syntax question, data type quetion and generic quesiton

1. first thing we can do is to check the current questions we have.
2. we can iterate through the two dimensional list and check for number of spaces
Flag a indentation boolean if...
a. the number of space is not multiple of 4,
b. the number of space is multiple of 4 but, the number of space does not match with the next line and
the previous line although the last character is not :

3. if we see the flag for the syntax question then create a syntax question. with id 10 question about the indentation
(this can be done before any loop)

** also having a list of keyword that we want to be paying attention might be a good idea.
keyword = ["'", "if", "else", "def"]
matching of parenthesis to figure out if we need another syntax question.
4. let's iterate throught the two dimensional list one by one.

processing the row.

1. we want to catch the assignment of values (iData Type) question
so we want to have a catch in = but make sure in the condition that it is actually the assignment by looking at the previous and the next

if type of the value was list, we could generate more questions on list

2. if the current element that we are looking at is in the list of keyword then create syntax questions

3. Generic is kindo of like a fun trivia quesiton so create the question at least one.



4 changes: 0 additions & 4 deletions tutorBot/Questions.csv

This file was deleted.

19 changes: 19 additions & 0 deletions tutorBot/Questions_11_27.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
id,Question Type,Question,A,B,C,D,Answer,Link
1,iData Type,what is the data type of (variable name)?,int,float,str,bool,TBD,http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12
2,Data Type,how many buit-in data type are there in python,5,4,6,3,A,http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12
3,Syntax,"what is the formal form of logical operator: ""and""? ",&&,||,!,%,A,
4,Syntax,Tell me about = and == !,"""="" is used for assignment and ""=="" is used for equality","""="" is used for equality and ""=="" is used for assignment","both ""="" and ""=="" can be used as equality ","both ""="" and ""=="" can be used as assignment",A,http://greenteapress.com/thinkpython/html/thinkpython003.html#toc13
5,Syntax,What do we have to have after () in function declaration?,Semicolon(;),Colon(:),Period(.),Exclamation mark(!),B,
6,Data Type,Are 67 and '67' same,Yes,No,,,B,
7,Syntax,** arithmatic expression represents…,multiplication by 2,Exponents,multiplication,"Nothing, it is an invalid arithmatic operator",B,
8,Data Type,Can you contain different types of data in a list?,Yes,No,,,Yes,
9,Data Type,How can you store additional values to Python's list?,use append(),use add(),You can't add anything to a Python's list once it's initialized with some values,,A,
10,Syntax,Is indentation important in Python?,Yes it is important because it would make my code look nicer,Yes it is very important so that we and python can identify code blocks,"No, Python doesn't care, they can handle anything","No, because we can use semicolons and parentheses",B,
11,Generic,Who invented Python?,Alan Turing,Alan Kays,Guido van Rossum,Steve Jobs,C,
12,Data Type,Explain String Concatenation,Python allows us to combine two different strings using + and = operators,"Python allows us to add and subtract two different strings using +, -, and = operator",Python allows you to change modify the string once it is declared,,A,
13,Data Type,What is the return type of this function?,int ,float,str,bool,(Depends on the parsing code),
14,Data Type,the first index of a list starts from 1,TRUE,FALSE,,,FALSE,
15,Syntax,we create chained condition using…,keyword: elif,keyword: else if,keyword: if ,keyword: else,A or D,http://greenteapress.com/thinkpython/html/thinkpython006.html#toc57
16,Generic,Does Python require compiler?,Sometimes,Yes,No,Depends,C,
17,Syntax,print 3.4. Is this a valid syntax?,Yes it is a valid syntax,No because you have white space in between, No because you don't have parentheses around,Yes Python does not care,C
18,Data Type,Identify int value,4,'4',4.0,[4],A,
28 changes: 28 additions & 0 deletions tutorBot/Questions_Recent.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
id ,Question Type,Question,A,B,C,D,Answer,Link
1,iData Types,what is the data type of (variable name) ,int ,float,str,bool,(Depends on the parsing code),http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12
2,Data Types,how many buit-in data type are there in python,5,4,6,3,A,http://greenteapress.com/thinkpython/html/thinkpython003.html#toc12
3,Syntax,"what is the formal logical operator of ""and""? ",&&,||,!,%,A,
4,Data Types,Tell me about = and == !,"""="" is used for assignment and ""=="" is used for equality","""="" is used for equality and ""=="" is used for assignment","both ""="" and ""=="" can be used as equality ","both ""="" and ""=="" can be used as assignment",A,http://greenteapress.com/thinkpython/html/thinkpython003.html#toc13
5,Syntax,What do we have to have after () in function declaration?,Semicolon(;),Colon(:),Period(.),Exclamation mark(!),B,
6,Data Types,Are 67 and '67' same,Yes,No,,,B,
7,Syntax,** arithmatic expression represents…,multiplication by 2,Exponents,multiplication,"Nothing, it is an invalid arithmatic operator",B,
8,Data Types,Can you contain different types of data in a list?,Yes,No,,,Yes,
9,Data Types,How can you store additional values to Python's list?,use append(),use add(),You can't add anything to a Python's list once it's initialized with some values,,A,
10,Syntax ,Is indentation important in Python?,Yes it is important because it would make my code look nicer,Yes it is very important so that we and python can identify code blocks,"No, Python doesn't care, they can handle anything","No, because we can use semicolons and parentheses",B,
11,Generic,Who invented Python?,Alan Turing,Alan Kays,Guido van Rossum,Steve Jobs,C,
12,Data Types,Explain String Concatenation,Python allows us to combine two different strings using + and = operators,"Python allows us to add and subtract two different strings using +, -, and = operator",Python allows you to change modify the string once it is declared,,A,
13,Data Types,What is the return type of this function?,int ,float,str,bool,(Depends on the parsing code),
14,Data Types,the first index of a list starts from 1,TRUE,FALSE,,,FALSE,
15,Syntax,we create chained condition using…,keyword: elif,keyword: else if,keyword: if ,keyword: else,A or D,http://greenteapress.com/thinkpython/html/thinkpython006.html#toc57
16,Generic,Does Python require compiler?,Sometimes,Yes,No,Depends,C,
17,Syntax,print 3.4. Is this a valid syntax?,Yes it is a valid syntax,No because you have white space in between, No because you don't have parentheses around,Yes Python does not care,C ,
18,Generic,What is a key component that python uses to determine the flow of a program,Semicolon(;),Indentation,Capatalization,number of lines between components,B,
19,Generic,What is the keyword you need to use a package?,"""install""","""integrate""","""use""","""import""",D,
20,Generic,Where should you put main?,after your first function,In the middle of the program,At the bottom of the program,At the top of the program,C,
21,Generic,How does variable assignment work?,The variable on the right hand side gets the value on the lefthand side,The variable on the lefthand side gets the value on the righthand side,Both variables get each other's value,,B,
22,Generic,"If you want multiple lines of code within a condition (if or ifelse), how should you format them?","Make sure they're within the if or ifelse, not necessarily in line with each other","Make sure they are within the if/ifelse, in line with each other",Make them directly in line with if/ifelse,Just make sure they are below if/ifelse,B,
23,Syntax,What is the proper practice for naming variables?,camelCase,spaces between words (ex: first num),use underscores: first_num,,C,
24,Data Types,Can you use integers and floats interchangeably?,No,Yes,,,A,
25,Data Types,What is the difference between a string and a character?,They are the same,"A string is a combination of characters, whereas a character is a single value",characters just have to be shorter than strings,,B,
26,Syntax,What does ``` represent?,Block comments,In line comments,Character notation,Documentation string,D,
27,Generic,How is NULL represented in Python?,null,\0',None,none,C,
Binary file not shown.
Binary file added tutorBot/__pycache__/tutor_Parser.cpython-38.pyc
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions tutorBot/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

################################################################################################################################
# NAME: Jenny Goldsher, Noah Harvey, Deandra Martin, Hiroki Sato
# DATE: 07112020
# IDEA: this script will start the tutor flask server and open the appropriate ports in the firewall
################################################################################################################################

echo "" | sudo -S ufw allow 5000 # pipes user pwd to sudo to open port 5000 in firewall
export FLASK_APP=/slack/tutorBot.py # sets env vairable for flask to tutorBot script
flask run --host=0.0.0.0 # runs flask server as publicly available
9 changes: 9 additions & 0 deletions tutorBot/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

################################################################################################################################
# NAME: Jenny Goldsher, Noah Harvey, Deandra Martin, Hiroki Sato
# DATE: 07112020
# IDEA: this script will close the port used for the tutor flask server
################################################################################################################################

echo "" | sudo -S ufw deny 5000 # pipes user pwd to sudo to close port 5000 in firewall
Loading