Commit 90e496bc authored by Kumarasinghe C.A.W.'s avatar Kumarasinghe C.A.W.

Automated ER Diagram Generation and Query Generation

parent f55d0806
Pipeline #7212 canceled with stages
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
{"Event": ["e_id", "e_title", "e_date", "e_venue"], "Customer": ["c_id", "c_name", "c_contact_info", "c_ticket_history"], "Attendee": ["a_id", "a_event_id", "a_customer_id"], "Ticket": ["t_id", "t_price", "t_event_id", "t_capacity", "t_scanning"]}
\ No newline at end of file
["Event", "Customer", "Attendee", "Ticket"]
\ No newline at end of file
{"has": {"left": ["Event", "M"], "right": ["Attendee", "M"]}, "purchases": {"left": ["Customer", "M"], "right": ["Ticket", "M"]}, "attends": {"left": ["Attendee", "M"], "right": ["Event", "M"]}}
\ No newline at end of file
"CREATE TABLE Event (e_id VARCHAR(255), e_title VARCHAR(255), e_date VARCHAR(255), e_venue VARCHAR(255));\nCREATE TABLE Customer (c_id VARCHAR(255), c_name VARCHAR(255), c_contact_info VARCHAR(255), c_ticket_history VARCHAR(255));\nCREATE TABLE Attendee (a_id VARCHAR(255), a_event_id VARCHAR(255), a_customer_id VARCHAR(255));\nCREATE TABLE Ticket (t_id VARCHAR(255), t_price VARCHAR(255), t_event_id VARCHAR(255), t_capacity VARCHAR(255), t_scanning VARCHAR(255));\nALTER TABLE Event ADD CONSTRAINT FK_Event_Attendee FOREIGN KEY (event_id) REFERENCES Attendee(attendee_id);\nALTER TABLE Customer ADD CONSTRAINT FK_Customer_Ticket FOREIGN KEY (customer_id) REFERENCES Ticket(ticket_id);\nALTER TABLE Attendee ADD CONSTRAINT FK_Attendee_Event FOREIGN KEY (attendee_id) REFERENCES Event(event_id);"
\ No newline at end of file
File added
This diff is collapsed.
import nltk
nltk.download('wordnet')
matplotlib==3.7.1
nltk==3.8.1
numpy==1.23.5
pandas==2.0.2
scikit-learn==1.2.2
seaborn==0.12.2
joblib==1.2.0
imutils==0.5.4
Flask==2.3.2
keras-ocr==0.8.9
openai==0.27.8
tensorflow==2.12.0
seaborn==0.12.2
wheel==0.40.0
spellchecker==0.4
yarl==1.9.2
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Add the Bootstrap CSS link here -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<!-- Add Font Awesome CSS link here -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<style>
/* Additional CSS styles */
.navbar {
background-color: #333;
}
.navbar-nav .nav-link {
color: white;
}
.navbar-nav .nav-link:hover {
color: yellow;
}
.carousel-container {
background-color: #000; /* Set your desired background color */
overflow: hidden;
}
.carousel-item img {
width: 100%;
height: 100%;
object-fit: cover; /* Ensure the image covers the entire slide */
}
.carousel {
width: 100%; /* Set carousel width to 100% */
height: 100%;
}
</style>
</head>
<body>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="#">ER DIAGRAM TOOL</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
{% if user_role == 'student' %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('generate_er_diagram') }}"><i class="fas fa-database"></i> ER Diagram Generator</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('quiz') }}"><i class="fas fa-question-circle"></i> AI Based Quiz</a>
</li>
{% elif user_role == 'teacher' %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('generate_er_diagram') }}"><i class="fas fa-database"></i> ER Diagram Generator</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('extract') }}"><i class="fas fa-project-diagram"></i> ER Diagram Extractor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('similarity') }}"><i class="fas fa-search"></i> Similarity Checker</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('quiz_count') }}"><i class="fas fa-search"></i> Quiz count</a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('logout') }}"><i class="fas fa-sign-out-alt"></i> Logout {{user_role}}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('home') }}"><i class="fas fa-home"></i> Home</a>
</li>
</ul>
</div>
</nav>
<!-- Content Area -->
<!--<div class="container">-->
<div id="carouselExample" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="/static/diagram.webp" class="d-block w-100" alt="Slide 1">
</div>
<div class="carousel-item">
<img src="/static/diagram2.webp" class="d-block w-100" alt="Slide 2">
</div>
<div class="carousel-item">
<img src="/static/diagram3.webp" class="d-block w-100" alt="Slide 3">
</div>
<div class="carousel-item">
<img src="/static/diagram4.webp" class="d-block w-100" alt="Slide 4">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExample" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExample" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!--</div>-->
<!-- Bootstrap JS, Popper.js, and jQuery scripts -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@2.9.1/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Add the Bootstrap CSS link here -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<!-- Add Font Awesome CSS link here -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ER Diagram Generator</title>
<style>
/* Additional CSS styles */
/* Add your custom styles here */
</style>
</head>
<body>
<!-- Navigation Bar (if needed) -->
<!-- Content Area -->
<div class="container mt-4">
<h2>ER Diagram Generator</h2>
<form method="POST" action="{{ url_for('generate_er_diagram') }}">
{{ form.hidden_tag() }}
<div class="form-group">
{{ form.user_input.label(class="form-control-label") }}
{{ form.user_input(class="form-control") }}
</div>
<div class="row">
<div class="col-md-1">
<button type="submit" class="btn btn-primary custom-btn">Generate</button>
</div>
<div class="col-md-2">
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary custom-btn">Back</a>
</div>
</div>
</form>
<!-- Display ER Diagram here -->
{% if er_diagram %}
<div class="mt-4">
<h3>Generated ER Diagram</h3>
<img src="{{ url_for('static', filename='er_diagram.png') }}" class="img-fluid" alt="ER Diagram">
<!-- Add a download button for the image -->
<a href="{{ url_for('static', filename='er_diagram.png') }}" download="er_diagram.png" class="btn btn-primary mt-2">
Download ER Diagram
</a>
</div>
{% endif %}
<!-- Display SQL Queries here -->
{% if sql_queries %}
<div class="mt-4">
<h3>Generated SQL Queries</h3>
<pre>{{ sql_queries }}</pre>
</div>
{% endif %}
</div>
<!-- Bootstrap JS scripts and other JS dependencies (if needed) -->
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Add the Bootstrap CSS link here -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ER Diagram Tool</title>
<style>
/* Additional CSS styles */
body, html {
height: 100%;
background: url('/static/back.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.card {
width: fit-content;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<div class="card-body text-center">
<h1 class="card-title">WELCOME TO THE ER DIAGRAM TOOL</h1>
<p class="card-text">Please register or log in to use this tool.</p>
<a href="{{ url_for('login') }}" class="btn btn-primary btn-lg btn-block">Login</a>
<a href="{{ url_for('register') }}" class="btn btn-success btn-lg btn-block mt-3">Register</a>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Add the Bootstrap CSS link here -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<style>
body {
font-family: Arial, sans-serif;
background: url('/static/cover.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.card {
max-width: 400px;
width: 100%;
}
.card-body {
padding: 20px;
}
input[type="text"], input[type="password"] {
font-size: 16px;
}
</style>
</head>
<body>
<div class="card">
<div class="card-body text-center">
<h1 class="card-title">LOGIN PAGE</h1>
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="form-group">
{{ form.username(class="form-control", placeholder="Username") }}
</div>
<div class="form-group">
{{ form.password(class="form-control", placeholder="Password") }}
</div>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
<a href="{{ url_for('register') }}" class="mt-3">Don't have an account? Sign Up</a>
<div>
<a href="{{ url_for('home') }}">Back to Home</a>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Add the Bootstrap CSS link here -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register</title>
<style>
body {
font-family: Arial, sans-serif;
background: url('/static/cover.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.card {
max-width: 400px;
width: 100%;
}
.card-body {
padding: 20px;
}
input[type="text"], input[type="password"] {
font-size: 16px;
}
</style>
</head>
<body>
<div class="card">
<div class="card-body text-center">
<h1 class="card-title">REGISTER PAGE</h1>
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="form-group">
{{ form.username(class="form-control", placeholder="Username") }}
</div>
<div class="form-group">
{{ form.password(class="form-control", placeholder="Password") }}
</div>
<button type="submit" class="btn btn-success btn-block">Register</button>
</form>
<a href="{{ url_for('login') }}" class="mt-3">Already have an account? Log In</a>
<div>
<a href="{{ url_for('home') }}">Back to Home</a>
</div>
</div>
</div>
</body>
</html>
id,username,password,role
1,student,student,student
2,teacher,teacher,teacher
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