Commit e99040b0 authored by OnellaNatalie's avatar OnellaNatalie

Merge branch 'master' into IT19041926

# Conflicts:
#	backend/config/database.py
#	backend/database.db
#	backend/requirements.txt
parents 93e63a76 d619ba7a
import os
from flask import Flask, request, jsonify, send_from_directory
from flask import Flask
from flask_cors import CORS
from flask_jwt_extended import JWTManager
from werkzeug.exceptions import BadRequestKeyError
from werkzeug.utils import secure_filename
from config.database import db
from constants.http_status_codes_constant import HTTP_404_NOT_FOUND, HTTP_500_INTERNAL_SERVER_ERROR, HTTP_200_OK, \
HTTP_400_BAD_REQUEST
from routes.auth_routes import auth
from constants.http_status_codes_constant import HTTP_404_NOT_FOUND, HTTP_500_INTERNAL_SERVER_ERROR
import services.question_preprocess_service
from routes.auth_routes import auth
from routes.module_routes import module
from routes.assignment_routes import assignment
from routes.diagram_routes import diagram
from routes.submission_routes import submission
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
UPLOADS_FOLDER_PATH = os.path.join(APP_ROOT, 'uploads')
OUTPUTS_GENERATED_DOT_FILES_PATH = os.path.join('outputs', 'generated_dot_files')
OUTPUTS_GENERATED_USE_CASE_DIAGRAMS_PATH = os.path.join('outputs', 'generated_use_case_diagrams')
OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH = os.path.join('outputs', 'generated_class_diagrams')
OUTPUTS_GENERATED_CLASS_FILES_PATH = os.path.join('outputs', 'generated_class_files')
OUTPUTS_FOLDER = os.path.join(APP_ROOT, 'outputs')
UML_GENERATOR_UPLOAD_FOLDER = os.path.join(APP_ROOT, 'uploads')
app = Flask(__name__)
SUBMISSION_PATH = os.path.join(APP_ROOT, 'submissions/use_case')
SUBMISSION_PATH_CLASS = os.path.join(APP_ROOT, 'submissions/class')
USE_CASE_SAVED_MODEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/use_case/model')
USE_CASE_SAVED_LABEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/use_case/label')
CLASS_SAVED_MODEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/class/model')
CLASS_SAVED_LABEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/class/label/label_map.pbtxt')
CLASS_COMP_SAVED_MODEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/class_component/model')
CLASS_COMP_SAVED_LABEL_PATH = os.path.join(APP_ROOT, 'tensorflow_models/class_component/label/label_map.pbtxt')
app = Flask(__name__, static_folder='outputs')
CORS(app)
app.config.from_mapping(SECRET_KEY=os.environ.get('SECRET_KEY'),
SQLALCHEMY_DATABASE_URI=os.environ.get('SQLALCHEMY_DATABASE_URI'),
SQLALCHEMY_TRACK_MODIFICATIONS=False, JWT_SECRET_KEY=os.environ.get('JWT_SECRET_KEY'))
SQLALCHEMY_DATABASE_URI='sqlite:///database.db',
SQLALCHEMY_TRACK_MODIFICATIONS=False, JWT_SECRET_KEY='JWT_SECRET_KEY')
app.config['UML_GENERATOR_UPLOAD_FOLDER'] = UML_GENERATOR_UPLOAD_FOLDER
db.app = app
......@@ -34,6 +43,10 @@ db.init_app(app)
JWTManager(app)
app.register_blueprint(auth)
app.register_blueprint(module)
app.register_blueprint(assignment)
app.register_blueprint(diagram)
app.register_blueprint(submission)
@app.before_first_request
......@@ -46,33 +59,6 @@ def index():
return 'UML Diagram Plagiarism Detection Tool API'
@app.route('/api/v1/process-uml-diagrams-inputs', methods=['POST'])
def process_uml_diagrams():
try:
if request.method == 'POST':
if request.files['scenarioFile']:
file = request.files['scenarioFile']
file.save(os.path.join(app.config['UML_GENERATOR_UPLOAD_FOLDER'], secure_filename(file.filename)))
# generated_class_diagram_path, generated_usecase_diagram_path = services.question_preprocess_service.main(
# file.filename)
# return jsonify(generated_class_diagram_path=generated_class_diagram_path,
# generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
generated_usecase_diagram_path = services.question_preprocess_service.main(
file.filename)
return jsonify(generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
except Exception or BadRequestKeyError:
if BadRequestKeyError:
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
return jsonify('Something went wrong'), HTTP_500_INTERNAL_SERVER_ERROR
@app.route('/api/v1/view-diagram/<path:path>')
def send_js(path):
return send_from_directory(OUTPUTS_FOLDER, path), HTTP_200_OK
@app.errorhandler(HTTP_404_NOT_FOUND)
def handle_404(error):
print(error)
......
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
db: SQLAlchemy = SQLAlchemy()
No preview for this file type
from config.database import db
class ActorANDUseCase(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
type = db.Column(db.String(50), nullable=False)
text = db.Column(db.String(500), nullable=False)
x_min = db.Column(db.String(50), nullable=False)
y_min = db.Column(db.String(50), nullable=False)
x_max = db.Column(db.String(50), nullable=False)
y_max = db.Column(db.String(50), nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'ActorANDUseCase>>> {self.content}'
from config.database import db
class ActorGeneralizationRelationship(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
connected_component_01 = db.Column(db.Integer, nullable=False)
connected_component_02 = db.Column(db.Integer, nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'ActorGeneralizationRelationship>>> {self.content}'
from datetime import datetime
from config.database import db
class Assignment(db.Model):
id = db.Column(db.Integer, primary_key=True)
module_id = db.Column(db.Integer, db.ForeignKey('module.id'))
content = db.Column(db.String(800), nullable=False)
plagiarism_percentage = db.Column(db.Integer, nullable=False)
start_at = db.Column(db.DateTime, default=datetime.now())
end_at = db.Column(db.DateTime)
created_at = db.Column(db.DateTime, default=datetime.now())
updated_at = db.Column(db.DateTime, onupdate=datetime.now(), default=datetime.now())
def __repr__(self) -> str:
return 'Assignment>>> {self.content}'
from datetime import datetime
from config.database import db
class ClassAnswer(db.Model):
id = db.Column(db.Integer, primary_key=True)
user = db.Column(db.Integer, nullable=False)
assignment = db.Column(db.Integer, nullable=False)
comments = db.Column(db.String(800), nullable=False)
submitted_at = db.Column(db.DateTime, default=datetime.now())
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
file_name = db.Column(db.String(50), nullable=False)
def __repr__(self) -> str:
return 'ClassAnswer>>> {self.content}'
from datetime import datetime
from config.database import db
class Diagram(db.Model):
id = db.Column(db.Integer, primary_key=True)
assignment_id = db.Column(db.Integer, db.ForeignKey('assignment.id'))
class_diagram_path = db.Column(db.String(80), nullable=False)
usecase_diagram_path = db.Column(db.String(80), nullable=False)
created_at = db.Column(db.DateTime, default=datetime.now())
updated_at = db.Column(db.DateTime, onupdate=datetime.now(), default=datetime.now())
def __repr__(self) -> str:
return 'Diagram>>> {self.content}'
from config.database import db
class ExtendRelationship(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
connected_component_01 = db.Column(db.Integer, nullable=False)
connected_component_02 = db.Column(db.Integer, nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'ExtendRelationship>>> {self.content}'
from config.database import db
class IncludeRelationship(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
connected_component_01 = db.Column(db.Integer, nullable=False)
connected_component_02 = db.Column(db.Integer, nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'IncludeRelationship>>> {self.content}'
\ No newline at end of file
from datetime import datetime
from config.database import db
class Module(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True, nullable=False)
code = db.Column(db.String(120), unique=True, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.now())
updated_at = db.Column(db.DateTime, onupdate=datetime.now(), default=datetime.now())
def __repr__(self) -> str:
return 'Module>>> {self.code}'
from datetime import datetime
from config.database import db
class UseCaseAnswer(db.Model):
id = db.Column(db.Integer, primary_key=True)
user = db.Column(db.Integer, nullable=False)
assignment = db.Column(db.Integer, nullable=False)
comments = db.Column(db.String(800), nullable=False)
submitted_at = db.Column(db.DateTime, default=datetime.now())
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
file_name = db.Column(db.String(50), nullable=False)
def __repr__(self) -> str:
return 'UseCaseAnswer>>> {self.code}'
\ No newline at end of file
from config.database import db
class UseCaseAssociationRelationship(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
connected_component_01 = db.Column(db.Integer, nullable=False)
connected_component_02 = db.Column(db.Integer, nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'UseCaseAssociationRelationship>>> {self.code}'
from config.database import db
class UseCaseGeneralizationRelationship(db.Model):
id = db.Column(db.Integer, primary_key=True)
use_case_answer = db.Column(db.Integer, nullable=False)
connected_component_01 = db.Column(db.Integer, nullable=False)
connected_component_02 = db.Column(db.Integer, nullable=False)
plagiarism_count = db.Column(db.String(50))
correctness_count = db.Column(db.String(50))
def __repr__(self) -> str:
return 'UseCaseGeneralizationRelationship>>> {self.code}'
\ No newline at end of file
class WarehouseOperator:
def create_orders_by_uploading_a_csv_file(self):
pass
def make_adjustments_to_the_order(self):
pass
def allocate_a_vehicle_for_a_job(self):
pass
def change_the_system_suggested_optimized_route_if_required(self):
pass
def confirm_a_job(self):
pass
def change_the_vehicle_allocated_for_a_job(self):
pass
def export_information_of_a_job_to_pdf_and_xls_format(self):
pass
def indicate_that_the_loading_is_completed(self):
pass
def generate_an_invoice_for_each_vehicle(self):
pass
def generate_vehicle_capacity_utilization_report(self):
pass
def generate_outlet_wise_transport_cost_report_for_a_given_date_range(self):
pass
def generate_vehicle_turnaround_time_report_for_a_warehouse(self):
pass
def generate_cost_per_1_kg_report(self):
pass
def generate_an_idle_time_limit_violation_report(self):
pass
class WarehouseIncharge:
def confirm_the_delivered_items_to_a_outlet(self):
pass
def approve_a_job(self):
pass
def request_a_modification_to_the_planned_mileage_of_a_job(self):
pass
class Admin:
def approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge(self):
pass
def modify_the_minimum_fix_mileage_configuration_for_a_job(self):
pass
def modify_the_unloading_charge(self):
pass
def update_the_radius_limit_from_a_warehouse_for___drop_off___charges(self):
pass
def set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited(self):
pass
def modify_the___drop_off___rate_table(self):
pass
def edit_the_eligibility_criteria_for_driver_incentive(self):
pass
def edit_the_per_km_rate_for_an_existing_vehicle_capacity_type(self):
pass
class WarehouseOperator:
def create_orders_by_uploading_a_csv_file(self):
pass
def make_adjustments_to_the_order(self):
pass
def allocate_a_vehicle_for_a_job(self):
pass
def change_the_system_suggested_optimized_route_if_required(self):
pass
def confirm_a_job(self):
pass
class Admin:
def modify_the_minimum_fix_mileage_configuration_for_a_job(self):
pass
def modify_the_unloading_charge(self):
pass
class Admin:
def login_to_the_system(self):
pass
def view_and_manage_cart_items(self):
pass
def check_the_payments_and_sold_items(self):
pass
def reply_to_Customer_feedbacks(self):
pass
class WarehouseOperator:
def create_orders_by_uploading_a_csv_file(self):
pass
def make_adjustments_to_the_order(self):
pass
def allocate_a_vehicle_for_a_job(self):
pass
def change_the_system_suggested_optimized_route_if_required(self):
pass
def confirm_a_job(self):
pass
def change_the_vehicle_allocated_for_a_job(self):
pass
def export_information_of_a_job_to_pdf_and_xls_format(self):
pass
def indicate_that_the_loading_is_completed(self):
pass
def generate_an_invoice_for_each_vehicle(self):
pass
def generate_vehicle_capacity_utilization_report(self):
pass
def generate_outlet_wise_transport_cost_report_for_a_given_date_range(self):
pass
def generate_vehicle_turnaround_time_report_for_a_warehouse(self):
pass
def generate_cost_per_1_kg_report(self):
pass
def generate_an_idle_time_limit_violation_report(self):
pass
class WarehouseIncharge:
def confirm_the_delivered_items_to_a_outlet(self):
pass
def approve_a_job(self):
pass
def request_a_modification_to_the_planned_mileage_of_a_job(self):
pass
class Admin:
def approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge(self):
pass
def modify_the_minimum_fix_mileage_configuration_for_a_job(self):
pass
def modify_the_unloading_charge(self):
pass
def update_the_radius_limit_from_a_warehouse_for___drop_off___charges(self):
pass
def set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited(self):
pass
def modify_the___drop_off___rate_table(self):
pass
def edit_the_eligibility_criteria_for_driver_incentive(self):
pass
def edit_the_per_km_rate_for_an_existing_vehicle_capacity_type(self):
pass
digraph "classes_hhiiofvlqz" {
rankdir=BT
charset="utf-8"
"hhiiofvlqz.Admin" [color="black", fontcolor="black", label="{Admin|\l|approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge()\ledit_the_eligibility_criteria_for_driver_incentive()\ledit_the_per_km_rate_for_an_existing_vehicle_capacity_type()\lmodify_the___drop_off___rate_table()\lmodify_the_minimum_fix_mileage_configuration_for_a_job()\lmodify_the_unloading_charge()\lset_up_the___drop_off___rate_table_based_on_number_of_outlets_visited()\lupdate_the_radius_limit_from_a_warehouse_for___drop_off___charges()\l}", shape="record", style="solid"];
"hhiiofvlqz.WarehouseIncharge" [color="black", fontcolor="black", label="{WarehouseIncharge|\l|approve_a_job()\lconfirm_the_delivered_items_to_a_outlet()\lrequest_a_modification_to_the_planned_mileage_of_a_job()\l}", shape="record", style="solid"];
"hhiiofvlqz.WarehouseOperator" [color="black", fontcolor="black", label="{WarehouseOperator|\l|allocate_a_vehicle_for_a_job()\lchange_the_system_suggested_optimized_route_if_required()\lchange_the_vehicle_allocated_for_a_job()\lconfirm_a_job()\lcreate_orders_by_uploading_a_csv_file()\lexport_information_of_a_job_to_pdf_and_xls_format()\lgenerate_an_idle_time_limit_violation_report()\lgenerate_an_invoice_for_each_vehicle()\lgenerate_cost_per_1_kg_report()\lgenerate_outlet_wise_transport_cost_report_for_a_given_date_range()\lgenerate_vehicle_capacity_utilization_report()\lgenerate_vehicle_turnaround_time_report_for_a_warehouse()\lindicate_that_the_loading_is_completed()\lmake_adjustments_to_the_order()\l}", shape="record", style="solid"];
}
digraph "classes_lxceiajuky" {
rankdir=BT
charset="utf-8"
"lxceiajuky.Admin" [color="black", fontcolor="black", label="{Admin|\l|modify_the_minimum_fix_mileage_configuration_for_a_job()\lmodify_the_unloading_charge()\l}", shape="record", style="solid"];
"lxceiajuky.WarehouseOperator" [color="black", fontcolor="black", label="{WarehouseOperator|\l|allocate_a_vehicle_for_a_job()\lchange_the_system_suggested_optimized_route_if_required()\lconfirm_a_job()\lcreate_orders_by_uploading_a_csv_file()\lmake_adjustments_to_the_order()\l}", shape="record", style="solid"];
}
digraph "classes_qxjyzaydlr" {
rankdir=BT
charset="utf-8"
"qxjyzaydlr.Admin" [color="black", fontcolor="black", label="{Admin|\l|check_the_payments_and_sold_items()\llogin_to_the_system()\lreply_to_Customer_feedbacks()\lview_and_manage_cart_items()\l}", shape="record", style="solid"];
}
digraph "classes_xgxiplwygn" {
rankdir=BT
charset="utf-8"
"xgxiplwygn.Admin" [color="black", fontcolor="black", label="{Admin|\l|approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge()\ledit_the_eligibility_criteria_for_driver_incentive()\ledit_the_per_km_rate_for_an_existing_vehicle_capacity_type()\lmodify_the___drop_off___rate_table()\lmodify_the_minimum_fix_mileage_configuration_for_a_job()\lmodify_the_unloading_charge()\lset_up_the___drop_off___rate_table_based_on_number_of_outlets_visited()\lupdate_the_radius_limit_from_a_warehouse_for___drop_off___charges()\l}", shape="record", style="solid"];
"xgxiplwygn.WarehouseIncharge" [color="black", fontcolor="black", label="{WarehouseIncharge|\l|approve_a_job()\lconfirm_the_delivered_items_to_a_outlet()\lrequest_a_modification_to_the_planned_mileage_of_a_job()\l}", shape="record", style="solid"];
"xgxiplwygn.WarehouseOperator" [color="black", fontcolor="black", label="{WarehouseOperator|\l|allocate_a_vehicle_for_a_job()\lchange_the_system_suggested_optimized_route_if_required()\lchange_the_vehicle_allocated_for_a_job()\lconfirm_a_job()\lcreate_orders_by_uploading_a_csv_file()\lexport_information_of_a_job_to_pdf_and_xls_format()\lgenerate_an_idle_time_limit_violation_report()\lgenerate_an_invoice_for_each_vehicle()\lgenerate_cost_per_1_kg_report()\lgenerate_outlet_wise_transport_cost_report_for_a_given_date_range()\lgenerate_vehicle_capacity_utilization_report()\lgenerate_vehicle_turnaround_time_report_for_a_warehouse()\lindicate_that_the_loading_is_completed()\lmake_adjustments_to_the_order()\l}", shape="record", style="solid"];
}
digraph G {
rankdir=LR;
labelloc="b";
peripheries=0;
node [shape=plaintext]
subgraph Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
login_to_the_system [label="Login To The System"];
check_the_home_page [label="Check The Home Page"];
play_the_site_demo_video [label="Play The Site Demo Video"];
add_items_to_the_cart [label="Add Items To The Cart"];
pay_the_items [label="Pay The Items"];
give_a_feedback_for_the_system [label="Give A Feedback For The System"];
view_the_seller_details [label="View The Seller Details"];
contact_the_seller_to_request_more_items [label="Contact The Seller To Request More Items"];
login_to_the_system [label="Login To The System"];
view_and_manage_cart_items [label="View And Manage Cart Items"];
check_the_payments_and_sold_items [label="Check The Payments And Sold Items"];
reply_to_customer_feedbacks [label="Reply To Customer Feedbacks"];
edge [arrowhead="none"];
customer->login_to_the_system;
customer->check_the_home_page;
customer->play_the_site_demo_video;
customer->add_items_to_the_cart;
customer->pay_the_items;
customer->give_a_feedback_for_the_system;
customer->view_the_seller_details;
customer->contact_the_seller_to_request_more_items;
admin->login_to_the_system;
admin->view_and_manage_cart_items;
admin->check_the_payments_and_sold_items;
admin->reply_to_customer_feedbacks;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
give_a_feedback_for_the_system->rate_the_service;
edge [arrowtail="vee", label="<<include>>", style=dashed];
pay_the_items->recieve_the_confirmation_email;
}
\ No newline at end of file
digraph G {
rankdir=LR;
labelloc="b";
peripheries=0;
node [shape=plaintext]
subgraph WarehouseOperator {label="WarehouseOperator"; warehouseoperator};
warehouseoperator [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph WarehouseIncharge {label="WarehouseIncharge"; warehouseincharge};
warehouseincharge [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
sign_up_to_the_system [label="Sign Up To The System"];
sign_in_to_the_system [label="Sign In To The System"];
create_orders_by_uploading_a_csv_file [label="Create Orders By Uploading A Csv File"];
make_adjustments_to_the_order [label="Make Adjustments To The Order"];
allocate_a_vehicle_for_a_job [label="Allocate A Vehicle For A Job"];
change_the_system_suggested_optimized_route_if_required [label="Change The System Suggested Optimized Route If Required"];
confirm_a_job [label="Confirm A Job"];
change_the_vehicle_allocated_for_a_job [label="Change The Vehicle Allocated For A Job"];
export_information_of_a_job_to_pdf_and_xls_format [label="Export Information Of A Job To Pdf And Xls Format"];
indicate_that_the_loading_is_completed [label="Indicate That The Loading Is Completed"];
confirm_the_delivered_items_to_a_outlet [label="Confirm The Delivered Items To A Outlet"];
approve_a_job [label="Approve A Job"];
request_a_modification_to_the_planned_mileage_of_a_job [label="Request A Modification To The Planned Mileage Of A Job"];
approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge [label="Approve The Planned Mileage Modification Request Submitted By The Warehouseincharge"];
generate_an_invoice_for_each_vehicle [label="Generate An Invoice For Each Vehicle"];
modify_the_minimum_fix_mileage_configuration_for_a_job [label="Modify The Minimum Fix Mileage Configuration For A Job"];
modify_the_unloading_charge [label="Modify The Unloading Charge"];
update_the_radius_limit_from_a_warehouse_for___drop_off___charges [label="Update The Radius Limit From A Warehouse For Drop Off Charges"];
set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited [label="Set Up The Drop Off Rate Table Based On Number Of Outlets Visited"];
modify_the___drop_off___rate_table [label="Modify The Drop Off Rate Table"];
edit_the_eligibility_criteria_for_driver_incentive [label="Edit The Eligibility Criteria For Driver Incentive"];
edit_the_per_km_rate_for_an_existing_vehicle_capacity_type [label="Edit The Per Km Rate For An Existing Vehicle Capacity Type"];
generate_vehicle_capacity_utilization_report [label="Generate Vehicle Capacity Utilization Report"];
generate_outlet_wise_transport_cost_report_for_a_given_date_range [label="Generate Outlet Wise Transport Cost Report For A Given Date Range"];
generate_vehicle_turnaround_time_report_for_a_warehouse [label="Generate Vehicle Turnaround Time Report For A Warehouse"];
generate_cost_per_1_kg_report [label="Generate Cost Per 1 Kg Report"];
generate_an_idle_time_limit_violation_report [label="Generate An Idle Time Limit Violation Report"];
edge [arrowhead="none"];
user->sign_up_to_the_system;
user->sign_in_to_the_system;
warehouseoperator->create_orders_by_uploading_a_csv_file;
warehouseoperator->make_adjustments_to_the_order;
warehouseoperator->allocate_a_vehicle_for_a_job;
warehouseoperator->change_the_system_suggested_optimized_route_if_required;
warehouseoperator->confirm_a_job;
warehouseoperator->change_the_vehicle_allocated_for_a_job;
warehouseoperator->export_information_of_a_job_to_pdf_and_xls_format;
warehouseoperator->indicate_that_the_loading_is_completed;
warehouseincharge->confirm_the_delivered_items_to_a_outlet;
warehouseincharge->approve_a_job;
warehouseincharge->request_a_modification_to_the_planned_mileage_of_a_job;
admin->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
warehouseoperator->generate_an_invoice_for_each_vehicle;
admin->modify_the_minimum_fix_mileage_configuration_for_a_job;
admin->modify_the_unloading_charge;
admin->update_the_radius_limit_from_a_warehouse_for___drop_off___charges;
admin->set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited;
admin->modify_the___drop_off___rate_table;
admin->edit_the_eligibility_criteria_for_driver_incentive;
admin->edit_the_per_km_rate_for_an_existing_vehicle_capacity_type;
warehouseoperator->generate_vehicle_capacity_utilization_report;
warehouseoperator->generate_outlet_wise_transport_cost_report_for_a_given_date_range;
warehouseoperator->generate_vehicle_turnaround_time_report_for_a_warehouse;
warehouseoperator->generate_cost_per_1_kg_report;
warehouseoperator->generate_an_idle_time_limit_violation_report;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
create_orders_by_uploading_a_csv_file->make_adjustments_to_the_order;
confirm_a_job->change_the_vehicle_allocated_for_a_job_change_the_system_suggested_optimized_route_if_required;
edge [arrowtail="vee", label="<<include>>", style=dashed];
confirm_a_job->allocate_a_vehicle_for_a_job;
approve_a_job->confirm_the_delivered_items_to_a_outlet;
request_a_modification_to_the_planned_mileage_of_a_job->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
}
\ No newline at end of file
digraph G {
rankdir=LR;
labelloc="b";
peripheries=0;
node [shape=plaintext]
subgraph WarehouseOperator {label="WarehouseOperator"; warehouseoperator};
warehouseoperator [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
sign_in_to_the_system [label="Sign In To The System"];
create_orders_by_uploading_a_csv_file [label="Create Orders By Uploading A Csv File"];
make_adjustments_to_the_order [label="Make Adjustments To The Order"];
allocate_a_vehicle_for_a_job [label="Allocate A Vehicle For A Job"];
change_the_system_suggested_optimized_route_if_required [label="Change The System Suggested Optimized Route If Required"];
confirm_a_job [label="Confirm A Job"];
modify_the_minimum_fix_mileage_configuration_for_a_job [label="Modify The Minimum Fix Mileage Configuration For A Job"];
modify_the_unloading_charge [label="Modify The Unloading Charge"];
edge [arrowhead="none"];
user->sign_in_to_the_system;
warehouseoperator->create_orders_by_uploading_a_csv_file;
warehouseoperator->make_adjustments_to_the_order;
warehouseoperator->allocate_a_vehicle_for_a_job;
warehouseoperator->change_the_system_suggested_optimized_route_if_required;
warehouseoperator->confirm_a_job;
admin->modify_the_minimum_fix_mileage_configuration_for_a_job;
admin->modify_the_unloading_charge;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
create_orders_by_uploading_a_csv_file->make_adjustments_to_the_order;
confirm_a_job->change_the_vehicle_allocated_for_a_job_change_the_system_suggested_optimized_route_if_required;
edge [arrowtail="vee", label="<<include>>", style=dashed];
confirm_a_job->allocate_a_vehicle_for_a_job;
}
\ No newline at end of file
digraph G {
rankdir=LR;
labelloc="b";
peripheries=0;
node [shape=plaintext]
subgraph WarehouseOperator {label="WarehouseOperator"; warehouseoperator};
warehouseoperator [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph WarehouseIncharge {label="WarehouseIncharge"; warehouseincharge};
warehouseincharge [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
sign_up_to_the_system [label="Sign Up To The System"];
sign_in_to_the_system [label="Sign In To The System"];
create_orders_by_uploading_a_csv_file [label="Create Orders By Uploading A Csv File"];
make_adjustments_to_the_order [label="Make Adjustments To The Order"];
allocate_a_vehicle_for_a_job [label="Allocate A Vehicle For A Job"];
change_the_system_suggested_optimized_route_if_required [label="Change The System Suggested Optimized Route If Required"];
confirm_a_job [label="Confirm A Job"];
change_the_vehicle_allocated_for_a_job [label="Change The Vehicle Allocated For A Job"];
export_information_of_a_job_to_pdf_and_xls_format [label="Export Information Of A Job To Pdf And Xls Format"];
indicate_that_the_loading_is_completed [label="Indicate That The Loading Is Completed"];
confirm_the_delivered_items_to_a_outlet [label="Confirm The Delivered Items To A Outlet"];
approve_a_job [label="Approve A Job"];
request_a_modification_to_the_planned_mileage_of_a_job [label="Request A Modification To The Planned Mileage Of A Job"];
approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge [label="Approve The Planned Mileage Modification Request Submitted By The Warehouseincharge"];
generate_an_invoice_for_each_vehicle [label="Generate An Invoice For Each Vehicle"];
modify_the_minimum_fix_mileage_configuration_for_a_job [label="Modify The Minimum Fix Mileage Configuration For A Job"];
modify_the_unloading_charge [label="Modify The Unloading Charge"];
update_the_radius_limit_from_a_warehouse_for___drop_off___charges [label="Update The Radius Limit From A Warehouse For Drop Off Charges"];
set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited [label="Set Up The Drop Off Rate Table Based On Number Of Outlets Visited"];
modify_the___drop_off___rate_table [label="Modify The Drop Off Rate Table"];
edit_the_eligibility_criteria_for_driver_incentive [label="Edit The Eligibility Criteria For Driver Incentive"];
edit_the_per_km_rate_for_an_existing_vehicle_capacity_type [label="Edit The Per Km Rate For An Existing Vehicle Capacity Type"];
generate_vehicle_capacity_utilization_report [label="Generate Vehicle Capacity Utilization Report"];
generate_outlet_wise_transport_cost_report_for_a_given_date_range [label="Generate Outlet Wise Transport Cost Report For A Given Date Range"];
generate_vehicle_turnaround_time_report_for_a_warehouse [label="Generate Vehicle Turnaround Time Report For A Warehouse"];
generate_cost_per_1_kg_report [label="Generate Cost Per 1 Kg Report"];
generate_an_idle_time_limit_violation_report [label="Generate An Idle Time Limit Violation Report"];
edge [arrowhead="none"];
user->sign_up_to_the_system;
user->sign_in_to_the_system;
warehouseoperator->create_orders_by_uploading_a_csv_file;
warehouseoperator->make_adjustments_to_the_order;
warehouseoperator->allocate_a_vehicle_for_a_job;
warehouseoperator->change_the_system_suggested_optimized_route_if_required;
warehouseoperator->confirm_a_job;
warehouseoperator->change_the_vehicle_allocated_for_a_job;
warehouseoperator->export_information_of_a_job_to_pdf_and_xls_format;
warehouseoperator->indicate_that_the_loading_is_completed;
warehouseincharge->confirm_the_delivered_items_to_a_outlet;
warehouseincharge->approve_a_job;
warehouseincharge->request_a_modification_to_the_planned_mileage_of_a_job;
admin->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
warehouseoperator->generate_an_invoice_for_each_vehicle;
admin->modify_the_minimum_fix_mileage_configuration_for_a_job;
admin->modify_the_unloading_charge;
admin->update_the_radius_limit_from_a_warehouse_for___drop_off___charges;
admin->set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited;
admin->modify_the___drop_off___rate_table;
admin->edit_the_eligibility_criteria_for_driver_incentive;
admin->edit_the_per_km_rate_for_an_existing_vehicle_capacity_type;
warehouseoperator->generate_vehicle_capacity_utilization_report;
warehouseoperator->generate_outlet_wise_transport_cost_report_for_a_given_date_range;
warehouseoperator->generate_vehicle_turnaround_time_report_for_a_warehouse;
warehouseoperator->generate_cost_per_1_kg_report;
warehouseoperator->generate_an_idle_time_limit_violation_report;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
create_orders_by_uploading_a_csv_file->make_adjustments_to_the_order;
confirm_a_job->change_the_vehicle_allocated_for_a_job_change_the_system_suggested_optimized_route_if_required;
edge [arrowtail="vee", label="<<include>>", style=dashed];
confirm_a_job->allocate_a_vehicle_for_a_job;
approve_a_job->confirm_the_delivered_items_to_a_outlet;
request_a_modification_to_the_planned_mileage_of_a_job->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
}
\ No newline at end of file
import requests
from flask import Blueprint, jsonify, request
from constants.http_status_codes_constant import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_201_CREATED, HTTP_500_INTERNAL_SERVER_ERROR
from config.database import db
from datetime import datetime
from models.assignment_model import Assignment
assignment = Blueprint('assignments', __name__, url_prefix='/api/v1/assignments')
@assignment.post('/create')
def create_assignment():
content = request.json.get('content', '')
module_id = request.json.get('module_id', '')
plagiarism_percentage = request.json.get('plagiarism_percentage', '')
start_at = datetime.strptime(request.json.get('start_at', ''), '%Y-%m-%d %H:%M:%S')
end_at = datetime.strptime(request.json.get('end_at', ''), '%Y-%m-%d %H:%M:%S')
if not content or not module_id or not plagiarism_percentage or not start_at or not end_at:
return jsonify({'err': 'Missing assignment details'}), HTTP_400_BAD_REQUEST
assignment_obj = Assignment(content=content,
module_id=module_id,
plagiarism_percentage=plagiarism_percentage,
start_at=start_at,
end_at=end_at)
db.session.add(assignment_obj)
db.session.commit()
response = requests.post(url="http://127.0.0.1:5000/api/v1/diagrams/generate", json={"scenario": content, "assignment_id": assignment_obj.id})
if response.ok:
return jsonify({'msg': 'Assignment created', 'assignment': {
'id': assignment_obj.id,
'content': assignment_obj.content,
'module_id': assignment_obj.module_id,
'plagiarism_percentage': assignment_obj.plagiarism_percentage,
'start_at': assignment_obj.start_at,
'end_at': assignment_obj.end_at,
'diagrams': response.json()
}}), HTTP_201_CREATED
else:
assignment_obj = Assignment.query.filter_by(id=assignment_obj.id).first()
db.session.delete(assignment_obj)
db.commit()
return jsonify({'err': 'Something went wrong while generating model answers'}), HTTP_500_INTERNAL_SERVER_ERROR
@assignment.get('/<assignment_id>')
def get_assignment(assignment_id):
if not assignment_id:
return jsonify({'err': 'Missing assignment id'}), HTTP_400_BAD_REQUEST
assignment_obj = Assignment.query.filter_by(id=assignment_id).first()
if assignment_obj is None:
return jsonify({'err': "Module does not exist"}), HTTP_400_BAD_REQUEST
return jsonify({'msg': 'Assignment found', 'assignment': {
'id': assignment_obj.id,
'content': assignment_obj.content,
'module_id': assignment_obj.module_id,
'plagiarism_percentage': assignment_obj.plagiarism_percentage,
'start_at': assignment_obj.start_at,
'end_at': assignment_obj.end_at,
}}), HTTP_200_OK
@assignment.delete('/<assignment_id>')
def delete_assignment(assignment_id):
if not assignment_id:
return jsonify({'err': 'Missing assignment id'}), HTTP_400_BAD_REQUEST
assignment_obj = Assignment.query.filter_by(id=assignment_id).first()
if assignment_obj is None:
return jsonify({'err': "Module does not exist"}), HTTP_400_BAD_REQUEST
else:
db.session.delete(assignment_obj)
db.session.commit()
return jsonify({'msg': 'Assignment deleted', 'assignment': {
'id': assignment_obj.id,
'content': assignment_obj.content,
'module_id': assignment_obj.module_id,
'plagiarism_percentage': assignment_obj.plagiarism_percentage,
'start_at': assignment_obj.start_at,
'end_at': assignment_obj.end_at,
}}), HTTP_200_OK
@assignment.patch('/<assignment_id>')
def update_assignment(assignment_id):
content = request.json.get('content', '')
module_id = request.json.get('module_id', '')
plagiarism_percentage = request.json.get('plagiarism_percentage', '')
start_at = datetime.strptime(request.json.get('start_at', ''), '%Y-%m-%d %H:%M:%S')
end_at = datetime.strptime(request.json.get('end_at', ''), '%Y-%m-%d %H:%M:%S')
if not content or not module_id or not plagiarism_percentage or not start_at or not end_at:
return jsonify({'err': 'Missing assignment details'}), HTTP_400_BAD_REQUEST
assignment_obj = Assignment.query.filter_by(id=assignment_id).first()
assignment_obj.content = content
assignment_obj.module_id = module_id
assignment_obj.plagiarism_percentage = plagiarism_percentage
assignment_obj.start_at = start_at
assignment_obj.end_at = end_at
db.session.commit()
return jsonify({'msg': 'Assignment updated', 'assignment': {
'id': assignment_obj.id,
'content': assignment_obj.content,
'module_id': assignment_obj.module_id,
'plagiarism_percentage': assignment_obj.plagiarism_percentage,
'start_at': assignment_obj.start_at,
'end_at': assignment_obj.end_at,
}}), HTTP_200_OK
from flask import request, jsonify, send_from_directory, Blueprint
from werkzeug.exceptions import BadRequestKeyError
from app import *
from config.database import db
from constants.http_status_codes_constant import HTTP_404_NOT_FOUND, HTTP_500_INTERNAL_SERVER_ERROR, HTTP_200_OK, \
HTTP_400_BAD_REQUEST
import services.question_preprocess_service
from models.diagram_model import Diagram
diagram = Blueprint('diagrams', __name__, url_prefix='/api/v1/diagrams')
@diagram.post('/generate')
def generate_diagrams():
try:
data = request.get_json(silent=True)
if data is None:
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
generated_class_diagram_path, generated_usecase_diagram_path = services.question_preprocess_service.main(
data['scenario'])
if generated_usecase_diagram_path or generated_usecase_diagram_path:
diagram_obj = Diagram(assignment_id=data['assignment_id'],
usecase_diagram_path=generated_usecase_diagram_path,
class_diagram_path=generated_class_diagram_path)
db.session.add(diagram_obj)
db.session.commit()
else:
return jsonify('Something went wrong'), HTTP_500_INTERNAL_SERVER_ERROR
return jsonify(generated_class_diagram_path=generated_class_diagram_path,
generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
except Exception or BadRequestKeyError:
if BadRequestKeyError:
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
return jsonify('Something went wrong'), HTTP_500_INTERNAL_SERVER_ERROR
@diagram.get('/<assignment_id>')
def get_diagrams(assignment_id):
diagram_obj = Diagram.query.filter_by(assignment_id=assignment_id).first()
if diagram_obj is None:
return jsonify({"err": "No diagram found"}, HTTP_404_NOT_FOUND)
return jsonify({'msg': 'Diagrams found', 'diagrams': {'class_diagram': diagram_obj.class_diagram_path, 'usecase_diagram': diagram_obj.usecase_diagram_path}}), HTTP_200_OK
from flask import Blueprint, jsonify, request
from constants.http_status_codes_constant import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_201_CREATED
from config.database import db
from models.module_model import Module
module = Blueprint('modules', __name__, url_prefix='/api/v1/modules')
@module.post('/create')
def create_module():
name = request.json.get('name', '')
code = request.json.get('code', '')
if not name or not code:
return jsonify({'err': 'Missing module name or code'}), HTTP_400_BAD_REQUEST
module_obj = Module(name=name, code=code)
db.session.add(module_obj)
db.session.commit()
return jsonify({'msg': 'Module created', 'module': {
'id': module_obj.id,
'name': module_obj.name,
'code': module_obj.code,
}}), HTTP_201_CREATED
@module.get('/<module_id>')
def get_module(module_id):
if not module_id:
return jsonify({'err': 'Missing module id'}), HTTP_400_BAD_REQUEST
module_obj = Module.query.filter_by(id=module_id).first()
if module_obj is None:
return jsonify({'err': "Module does not exist"}), HTTP_400_BAD_REQUEST
return jsonify({'msg': 'Module found', 'module': {
'name': module_obj.name,
'code': module_obj.code,
'created_at': module_obj.created_at,
'updated_at': module_obj.updated_at
}}), HTTP_200_OK
@module.delete('/<module_id>')
def delete_module(module_id):
if not module_id:
return jsonify({'err': 'Missing module id'}), HTTP_400_BAD_REQUEST
module_obj = Module.query.filter_by(id=module_id).first()
if module_obj is None:
return jsonify({'err': "Module does not exist"}), HTTP_400_BAD_REQUEST
else:
db.session.delete(module_obj)
db.session.commit()
return jsonify({'msg': 'Module deleted', 'module': {
'name': module_obj.name,
'code': module_obj.code,
'created_at': module_obj.created_at,
'updated_at': module_obj.updated_at
}}), HTTP_200_OK
@module.patch('/<module_id>')
def update_module(module_id):
name = request.json.get('name', '')
code = request.json.get('code', '')
if not name or not code:
return jsonify({'err': 'Missing module name or code'}), HTTP_400_BAD_REQUEST
module_obj = Module.query.filter_by(id=module_id).first()
module_obj.code = code
module_obj.name = name
db.session.commit()
return jsonify({'msg': 'Module updated', 'module': {
'id': module_obj.id,
'name': module_obj.name,
'code': module_obj.code,
}}), HTTP_200_OK
import json
from flask import request, jsonify, Blueprint
from flask_jwt_extended import jwt_required, get_jwt_identity
from constants.http_status_codes_constant import HTTP_400_BAD_REQUEST, HTTP_200_OK
from services.submission_service import save_submission
from services.use_case_model_detection_service import model_object_detection
submission = Blueprint('submissions', __name__, url_prefix='/api/v1/submissions')
@submission.post('/upload')
@jwt_required()
def upload_submission():
user_id = get_jwt_identity()
image = request.files['file']
json_data = json.loads(request.form['data'])
submission_type = json_data['type']
assignment_id = json_data['id']
comment = json_data['comment']
if submission_type is None or image is None or assignment_id is None:
return jsonify({'err': 'invalid request '}), HTTP_400_BAD_REQUEST
elif submission_type == 'use case':
use_case_obj = save_submission(assignment_id, image, submission_type, comment, user_id)
model_object_detection(image.filename, use_case_obj.id)
return jsonify({'message': 'upload successful '}), HTTP_200_OK
elif submission_type == 'class':
class_obj = save_submission(assignment_id, image, submission_type, comment, user_id)
# model_object_detection(image.filename, class_obj.id)
return jsonify({'id': str(class_obj.id)}), HTTP_200_OK
else:
return jsonify({'err': 'invalid request '}), HTTP_400_BAD_REQUEST
import random
import string
import subprocess
import shutil
import os
from app import OUTPUTS_GENERATED_DOT_FILES_PATH, OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH, \
OUTPUTS_GENERATED_CLASS_FILES_PATH, APP_ROOT
def generate_random_string():
letters = string.ascii_lowercase
random_string = ''.join(random.choice(letters) for i in range(10))
return random_string
def remove_duplicate_class_names(data):
return list(dict.fromkeys(data))
def generate_class_string_array(actors, data):
class_content = []
for actor in actors:
single_class = []
for d in data:
if d[0] == actor:
class_name_string = "class " + actor + ": \n\t\n"
class_methods_string = "\t def " + d[1] + "(self): \n\t\t pass \n\n"
single_class.extend((class_name_string, class_methods_string))
cleaned_class = remove_duplicate_class_names(single_class)
class_content.append(cleaned_class)
return class_content
def create_class_methods(data):
cleaned_data = []
for element in data:
cleaned_array = []
class_name = element[0].strip()
method_name = element[1].replace(" ", "_")
cleaned_array.extend((class_name, method_name))
cleaned_data.append(cleaned_array)
return cleaned_data
def generate_diagram(filename):
try:
subprocess.run(["pyreverse", "-S", "-o", "dot", "-p", filename, OUTPUTS_GENERATED_CLASS_FILES_PATH+"/"+filename+".py"])
shutil.move("classes_" + filename + ".dot", OUTPUTS_GENERATED_DOT_FILES_PATH)
subprocess.run(["dot", "-Tpng", OUTPUTS_GENERATED_DOT_FILES_PATH+"/classes_"+filename+".dot", "-o", OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH+"/"+filename+".png"])
except Exception:
print(Exception)
# generate python file for the class
def generate_class(actors, data):
res = create_class_methods(data)
class_string_arr = generate_class_string_array(actors, res)
python_class_file_name = generate_random_string()
class_file = open(OUTPUTS_GENERATED_CLASS_FILES_PATH + "/" + python_class_file_name + ".py", "x")
for single_class_string in class_string_arr:
for single_string in single_class_string:
class_file.write(single_string)
class_file.write("\n\n")
class_file.close()
generate_diagram(python_class_file_name)
return '/generated_class_diagrams/' + python_class_file_name + '.png'
import operator
import re
import cv2
import numpy as np
import pytesseract as pytesseract
from PIL import Image
from object_detection.utils import label_map_util
import app
import tensorflow as tf
from config.database import db
def class_object_detection(filename, class_comp_id, model_path, label_path, image_path):
detect_fn = tf.saved_model.load(model_path)
category_index = label_map_util.create_category_index_from_labelmap(label_path, use_display_name=True)
image_np = np.array(Image.open(image_path))
input_tensor = tf.convert_to_tensor(image_np)
input_tensor = input_tensor[tf.newaxis, ...]
detections = detect_fn(input_tensor)
num_detections = int(detections.pop('num_detections'))
detections = {key: value[0, :num_detections].numpy()
for key, value in detections.items()}
detections['num_detections'] = num_detections
detections['detection_classes'] = detections['detection_classes'].astype(np.int64)
accurate_indexes = [k for k, v in enumerate(detections['detection_scores']) if (v > 0.6)]
num_entities = len(accurate_indexes)
class_id = operator.itemgetter(*accurate_indexes)(detections['detection_classes'])
boxes = detections['detection_boxes']
return boxes, num_entities, accurate_indexes, num_entities, category_index, class_id
def component_separation(filename, class_comp_id):
boxes, num_entities, accurate_indexes, num_entities, category_index, class_id = class_object_detection(filename,
class_comp_id,
app.CLASS_SAVED_MODEL_PATH,
app.CLASS_SAVED_LABEL_PATH,
app.SUBMISSION_PATH_CLASS + '/' + filename)
# Convert the class id in their name
if num_entities > 0:
for i in range(0, len(accurate_indexes)):
if category_index[class_id]['name'] == 'class':
class_image = crop_and_image_resolution(filename, boxes)
cv2.imwrite(app.SUBMISSION_PATH_CLASS, "class" + str(i))
# boxes,num_entities,accurate_indexes,num_entities,category_index,class_id = class_object_detection(class_image, class_comp_id, app.CLASS_SAVED_MODEL_PATH, app.CLASS_SAVED_LABEL_PATH,app.SUBMISSION_PATH_CLASS+'/'+"class"+str(i))
elif category_index[class_id]['name'] == 'interface':
image = crop_and_image_resolution(filename, boxes)
def crop_and_image_resolution(filename, boxes):
image = cv2.imread(app.SUBMISSION_PATH + '/' + filename)
height, width, c = image.shape
# crop box format: xmin, ymin, xmax, ymax
ymin = boxes[0] * height
xmin = boxes[1] * width
ymax = boxes[2] * height
xmax = boxes[3] * width
cropped_image = image[int(ymin):int(ymax), int(xmin):int(xmax)]
image = cv2.imwrite('image.jpg', cropped_image)
# convert values to int
black = (0, 0, 0)
white = (255, 255, 255)
threshold = (160, 160, 160)
# Open input image in grayscale mode and get its pixels.
img = Image.open("image.jpg").convert("LA")
pixels = img.getdata()
new_pixels = []
# Compare each pixel
for pixel in pixels:
if pixel < threshold:
new_pixels.append(black)
else:
new_pixels.append(white)
# Create and save new image.
new_img = Image.new("RGB", img.size)
new_img.putdata(new_pixels)
return image
import math
import cv2
import keras_ocr
import numpy as np
import app
from config.database import db
from models.actor_and_use_case import ActorANDUseCase
from decimal import Decimal
from models.extend_relationship import ExtendRelationship
from models.include_relationship import IncludeRelationship
def detect_extend_include_relationship(filename, boxes, accurate_indexes, use_case_id, category_index, class_id):
image = cv2.imread(app.SUBMISSION_PATH + '/' + filename)
height, width, c = image.shape
use_case_objects = ActorANDUseCase.query.filter_by(use_case_answer=use_case_id, type='use case').all()
for i in range(0, len(accurate_indexes)):
if category_index[class_id[i]]['name'] == 'relationship':
ymin = boxes[i][0] * height
xmin = boxes[i][1] * width
ymax = boxes[i][2] * height
xmax = boxes[i][3] * width
crop_img = image[int(ymin):int(ymax), int(xmin):int(xmax)]
r_type = text_detection(crop_img)
line_recovery_image = line_recovery(crop_img)
gray_image = cv2.cvtColor(line_recovery_image, cv2.COLOR_BGR2GRAY)
_, thresh_image = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY_INV)
arrow_image = get_filter_arrow_image(thresh_image)
if arrow_image is not None:
arrow_info_image, point1, point2 = get_arrow_info(arrow_image)
point1_x = int(xmin) + point1[0]
point1_y = int(ymin) + point1[1]
point2_x = int(xmin) + point2[0]
point2_y = int(ymin) + point2[1]
line_point1 = (point1_x, point1_y)
line_point2 = (point2_x, point2_y)
u1_object = find_closest_components_length(line_point1, use_case_objects)
u2_object = find_closest_components_length(line_point2, use_case_objects)
if (r_type == 'include'):
include_obj = IncludeRelationship(use_case_answer=use_case_id,
connected_component_01=u1_object.id,
connected_component_02=u2_object.id)
db.session.add(include_obj)
db.session.commit()
if (r_type == "extend"):
extend_obj = ExtendRelationship(use_case_answer=use_case_id,
connected_component_01=u1_object.id,
connected_component_02=u2_object.id)
db.session.add(extend_obj)
db.session.commit()
def line_recovery(img):
kernel1 = np.ones((3, 5), np.uint8)
kernel2 = np.ones((9, 9), np.uint8)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgBW = cv2.threshold(imgGray, 230, 255, cv2.THRESH_BINARY_INV)[1]
img1 = cv2.erode(imgBW, kernel1, iterations=1)
img2 = cv2.dilate(img1, kernel2, iterations=3)
img3 = cv2.bitwise_and(imgBW, img2)
img3 = cv2.bitwise_not(img3)
img4 = cv2.bitwise_and(imgBW, imgBW, mask=img3)
imgLines = cv2.HoughLinesP(img4, 1, np.pi / 180, 20, minLineLength=0, maxLineGap=5)
for i in range(len(imgLines)):
for x1, y1, x2, y2 in imgLines[i]:
cv2.line(img, (x1, y1), (x2, y2), (0, 0, 0), 2)
return img
def text_detection(c_img):
pipeline = keras_ocr.pipeline.Pipeline()
prediction_groups = pipeline.recognize([c_img])
for prg in prediction_groups[0]:
print(prg[0])
if prg[0].find('clu') >= 0:
return "include"
else:
if prg[0].find('ten') >= 0:
return "extend"
def get_filter_arrow_image(threslold_image):
blank_image = np.zeros_like(threslold_image)
kernel_dilate = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2))
threslold_image = cv2.dilate(threslold_image, kernel_dilate, iterations=1)
contours, hierarchy = cv2.findContours(threslold_image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
if hierarchy is not None:
threshold_distnace = 100
for cnt in contours:
hull = cv2.convexHull(cnt, returnPoints=False)
defects = cv2.convexityDefects(cnt, hull)
if defects is not None:
for i in range(defects.shape[0]):
start_index, end_index, farthest_index, distance = defects[i, 0]
if distance > threshold_distnace:
cv2.drawContours(blank_image, [cnt], -1, 225, -1)
return blank_image
else:
return None
def get_length(p1, p2):
line_length = ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5
return line_length
def find_max_length(contours):
max_lenth = 0
for cnt in contours:
p1, p2 = get_max_distace_point(cnt)
line_length = ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5
if line_length > max_lenth:
max_lenth = line_length
return max_lenth
def get_max_distace_point(cnt):
max_distance = 0
max_points = None
for [[x1, y1]] in cnt:
for [[x2, y2]] in cnt:
distance = get_length((x1, y1), (x2, y2))
if distance > max_distance:
max_distance = distance
max_points = [(x1, y1), (x2, y2)]
return max_points
def angle_beween_points(a, b):
arrow_slope = (a[0] - b[0]) / (a[1] - b[1])
arrow_angle = math.degrees(math.atan(arrow_slope))
return arrow_angle
def get_arrow_info(arrow_image):
arrow_info_image = cv2.cvtColor(arrow_image.copy(), cv2.COLOR_GRAY2BGR)
contours, hierarchy = cv2.findContours(arrow_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
if hierarchy is not None:
max_lenth = find_max_length(contours)
for cnt in contours:
blank_image = np.zeros_like(arrow_image)
cv2.drawContours(blank_image, [cnt], -1, 255, -1)
point1, point2 = get_max_distace_point(cnt)
lenght = get_length(point1, point2)
if lenght == max_lenth:
cv2.circle(arrow_info_image, point1, 2, (255, 0, 0), 3)
cv2.circle(arrow_info_image, point2, 2, (255, 0, 0), 3)
cv2.putText(arrow_info_image, "point 1 : %s" % (str(point1)), point2, cv2.FONT_HERSHEY_PLAIN, 0.8,
(0, 0, 255), 1)
cv2.putText(arrow_info_image, "point 2 : %s" % (str(point2)), (point2[0], point2[1] + 20),
cv2.FONT_HERSHEY_PLAIN, 0.8, (0, 0, 255), 1)
return arrow_info_image, point1, point2
else:
return None, None
def find_closest_components_length(point, use_case_objects):
u_object = 0
min_length = 1000000000000
for obj in use_case_objects:
ymin = Decimal(obj.y_min)
xmin = Decimal(obj.x_min)
ymax = Decimal(obj.y_max)
xmax = Decimal(obj.x_max)
usecase_x = xmin + (xmax - xmin) / 2
usecase_y = ymin + (ymax - ymin) / 2
usecase_point = (int(usecase_x), int(usecase_y))
l_length = ((point[0] - usecase_point[0]) ** 2 + (point[1] - usecase_point[1]) ** 2) ** 0.5
if min_length > l_length:
min_length = l_length
u_object = obj
return u_object
import math
import cv2
import numpy as np
import app
from config.database import db
from decimal import Decimal
from models.actor_and_use_case import ActorANDUseCase
from models.actor_generalization_relationship import ActorGeneralizationRelationship
from models.use_case_association_relationship import UseCaseAssociationRelationship
from models.use_case_generalization_relationship import UseCaseGeneralizationRelationship
def detect_generalization_relationship(filename, boxes, accurate_indexes, use_case_id):
image = cv2.imread(app.SUBMISSION_PATH + '/' + filename)
img1 = hide_detected_components(image, boxes, accurate_indexes)
img2 = remove_rectangle(img1)
img3 = recover_broke_line(img2)
gray_image = cv2.cvtColor(img3, cv2.COLOR_BGR2GRAY)
_, thresh_image = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY_INV)
arrow_image = get_filter_arrow_image(thresh_image)
if arrow_image is not None:
all_objects = ActorANDUseCase.query.filter_by(use_case_answer=use_case_id).all()
result = get_arrow_info(arrow_image, all_objects, use_case_id)
def hide_detected_components(image, boxes, accurate_indexes):
height, width, c = image.shape
for i in range(0, len(accurate_indexes)):
ymin = boxes[i][0] * height
xmin = boxes[i][1] * width
ymax = boxes[i][2] * height
xmax = boxes[i][3] * width
cv2.rectangle(image, (int(xmin), int(ymin)), (int(xmax), int(ymax)), (255, 255, 255), -1)
return image
def remove_rectangle(image):
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
_, thrash = cv2.threshold(gray_image, 240, 255, cv2.THRESH_BINARY)
contours, _ = cv2.findContours(thrash, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
for contour in contours:
shape = cv2.approxPolyDP(contour, 0.05 * cv2.arcLength(contour, True), True)
if len(shape) == 4:
cv2.drawContours(image, [shape], 0, (255, 255, 255), 3)
return image
def recover_broke_line(image):
kernel1 = np.ones((3, 5), np.uint8)
kernel2 = np.ones((9, 9), np.uint8)
imgGray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
imgBW = cv2.threshold(imgGray, 230, 255, cv2.THRESH_BINARY_INV)[1]
img1 = cv2.erode(imgBW, kernel1, iterations=1)
img2 = cv2.dilate(img1, kernel2, iterations=3)
img3 = cv2.bitwise_and(imgBW, img2)
img3 = cv2.bitwise_not(img3)
img4 = cv2.bitwise_and(imgBW, imgBW, mask=img3)
imgLines = cv2.HoughLinesP(img4, 1, np.pi / 180, 40, minLineLength=0, maxLineGap=10)
for i in range(len(imgLines)):
for x1, y1, x2, y2 in imgLines[i]:
cv2.line(image, (x1, y1), (x2, y2), (0, 0, 0), 2)
return image
def get_filter_arrow_image(threslold_image):
blank_image = np.zeros_like(threslold_image)
kernel_dilate = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2))
threslold_image = cv2.dilate(threslold_image, kernel_dilate, iterations=1)
contours, hierarchy = cv2.findContours(threslold_image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
if hierarchy is not None:
threshold_distnace = 100
for cnt in contours:
hull = cv2.convexHull(cnt, returnPoints=False)
defects = cv2.convexityDefects(cnt, hull)
if defects is not None:
for i in range(defects.shape[0]):
start_index, end_index, farthest_index, distance = defects[i, 0]
if distance > threshold_distnace:
cv2.drawContours(blank_image, [cnt], -1, 225, -1)
return blank_image
else:
return None
def get_length(p1, p2):
line_length = ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5
return line_length
def get_max_distace_point(cnt):
max_distance = 0
max_points = None
for [[x1, y1]] in cnt:
for [[x2, y2]] in cnt:
distance = get_length((x1, y1), (x2, y2))
if distance > max_distance:
max_distance = distance
max_points = [(x1, y1), (x2, y2)]
return max_points
def angle_beween_points(a, b):
arrow_slope = (a[0] - b[0]) / (a[1] - b[1])
arrow_angle = math.degrees(math.atan(arrow_slope))
return arrow_angle
def get_arrow_info(arrow_image, all_objects, use_case_id):
contours, hierarchy = cv2.findContours(arrow_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
if hierarchy is not None:
for cnt in contours:
blank_image = np.zeros_like(arrow_image)
cv2.drawContours(blank_image, [cnt], -1, 255, -1)
point1, point2 = get_max_distace_point(cnt)
component_1 = find_closest_components_length(point1, all_objects)
component_2 = find_closest_components_length(point2, all_objects)
if component_1.type == 'use case' and component_2.type == 'use case':
use_case_generalization_obj = UseCaseGeneralizationRelationship(use_case_answer=use_case_id,
connected_component_01=component_1.id,
connected_component_02=component_2.id)
db.session.add(use_case_generalization_obj)
db.session.commit()
elif component_1.type == "actor" and component_2.type == "actor":
actor_generalization_obj = ActorGeneralizationRelationship(use_case_answer=use_case_id,
connected_component_01=component_1.id,
connected_component_02=component_2.id)
db.session.add(actor_generalization_obj)
db.session.commit()
else:
association_obj = UseCaseAssociationRelationship(use_case_answer=use_case_id,
connected_component_01=component_1.id,
connected_component_02=component_2.id)
db.session.add(association_obj)
db.session.commit()
else:
return None
def find_closest_components_length(point, all_objects):
component = None
min_length = 1000000000
for obj in all_objects:
ymin = Decimal(obj.y_min)
xmin = Decimal(obj.x_min)
ymax = Decimal(obj.y_max)
xmax = Decimal(obj.x_max)
usecase_x = xmin + (xmax - xmin) / 2
usecase_y = ymin + (ymax - ymin) / 2
usecase_point = (int(usecase_x), int(usecase_y))
l_length = ((point[0] - usecase_point[0]) ** 2 + (point[1] - usecase_point[1]) ** 2) ** 0.5
if min_length > l_length:
min_length = l_length
component = obj
return component
import spacy
import os
from services.tokenization_service import *
# from services.class_diagram_generation_service import *
from services.class_diagram_generation_service import *
from services.use_case_diagram_generation_service import *
from app import UPLOADS_FOLDER_PATH
# removing unwanted spaces
def remove_unwanted_values(data):
remove_element = 'None'
if remove_element in data:
......@@ -25,22 +23,23 @@ def remove_punctuation(sentence):
return cleaned_sentence
# load the text file
def main(filepath):
with open(UPLOADS_FOLDER_PATH + "/" + filepath, "r", errors='ignore') as f:
requirement_text = f.read().replace("\n\n", " ").replace("\n", " ")
# load the text
def main(scenario):
requirement_text = scenario.replace("\n\n", " ").replace("\n", " ")
nlp = spacy.load("en_core_web_lg")
doc = nlp(requirement_text)
# sentence splitting
sentences = list(doc.sents)
sentences.pop(0)
del sentences[-1]
nc = []
cleaned_extracted_actions = []
cleaned_sentences = []
splitted_actions_array = []
# looping through sentences
# looping through each sentence
for sentence in sentences:
res = get_nouns_pnouns(sentence)
nc.append(str(res))
......@@ -58,13 +57,10 @@ def main(filepath):
# remove duplicates of the actors
nc = list(dict.fromkeys(nc))
data = remove_unwanted_values(nc)
# generated_class_diagram_path = generate_class(data, cleaned_extracted_actions)
generated_class_diagram_path = generate_class(data, cleaned_extracted_actions)
extracted_relationships = get_include_extend_relationships(splitted_actions_array)
actors_and_use_cases_array = identify_use_cases(cleaned_extracted_actions)
generated_usecase_diagram_path = generate_use_case_diagram(data, extracted_relationships,
actors_and_use_cases_array)
# return generated_class_diagram_path, generated_usecase_diagram_path
return generated_usecase_diagram_path
return generated_class_diagram_path, generated_usecase_diagram_path
import os
import app
from config.database import db
from models.class_diagram_answer import ClassAnswer
from models.use_case_answer import UseCaseAnswer
def save_submission(assignment_id, image, submission_type, comment, user_id):
if submission_type == 'use case':
image.save(os.path.join(app.SUBMISSION_PATH, image.filename))
use_case_obj = UseCaseAnswer(user=user_id, assignment=assignment_id, file_name=image.filename,
comments=comment)
db.session.add(use_case_obj)
db.session.commit()
return use_case_obj
else:
image.save(os.path.join(app.SUBMISSION_PATH_CLASS, image.filename))
class_obj = ClassAnswer(user=user_id, assignment=assignment_id, file_name=image.filename,
comments=comment)
db.session.add(class_obj)
db.session.commit()
return class_obj
import re
import spacy
# import docx
def get_ner(sentence):
print(sentence)
ents = list(sentence.ents)
return ents
def get_pos(sentence):
for token in sentence:
print(token.text, token.pos_)
def get_noun_chunks(sentence):
return list(sentence.noun_chunks)
def get_nouns_pnouns(sentence):
for token in sentence:
if token.pos_ == "PROPN" and token.pos_ != None:
return token
def remove_punctuation(sentence):
text_no_punct = [token for token in sentence if not token.is_punct]
cleaned_sentence = ' '.join(token.text for token in text_no_punct)
return cleaned_sentence
def split_actions(sentence):
split_string = "should be able to "
if split_string in sentence:
extracted_string = sentence.split(split_string)
return extracted_string
def get_actions(splitted_action):
# print('splitted_action',splitted_action)
temp_array = []
if splitted_action is not None and '|' in splitted_action[1]:
res = splitted_action[1].split(' | ')
# print('res',res)
temp_array.append(splitted_action[0])
temp_array.append(res[0])
return temp_array
res = splitted_action[1].split(' | ')
# print('res',res)
temp_array.append(splitted_action[0])
temp_array.append(res[0])
return temp_array
else:
return splitted_action
# def get_text_from_docx(filename):
# doc = docx.Document(filename)
# fullText = []
# for para in doc.paragraphs:
# fullText.append(para.text)
# return '\n'.join(fullText)
def get_sentences(text):
nlp = spacy.load("en_core_web_lg")
......@@ -58,9 +58,12 @@ def get_sentences(text):
flag = False
token_count = 0
for token in sentence:
token_count = token_count+1
token_count = token_count + 1
if token.pos_ == 'INTJ' or token.text == '?' or (token.text == 'I' and token.pos_ == 'PRON') or (
token.text == '’m' and token.pos_ == 'VERB') or ((token.text == 'what' or token.text == 'What') and token.pos_ == 'PRON') or ((token.text == 'We' or token.text == 'we') and token.pos_ == 'PRON') or ((token.text == 'You' or token.text == 'you') and token.pos_ == 'PRON'):
token.text == '’m' and token.pos_ == 'VERB') or (
(token.text == 'what' or token.text == 'What') and token.pos_ == 'PRON') or (
(token.text == 'We' or token.text == 'we') and token.pos_ == 'PRON') or (
(token.text == 'You' or token.text == 'you') and token.pos_ == 'PRON'):
flag = True
if token_count < 6:
flag = True
......
......@@ -43,6 +43,7 @@ def get_include_extend_relationships(splitted_actions_array):
continue
relationship_array.append(dictionary)
return relationship_array
def clean_use_case_strings(use_case):
if 'Extend' in use_case:
return use_case.replace('Extend','').lstrip(' ')
......
import operator
import re
import cv2
import numpy as np
import pytesseract as pytesseract
from PIL import Image
from object_detection.utils import label_map_util
import app
import tensorflow as tf
from config.database import db
from models.actor_and_use_case import ActorANDUseCase
# pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'
from services.extend_include_relationship_detection_service import detect_extend_include_relationship
from services.generalization_relationship_detection_service import detect_generalization_relationship
def model_object_detection(filename, use_case_id):
detect_fn = tf.saved_model.load(app.USE_CASE_SAVED_MODEL_PATH)
category_index = label_map_util.create_category_index_from_labelmap(
app.USE_CASE_SAVED_LABEL_PATH + "/label_map.pbtxt",
use_display_name=True)
image_np = np.array(Image.open(app.SUBMISSION_PATH + '/' + filename))
input_tensor = tf.convert_to_tensor(image_np)
input_tensor = input_tensor[tf.newaxis, ...]
detections = detect_fn(input_tensor)
num_detections = int(detections.pop('num_detections'))
detections = {key: value[0, :num_detections].numpy()
for key, value in detections.items()}
detections['num_detections'] = num_detections
detections['detection_classes'] = detections['detection_classes'].astype(np.int64)
accurate_indexes = [k for k, v in enumerate(detections['detection_scores']) if (v > 0.4)]
class_id = operator.itemgetter(*accurate_indexes)(detections['detection_classes'])
boxes = detections['detection_boxes']
text_extraction(filename, class_id, boxes, accurate_indexes, category_index, use_case_id)
detect_generalization_relationship(filename, boxes, accurate_indexes, use_case_id)
detect_extend_include_relationship(filename, boxes, accurate_indexes, use_case_id, category_index, class_id)
def text_extraction(filename, class_id, boxes, accurate_indexes, category_index, use_case_id):
image = cv2.imread(app.SUBMISSION_PATH + '/' + filename)
for i in range(0, len(accurate_indexes)):
if category_index[class_id[i]]['name'] != "relationship":
height, width, c = image.shape
ymin = boxes[i][0] * height
xmin = boxes[i][1] * width
ymax = boxes[i][2] * height
xmax = boxes[i][3] * width
crop_img = image[int(ymin):int(ymax), int(xmin):int(xmax)]
gray_img = cv2.cvtColor(crop_img, cv2.COLOR_BGR2GRAY)
thresh, bw_img = cv2.threshold(gray_img, 160, 255, cv2.THRESH_TOZERO)
resize_img = cv2.resize(bw_img, None, fx=1, fy=1)
ocr_result = pytesseract.image_to_string(resize_img, config='1 eng --oem 1 --psm 13')
result = ocr_result.strip().replace("\\", "")
text = re.sub("=|,", "", result)
if category_index[class_id[i]]['name'] == 'actor':
actor_obj = ActorANDUseCase(use_case_answer=use_case_id, type='actor', text=text, x_min=xmin,
y_min=ymin, x_max=xmax,
y_max=ymax)
db.session.add(actor_obj)
db.session.commit()
else:
use_case_obj = ActorANDUseCase(use_case_answer=use_case_id, type='use case', text=text, x_min=xmin,
y_min=ymin, x_max=xmax,
y_max=ymax)
db.session.add(use_case_obj)
db.session.commit()
item {
id: 1
name: 'class'
}
item {
id: 2
name: 'relationship'
}
\ No newline at end of file
item {
id: 1
name: 'class_attributes'
}
item {
id: 2
name: 'class_methods'
}
item {
id: 3
name: 'class_name'
}
\ No newline at end of file
item {
id: 1
name: 'actor'
}
item {
id: 2
name: 'relationship'
}
item {
id: 3
name: 'use case'
}
\ No newline at end of file
In ABC shop which provides essential goods requirements are as follows. Customer should be able to login to the system. Customer should be able to check the home page. Customer should be able to play the site demo video. Customer should be able to add items to the cart. Customer should be able to pay the items | include: recieve the confirmation email. Customer should be able to give a feedback for the system | extend: rate the service. Customer should be able to view the seller details. Customer should be able to contact the seller to request more items. Admin should be able to login to the system. Admin should be able to view and manage cart items. Admin should be able to check the payments and sold items. Admin should be able to reply to Customer feedbacks. Consider above requirements and draw an usecase diagram.
\ No newline at end of file
......@@ -11,6 +11,9 @@
# production
/build
# idea
/.idea
# misc
.DS_Store
.env.local
......
This diff is collapsed.
......@@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@emotion/react": "^11.4.1",
"@grammarly/editor-sdk-react": "^1.7.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
......
......@@ -37,7 +37,7 @@
.row-user input {
width: 100%;
box-sizing: border-box;
border: 1px solid var(--main-color-blue);
border: 2px solid var(--main-color-blue);
font-size: 1rem;
padding: 1rem;
border-radius: 5px;
......
frontend/src/assets/images/logo.png

20.4 KB | W: | H:

frontend/src/assets/images/logo.png

41.2 KB | W: | H:

frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -54,11 +54,7 @@
}
.sidebar__item-inner.active {
background-image: linear-gradient(
to right,
var(--main-color-blue),
var(--second-color)
);
background-image: linear-gradient(to right, var(--main-color-blue), var(--second-color));
color: var(--txt-white);
}
......
......@@ -5,8 +5,8 @@ const sidebar_teacher = [
icon: "bx bx-category-alt",
},
{
display_name: "Manage Classes",
route: "/auth/teacher/classes",
display_name: "Manage Modules",
route: "/auth/teacher/modules",
icon: "bx bx-bar-chart-square",
},
{
......@@ -34,8 +34,8 @@ const sidebar_student = [
},
{
display_name: "Modules",
route: "/auth/student/subjects",
icon: "bx bx-transfer",
route: "/auth/student/modules",
icon: "bx bx-bar-chart-square",
},
{
display_name: "Sign Out",
......
import axios from "axios";
import { Link } from "react-router-dom";
import React, { useEffect, useState } from "react";
import Sidebar from "../components/sidebar/Sidebar";
import TopNav from "../components/topnav/TopNav";
import Table from "../components/table/Table";
import Badge from "../components/badge/Badge";
import Spinner from "../components/loading/Spinner";
import { RiDeleteBinLine } from "react-icons/ri";
import Popup from "./Popup";
const ViewAssignment = () => {
const siteId = localStorage.getItem("site");
const [Materials, setMaterials] = useState([]);
const students = [
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 40,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 10,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 30,
CorrectnessPercentage: 70,
},
];
const fields = [
"",
"Student Email",
"Submission",
"Plagiarism Percentage",
"Correctness Percentage",
"Submitted At",
"Action",
];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const [OrderDetail, setOrderDetail] = useState([]);
const [Loading, setLoading] = useState(false);
const [Trigger, setTrigger] = useState(false);
const [Name, setName] = useState("");
const [Id, setId] = useState("");
const [ItemName, setItemName] = useState("");
const [Description, setDescription] = useState("");
const [Order, setOrder] = useState({
item: {},
quantity: 0,
siteid: siteId,
requiredDate: "",
urgentOrder: false,
});
console.log(Order);
const FetchData = async () => {
const resMaterials = await axios.get(`materials`);
setMaterials(resMaterials.data.materials);
const resOrders = await axios.get("/orders");
setOrderDetail(resOrders.data.orders);
if (resOrders.statusText === "OK") {
setLoading(true);
}
};
useEffect(() => {
FetchData();
}, []);
const orderHandler = async () => {
try {
console.log(Order);
const res = await axios.post("/orders", Order);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
return (
<div>
<Sidebar />
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<div className="row">
<div className="col-10">
<h1 className="page-header">CTSE Assignment 01</h1>
</div>
<div className="col-1" style={{ marginTop: "1rem" }}>
<Link to={`/auth/teacher/assignments/1`}>
<button className="view-btn">Back to Assignment</button>
</Link>
</div>
</div>
<div className="row">
<div className="col-12">
<div className="card">
<h3>Generated usecase diagram</h3>
<br />
<div className="flex" style={{ justifyContent: "center" }}>
<img
src="https://d2slcw3kip6qmk.cloudfront.net/marketing/pages/chart/what-is-a-use-case-diagram-in-UML/UML_use_case_example-800x707.PNG"
alt="usecase"
/>
</div>
</div>
</div>
</div>
<div className="row">
<div className="col-12">
<div className="card">
<h3>Generated class diagram</h3>
<br />
<div className="flex" style={{ justifyContent: "center" }}>
<img
src="https://www.researchgate.net/profile/Sergi-Valverde/publication/225686440/figure/fig3/AS:667828239732738@1536234068086/A-simple-class-diagram-for-a-commercial-software-application-in-UML-notation-The.png"
alt="usecase"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default ViewAssignment;
import React, { useEffect, useState } from "react";
import axios from "axios";
import { GrammarlyEditorPlugin } from "@grammarly/editor-sdk-react";
import { RiDeleteBinLine } from "react-icons/ri";
import { Link } from "react-router-dom";
import Sidebar from "../components/sidebar/Sidebar";
import Spinner from "../components/loading/Spinner";
import Table from "../components/table/Table";
import TopNav from "../components/topnav/TopNav";
import Badge from "../components/badge/Badge";
import "../assets/css/Usercreate.css";
......@@ -16,7 +19,17 @@ const ManageAssignments = () => {
const [material, setMaterial] = useState({ scenario: "" });
const [materials, setMaterials] = useState([]);
const fields = ["Scenario", "Material Name", "Actions"];
const fields = ["", "Module Code", "Name", "Status", "Created At", "Actions"];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const assignments = [
{ code: "A001", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
{ code: "A002", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
{ code: "A003", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
];
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
......@@ -26,7 +39,17 @@ const ManageAssignments = () => {
<td>{item.code}</td>
<td>{item.name}</td>
<td>
<>
<Badge type={permissionStatus[item.status]} content={item.status} />
</td>
<td>{item.createdAt}</td>
<td>
<div style={{ display: "flex", alignItems: "center" }}>
<Link to={`/auth/teacher/assignments/1`}>
<button className="view-btn">View</button>
</Link>
<button className="action-btn check" style={{ marginLeft: "2rem" }}>
<i className="bx bx-edit-alt"></i>
</button>
<button
className="action-btn x"
onClick={() => {
......@@ -37,7 +60,7 @@ const ManageAssignments = () => {
>
<RiDeleteBinLine />
</button>
</>
</div>
</td>
</tr>
);
......@@ -114,18 +137,20 @@ const ManageAssignments = () => {
)}
<div className="row">
<div className="col-12">
<textarea
type="text"
placeholder="Paste question scenario here..."
value={material.code}
onChange={e =>
setMaterial({
...material,
code: e.target.value,
})
}
required
/>
<GrammarlyEditorPlugin clientId="5c891c34-55b1-4504-b1a2-5215d35757ba">
<textarea
type="text"
placeholder="PASTE QUESTION SCENARIO HERE..."
value={material.code}
onChange={e =>
setMaterial({
...material,
code: e.target.value,
})
}
required
/>
</GrammarlyEditorPlugin>
</div>
</div>
<div className="row">
......@@ -133,13 +158,30 @@ const ManageAssignments = () => {
<div className="row-user">
<select name="position" id="position" required>
<option value="position" defaultValue>
Please select class
PLEASE SELECT MODULE
</option>
<option value="class">Class A</option>
<option value="class">Class B</option>
<option value="class">Module A</option>
<option value="class">Module B</option>
</select>
</div>
</div>
<div className="col-4">
<div className="row-user">
<input
type="text"
placeholder="Accepted Plagiarism Percentage"
value={material.name}
onChange={e =>
setMaterial({
...material,
name: e.target.value,
})
}
required
/>
</div>
</div>
</div>
<div className="row-user">
<button type="submit" onClick={saveMaterial}>
......@@ -151,14 +193,14 @@ const ManageAssignments = () => {
</div>
<div className="card col-12">
<h2>Created Assignments</h2>
{isLoading ? (
{false ? (
<Spinner />
) : (
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={materials}
bodyData={assignments}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
)}
......
......@@ -17,7 +17,7 @@ const ManageClasses = () => {
const [material, setMaterial] = useState({ code: "", name: "" });
const [materials, setMaterials] = useState([]);
const fields = ["", "Class Code", "Class Name", "Created At", "Actions"];
const fields = ["", "Module Code", "Module Name", "Created At", "Actions"];
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const classes = [
......@@ -34,7 +34,7 @@ const ManageClasses = () => {
<td>
<div style={{ display: "flex", alignItems: "center" }}>
<Link to={``}>
<button className="view-btn">View Class</button>
<button className="view-btn">View Module</button>
</Link>
<button
className="action-btn x"
......@@ -114,7 +114,7 @@ const ManageClasses = () => {
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">Manage Classes</h1>
<h1 className="page-header">Manage Modules</h1>
<div className="row">
<div className="col-12">
<form className="card" style={{ position: "relative" }}>
......@@ -128,7 +128,7 @@ const ManageClasses = () => {
<div className="row-user">
<input
type="text"
placeholder="Class Code"
placeholder="Module Code"
value={material.code}
onChange={e =>
setMaterial({
......@@ -144,7 +144,7 @@ const ManageClasses = () => {
<div className="row-user">
<input
type="text"
placeholder="Class Name"
placeholder="Module Name"
value={material.name}
onChange={e =>
setMaterial({
......@@ -166,7 +166,7 @@ const ManageClasses = () => {
</div>
</div>
<div className="card col-12">
<h2>Created Classes</h2>
<h2>Created Modules</h2>
{false ? (
<Spinner />
) : (
......
import React, { useState, useContext, useEffect } from "react";
import { RiDeleteBinLine } from "react-icons/ri";
import axios from "axios";
import Sidebar from "../components/sidebar/Sidebar";
......@@ -15,11 +16,20 @@ const ManageStudents = () => {
const { loggedIn } = useContext(AuthContext);
const [suppliers, setSuppliers] = useState([]);
const [isLoading, setIsLoading] = useState(true);
const fields = ["", "Username", "Email", "Class", "Registered At", "Actions"];
const fields = ["", "Username", "Email", "Class", "Enrolled At", "Actions"];
const students = [
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
];
const deleteHandler = async id => {
......@@ -57,15 +67,15 @@ const ManageStudents = () => {
<td>{item.class}</td>
<td>{item.registeredAt}</td>
<td className="">
<button className="action-btn x">
<i
className="bx bx-x"
onClick={() => {
if (window.confirm("Are you sure to remove this student?")) {
deleteHandler(item._id);
}
}}
></i>
<button
className="action-btn x"
onClick={() => {
if (window.confirm("Are you sure to remove this student?")) {
deleteHandler(item._id);
}
}}
>
<RiDeleteBinLine />
</button>
</td>
</tr>
......@@ -77,7 +87,22 @@ const ManageStudents = () => {
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">Manage Students</h1>
<div className="row">
<div className="col-8">
<h1 className="page-header">Manage Students</h1>
</div>
<div className="col-4">
<div className="row-user">
<select name="position" id="position" required>
<option value="position" defaultValue>
FILTER STUDENTS BY MODULE
</option>
<option value="class">Module A</option>
<option value="class">Module B</option>
</select>
</div>
</div>
</div>
<div className="row"></div>
<div className="row">
<div className="col-12">
......@@ -86,7 +111,7 @@ const ManageStudents = () => {
<Spinner />
) : (
<Table
limit="5"
limit="8"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={students}
......
......@@ -31,17 +31,19 @@ const SupplierDashboard = () => {
"Subject Code",
];
const subjects = [
{ ModuleCode: "IT20300", ModuleName: "CTSE", assign: "Assignment 01" },
{ ModuleCode: "IT30300", ModuleName: "DMS", assign: "Assignment 02" },
{ ModuleCode: "IT40300", ModuleName: "SPM", assign: "Assignment 03" }
]
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{item.itemName}</td>
<td>{item.quantity}</td>
<td>{item.total}</td>
<td>{item.address}</td>
<td>{new Date(item.updatedAt).toDateString()}</td>
<td>{ }</td>
<td>{item.assign}</td>
<td>{item.ModuleName}</td>
<td>{item.ModuleCode}</td>
<td>
<div className="row-user" style={{ paddingTop: "0" }}>
{item.DeliveryStatus === "pending" ? (
......@@ -138,9 +140,7 @@ const SupplierDashboard = () => {
<div className="card">
<div className="flex">
<h2 className="request-title">Assignments to complete</h2>
<Link to={`/auth/student/assignments`}>
<button className="view-btn">View All</button>
</Link>
</div>
{/* {isLoading ? (
<Spinner />
......@@ -149,7 +149,7 @@ const SupplierDashboard = () => {
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={orderDetails}
bodyData={subjects}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
{/* ) : (
......
......@@ -17,24 +17,29 @@ const ManageOrdersSupplier = () => {
const [orderDetails, setOrderDetails] = useState([]);
const fields = [
"",
"Module Code",
"Module Code",
"Module Name",
"Year",
"",
"Actions",
];
const subjects = [
{ ModuleCode: "IT20300", ModuleName: "CTSE", Year: "4th Year" },
{ ModuleCode: "IT30300", ModuleName: "DMS", Year: "4th Year" },
{ ModuleCode: "IT40300", ModuleName: "SPM:", Year: "4th Year" }
]
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{"IT2030"}</td>
<td>{"Software Process"}</td>
<td>{item.total}</td>
<td>{item.address}</td>
<td>{new Date(item.updatedAt).toDateString()}</td>
<td style={{ textTransform: "capitalize" }}>{item.DeliveryStatus}</td>
<td>{ }</td>
<td>{item.ModuleCode}</td>
<td>{item.ModuleName}</td>
<td>{item.Year}</td>
<td>{ }</td>
<td><Link to={`/auth/student/assignment`}>
<button className="view-btn">View</button>
</Link></td>
<td>
<div className="row-user" style={{ paddingTop: "0" }}>
{item.DeliveryStatus === "pending" ? (
......@@ -162,19 +167,19 @@ const ManageOrdersSupplier = () => {
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">All Assignments</h1>
<h1 className="page-header">All Modules</h1>
<div className="card">
<h2>Assignments to Complete </h2>
<h2>Subjects You Enrolled </h2>
{/* {isLoading ? (
<Spinner />
) : orderDetails.length > 0 ? ( */}
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={orderDetails}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={subjects}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
{/* ) : (
<>
{setError("No Assignments found")}
......
import React, { useState, useContext, useEffect } from "react";
import axios from "axios";
import { Link } from "react-router-dom";
import { RiDeleteBinLine } from "react-icons/ri";
import Sidebar from "../components/sidebar/Sidebar";
import Spinner from "../components/loading/Spinner";
......@@ -22,7 +23,7 @@ const TeacherDashboard = () => {
const { loggedIn } = useContext(AuthContext);
const [suppliers, setSuppliers] = useState([]);
const [isLoading, setIsLoading] = useState(true);
const fields = ["", "Name", "Class Code", "Status", "Actions"];
const fields = ["", "Name", "Module Code", "Status", "Actions"];
const permissionStatus = {
pending: "warning",
......@@ -95,15 +96,15 @@ const TeacherDashboard = () => {
}}
></i>
</button>
<button className="action-btn x">
<i
className="bx bx-x"
onClick={() => {
if (window.confirm("Are you sure to remove this assignment?")) {
deleteHandler(item._id);
}
}}
></i>
<button
className="action-btn x"
onClick={() => {
if (window.confirm("Are you sure to remove this assignment?")) {
deleteHandler(item._id);
}
}}
>
<RiDeleteBinLine />
</button>
</>
)}
......@@ -152,7 +153,7 @@ const TeacherDashboard = () => {
<div className="card">
<div className="flex">
<h2 className="request-title">Recent Assignments</h2>
<Link to={`/auth/manager/suppliers`}>
<Link to={`/auth/teacher/assignments`}>
<button className="view-btn">View All</button>
</Link>
</div>
......
import axios from "axios";
import { Link } from "react-router-dom";
import React, { useEffect, useState } from "react";
import Sidebar from "../components/sidebar/Sidebar";
import TopNav from "../components/topnav/TopNav";
import Table from "../components/table/Table";
import Badge from "../components/badge/Badge";
import Spinner from "../components/loading/Spinner";
import { RiDeleteBinLine } from "react-icons/ri";
import Popup from "./Popup";
const ViewAssignment = () => {
const siteId = localStorage.getItem("site");
const [Materials, setMaterials] = useState([]);
const students = [
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 40,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 10,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 30,
CorrectnessPercentage: 70,
},
];
const fields = [
"",
"Student Email",
"Submission",
"Plagiarism Percentage",
"Correctness Percentage",
"Submitted At",
"Action",
];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const [OrderDetail, setOrderDetail] = useState([]);
const [Loading, setLoading] = useState(false);
const [Trigger, setTrigger] = useState(false);
const [Name, setName] = useState("");
const [Id, setId] = useState("");
const [ItemName, setItemName] = useState("");
const [Description, setDescription] = useState("");
const [Order, setOrder] = useState({
item: {},
quantity: 0,
siteid: siteId,
requiredDate: "",
urgentOrder: false,
});
console.log(Order);
const FetchData = async () => {
const resMaterials = await axios.get(`materials`);
setMaterials(resMaterials.data.materials);
const resOrders = await axios.get("/orders");
setOrderDetail(resOrders.data.orders);
if (resOrders.statusText === "OK") {
setLoading(true);
}
};
useEffect(() => {
FetchData();
}, []);
const deleteHandler = async id => {
console.log(id);
try {
const res = await axios.delete(`/orders/delete/${id}`);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
const orderHandler = async () => {
try {
console.log(Order);
const res = await axios.post("/orders", Order);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{item.email}</td>
<td>{item.submission}</td>
<td>
{item.plagiarismPercentage >= 20 ? (
<Badge type={permissionStatus.rejected} content={item.plagiarismPercentage + "%"} />
) : (
<Badge type={permissionStatus.approved} content={item.plagiarismPercentage + "%"} />
)}
</td>
<td>{item.CorrectnessPercentage + "%"}</td>
<td>{item.submittedAt}</td>
<td>
<div style={{ display: "flex", alignItems: "center" }}>
<button className="action-btn check">
<i
className="bx bx-check"
onClick={() => {
if (window.confirm("Are you sure to accept this submission?")) {
// successHandler(item._id);
}
}}
></i>
</button>
<button
className="action-btn x"
style={{ marginRight: "2rem" }}
onClick={() => {
if (window.confirm("Are you sure to remove this submission?")) {
deleteHandler(item._id);
}
}}
>
<RiDeleteBinLine />
</button>
<Link to={``}>
<button className="view-btn">View</button>
</Link>
</div>
</td>
</tr>
);
return (
<div>
<Sidebar />
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">CTSE Assignment 01</h1>
<div className="row">
<div className="col-12">
<div className="card">
<div className="row">
<div className="col-10">
<h3>
Analyze the case study given below and draw a usecase and class diagram.
</h3>
</div>
<div className="col-1">
<Link to={`/auth/teacher/assignments/1/diagrams`}>
<button className="view-btn">View Generated Diagrams</button>
</Link>
</div>
</div>
<br />
<p>
GlamourFashions (GF) is a clothing store situated in Colombo and its planning
to build an online shopping system to promote their sales further. The management
of clothing store hired you as a System Analyst and asked to come up with the
design models for GlamourFashions Online Store (GFOS). GlamourFashions (GF) Online
Clothing Store is expected to organize clothing items under several categories
like office wear, casual wear, evening wear and so on. A visitor can browse on
items without being registering to the system. If he/she likes to order item, the
system facilitates to add selected items into the shopping cart and directly move
to checkout option. If the user interested to be a regular user, the system will
provide registration facility as well. Without even registering, the user can
directly go for the checkout. For a registered user, the system is expected to
send a promotion code for users mobile every month which can be used only once.
when the user logs into the system to do online shopping, user can enter this code
which will give a 5% discount for the order he/she makes. If the user does not use
the code within the month, automatically the system must discard promotion code.
If its been already used, the system must display a message saying its already
been used.
</p>
</div>
</div>
</div>
<div className="row ">
<div className="col-12">
<div className="card">
<h2>Student Submissions</h2>
{false ? (
<Spinner />
) : (
<Table
limit="8"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={students}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
)}
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default ViewAssignment;
......@@ -7,6 +7,7 @@ import Inventory from "../pages/Inventory";
import Login from "../pages/Login";
import ManageAllOrders from "../pages/ManageAllOrders";
import ManageDeliveryReports from "../pages/ManageDeliveryReports";
import ManageAssignments from "../pages/ManageAssignments";
import SubjectsStudent from "../pages/SubjectsStudent";
import ManagerApprovedOrders from "../pages/ManagerApprovedOrders";
import TeacherDashboard from "../pages/TeacherDashboard";
......@@ -17,8 +18,10 @@ import OfficerDashboard from "../pages/OfficerDashboard";
import OfficerOrders from "../pages/OfficerOrders";
import Register from "../pages/Register";
import SiteManagerDashboard from "../pages/SiteManagerDashboard";
import SiteManagerForm from "../pages/SiteManagerForm";
import StudentSubjectAssingment from "../pages/StudentSubjectAssingment";
import ViewAssignment from "../pages/ViewAssignment";
import StudentDashboard from "../pages/StudentDashboard";
import GeneratedDiagrams from "../pages/GeneratedDiagrams";
import { AuthContext } from "../contexts/AuthContext";
......@@ -29,36 +32,22 @@ const Routes = () => {
return (
<Switch>
<Route exact path="/" component={Login} />
<Route exact path="/register" component={Register} />
<Route exact path="/login" component={Login} />
<Route exact path="/auth/teacher/dashboard" component={TeacherDashboard} />
{/* <Route exact path="/auth/teacher/users" component={ManageUsers} /> */}
{/* <Route exact path="/auth/teacher/sites" component={ManageSites} /> */}
{/* <Route exact path="/auth/teacher/materials" component={ManageMaterials} /> */}
{/* <Route exact path="/auth/teacher/suppliers" component={ManageSuppliers} /> */}
<Route exact path="/auth/student/dashboard" component={StudentDashboard} />
<Route exact path="/auth/student/subjects" component={SubjectsStudent} />
<Route exact path="/auth/teacher/students" component={ManageStudents} />
<Route exact path="/auth/teacher/classes" component={ManageClasses} />
{/* <Route exact path="/auth/teacher/assignments" component={ManageAssignments} /> */}
<Route exact path="/auth/teacher/modules" component={ManageClasses} />
<Route exact path="/auth/teacher/assignments" component={ManageAssignments} />
<Route exact path="/auth/teacher/assignments/:id" component={ViewAssignment} />
<Route exact path="/auth/teacher/assignments/:id/diagrams" component={GeneratedDiagrams} />
<Route exact path="/auth/student/dashboard" component={StudentDashboard} />
<Route exact path="/auth/student/modules" component={SubjectsStudent} />
<Route exact path="/auth/student/services" component={ManageServices} />
<Route exact path="/auth/student/deliveryreports/:id" component={DeliveryReportSubmit} />
<Route exact path="/auth/student/deliveryreports" component={ManageDeliveryReports} />
<Route exact path="/auth/officer/dashboard" component={OfficerDashboard} />
{/* <Route exact path="/auth/sitemanager/dashboard" component={SiteManagerDashboard} /> */}
<Route exact path="/auth/officers/orderlist" component={OfficerOrders} />
<Route exact path="/auth/officers/form" component={Assign} />
<Route exact path="/auth/sitemanager/requisitions" component={SiteManagerForm} />
<Route exact path="/auth/sitemanager/inventory" component={Inventory} />
<Route exact path="/auth/manager/allorders" component={ManageAllOrders} />
<Route exact path="/auth/manager/ApprovedOrders" component={ManagerApprovedOrders} />
<Route exact path="/auth/student/assignment" component={StudentSubjectAssingment} />
</Switch>
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment