Giter Site home page Giter Site logo

adriangohjw / cz3003-eduventure Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 89.01 MB

NTU Computer Science - CZ3003 Software Systems Analysis and Design (SSAD)

Python 10.49% Mako 0.01% HTML 0.03% JavaScript 3.52% C# 83.83% ShaderLab 1.16% HLSL 0.20% Objective-C 0.21% Objective-C++ 0.53%
python flask flask-sqlalchemy postgresql flask-restful flask-migrate bcrypt flask-script

cz3003-eduventure's Introduction

cz3003-eduventure

Lab Project for NTU CZ3003 - Software Systems Analysis and Design

Setting up local environment (Windows)

This is a very simplified guide on setting up local environment for Windows

Pre-requisite:

  1. Installed python3
  2. Installed pip

Setting up repository

  1. Go to a folder where you want the repository to be in
  2. Clone the repository git clone https://github.com/adriangohjw/cz3003-eduventure.git

Setting up PostgreSQL

PostgreSQL is the relational DBMS of choice in this project

  1. Download and install PostgreSQL from Windows installers
  2. Use the following credentials during the installation (otherwise you can update the Config file):
    1. Username = postgres and password = localhostdbpassword
  3. Open the psql command-line tool by
    1. In the Windows CMD, run the command: psql -U postgres
    2. Enter password when prompted
    3. Run the command: create database "cz3003"

Reference: Set Up a PostgreSQL Database on Windows

Setup virtual environment in project

In Windows CMD, ensure you are in the folder of your repository

  1. Run python โ€“m venv venv
  2. Run venv\Scripts\activate
  3. Run pip install -r requirements.txt

All required packages should have been installed!

venv\Scripts\activate is also the command to enter your virtual environment whenever you want to run the application on CMD

Setup local database

In Windows CMD, ensure you are in the folder of your repository

  1. Run python manage.py db init
  2. Run python manage.py db migrate
  3. Run python manage.py db upgrade

To run the application

python run.py

To populate the database with mock data

python db_populate\db_populate.py

  • WARNING: It will wipe the entire local test DB clean, before populating it with mock data
  • To populate in local actual DB, replace from run_test import create_app with from run import create_app, save the file and execute the same command

Testing the API endpoints

  1. Download and install Postman
  2. Import the collection (cz3003-eduventure.postman_collection.json) (Note: not the most updated version)

Running test scripts

python tests.py

Do load testing using Locust

  1. In console #1, run your local server using python run_test.py
  2. In console #2, start locust server using locust --host=http://localhost:5000
  3. Open web browser and go to http://localhost:8089/
  4. Enter number of users and hatch rate (e.g. 100, 10)
  5. Start load testing by clicking Start swarming

cz3003-eduventure's People

Contributors

adriangohjw avatar dependabot[bot] avatar dfeng003 avatar eugeneteoyujie avatar phangjunyu avatar tjaslyn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cz3003-eduventure's Issues

Bug in QuizAPI-PUT

input
http://127.0.0.1:5000/quizzes/?id=1&name=name&is_fast=whatever&date_start=2020-03-22&date_end=2020-03-21

response

TypeError: quizUpdateOperation() takes 3 positional arguments but 5 were given

create url_link param for lessonAPI_POST and in the response of lessonAPI_GET

Example response from GET request

{
  "content": "B is for Boy",
  "count_questions": 1,
  "created_at": "Wed, 08 Apr 2020 11:00:25 GMT",
  "id": 1,
  "name": "Lesson 2",
  "questions": [
    {
      "attempts": [],
      "choices": [
        {
          "created_at": "Wed, 08 Apr 2020 11:00:55 GMT",
          "description": "Option A",
          "id": 1,
          "is_correct": true
        },
        {
          "created_at": "Wed, 08 Apr 2020 11:02:19 GMT",
          "description": "Option B",
          "id": 2,
          "is_correct": false
        }
      ],
      "count_attempts": 0,
      "count_choices": 2,
      "created_at": "Wed, 08 Apr 2020 11:00:42 GMT",
      "description": "sasuke",
      "id": 1,
      "lesson_id": 1,
      "topic_id": 1
    }
  ],
  "topic_id": 1,
**"url_link": "https://www.youtube.com/watch?v=6Wcg15FaUnU"**
}

Example POST request:
http://127.0.0.1:5000/lessons/?topic_id=1&name=Lesson 1&content=B%20is%20for%20Boy&link=https://www.youtube.com/watch?v=6Wcg15FaUnU

Different Responses needed for Dashboard API

My bad on the previous issue!

Here are the ideal responses for the various Dashboard APIs:

SS1:

stats: [
  {
    name: "avg_score",
    courses: [
      {
        course_index: "SS1",
        data: [ 2, 2.3, ...], // if the course doesn't have an entry for the score, can leave it as " " or 0 but 
        basically the length of both data and course_index array should be the same
      },
      {
        course_index: "SS2",
        data: [ 2.1, 2.4, ...], 
      },
      ...
    ],
  }
  ....
  }
]

SS2

Additional "All" option for CourseScoreAPI_get

Allow for key to be "All" when submitting the get request. Result will return for across all course groups.

{
"courses": [
{
"course_index": "All",
"scores": {
"0-10": 0,
"11-20": 0,
"21-30": 3,
"31-40": 5,
"41-50": 0,
"51-60": 0,
"61-70": 6,
"71-80": 0,
"81-90": 0,
"91-100": 16
}
}
]
}

add topic name in progressAPI

{ "topics": [ { "completed_lessons": 2, "completion_status": false, "id": 1, "lessons": [ ...

could you add topic name as well? thank you

Additional "All" for lessonCompletedAPI_get

Would be good if we could have an "All" result aside from the SS7, TS1, etc. course groups.

  "courses": [
    {
      "course_index": "All",
      "progress": [
        {
          "lessons": [
            {
              "count_completed": 14,
              "lesson_id": 1,
              "lesson_name": "Functional & Non-functional Requirements"
            },
            {
              "count_completed": 5,
              "lesson_id": 2,
              "lesson_name": "Requirement Elicitation"
            },
            {
              "count_completed": 3,
              "lesson_id": 3,
              "lesson_name": "Requirement Analysis"
            }
          ],
          "topic_id": 1,
          "topic_name": "Requirement Engineering"
        },
...

Statistics and Analytics Feature

PRIORITY:

  • SA.1.
  • SA.2.
  • SA.3.
  • SA.4.
  • SA.7.
  • SA.6.
  • SA.5.

Replace STAT with one of these:

  1. Average
  2. Median
  3. 95th Percentile
  4. 75th Percentile
  5. 25th Percentile
  6. Standard Deviation
  7. Max score achieved
  8. Min score achieved
  9. Count of unique students attempted

Replace SCOPE with one of these:

  1. Course Groups (ALL Students)
  2. Course (Only Students within one course group)

Score Comparison within SCOPE

SA.1. The STAT scores of the Student Course Groups (SS)

I.e. SS7 - avg is 80 points, SS6 - avg is 75 points, etc.
Graph i.e.: Plot the quizzes as categories on a histogram, and show the STAT score of each quiz.

input

  • course_index (optional, if left bank, return for all students)
select 
   quiz_id, 
   count(quizattempts)
   avg(quizattempts.score),
   median(quizattempts.score),
   75th_percentile(quizattempts.score),
   25th_percentile(quizattempts.score),
   max(quizattempts.score),
   min(quizattempts.score)
group_by
   quiz_id   

Expected Output:

{
  stats: [ 
    {
      course_index: "SS1",
      quizzes: [
        {
          quiz_name: "Midterms",
          quiz_id: 22,
          average_score: 80,
        },
      ],
    },
  ],
}

Progress Comparison within SCOPE

SA.2. Completed Lessons of the students

I.e. 5 students from SS7 and 10 students from SS6 completed lesson 3.
3 students from SS7 and 2 students from SS6 completed lesson 4.
Graph i.e. Plot the lesson ID as categories on a histogram, and show the number of students that have completed each lesson.

input

  • course_index (optional, if left bank, return for all students)
select
   lesson_id,
   count(student who completed the lesson)
group by
   lesson_id

Expected Response:

{
  progresses: [
    {
      course_group: "SS6",
      progress: [
        {
          lesson_name: "Lesson 1",
          count: 5,
        },
      ]
    },
    {
      course_group: "All",
      progress: [
        {
          lesson_name: "Lesson 1",
          count: 50,
        },
      ]
    },
  ]
}

Leaderboard (Score)

SA.3

select
   student_id, 
   sum(avg(past 3 attempts.score for each quiz)) 
group by
   student_id

response includes: student ID, student name, score

Individual Student Comparison:

SA.4. The scores of the student across the quizzes.

  • I.e. Jaslyn scored 70 for Quiz1, 65 for Quiz2 and 78 for Quiz3

input:

  • student_id
select
   quiz_id, 
   sum(avg(past 3 attempts.score for each quiz)) 
group by
   quiz_id

Expected response: student name, quiz name, score
also need an GET API of all students with ID and Name

SA.5. The [stat] scores of the student, based on all the quizzes they have completed.

inputs

  • student_id
select
   sum(avg(past 3 attempts.score for each quiz)) 

SA.6. Activity rate of a timeline.

Graph i.e. Plot the quizID against the date it was completed.

inputs

  • start date
  • end date
  • student_id

outputs

select
   date,
   count(attempts)
group by
   date

SA.7. Count of scores of students by Course Groups

Inputs
-course group ID

Outputs
-count (calculated score) in intervals of 10

range:count
0-10: 0
11-20: 3
21-30: 3
31-40: 5
41-50: 2

Also need a GET API of all course groups ID and NAME.

TopicsAPI throwing unexpected error

API called: http://127.0.0.1:5000/topics/?id=1

{
  "error": "Id is not an integer"
}

Expected: request should go through since param was 1 (int)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.