Spaces:
Sleeping
Sleeping
Commit
·
cce2a89
1
Parent(s):
250ab6b
all code files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitignore +160 -0
- Dockerfile +14 -0
- LICENSE +21 -0
- app.py +242 -0
- config.py +9 -0
- data_connector/fakedata_generator.py +14 -0
- data_connector/sqlite_connector.py +15 -0
- lang_assistant/langhelper.py +301 -0
- referencefiles/badges.csv +0 -0
- referencefiles/workforce.csv +0 -0
- requirements.txt +13 -0
- static/css/chat_style.css +191 -0
- static/css/data_style.css +72 -0
- static/css/home_style.css +32 -0
- static/css/layout_style.css +50 -0
- static/css/validate_style.css +78 -0
- static/images/aichat.png +0 -0
- static/images/aichat1.png +0 -0
- static/images/aichat2.png +0 -0
- static/images/aichat3.png +0 -0
- static/images/bot.png +0 -0
- static/images/bot1.png +0 -0
- static/images/bot2.png +0 -0
- static/images/labormarket - Copy.jpeg +0 -0
- static/images/labormarket.jpeg +0 -0
- static/images/send.png +0 -0
- static/images/send1.png +0 -0
- static/images/send2.png +0 -0
- static/images/send3.png +0 -0
- static/images/send4.png +0 -0
- static/images/send5.png +0 -0
- static/images/user-5.png +0 -0
- static/images/user.png +0 -0
- static/images/user1.png +0 -0
- static/images/user2.png +0 -0
- static/images/user3.png +0 -0
- static/images/user4.png +0 -0
- static/images/user6.png +0 -0
- static/images/user7.png +0 -0
- static/js/data_script.js +83 -0
- static/js/home_script.js +47 -0
- static/js/mytest.js +79 -0
- static/js/validate_script.js +723 -0
- templates/chatfile8.html +63 -0
- templates/data.html +114 -0
- templates/home.html +72 -0
- templates/index.html +179 -0
- templates/lay_side.html +130 -0
- templates/survey_display.html +93 -0
- templates/validate_badges.html +156 -0
.gitignore
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
share/python-wheels/
|
| 24 |
+
*.egg-info/
|
| 25 |
+
.installed.cfg
|
| 26 |
+
*.egg
|
| 27 |
+
MANIFEST
|
| 28 |
+
|
| 29 |
+
# PyInstaller
|
| 30 |
+
# Usually these files are written by a python script from a template
|
| 31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 32 |
+
*.manifest
|
| 33 |
+
*.spec
|
| 34 |
+
|
| 35 |
+
# Installer logs
|
| 36 |
+
pip-log.txt
|
| 37 |
+
pip-delete-this-directory.txt
|
| 38 |
+
|
| 39 |
+
# Unit test / coverage reports
|
| 40 |
+
htmlcov/
|
| 41 |
+
.tox/
|
| 42 |
+
.nox/
|
| 43 |
+
.coverage
|
| 44 |
+
.coverage.*
|
| 45 |
+
.cache
|
| 46 |
+
nosetests.xml
|
| 47 |
+
coverage.xml
|
| 48 |
+
*.cover
|
| 49 |
+
*.py,cover
|
| 50 |
+
.hypothesis/
|
| 51 |
+
.pytest_cache/
|
| 52 |
+
cover/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
.pybuilder/
|
| 76 |
+
target/
|
| 77 |
+
|
| 78 |
+
# Jupyter Notebook
|
| 79 |
+
.ipynb_checkpoints
|
| 80 |
+
|
| 81 |
+
# IPython
|
| 82 |
+
profile_default/
|
| 83 |
+
ipython_config.py
|
| 84 |
+
|
| 85 |
+
# pyenv
|
| 86 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 88 |
+
# .python-version
|
| 89 |
+
|
| 90 |
+
# pipenv
|
| 91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 94 |
+
# install all needed dependencies.
|
| 95 |
+
#Pipfile.lock
|
| 96 |
+
|
| 97 |
+
# poetry
|
| 98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 100 |
+
# commonly ignored for libraries.
|
| 101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 102 |
+
#poetry.lock
|
| 103 |
+
|
| 104 |
+
# pdm
|
| 105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 106 |
+
#pdm.lock
|
| 107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 108 |
+
# in version control.
|
| 109 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 110 |
+
.pdm.toml
|
| 111 |
+
|
| 112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 113 |
+
__pypackages__/
|
| 114 |
+
|
| 115 |
+
# Celery stuff
|
| 116 |
+
celerybeat-schedule
|
| 117 |
+
celerybeat.pid
|
| 118 |
+
|
| 119 |
+
# SageMath parsed files
|
| 120 |
+
*.sage.py
|
| 121 |
+
|
| 122 |
+
# Environments
|
| 123 |
+
.env
|
| 124 |
+
.venv
|
| 125 |
+
env/
|
| 126 |
+
venv/
|
| 127 |
+
ENV/
|
| 128 |
+
env.bak/
|
| 129 |
+
venv.bak/
|
| 130 |
+
|
| 131 |
+
# Spyder project settings
|
| 132 |
+
.spyderproject
|
| 133 |
+
.spyproject
|
| 134 |
+
|
| 135 |
+
# Rope project settings
|
| 136 |
+
.ropeproject
|
| 137 |
+
|
| 138 |
+
# mkdocs documentation
|
| 139 |
+
/site
|
| 140 |
+
|
| 141 |
+
# mypy
|
| 142 |
+
.mypy_cache/
|
| 143 |
+
.dmypy.json
|
| 144 |
+
dmypy.json
|
| 145 |
+
|
| 146 |
+
# Pyre type checker
|
| 147 |
+
.pyre/
|
| 148 |
+
|
| 149 |
+
# pytype static type analyzer
|
| 150 |
+
.pytype/
|
| 151 |
+
|
| 152 |
+
# Cython debug symbols
|
| 153 |
+
cython_debug/
|
| 154 |
+
|
| 155 |
+
# PyCharm
|
| 156 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 157 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 158 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 159 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 160 |
+
#.idea/
|
Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# you will also find guides on how best to write your Dockerfile
|
| 3 |
+
|
| 4 |
+
FROM python:3.9
|
| 5 |
+
|
| 6 |
+
WORKDIR /code
|
| 7 |
+
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 11 |
+
|
| 12 |
+
COPY . .
|
| 13 |
+
|
| 14 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 binaychandra
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
app.py
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Standard Library Imports
|
| 2 |
+
from flask import ( Flask, jsonify, render_template, request,
|
| 3 |
+
url_for,
|
| 4 |
+
make_response,
|
| 5 |
+
session,
|
| 6 |
+
send_file,
|
| 7 |
+
Response,
|
| 8 |
+
render_template_string,
|
| 9 |
+
redirect)
|
| 10 |
+
import pandas as pd
|
| 11 |
+
import plotly.graph_objects as go
|
| 12 |
+
from sqlalchemy import create_engine
|
| 13 |
+
from config import tbl_mapping
|
| 14 |
+
from data_connector.sqlite_connector import get_db_connection
|
| 15 |
+
from lang_assistant.langhelper import chat_response, summary_extractor_from_df, chat_with_df, generate_graphdata
|
| 16 |
+
from utilities.plotting import (get_validation_json,
|
| 17 |
+
badges_get_pillar_dougnutdata,
|
| 18 |
+
badges_get_badgecompletion_monthwise,
|
| 19 |
+
get_wfrankwise_countmom,
|
| 20 |
+
get_lst_topdepartment,
|
| 21 |
+
get_wfrankwise_count,
|
| 22 |
+
get_topfive_badgetitle)
|
| 23 |
+
import sqlite3
|
| 24 |
+
import time
|
| 25 |
+
import json
|
| 26 |
+
|
| 27 |
+
app = Flask(__name__, static_url_path='/static')
|
| 28 |
+
app.secret_key = 'test'
|
| 29 |
+
|
| 30 |
+
@app.route("/validate_learning", methods=['GET'])
|
| 31 |
+
def load_learning():
|
| 32 |
+
# con = sqlite3.connect("database.db")
|
| 33 |
+
# df = pd.read_sql_query(f"SELECT * from learning", con)
|
| 34 |
+
df = pd.DataFrame({'ID':[12,13], 'Status':['Done', 'In Progress']})
|
| 35 |
+
no_rows, no_cols = df.shape
|
| 36 |
+
n_gui = df.GUI.nunique() if 'GUI' in df.columns else 'GUI not Found'
|
| 37 |
+
|
| 38 |
+
tablevalues = {'n_rows':no_rows, 'n_cols':no_cols, 'unique_gui':n_gui}
|
| 39 |
+
print('Calculation done')
|
| 40 |
+
# Data for the bar chart
|
| 41 |
+
bar_chart_data = {
|
| 42 |
+
'labels': ['Label 1', 'Label 2', 'Label 3', 'Label 4', 'Label 5'],
|
| 43 |
+
'values': [30, 40, 30, 21, 34]
|
| 44 |
+
}
|
| 45 |
+
# Data for the pie chart
|
| 46 |
+
pie_chart_data = {
|
| 47 |
+
'labels': ['Label A', 'Label B', 'Label C', 'Label D', 'Label E'],
|
| 48 |
+
'values': [45, 30, 25, 9, 34]
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# Create the bar chart figure
|
| 52 |
+
bar_chart_figure = go.Figure(
|
| 53 |
+
data=[
|
| 54 |
+
go.Bar(
|
| 55 |
+
x=bar_chart_data['labels'],
|
| 56 |
+
y=bar_chart_data['values'],
|
| 57 |
+
marker_color='rgba(54, 162, 235, 0.5)',
|
| 58 |
+
marker_line_color='rgba(54, 162, 235, 1)',
|
| 59 |
+
marker_line_width=1
|
| 60 |
+
)
|
| 61 |
+
],
|
| 62 |
+
layout=go.Layout(
|
| 63 |
+
title='Bar Chart',
|
| 64 |
+
yaxis=dict(title='Values'),
|
| 65 |
+
margin=dict(l=20, r=20, t=40, b=20)
|
| 66 |
+
)
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
# Create the pie chart figure
|
| 70 |
+
pie_chart_figure = go.Figure(
|
| 71 |
+
data=[
|
| 72 |
+
go.Pie(
|
| 73 |
+
labels=pie_chart_data['labels'],
|
| 74 |
+
values=pie_chart_data['values'],
|
| 75 |
+
hole=0.3,
|
| 76 |
+
marker=dict(colors=['rgba(255, 99, 132, 0.5)', 'rgba(54, 162, 235, 0.5)', 'rgba(255, 206, 86, 0.5)'],
|
| 77 |
+
line=dict(color='rgba(0, 0, 0, 0.5)', width=1))
|
| 78 |
+
)
|
| 79 |
+
],
|
| 80 |
+
layout=go.Layout(
|
| 81 |
+
title='Pie Chart',
|
| 82 |
+
margin=dict(l=20, r=20, t=40, b=20)
|
| 83 |
+
)
|
| 84 |
+
)
|
| 85 |
+
# Convert the figures to HTML
|
| 86 |
+
bar_chart_html = bar_chart_figure.to_html(full_html=False)
|
| 87 |
+
pie_chart_html = pie_chart_figure.to_html(full_html=False)
|
| 88 |
+
|
| 89 |
+
data = {
|
| 90 |
+
'Regex issue': [-90, -10, -5, 0],
|
| 91 |
+
'Null percentage': [-10, -35, 0, 0],
|
| 92 |
+
'Seems ok': [40, 45, 90, 100],
|
| 93 |
+
'data mismatch': [0, -10, -5, 0]
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
df = pd.DataFrame(data, index=['GTE', 'SMU', 'Service_Line', 'Sub_SL'])
|
| 97 |
+
|
| 98 |
+
labels = df.index.to_list()
|
| 99 |
+
reg_issue = df['Regex issue'].to_list()
|
| 100 |
+
null_issue = df['Null percentage'].to_list()
|
| 101 |
+
ok_data = df['Seems ok'].to_list()
|
| 102 |
+
mismatch_issue = df['data mismatch'].to_list()
|
| 103 |
+
tbl_selected = session.get('tbl_selected', [])
|
| 104 |
+
|
| 105 |
+
return render_template("validate_learning.html",
|
| 106 |
+
req_tables = tbl_selected,
|
| 107 |
+
bar_chart_html=bar_chart_html,
|
| 108 |
+
pie_chart_html=pie_chart_html,
|
| 109 |
+
table_info = tablevalues,
|
| 110 |
+
labels = labels, reg_issue=reg_issue,
|
| 111 |
+
null_issue=null_issue, ok_data=ok_data , mismatch_issue=mismatch_issue,
|
| 112 |
+
show_sidebar=True)
|
| 113 |
+
|
| 114 |
+
@app.route("/validate_badges", methods=['GET', 'POST'])
|
| 115 |
+
def load_badges():
|
| 116 |
+
con = sqlite3.connect("database.db")
|
| 117 |
+
df = pd.read_sql_query(f"SELECT * from badges", con)
|
| 118 |
+
no_rows, no_cols = df.shape
|
| 119 |
+
n_gui = df.GUI.nunique() if 'GUI' in df.columns else 'GUI not Found'
|
| 120 |
+
|
| 121 |
+
tablevalues = {'n_rows':no_rows, 'n_cols':no_cols, 'unique_gui':n_gui}
|
| 122 |
+
print('Calculation done')
|
| 123 |
+
|
| 124 |
+
tbl_selected = session.get('tbl_selected', [])
|
| 125 |
+
|
| 126 |
+
json_data = get_validation_json('badges')
|
| 127 |
+
json_pillar_data = badges_get_pillar_dougnutdata()
|
| 128 |
+
json_badgecompletion_data = badges_get_badgecompletion_monthwise()
|
| 129 |
+
lst_topfive_badgetitle = get_topfive_badgetitle()
|
| 130 |
+
|
| 131 |
+
return render_template("validate_badges.html",
|
| 132 |
+
lst_topfive_badgetitle = lst_topfive_badgetitle,
|
| 133 |
+
req_tables = tbl_selected,
|
| 134 |
+
table_info = tablevalues,
|
| 135 |
+
json_data = json_data,
|
| 136 |
+
json_pillar_data=json_pillar_data,
|
| 137 |
+
json_badgecompletion_data = json_badgecompletion_data,
|
| 138 |
+
show_sidebar=True)
|
| 139 |
+
|
| 140 |
+
@app.route("/validation", methods=['GET', 'POST'])
|
| 141 |
+
@app.route("/validate_workforce", methods=['GET', 'POST'])
|
| 142 |
+
def load_workforce():
|
| 143 |
+
# con = sqlite3.connect("database.db")
|
| 144 |
+
# df = pd.read_sql_query(f"SELECT * from workforce", con)
|
| 145 |
+
df = pd.read_csv(r"referencefiles\workforce.csv")
|
| 146 |
+
no_rows, no_cols = df.shape
|
| 147 |
+
n_gui = df.GUI.nunique() if 'GUI' in df.columns else 'GUI not Found'
|
| 148 |
+
|
| 149 |
+
tablevalues = {'n_rows':no_rows, 'n_cols':no_cols, 'unique_gui':n_gui}
|
| 150 |
+
|
| 151 |
+
json_val_data = get_validation_json('workforce')
|
| 152 |
+
json_empdist = get_wfrankwise_countmom()
|
| 153 |
+
lst_topfive_dept = get_lst_topdepartment()
|
| 154 |
+
json_rankwise_empdist = get_wfrankwise_count()
|
| 155 |
+
tbl_selected = session.get('tbl_selected', []) #['Badges', 'learning']
|
| 156 |
+
gpt_response = summary_extractor_from_df("""{"male": 56, "female": 44 }""")
|
| 157 |
+
|
| 158 |
+
return render_template("validate_workforce.html",
|
| 159 |
+
req_tables = tbl_selected,
|
| 160 |
+
table_info = tablevalues,
|
| 161 |
+
json_data = json_val_data,
|
| 162 |
+
json_empdist = json_empdist,
|
| 163 |
+
lst_topfive_dept = lst_topfive_dept,
|
| 164 |
+
json_rankwise_empdist = json_rankwise_empdist,
|
| 165 |
+
aicontent_genderanalysis = gpt_response,
|
| 166 |
+
show_sidebar = True)
|
| 167 |
+
|
| 168 |
+
@app.route("/validate_miscellaneous", methods=['GET', 'POST'])
|
| 169 |
+
def load_miscellaneous():
|
| 170 |
+
tbl_selected = session.get('tbl_selected', [])
|
| 171 |
+
return render_template("validate_miscellaneous.html",
|
| 172 |
+
req_tables = tbl_selected,
|
| 173 |
+
show_sidebar = True)
|
| 174 |
+
|
| 175 |
+
@app.route("/timecard.html", methods=['GET', 'POST'])
|
| 176 |
+
def load_timecard():
|
| 177 |
+
return render_template("timecard.html")
|
| 178 |
+
|
| 179 |
+
@app.route("/get_llmresponse")
|
| 180 |
+
def get_bot_response():
|
| 181 |
+
user_message = request.args.get('msg')
|
| 182 |
+
dd_table_selected = request.args.get('table_selected')
|
| 183 |
+
print(f"user message and table selected : {user_message}, {dd_table_selected}")
|
| 184 |
+
print(f"request args : {request.args.get('msg')}")
|
| 185 |
+
response_usrmsg = chat_with_df(user_message, table_name = dd_table_selected)
|
| 186 |
+
return response_usrmsg
|
| 187 |
+
|
| 188 |
+
@app.route("/get_val_llmresponse")
|
| 189 |
+
def get_bot_valresponse():
|
| 190 |
+
user_message = request.args.get('msg')
|
| 191 |
+
table_selected = request.args.get('table_selected')
|
| 192 |
+
print(f"user message and table selected : {user_message}, {table_selected}")
|
| 193 |
+
print(f"request args : {request.args.get('msg')}")
|
| 194 |
+
|
| 195 |
+
try:
|
| 196 |
+
llm_response_dict = generate_graphdata(user_message, table_name = table_selected)
|
| 197 |
+
except Exception as e:
|
| 198 |
+
llm_response_dict = dict(success=False,
|
| 199 |
+
chart_type='text',
|
| 200 |
+
chart_label=None,
|
| 201 |
+
chart_json_data=None,
|
| 202 |
+
text_to_display="Exception : Some error occured while processing, "+str(e)[:50] + "..")
|
| 203 |
+
|
| 204 |
+
print(llm_response_dict)
|
| 205 |
+
output_gendata = json.dumps(llm_response_dict)
|
| 206 |
+
return output_gendata
|
| 207 |
+
|
| 208 |
+
@app.route("/data.html", methods=['GET', 'POST'])
|
| 209 |
+
@app.route("/data", methods=['GET', 'POST'])
|
| 210 |
+
def data():
|
| 211 |
+
tbl_htmls = {}
|
| 212 |
+
tbl_selected = session.get('tbl_selected', [])
|
| 213 |
+
print(tbl_selected)
|
| 214 |
+
for tblname in tbl_selected:
|
| 215 |
+
# Read sqlite query results into a pandas DataFrame
|
| 216 |
+
# con = sqlite3.connect("database.db")
|
| 217 |
+
# df = pd.read_sql_query(f"SELECT * from {tblname}", con)
|
| 218 |
+
df = pd.read_csv(f"referencefiles\{tblname}.csv")
|
| 219 |
+
top_records = df.copy()
|
| 220 |
+
# con.close()
|
| 221 |
+
html_top_records = top_records.to_html(index=False, table_id= f'dtable_{tblname}', classes='display nowrap table table-bordered table-striped table-condensed small p-1', justify='left')
|
| 222 |
+
html_top_records = html_top_records.replace('<thead>', '<thead class="thead-light" style="top: 0;position: sticky;">')
|
| 223 |
+
tbl_htmls[tblname] = html_top_records
|
| 224 |
+
|
| 225 |
+
return render_template('data.html', table_htmls = tbl_htmls, req_tables = json.dumps(tbl_selected[0]))
|
| 226 |
+
|
| 227 |
+
@app.route("/", methods=['GET', 'POST'])
|
| 228 |
+
@app.route("/home", methods=['GET', 'POST'])
|
| 229 |
+
def hometest():
|
| 230 |
+
if request.method == 'GET':
|
| 231 |
+
return render_template('home.html')
|
| 232 |
+
elif request.method == 'POST':
|
| 233 |
+
session['start_date'] = request.form.get('calendar_value').split(":")[0]
|
| 234 |
+
session['end_date'] = request.form.get('calendar_value').split(":")[1]
|
| 235 |
+
session['sl_subsl'] = request.form.get('sl_subsl')
|
| 236 |
+
session['tbl_selected'] = request.form.getlist('tbl_selected')
|
| 237 |
+
return redirect(url_for('data'))
|
| 238 |
+
|
| 239 |
+
if __name__ == '__main__':
|
| 240 |
+
#app.run(debug=True)
|
| 241 |
+
from waitress import serve
|
| 242 |
+
serve(app, host="0.0.0.0", port=8080)
|
config.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tbl_mapping = {
|
| 2 |
+
'workforce' : '[dbo].[workforce]',
|
| 3 |
+
'badges' : '[dbo].[badges]',
|
| 4 |
+
'learning' : '[dbo].[learning]',
|
| 5 |
+
'lat' : '[dbo].[lat]',
|
| 6 |
+
'mct' : '[dbo].[mct]',
|
| 7 |
+
'profqual' : '[dbo].[profqual]',
|
| 8 |
+
'workexperience' : '[dbo].[workexperience]'
|
| 9 |
+
}
|
data_connector/fakedata_generator.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
#from faker import Faker
|
| 3 |
+
from datetime import date, timedelta
|
| 4 |
+
import random
|
| 5 |
+
|
| 6 |
+
def generate_fakedata_badges(num_rows = 1000):
|
| 7 |
+
pass
|
| 8 |
+
|
| 9 |
+
def generate_fakedata_workforce(num_rows = 1000):
|
| 10 |
+
# Initialize the Faker object
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
+
def upload_to_sqlitedb():
|
| 14 |
+
pass
|
data_connector/sqlite_connector.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sqlite3
|
| 2 |
+
|
| 3 |
+
def get_db_connection():
|
| 4 |
+
conn = sqlite3.connect('database.db')
|
| 5 |
+
conn.row_factory = sqlite3.Row
|
| 6 |
+
return conn
|
| 7 |
+
|
| 8 |
+
def push_to_sqlitedb(df, db_tblname):
|
| 9 |
+
# Get the database connection object
|
| 10 |
+
conn = get_db_connection()
|
| 11 |
+
try:
|
| 12 |
+
df.to_sql(db_tblname, conn, index=False, if_exists = 'replace')
|
| 13 |
+
except:
|
| 14 |
+
raise Exception("Insertion Error : DB Insertion failed..")
|
| 15 |
+
return None
|
lang_assistant/langhelper.py
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import langchain
|
| 2 |
+
from langchain.chat_models import ChatOpenAI
|
| 3 |
+
from langchain.prompts import ChatPromptTemplate
|
| 4 |
+
import openai
|
| 5 |
+
from langchain.memory import ConversationBufferMemory
|
| 6 |
+
import pandas as pd
|
| 7 |
+
from langchain import memory
|
| 8 |
+
import sqlite3
|
| 9 |
+
import os
|
| 10 |
+
import json
|
| 11 |
+
from langchain.agents import create_pandas_dataframe_agent
|
| 12 |
+
from langchain.agents.agent_types import AgentType
|
| 13 |
+
import io
|
| 14 |
+
import logging
|
| 15 |
+
import requests
|
| 16 |
+
import urllib3
|
| 17 |
+
from langchain.prompts import ChatPromptTemplate
|
| 18 |
+
from langchain.output_parsers import ResponseSchema
|
| 19 |
+
from langchain.output_parsers import StructuredOutputParser
|
| 20 |
+
from langchain.callbacks import LLMonitorCallbackHandler
|
| 21 |
+
from langchain.chat_models import ChatOpenAI
|
| 22 |
+
from langchain.prompts.chat import SystemMessage, HumanMessagePromptTemplate, HumanMessage, AIMessage
|
| 23 |
+
from langchain.agents import create_pandas_dataframe_agent
|
| 24 |
+
|
| 25 |
+
model_id = 'gpt-3.5-turbo'
|
| 26 |
+
|
| 27 |
+
from dotenv import load_dotenv, find_dotenv
|
| 28 |
+
_ = load_dotenv(find_dotenv()) # read local .env file
|
| 29 |
+
|
| 30 |
+
def summary_extractor_from_df(df:pd.DataFrame)-> str:
|
| 31 |
+
chatmodel = ChatOpenAI()
|
| 32 |
+
template = "You are an AI assistant and your task is to summarize the workforce distribution based on gender delimited by triple backticks \
|
| 33 |
+
and output should clearly indicate how much percentage one gender is higher than other one, and based on the findings make some comments on includsiveness \
|
| 34 |
+
if this is good for company or not.. limit the output in 50 words```{json_genderdf}```"
|
| 35 |
+
prompt_template = ChatPromptTemplate.from_template(template)
|
| 36 |
+
|
| 37 |
+
user_message = prompt_template.format_messages(json_genderdf = df)
|
| 38 |
+
response = chatmodel(user_message)
|
| 39 |
+
# print(response.content)
|
| 40 |
+
return response.content
|
| 41 |
+
|
| 42 |
+
def chat_response(text:str)->str:
|
| 43 |
+
chatmodel = ChatOpenAI(max_tokens=50)
|
| 44 |
+
response = chatmodel.predict(text)
|
| 45 |
+
return response
|
| 46 |
+
|
| 47 |
+
def chat_with_df(query, table_name = None):
|
| 48 |
+
if table_name is None:
|
| 49 |
+
df = pd.read_csv(r"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
|
| 50 |
+
else:
|
| 51 |
+
#get data
|
| 52 |
+
con = sqlite3.connect("database.db")
|
| 53 |
+
df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 54 |
+
|
| 55 |
+
agent = create_pandas_dataframe_agent(
|
| 56 |
+
ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),
|
| 57 |
+
df,
|
| 58 |
+
agent_type=AgentType.OPENAI_FUNCTIONS,
|
| 59 |
+
verbose=True
|
| 60 |
+
)
|
| 61 |
+
try:
|
| 62 |
+
res_query = agent.run(query)
|
| 63 |
+
except Exception as e:
|
| 64 |
+
print(str(e))
|
| 65 |
+
res_query = "ERROR"
|
| 66 |
+
|
| 67 |
+
return res_query
|
| 68 |
+
|
| 69 |
+
def gen_chartdata(df_out, label, chart_type):
|
| 70 |
+
|
| 71 |
+
print("Inside gen_chartdata.....")
|
| 72 |
+
print(f"df_out --> {df_out}")
|
| 73 |
+
data_dict = {
|
| 74 |
+
"labels": None,
|
| 75 |
+
"datasets": [
|
| 76 |
+
{
|
| 77 |
+
"label": "Default Label",
|
| 78 |
+
"data": None,
|
| 79 |
+
"type" : chart_type,
|
| 80 |
+
"backgroundColor": ["rgba(250, 240, 230, 0.7)"],
|
| 81 |
+
"hoverBackgroundColor": ["rgba(250, 240, 230, 1)"],
|
| 82 |
+
"borderColor": ["rgba(250, 240, 230, 1)"]
|
| 83 |
+
}
|
| 84 |
+
]
|
| 85 |
+
}
|
| 86 |
+
print(f"df_out.iloc[:,0].to_list() ---> {df_out.iloc[:,0].to_list()}")
|
| 87 |
+
print(f"data_dict[\"datasets\"][0][\"label\"] --> {data_dict['datasets'][0]['label']}")
|
| 88 |
+
print(f"label : {label}")
|
| 89 |
+
print(f"data_dict['datasets'][0]['data'] --> {data_dict['datasets'][0]['data']}")
|
| 90 |
+
print(f"df_out.iloc[:,1].to_list() --> {df_out.iloc[:,1].to_list()}")
|
| 91 |
+
|
| 92 |
+
data_dict["labels"] = df_out.iloc[:,0].to_list()
|
| 93 |
+
data_dict["datasets"][0]["label"] = label
|
| 94 |
+
data_dict["datasets"][0]["data"] = df_out.iloc[:,1].to_list()
|
| 95 |
+
if chart_type == 'doughnut':
|
| 96 |
+
data_dict["datasets"][0]["backgroundColor"] = ["rgba(120, 214, 198, 0.7)", "rgba(255, 105, 105, 0.7)", "rgba(150, 194, 145, 0.7)", "rgba(250, 240, 230, 0.7)"]
|
| 97 |
+
data_dict["datasets"][0]["hoverBackgroundColor"] = ["rgba(120, 214, 198, 1)", "rgba(255, 105, 105, 1)", "rgba(150, 194, 145, 1)", "rgba(250, 240, 230, 1)"]
|
| 98 |
+
data_dict["datasets"][0]["borderColor"] = ["rgba(120, 214, 198, 1)", "rgba(255, 105, 105, 1)", "rgba(150, 194, 145, 1)", "rgba(250, 240, 230, 1)"]
|
| 99 |
+
|
| 100 |
+
# Serializing json
|
| 101 |
+
json_object = json.dumps(data_dict, indent = 4)
|
| 102 |
+
|
| 103 |
+
return json_object
|
| 104 |
+
|
| 105 |
+
def generate_graphdata(query, table_name = None):
|
| 106 |
+
if table_name is None:
|
| 107 |
+
df = pd.read_csv(r"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
|
| 108 |
+
else:
|
| 109 |
+
#get data from sqlite db
|
| 110 |
+
con = sqlite3.connect("database.db")
|
| 111 |
+
df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 112 |
+
|
| 113 |
+
jsondf = df.head(5).to_json(orient='records')
|
| 114 |
+
|
| 115 |
+
prompt_template = ChatPromptTemplate.from_messages(
|
| 116 |
+
[
|
| 117 |
+
SystemMessage(
|
| 118 |
+
content=(
|
| 119 |
+
"You are a data manager and you have to assign the task to a pandas coder \
|
| 120 |
+
who will be working on the steps provided by you. Assuming the pandas coder has already loaded \
|
| 121 |
+
the dataset in pandas dataframe, your task is to properly provide the steps with \
|
| 122 |
+
proper column names so that pandas coder can easily understand the ask and code till the processing of dataset\
|
| 123 |
+
which can be used for graph creation. include steps only to process the data \
|
| 124 |
+
THE STEPS SHOULD NOT CONTAIN ANY GRAPH CREATION OR PLOTTING INSTRUCTIONS.. \
|
| 125 |
+
always select columns only that are mentioned \
|
| 126 |
+
not any extra columns. also think through if output contains two columns if not then create the steps to \
|
| 127 |
+
only include two appropriate columns in output. Also do not include any steps to select top few records.. \
|
| 128 |
+
the output should be all records from the steps execution.")
|
| 129 |
+
),
|
| 130 |
+
HumanMessage(content=("\
|
| 131 |
+
user_input = ```plot the distribution of males and females who survived```\
|
| 132 |
+
use below dataset for reference delimited by <<<>>>\
|
| 133 |
+
<<<[{\"PassengerId\":1,\"Survived\":0,\"Pclass\":3,\"Name\":\"Braund, Mr. Owen Harris\",\"Sex\":\"male\",\"Age\":22.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"A\/5 21171\",\"Fare\":7.25,\"Cabin\":null,\"Embarked\":\"S\"},{\"PassengerId\":2,\"Survived\":1,\"Pclass\":1,\"Name\":\"Cumings, Mrs. John Bradley (Florence Briggs Thayer)\",\"Sex\":\"female\",\"Age\":38.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"PC 17599\",\"Fare\":71.2833,\"Cabin\":\"C85\",\"Embarked\":\"C\"},{\"PassengerId\":3,\"Survived\":1,\"Pclass\":3,\"Name\":\"Heikkinen, Miss. Laina\",\"Sex\":\"female\",\"Age\":26.0,\"SibSp\":0,\"Parch\":0,\"Ticket\":\"STON\/O2. 3101282\",\"Fare\":7.925,\"Cabin\":null,\"Embarked\":\"S\"},{\"PassengerId\":4,\"Survived\":1,\"Pclass\":1,\"Name\":\"Futrelle, Mrs. Jacques Heath (Lily May Peel)\",\"Sex\":\"female\",\"Age\":35.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"113803\",\"Fare\":53.1,\"Cabin\":\"C123\",\"Embarked\":\"S\"},{\"PassengerId\":5,\"Survived\":0,\"Pclass\":3,\"Name\":\"Allen, Mr. William Henry\",\"Sex\":\"male\",\"Age\":35.0,\"SibSp\":0,\"Parch\":0,\"Ticket\":\"373450\",\"Fare\":8.05,\"Cabin\":null,\"Embarked\":\"S\"}]>>>\
|
| 134 |
+
{format_instructions}\
|
| 135 |
+
from these inputs extract the following information\
|
| 136 |
+
steps: the steps to be performed for the execution of task\
|
| 137 |
+
label: suggest label to be displayed on the graph for the required ask in less than 3 words\
|
| 138 |
+
chart_type: extract what type of chart user want to see.. if not specified then suggest which one \
|
| 139 |
+
would be suitable for the task.. should be one of these ['bar', 'line', 'doughnut', 'scatter', 'text']\
|
| 140 |
+
output text if graph cant be plotted or user required the answer in text format")),
|
| 141 |
+
AIMessage(content=("{\n\t\"steps\": \"1. Filter the dataframe to include only the rows where \'Survived\' column is equal to 1.\\n\
|
| 142 |
+
2. Group the filtered dataframe by \'Sex\' column.\\n\
|
| 143 |
+
3. Count the number of occurrences of each unique value in the \'Sex\' column.\\n\
|
| 144 |
+
4. Create a new dataframe with two columns: \'Sex\' and \'Count\', where \'Sex\' contains the unique values from the \'Sex\' column and \'Count\' contains the corresponding counts.\\n\
|
| 145 |
+
5. Select top two records from the dataframe.\",\\n\
|
| 146 |
+
6. Convert the dataset to Json and create the bar graph.\"t\
|
| 147 |
+
\"label\": \"Distribution of Males and Females who Survived\",\\n\t\
|
| 148 |
+
\"chart_type\": \"bar\"\\n}")),
|
| 149 |
+
HumanMessage(content=("The output seems not correct. the provided steps include importing matplotlib and creating the bar diagram\
|
| 150 |
+
which was clearly mentioned not to include. Also steps include selecting top two records where it was mentioned \
|
| 151 |
+
not to select top few records for output. you should output all records unless asked otherwise. Also steps include \
|
| 152 |
+
the conversion to json which should not have been included. the output should be only pandas dataframe..\
|
| 153 |
+
can you correct these and provide the response.")),
|
| 154 |
+
AIMessage(content=("{\n\t\"steps\": 1. Filter the dataframe to include only the rows where \'Survived\' column is equal to 1.\\n\
|
| 155 |
+
2. Group the filtered dataframe by \'Sex\' column.\\n\
|
| 156 |
+
3. Count the number of occurrences of each unique value in the \'Sex\' column.\\n\
|
| 157 |
+
4. Create a new dataframe with two columns: \'Sex\' and \'Count\', where \'Sex\' contains the unique values from the \'Sex\' column and \'Count\' contains the corresponding counts.\\n\
|
| 158 |
+
5. Return the new dataframe.\",\\n\t\
|
| 159 |
+
\"label\": \"Distribution of Males and Females who Survived\",\\n\t\
|
| 160 |
+
\"chart_type\": \"bar\"\\n}")),
|
| 161 |
+
HumanMessage(content=("Now the output looks perfect. This was just the way I wanted. Thanks a lot..")),
|
| 162 |
+
AIMessage(content=("Thanks for the feedback, I will double check these things next time..")),
|
| 163 |
+
HumanMessage(content=("\
|
| 164 |
+
user_input = ```draw the bar chart for distribution of pclass and for only sex=males```\
|
| 165 |
+
use below dataset for reference delimited by <<<>>>\
|
| 166 |
+
<<<[{\"PassengerId\":1,\"Survived\":0,\"Pclass\":3,\"Name\":\"Braund, Mr. Owen Harris\",\"Sex\":\"male\",\"Age\":22.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"A\/5 21171\",\"Fare\":7.25,\"Cabin\":null,\"Embarked\":\"S\"},{\"PassengerId\":2,\"Survived\":1,\"Pclass\":1,\"Name\":\"Cumings, Mrs. John Bradley (Florence Briggs Thayer)\",\"Sex\":\"female\",\"Age\":38.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"PC 17599\",\"Fare\":71.2833,\"Cabin\":\"C85\",\"Embarked\":\"C\"},{\"PassengerId\":3,\"Survived\":1,\"Pclass\":3,\"Name\":\"Heikkinen, Miss. Laina\",\"Sex\":\"female\",\"Age\":26.0,\"SibSp\":0,\"Parch\":0,\"Ticket\":\"STON\/O2. 3101282\",\"Fare\":7.925,\"Cabin\":null,\"Embarked\":\"S\"},{\"PassengerId\":4,\"Survived\":1,\"Pclass\":1,\"Name\":\"Futrelle, Mrs. Jacques Heath (Lily May Peel)\",\"Sex\":\"female\",\"Age\":35.0,\"SibSp\":1,\"Parch\":0,\"Ticket\":\"113803\",\"Fare\":53.1,\"Cabin\":\"C123\",\"Embarked\":\"S\"},{\"PassengerId\":5,\"Survived\":0,\"Pclass\":3,\"Name\":\"Allen, Mr. William Henry\",\"Sex\":\"male\",\"Age\":35.0,\"SibSp\":0,\"Parch\":0,\"Ticket\":\"373450\",\"Fare\":8.05,\"Cabin\":null,\"Embarked\":\"S\"}]>>>\
|
| 167 |
+
{format_instructions}\
|
| 168 |
+
from these inputs extract the following information\
|
| 169 |
+
steps: the steps to be performed for the execution of task\
|
| 170 |
+
label: suggest label to be displayed on the graph for the required ask in less than 3 words\
|
| 171 |
+
chart_type: extract what type of chart user want to see.. if not specified then suggest which one \
|
| 172 |
+
would be suitable for the task.. should be one of these ['bar', 'line', 'doughnut', 'scatter', 'text']\
|
| 173 |
+
output text if graph cant be plotted or user required the answer in text format")),
|
| 174 |
+
AIMessage(content=("{\"\n\t\"steps\": \"1. Filter the dataframe to include only rows where Sex is \'male\'\\n\
|
| 175 |
+
2. Group the data by Pclass and count the number of occurrences\\n\
|
| 176 |
+
3. Create a new dataframe with the Pclass and count columns\\n\
|
| 177 |
+
4. Sort the dataframe by Pclass\\n\
|
| 178 |
+
5. Output the resulting dataframe\",\n\t\
|
| 179 |
+
\"label\": \"Distribution of Pclass for males\",\n\t\
|
| 180 |
+
\"chart_type\": \"bar\"\n}")),
|
| 181 |
+
HumanMessage(content=("The output looks perfect. This is exactly the response I was looking for.")),
|
| 182 |
+
AIMessage(content=("Thanks! Now I am more confident about the requirement. ")),
|
| 183 |
+
HumanMessagePromptTemplate.from_template(
|
| 184 |
+
"user_input = ```{user_input}```\
|
| 185 |
+
use sample dataset below for reference delimited by <<<>>>\
|
| 186 |
+
<<<{reference_data}>>>\
|
| 187 |
+
{format_instructions}\
|
| 188 |
+
from these inputs extract the following information\
|
| 189 |
+
steps: the steps to be performed for the execution of task. stritcly remember to not include any graph or plotting related instructions..\
|
| 190 |
+
label: suggest label to be displayed on the graph for the required ask in less than 3 words\
|
| 191 |
+
chart_type: extract what type of chart user want to see.. if not specified then suggest which one \
|
| 192 |
+
would be suitable for the task.. should be one of these ['bar', 'line', 'doughnut', 'scatter', 'text']\
|
| 193 |
+
output text if graph cant be plotted or user required the answer in text format"
|
| 194 |
+
),
|
| 195 |
+
]
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
step_schema = ResponseSchema(name="steps",
|
| 199 |
+
description="steps to be performed for the execution of task. stritcly remember to not include any graph or plotting related instructions..")
|
| 200 |
+
label_schema = ResponseSchema(name="label",
|
| 201 |
+
description="suggest label to be displayed on the graph for the required ask")
|
| 202 |
+
chart_type_schema = ResponseSchema(name="chart_type",
|
| 203 |
+
description="Suggest the type of chart to be created.. if user specified\
|
| 204 |
+
any chart type, select that.. otherwise suggest what would be suitable for the user ask\
|
| 205 |
+
From the user input.. should be one of these ['bar', 'line', 'doughnut', 'scatter', 'text']\
|
| 206 |
+
output text if graph cant be plotted or user required the answer in text format")
|
| 207 |
+
|
| 208 |
+
response_schemas = [step_schema, label_schema, chart_type_schema]
|
| 209 |
+
output_parser = StructuredOutputParser.from_response_schemas(response_schemas)
|
| 210 |
+
format_instructions = output_parser.get_format_instructions()
|
| 211 |
+
|
| 212 |
+
customer_messages = prompt_template.format_messages(user_input=query,
|
| 213 |
+
reference_data=jsondf,
|
| 214 |
+
format_instructions=format_instructions)
|
| 215 |
+
|
| 216 |
+
llm = ChatOpenAI(model = 'gpt-3.5-turbo-0613', temperature = 0)
|
| 217 |
+
response = llm(customer_messages)
|
| 218 |
+
json_pandassteps_charttype = output_parser.parse(response.content)
|
| 219 |
+
print("pandas steps and charttype" , json_pandassteps_charttype)
|
| 220 |
+
agent = create_pandas_dataframe_agent(
|
| 221 |
+
ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),
|
| 222 |
+
df,
|
| 223 |
+
agent_type=AgentType.OPENAI_FUNCTIONS,
|
| 224 |
+
verbose=True,
|
| 225 |
+
return_intermediate_steps=True
|
| 226 |
+
)
|
| 227 |
+
try:
|
| 228 |
+
if json_pandassteps_charttype['chart_type'] != "text":
|
| 229 |
+
agent_response = agent({
|
| 230 |
+
'input': f"Remove any steps related to charts or plotting from the steps mentioned in triple backticks\
|
| 231 |
+
and Execute the Python script combining all the steps after remoing the chart related steps\
|
| 232 |
+
Please don't use any print statements. Output should be a pandas dataframe only \
|
| 233 |
+
steps to be performed : {json_pandassteps_charttype['steps']}"
|
| 234 |
+
})
|
| 235 |
+
else:
|
| 236 |
+
chart_type, chart_label, chart_json_data = "text", None, None
|
| 237 |
+
print("The text block has been activated")
|
| 238 |
+
text_to_display = chat_with_df(query, table_name)
|
| 239 |
+
success = True
|
| 240 |
+
except langchain.schema.output_parser.OutputParserException as e:
|
| 241 |
+
success = False
|
| 242 |
+
chart_type, chart_label, chart_json_data = "text", None, None
|
| 243 |
+
text_to_display = "OutputParserException : " + str(e)[:25] + "...."
|
| 244 |
+
print(f"OutputParserException Occurred --> {str(e)}")
|
| 245 |
+
except Exception as e:
|
| 246 |
+
success = False
|
| 247 |
+
chart_type, chart_label, chart_json_data = "text", None, None
|
| 248 |
+
text_to_display = "AgentException : " + str(e)[:25] + "...."
|
| 249 |
+
print(f"Exception Occurred --> {str(e)}")
|
| 250 |
+
else:
|
| 251 |
+
graph_data_df = agent_response['intermediate_steps'][-1][-1]
|
| 252 |
+
print("intermediate steps " , agent_response['intermediate_steps'])
|
| 253 |
+
if isinstance(graph_data_df, pd.DataFrame):
|
| 254 |
+
final_data = dataframe_sanitizer(graph_data_df)
|
| 255 |
+
chart_label = json_pandassteps_charttype['label']
|
| 256 |
+
chart_type = json_pandassteps_charttype['chart_type']
|
| 257 |
+
chart_json_data = gen_chartdata(final_data, chart_label, chart_type)
|
| 258 |
+
success = True
|
| 259 |
+
text_to_display = None
|
| 260 |
+
else:
|
| 261 |
+
chart_type, chart_label, chart_json_data = "text", None, None
|
| 262 |
+
text_to_display = graph_data_df
|
| 263 |
+
success = True
|
| 264 |
+
finally:
|
| 265 |
+
final_response = dict(success=success,
|
| 266 |
+
chart_type=chart_type,
|
| 267 |
+
chart_label=chart_label,
|
| 268 |
+
chart_json_data=chart_json_data,
|
| 269 |
+
text_to_display=text_to_display)
|
| 270 |
+
return final_response
|
| 271 |
+
|
| 272 |
+
def dataframe_sanitizer(raw_dataframe):
|
| 273 |
+
# Check if reset index is required or not
|
| 274 |
+
new_df = raw_dataframe.copy()
|
| 275 |
+
if new_df.index.name:
|
| 276 |
+
new_df = new_df.reset_index()
|
| 277 |
+
|
| 278 |
+
print("new_df --> ", new_df)
|
| 279 |
+
# Rearrange the columns as object and int
|
| 280 |
+
object_columns = [col for col, dtype in new_df.dtypes.items() if dtype not in ['int8','int16','int32','int64', 'float64', 'float32']]
|
| 281 |
+
int_columns = [col for col, dtype in new_df.dtypes.items() if dtype in ['int8','int16','int32','int64', 'float64', 'float32']]
|
| 282 |
+
reordered_columns = object_columns + int_columns
|
| 283 |
+
print(f"object Columns , reordered columns : {object_columns}, {reordered_columns}")
|
| 284 |
+
new_df_reordered = new_df[reordered_columns]
|
| 285 |
+
print(f"New ordered columns : {new_df_reordered}")
|
| 286 |
+
|
| 287 |
+
#Check if first column is object and second column is int
|
| 288 |
+
try:
|
| 289 |
+
if (new_df_reordered.shape[1] != 2) & (new_df_reordered.dtypes[1] not in ('int8','int16','int32','int64', 'float64', 'float32')):
|
| 290 |
+
print("========Exception in shape and type==========")
|
| 291 |
+
return_string = f"The output dataframe has columns count as {new_df_reordered.shape[1]}..\
|
| 292 |
+
and the datatypes of columns present as {new_df_reordered.dtypes}..\
|
| 293 |
+
so cant proceed further with plotting the same.."
|
| 294 |
+
print(return_string)
|
| 295 |
+
raise Exception(return_string)
|
| 296 |
+
|
| 297 |
+
else:
|
| 298 |
+
new_df_reordered[new_df_reordered.columns[0]] = new_df_reordered[new_df_reordered.columns[0]].astype(str)
|
| 299 |
+
return new_df_reordered
|
| 300 |
+
except Exception as e:
|
| 301 |
+
print("Exception occurred" , str(e))
|
referencefiles/badges.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
referencefiles/workforce.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Flask==3.0.0
|
| 2 |
+
Flask_Bootstrap==3.3.7.1
|
| 3 |
+
langchain==0.0.281
|
| 4 |
+
openai==0.27.8
|
| 5 |
+
pandas==1.3.5
|
| 6 |
+
plotly==5.14.1
|
| 7 |
+
pyodbc==4.0.32
|
| 8 |
+
python-dotenv==0.21.1
|
| 9 |
+
Requests==2.31.0
|
| 10 |
+
SQLAlchemy==1.4.42
|
| 11 |
+
urllib3==1.26.14
|
| 12 |
+
waitress==2.1.2
|
| 13 |
+
tabulate==0.9.0
|
static/css/chat_style.css
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.sidechatpanel {
|
| 2 |
+
width: 400px;
|
| 3 |
+
position: fixed;
|
| 4 |
+
top: 56px;
|
| 5 |
+
opacity: 0.98;
|
| 6 |
+
z-index: 3;
|
| 7 |
+
right: -400px;
|
| 8 |
+
padding-bottom: 60px;
|
| 9 |
+
height: calc(100vh - 55px);
|
| 10 |
+
background-color: #2e2e2e;
|
| 11 |
+
transition: right 0.3s ease-in-out;
|
| 12 |
+
overflow: hidden;
|
| 13 |
+
display: flex;
|
| 14 |
+
flex-direction: column;
|
| 15 |
+
scroll-behavior: auto;
|
| 16 |
+
box-shadow: -5px 4px 8px 0 rgba(0, 0, 0, 0.2);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.sidechatpanel.show {
|
| 20 |
+
right: 0;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.msger-header {
|
| 24 |
+
background-color: revert;
|
| 25 |
+
color: cornsilk;
|
| 26 |
+
text-align: center;
|
| 27 |
+
margin-top: -5px;
|
| 28 |
+
padding: 12px 5px 5px 20px;
|
| 29 |
+
/* font-weight: bolder; */
|
| 30 |
+
border-radius: 15px;
|
| 31 |
+
box-shadow: 0px 4px 4px 0 rgba(22, 0, 0, 0.2);
|
| 32 |
+
font-style: oblique;
|
| 33 |
+
padding-top: -5px;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.msger-send-btn {
|
| 37 |
+
background-color: transparent;
|
| 38 |
+
border: none;
|
| 39 |
+
padding: 10px;
|
| 40 |
+
width: 24px;
|
| 41 |
+
height: 24px;
|
| 42 |
+
background-image: url('/static/images/send5.png');
|
| 43 |
+
background-size: cover;
|
| 44 |
+
background-repeat: no-repeat;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.msger-inputarea {
|
| 48 |
+
position: absolute;
|
| 49 |
+
bottom: 0;
|
| 50 |
+
left: 0;
|
| 51 |
+
width: 100%;
|
| 52 |
+
padding: 6px;
|
| 53 |
+
background-color: #000000;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.msger-input {
|
| 57 |
+
display: flex;
|
| 58 |
+
align-items: center;
|
| 59 |
+
border: 1px solid #ccc;
|
| 60 |
+
border-radius: 5px;
|
| 61 |
+
background-color: #cdcdca;
|
| 62 |
+
overflow: hidden;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.msger-input input {
|
| 66 |
+
flex: 1;
|
| 67 |
+
padding: 10px;
|
| 68 |
+
border: none;
|
| 69 |
+
background-color: transparent;
|
| 70 |
+
width: 100%;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.msger-input button {
|
| 74 |
+
border: none;
|
| 75 |
+
margin: 0;
|
| 76 |
+
padding: 0;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
.chat-container {
|
| 81 |
+
padding-left: 15px;
|
| 82 |
+
padding-right: 15px;
|
| 83 |
+
padding-top: 10px;
|
| 84 |
+
display: flex;
|
| 85 |
+
flex-direction: column;
|
| 86 |
+
max-height: calc(100vh - 110px);
|
| 87 |
+
max-width: auto;
|
| 88 |
+
margin: 10 auto;
|
| 89 |
+
scroll-behavior: auto;
|
| 90 |
+
overflow-y: auto;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.chat-container::-webkit-scrollbar {
|
| 94 |
+
width: 5px;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.chat-container::-webkit-scrollbar-thumb {
|
| 98 |
+
background-color: #888;
|
| 99 |
+
border-radius: 5px;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/* Hide the scrollbar track */
|
| 103 |
+
.chat-container::-webkit-scrollbar-track {
|
| 104 |
+
display: none;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.user-message {
|
| 108 |
+
display: flex;
|
| 109 |
+
font-size: 500;
|
| 110 |
+
margin-bottom: 10px;
|
| 111 |
+
color: gold;
|
| 112 |
+
border-radius: 5px;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.bot-message {
|
| 116 |
+
display: flex;
|
| 117 |
+
color: rgb(209, 243, 244);
|
| 118 |
+
margin-bottom: 10px;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.user-icon {
|
| 122 |
+
margin-top: 8px;
|
| 123 |
+
justify-content: center;
|
| 124 |
+
width: 24px;
|
| 125 |
+
height: 24px;
|
| 126 |
+
color: white;
|
| 127 |
+
text-align: center;
|
| 128 |
+
line-height: 40px;
|
| 129 |
+
background-image: url('/static/images/user6.png');
|
| 130 |
+
background-size: cover;
|
| 131 |
+
margin-right: 10px;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
.bot-icon {
|
| 135 |
+
margin-top: 8px;
|
| 136 |
+
justify-content: center;
|
| 137 |
+
width: 24px;
|
| 138 |
+
height: 24px;
|
| 139 |
+
color: white;
|
| 140 |
+
text-align: center;
|
| 141 |
+
line-height: 40px;
|
| 142 |
+
background-image: url('/static/images/bot.png');
|
| 143 |
+
background-size: cover;
|
| 144 |
+
margin-right: 10px;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.bot-message-bubble {
|
| 148 |
+
flex: 1;
|
| 149 |
+
font-size: small;
|
| 150 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 151 |
+
background-color: transparent;
|
| 152 |
+
padding: 10px;
|
| 153 |
+
border-radius: 10px;
|
| 154 |
+
box-shadow: #1f2b37;
|
| 155 |
+
box-shadow: -4px 4px 8px 0 rgba(0, 0, 0, 0.2);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.user-message-bubble {
|
| 159 |
+
flex: 1;
|
| 160 |
+
font-size: small;
|
| 161 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 162 |
+
background-color: transparent;
|
| 163 |
+
padding: 10px;
|
| 164 |
+
border-radius: 10px;
|
| 165 |
+
box-shadow: #1f2b37;
|
| 166 |
+
box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.2);
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.closebtn {
|
| 170 |
+
cursor: pointer;
|
| 171 |
+
color: darkgrey;
|
| 172 |
+
font-size: 20px;
|
| 173 |
+
font-weight: bold;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.closebtn:hover {
|
| 177 |
+
color: coral;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.toggle-button {
|
| 181 |
+
position: fixed;
|
| 182 |
+
top: 65px;
|
| 183 |
+
height: 37px;
|
| 184 |
+
right: -10px;
|
| 185 |
+
background-color: #8fadc7;
|
| 186 |
+
color: white;
|
| 187 |
+
/* padding: 10px 10px; */
|
| 188 |
+
border: none;
|
| 189 |
+
border-radius: 10px;
|
| 190 |
+
cursor: pointer;
|
| 191 |
+
}
|
static/css/data_style.css
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.tab {
|
| 2 |
+
position: relative;
|
| 3 |
+
overflow: hidden;
|
| 4 |
+
background-color: #f1f1f1;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
.tab button {
|
| 8 |
+
background-color: inherit;
|
| 9 |
+
font-weight: bolder;
|
| 10 |
+
color:darkslategray;
|
| 11 |
+
float: left;
|
| 12 |
+
border: none;
|
| 13 |
+
outline: none;
|
| 14 |
+
cursor: pointer;
|
| 15 |
+
padding: 14px 12px;
|
| 16 |
+
transition: background-color 0.3s ease;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.tab button:hover {
|
| 20 |
+
background-color: #ddd;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.tab button.active {
|
| 24 |
+
background-color: #ccc;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
div.dataTables_wrapper {
|
| 28 |
+
margin: 0 auto;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.page-item.active .page-link {
|
| 32 |
+
z-index: 1;
|
| 33 |
+
color: #fff;
|
| 34 |
+
background-color: #84888d;
|
| 35 |
+
border-color: #929ba4;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.fixed-button {
|
| 39 |
+
position: fixed;
|
| 40 |
+
bottom: 0;
|
| 41 |
+
left: 0;
|
| 42 |
+
width: 100%;
|
| 43 |
+
/* margin-top: 50px; */
|
| 44 |
+
padding: 15px;
|
| 45 |
+
padding-right: 50px;
|
| 46 |
+
background-color: #f8f9fa;
|
| 47 |
+
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
|
| 48 |
+
z-index: 2;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/* Define your custom button color */
|
| 52 |
+
.btn-custom-color {
|
| 53 |
+
background-color: rgb(17, 67, 86); /* Replace 'specific-color' with your desired color */
|
| 54 |
+
color: rgb(168, 167, 167); /* Set text color to white to ensure readability on colored backgrounds */
|
| 55 |
+
border-color: rgb(17, 67, 86); /* Set border color to match the background color */
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/* If you want to change the color of the button on hover and active states as well */
|
| 59 |
+
.btn-custom-color:hover,
|
| 60 |
+
.btn-custom-color:active,
|
| 61 |
+
.btn-custom-color:focus {
|
| 62 |
+
background-color: rgb(17, 67, 86); /* Replace 'specific-hover-color' with the desired hover color */
|
| 63 |
+
color: rgb(209, 212, 214);
|
| 64 |
+
border-color: rgb(38, 144, 185);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.content {
|
| 68 |
+
padding-left: 0px;
|
| 69 |
+
padding-right: 0px;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
static/css/home_style.css
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* body {
|
| 2 |
+
font-family: Arial, sans-serif;
|
| 3 |
+
} */
|
| 4 |
+
.container {
|
| 5 |
+
max-width: 1100px;
|
| 6 |
+
margin: 0 auto;
|
| 7 |
+
padding: 0 auto;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
.row {
|
| 11 |
+
margin-bottom: 20px;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
.left-column {
|
| 15 |
+
background-color: #f8f9fa;
|
| 16 |
+
padding: 20px;
|
| 17 |
+
position: relative;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.right-column {
|
| 21 |
+
padding: 20px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
h1 {
|
| 25 |
+
text-align: center;
|
| 26 |
+
margin-bottom: 30px;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
form {
|
| 30 |
+
margin-bottom: 20px;
|
| 31 |
+
}
|
| 32 |
+
|
static/css/layout_style.css
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* .navbar {
|
| 2 |
+
background-color: black;
|
| 3 |
+
} */
|
| 4 |
+
|
| 5 |
+
/* .navbar-toggler {
|
| 6 |
+
border-color: rgba(255, 255, 255, 0.5);
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
.navbar-toggler-icon {
|
| 10 |
+
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
/* .navbar-toggler {
|
| 16 |
+
border-color: rgba(255, 18, 18, 0.5);
|
| 17 |
+
} */
|
| 18 |
+
|
| 19 |
+
/* .navbar-nav .nav-link {
|
| 20 |
+
padding: 0.5rem 0.75rem;
|
| 21 |
+
margin-left: 10px;
|
| 22 |
+
color: rgb(221, 234, 239);
|
| 23 |
+
} */
|
| 24 |
+
|
| 25 |
+
/* .navbar-nav .nav-link:hover {
|
| 26 |
+
color: rgb(234, 128, 41);
|
| 27 |
+
} */
|
| 28 |
+
|
| 29 |
+
/* .navbar-nav .nav-link.active {
|
| 30 |
+
font-weight: bold;
|
| 31 |
+
} */
|
| 32 |
+
/*
|
| 33 |
+
.navbar-nav .nav-link.active {
|
| 34 |
+
font-weight: bold !important;
|
| 35 |
+
color: rgb(235, 80, 13) !important;
|
| 36 |
+
background-color: red;
|
| 37 |
+
} */
|
| 38 |
+
|
| 39 |
+
/* .navbar-brand {
|
| 40 |
+
padding-left: 100px;
|
| 41 |
+
} */
|
| 42 |
+
|
| 43 |
+
#navbarNav {
|
| 44 |
+
padding-right: 110px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.disabled {
|
| 48 |
+
pointer-events: none; /* Disable click events */
|
| 49 |
+
opacity: 0.6; /* Visually indicate disabled state */
|
| 50 |
+
}
|
static/css/validate_style.css
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.tab {
|
| 2 |
+
position: relative;
|
| 3 |
+
overflow: hidden;
|
| 4 |
+
background-color: #f1f1f1;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
.tab button {
|
| 8 |
+
background-color: inherit;
|
| 9 |
+
float: left;
|
| 10 |
+
border: none;
|
| 11 |
+
outline: none;
|
| 12 |
+
cursor: pointer;
|
| 13 |
+
padding: 14px 16px;
|
| 14 |
+
transition: background-color 0.3s ease;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.tab button:hover {
|
| 18 |
+
background-color: #ddd;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.tab button.active {
|
| 22 |
+
background-color: #ccc;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
body {
|
| 26 |
+
background-color: #f0f0f0;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.left_tblsidebar {
|
| 30 |
+
background-color:cadetblue;
|
| 31 |
+
height: 100vh;
|
| 32 |
+
position: fixed;
|
| 33 |
+
top: 0;
|
| 34 |
+
left: 0px;
|
| 35 |
+
width: 100px;
|
| 36 |
+
display: flex;
|
| 37 |
+
flex-direction: column;
|
| 38 |
+
align-items: center;
|
| 39 |
+
padding-top: 80px;
|
| 40 |
+
z-index:0;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/* .nav-link { */
|
| 44 |
+
.val_leftsidebarcls {
|
| 45 |
+
color: #fff;
|
| 46 |
+
display: flex;
|
| 47 |
+
flex-direction: column;
|
| 48 |
+
align-items: center;
|
| 49 |
+
text-decoration:none;
|
| 50 |
+
padding-top: 10px;
|
| 51 |
+
padding-bottom: 10px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* .nav-link span { */
|
| 55 |
+
.val_leftsidebarcls span{
|
| 56 |
+
display: block;
|
| 57 |
+
width: 0;
|
| 58 |
+
text-align: center;
|
| 59 |
+
overflow: hidden;
|
| 60 |
+
white-space: nowrap;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/* .nav-link:hover span{ */
|
| 64 |
+
.val_leftsidebarcls:hover span{
|
| 65 |
+
display: block;
|
| 66 |
+
width:fit-content;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.dashboard-content{
|
| 70 |
+
margin-left: 20px;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
div.headstats{
|
| 74 |
+
text-align: center;
|
| 75 |
+
margin-left: 10px;
|
| 76 |
+
margin-right: 10px;
|
| 77 |
+
/* background-color: floralwhite; */
|
| 78 |
+
}
|
static/images/aichat.png
ADDED
|
static/images/aichat1.png
ADDED
|
static/images/aichat2.png
ADDED
|
static/images/aichat3.png
ADDED
|
static/images/bot.png
ADDED
|
static/images/bot1.png
ADDED
|
static/images/bot2.png
ADDED
|
static/images/labormarket - Copy.jpeg
ADDED
|
static/images/labormarket.jpeg
ADDED
|
static/images/send.png
ADDED
|
static/images/send1.png
ADDED
|
static/images/send2.png
ADDED
|
static/images/send3.png
ADDED
|
static/images/send4.png
ADDED
|
static/images/send5.png
ADDED
|
static/images/user-5.png
ADDED
|
static/images/user.png
ADDED
|
static/images/user1.png
ADDED
|
static/images/user2.png
ADDED
|
static/images/user3.png
ADDED
|
static/images/user4.png
ADDED
|
static/images/user6.png
ADDED
|
static/images/user7.png
ADDED
|
static/js/data_script.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function openTab(evt, tabName) {
|
| 2 |
+
var i, tabcontent, tablinks;
|
| 3 |
+
|
| 4 |
+
// Hide all content
|
| 5 |
+
tabcontent = document.getElementsByClassName("content");
|
| 6 |
+
for (i = 0; i < tabcontent.length; i++) {
|
| 7 |
+
tabcontent[i].style.display = "none";
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
// Remove "active" class from all buttons
|
| 11 |
+
tablinks = document.getElementsByClassName("tablinks");
|
| 12 |
+
for (i = 0; i < tablinks.length; i++) {
|
| 13 |
+
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
// Show the selected content and mark the button as active
|
| 17 |
+
document.getElementById(tabName).style.display = "block";
|
| 18 |
+
evt.currentTarget.className += " active";
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
function redirecttovalidation() {
|
| 22 |
+
window.location.href = '/validate_' + req_tables;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
// chat function which loads user message and gets bot response by invoking the URI
|
| 26 |
+
document.addEventListener("DOMContentLoaded", function () {
|
| 27 |
+
const msgerForm = document.querySelector(".msger-inputarea");
|
| 28 |
+
const msgerInput = document.querySelector("#textInput");
|
| 29 |
+
const msgerChat = document.querySelector(".chat-container");
|
| 30 |
+
|
| 31 |
+
msgerForm.addEventListener("submit", function (event) {
|
| 32 |
+
event.preventDefault();
|
| 33 |
+
const msgText = msgerInput.value;
|
| 34 |
+
if (!msgText) return;
|
| 35 |
+
|
| 36 |
+
appendMessage(msgText);
|
| 37 |
+
msgerInput.value = "";
|
| 38 |
+
botResponse(msgText);
|
| 39 |
+
});
|
| 40 |
+
|
| 41 |
+
function appendMessage(text) {
|
| 42 |
+
const msgHTML = `
|
| 43 |
+
<div class="user-message">
|
| 44 |
+
<div class="user-icon"></div>
|
| 45 |
+
<div class="user-message-bubble">
|
| 46 |
+
${text}
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
`;
|
| 50 |
+
msgerChat.insertAdjacentHTML("beforeend", msgHTML);
|
| 51 |
+
msgerChat.scrollTop += 500;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
function botResponse(rawText) {
|
| 55 |
+
const selectElement = document.getElementById("table-dropdown");
|
| 56 |
+
const desiredValue = document.getElementById("table-dropdown").value;
|
| 57 |
+
let selected_tbl_name = '';
|
| 58 |
+
for (let i = 0; i < selectElement.options.length; i++) {
|
| 59 |
+
const option = selectElement.options[i];
|
| 60 |
+
if (option.value === desiredValue) {
|
| 61 |
+
// Found a match, get the innerHTML
|
| 62 |
+
selected_tbl_name = option.innerHTML.toLowerCase();
|
| 63 |
+
break; // Exit the loop since we found a match
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
$.get("/get_llmresponse", { msg: rawText, table_selected: selected_tbl_name }).done(function (data) {
|
| 69 |
+
console.log(rawText);
|
| 70 |
+
console.log(data);
|
| 71 |
+
const msgHTML = `
|
| 72 |
+
<div class="bot-message">
|
| 73 |
+
<div class="bot-icon"></div>
|
| 74 |
+
<div class="bot-message-bubble">
|
| 75 |
+
${data}
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
`;
|
| 79 |
+
msgerChat.insertAdjacentHTML("beforeend", msgHTML);
|
| 80 |
+
msgerChat.scrollTop += 500;
|
| 81 |
+
});
|
| 82 |
+
}
|
| 83 |
+
});
|
static/js/home_script.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
$(function() {
|
| 2 |
+
var start = moment().subtract(29, 'days');
|
| 3 |
+
var end = moment();
|
| 4 |
+
function cb(start, end) {
|
| 5 |
+
$('#reportrange span').html(start.format('MMM D, YYYY') + ' - ' + end.format('MMM D, YYYY'));
|
| 6 |
+
$('input[name="calendar_value"]').val(start.format('YYYY-MM-DD') + ':' + end.format('YYYY-MM-DD'));
|
| 7 |
+
}
|
| 8 |
+
// Set the value for the calendar_value input field
|
| 9 |
+
$('#reportrange').daterangepicker({
|
| 10 |
+
startDate: start,
|
| 11 |
+
endDate: end,
|
| 12 |
+
ranges: {
|
| 13 |
+
// 'Today': [moment(), moment()],
|
| 14 |
+
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
| 15 |
+
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
| 16 |
+
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
| 17 |
+
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
| 18 |
+
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
| 19 |
+
'This Quarter': [moment().startOf('quarter'), moment().endOf('quarter')],
|
| 20 |
+
'Last Quarter': [moment().subtract(1, 'quarter').startOf('quarter'), moment().subtract(1, 'quarter').endOf('quarter')]
|
| 21 |
+
}
|
| 22 |
+
}, cb);
|
| 23 |
+
cb(start, end);
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
function toggleFormElements() {
|
| 27 |
+
var toggleSwitch = document.getElementById('toggleSwitch');
|
| 28 |
+
var dropdowns = document.querySelectorAll('form select');
|
| 29 |
+
var textbox = document.querySelector('form textarea');
|
| 30 |
+
var submitButton = document.querySelector('form button[type="submit"]');
|
| 31 |
+
|
| 32 |
+
if (toggleSwitch.checked) {
|
| 33 |
+
for (var i = 0; i < dropdowns.length; i++) {
|
| 34 |
+
dropdowns[i].disabled = true;
|
| 35 |
+
}
|
| 36 |
+
//reportrange.disabled = true;
|
| 37 |
+
textbox.disabled = false;
|
| 38 |
+
submitButton.disabled = false;
|
| 39 |
+
} else {
|
| 40 |
+
for (var i = 0; i < dropdowns.length; i++) {
|
| 41 |
+
dropdowns[i].disabled = false;
|
| 42 |
+
}
|
| 43 |
+
//reportrange.disabled = false;
|
| 44 |
+
textbox.disabled = true;
|
| 45 |
+
submitButton.disabled = false;
|
| 46 |
+
}
|
| 47 |
+
};
|
static/js/mytest.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function openTab(evt, tabName) {
|
| 2 |
+
var i, tabcontent, tablinks;
|
| 3 |
+
|
| 4 |
+
// Hide all content
|
| 5 |
+
tabcontent = document.getElementsByClassName("content");
|
| 6 |
+
for (i = 0; i < tabcontent.length; i++) {
|
| 7 |
+
tabcontent[i].style.display = "none";
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
// Remove "active" class from all buttons
|
| 11 |
+
tablinks = document.getElementsByClassName("tablinks");
|
| 12 |
+
for (i = 0; i < tablinks.length; i++) {
|
| 13 |
+
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
// Show the selected content and mark the button as active
|
| 17 |
+
document.getElementById(tabName).style.display = "block";
|
| 18 |
+
evt.currentTarget.className += " active";
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
// document.getElementById('slssl').value = "option8";;
|
| 22 |
+
|
| 23 |
+
$(function() {
|
| 24 |
+
var start = moment().subtract(29, 'days');
|
| 25 |
+
var end = moment();
|
| 26 |
+
function cb(start, end) {
|
| 27 |
+
$('#reportrange span').html(start.format('MMM D, YYYY') + ' - ' + end.format('MMM D, YYYY'));
|
| 28 |
+
$('input[name="calendar_value"]').val(start.format('YYYY-MM-DD') + ':' + end.format('YYYY-MM-DD'));
|
| 29 |
+
}
|
| 30 |
+
// Set the value for the calendar_value input field
|
| 31 |
+
$('#reportrange').daterangepicker({
|
| 32 |
+
startDate: start,
|
| 33 |
+
endDate: end,
|
| 34 |
+
ranges: {
|
| 35 |
+
// 'Today': [moment(), moment()],
|
| 36 |
+
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
| 37 |
+
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
| 38 |
+
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
| 39 |
+
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
| 40 |
+
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
| 41 |
+
'This Quarter': [moment().startOf('quarter'), moment().endOf('quarter')],
|
| 42 |
+
'Last Quarter': [moment().subtract(1, 'quarter').startOf('quarter'), moment().subtract(1, 'quarter').endOf('quarter')]
|
| 43 |
+
}
|
| 44 |
+
}, cb);
|
| 45 |
+
cb(start, end);
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
function downloadTableData() {
|
| 49 |
+
window.location.href = "/downloaddata";
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
function toggleFormElements() {
|
| 53 |
+
var toggleSwitch = document.getElementById('toggleSwitch');
|
| 54 |
+
var dropdowns = document.querySelectorAll('form select');
|
| 55 |
+
var textbox = document.querySelector('form textarea');
|
| 56 |
+
var submitButton = document.querySelector('form button[type="submit"]');
|
| 57 |
+
|
| 58 |
+
if (toggleSwitch.checked) {
|
| 59 |
+
for (var i = 0; i < dropdowns.length; i++) {
|
| 60 |
+
dropdowns[i].disabled = true;
|
| 61 |
+
}
|
| 62 |
+
//reportrange.disabled = true;
|
| 63 |
+
textbox.disabled = false;
|
| 64 |
+
submitButton.disabled = false;
|
| 65 |
+
} else {
|
| 66 |
+
for (var i = 0; i < dropdowns.length; i++) {
|
| 67 |
+
dropdowns[i].disabled = false;
|
| 68 |
+
}
|
| 69 |
+
//reportrange.disabled = false;
|
| 70 |
+
textbox.disabled = true;
|
| 71 |
+
submitButton.disabled = false;
|
| 72 |
+
}
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
function redirecttovalidation() {
|
| 76 |
+
window.location.href = '/validation';
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
document.getElementById("tab1").click();
|
static/js/validate_script.js
ADDED
|
@@ -0,0 +1,723 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Chart js | script to populate stacked horizontal bar chart for validation results
|
| 2 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 3 |
+
var labels = [];
|
| 4 |
+
var pct_pattern_mismatch = [];
|
| 5 |
+
var pct_null_values = [];
|
| 6 |
+
var pct_good_data = [];
|
| 7 |
+
var pct_column_notfound = [];
|
| 8 |
+
var pct_dtype_issue = [];
|
| 9 |
+
var pct_neg_values = [];
|
| 10 |
+
var pct_value_notdatetime = [];
|
| 11 |
+
var pct_value_unknown = [];
|
| 12 |
+
|
| 13 |
+
// Extract data from JSON
|
| 14 |
+
jsonData.forEach(function(item) {
|
| 15 |
+
labels.push(item.column);
|
| 16 |
+
pct_pattern_mismatch.push(item.pct_pattern_mismatch);
|
| 17 |
+
pct_null_values.push(item.pct_null_values);
|
| 18 |
+
pct_good_data.push(item.pct_good_data);
|
| 19 |
+
pct_column_notfound.push(item.pct_column_notfound);
|
| 20 |
+
pct_dtype_issue.push(item.pct_dtype_issue);
|
| 21 |
+
pct_neg_values.push(item.pct_neg_values);
|
| 22 |
+
pct_value_notdatetime.push(item.pct_value_notdatetime);
|
| 23 |
+
pct_value_unknown.push(item.pct_value_unknown);
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
new Chart(
|
| 27 |
+
document.getElementById('validationbar'), {
|
| 28 |
+
type: 'bar',
|
| 29 |
+
data: {
|
| 30 |
+
labels: labels,
|
| 31 |
+
datasets: [{
|
| 32 |
+
label: 'Pattern Issue',
|
| 33 |
+
data: pct_pattern_mismatch,
|
| 34 |
+
backgroundColor: "rgba(152, 134, 123, 0.75)", // Maroon shade
|
| 35 |
+
hoverBackgroundColor: "rgba(152, 134, 123, 1)",
|
| 36 |
+
barPercentage:0.65,
|
| 37 |
+
}, {
|
| 38 |
+
label: 'Null Values',
|
| 39 |
+
data: pct_null_values,
|
| 40 |
+
backgroundColor: "rgba(109, 104, 117, 0.75)", // Gray shade
|
| 41 |
+
hoverBackgroundColor: "rgba(109, 104, 117, 1)",
|
| 42 |
+
barPercentage:0.65,
|
| 43 |
+
}, {
|
| 44 |
+
label: "Good Data",
|
| 45 |
+
data: pct_good_data,
|
| 46 |
+
backgroundColor: "rgba(40, 75, 99, 0.75)", // Blue shade
|
| 47 |
+
hoverBackgroundColor: "rgba(40, 75, 99, 1)",
|
| 48 |
+
barPercentage:0.65,
|
| 49 |
+
}, {
|
| 50 |
+
label: "Column_unavailable",
|
| 51 |
+
data: pct_column_notfound,
|
| 52 |
+
backgroundColor: "rgba(255, 205, 178, 0.75)", // Light Maroon shade
|
| 53 |
+
hoverBackgroundColor: "rgba(255, 205, 178, 1)",
|
| 54 |
+
barPercentage:0.65,
|
| 55 |
+
}, {
|
| 56 |
+
label: "DataType Issue",
|
| 57 |
+
data: pct_dtype_issue,
|
| 58 |
+
backgroundColor: "rgba(111, 67, 76,0.75)", // The original color
|
| 59 |
+
hoverBackgroundColor: "rgba(111, 67, 76,1)",
|
| 60 |
+
barPercentage:0.65,
|
| 61 |
+
}, {
|
| 62 |
+
label: "Found Negative Values",
|
| 63 |
+
data: pct_neg_values,
|
| 64 |
+
backgroundColor: "rgba(255, 180, 162, 0.75)", // Reddish shade
|
| 65 |
+
hoverBackgroundColor: "rgba(255, 180, 162, 1)",
|
| 66 |
+
barPercentage:0.65,
|
| 67 |
+
}, {
|
| 68 |
+
label: "Not Datetime",
|
| 69 |
+
data: pct_value_notdatetime,
|
| 70 |
+
backgroundColor: "rgba(229, 152, 155, 0.75)", // Reddish shade
|
| 71 |
+
hoverBackgroundColor: "rgba(229, 152, 155, 1)",
|
| 72 |
+
barPercentage:0.65,
|
| 73 |
+
}, {
|
| 74 |
+
label: "Unknown value",
|
| 75 |
+
data: pct_value_unknown,
|
| 76 |
+
backgroundColor: "rgba(235, 152, 155, 0.75)", // Reddish shade
|
| 77 |
+
hoverBackgroundColor: "rgba(235, 152, 155, 1)",
|
| 78 |
+
barPercentage:0.65,
|
| 79 |
+
}]
|
| 80 |
+
|
| 81 |
+
},
|
| 82 |
+
options: {
|
| 83 |
+
indexAxis: 'y',
|
| 84 |
+
scales: {
|
| 85 |
+
x: {
|
| 86 |
+
stacked: true
|
| 87 |
+
},
|
| 88 |
+
y: {
|
| 89 |
+
stacked: true
|
| 90 |
+
}
|
| 91 |
+
},
|
| 92 |
+
plugins: {
|
| 93 |
+
legend: {
|
| 94 |
+
display: true,
|
| 95 |
+
position: 'top', // Place the legend to the top
|
| 96 |
+
align: 'end', // Place the legend to the right end
|
| 97 |
+
labels: {
|
| 98 |
+
// Use 'dataset' to display dataset labels instead of 'undefined'
|
| 99 |
+
generateLabels: function (chart) {
|
| 100 |
+
var datasets = chart.data.datasets;
|
| 101 |
+
var labels = chart.data.labels;
|
| 102 |
+
var legends = [];
|
| 103 |
+
|
| 104 |
+
datasets.forEach(function (dataset, datasetIndex) {
|
| 105 |
+
// Check if any non-zero value is present in the dataset
|
| 106 |
+
var hasNonZeroValue = dataset.data.some(function(value) {
|
| 107 |
+
return value !== 0;
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
if (hasNonZeroValue) {
|
| 111 |
+
legends.push({
|
| 112 |
+
text: dataset.label,
|
| 113 |
+
fillStyle: dataset.backgroundColor,
|
| 114 |
+
hidden: !chart.isDatasetVisible(datasetIndex),
|
| 115 |
+
lineCap: dataset.borderCapStyle,
|
| 116 |
+
lineDash: dataset.borderDash,
|
| 117 |
+
lineDashOffset: dataset.borderDashOffset,
|
| 118 |
+
lineJoin: dataset.borderJoinStyle,
|
| 119 |
+
lineWidth: dataset.borderWidth,
|
| 120 |
+
strokeStyle: dataset.borderColor,
|
| 121 |
+
pointStyle: dataset.pointStyle,
|
| 122 |
+
rotation: dataset.rotation,
|
| 123 |
+
datasetIndex: datasetIndex
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
});
|
| 127 |
+
return legends;
|
| 128 |
+
}
|
| 129 |
+
},
|
| 130 |
+
}
|
| 131 |
+
},
|
| 132 |
+
},
|
| 133 |
+
})
|
| 134 |
+
});
|
| 135 |
+
|
| 136 |
+
// Chart js | script to populate doughnut chart
|
| 137 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 138 |
+
|
| 139 |
+
var data = {
|
| 140 |
+
labels: ['Structured', 'Unstructured'],
|
| 141 |
+
datasets: [{
|
| 142 |
+
data: [58, 42],
|
| 143 |
+
backgroundColor: ['rgba(63,103,126,1)', 'rgba(163,103,126,1)', 'rgba(63,203,226,1)', 'rgba(90,34,21,1)', 'rgba(200,150,50,1)', 'rgba(235,91,56,1)', 'rgba(137,196,244,1)', 'rgba(245,203,83,1)', 'rgba(142,69,173,1)', 'rgba(76,175,80,1)'],
|
| 144 |
+
hoverBackgroundColor: ['rgba(50,90,100,1)', 'rgba(140,85,100,1)', 'rgba(46,185,235,1)', 'rgba(45,21,231,1)', 'rgba(190,120,40,1)', 'rgba(205,80,47,1)', 'rgba(101,154,204,1)', 'rgba(221,183,60,1)', 'rgba(110,49,147,1)', 'rgba(60,136,63,1)']
|
| 145 |
+
}]
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
new Chart(document.getElementById('doughnutchart_strvsunstr'), {
|
| 149 |
+
type: 'doughnut',
|
| 150 |
+
data: data,
|
| 151 |
+
options: {
|
| 152 |
+
plugins: {
|
| 153 |
+
legend: {
|
| 154 |
+
display: true,
|
| 155 |
+
position: 'bottom',
|
| 156 |
+
align: 'center',
|
| 157 |
+
}
|
| 158 |
+
},
|
| 159 |
+
tooltips: {
|
| 160 |
+
callbacks: {
|
| 161 |
+
label: function (context) {
|
| 162 |
+
var label = context.label || '';
|
| 163 |
+
var value = context.formattedValue;
|
| 164 |
+
return label + ': ' + value;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
});
|
| 170 |
+
});
|
| 171 |
+
|
| 172 |
+
// Chart js | script to populate doughnut chart
|
| 173 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 174 |
+
var ranks = [];
|
| 175 |
+
var cnt_rank_employee = [];
|
| 176 |
+
|
| 177 |
+
// Extract data from JSON
|
| 178 |
+
json_rankwise_empdist.forEach(function(item) {
|
| 179 |
+
ranks.push(item.Rank);
|
| 180 |
+
cnt_rank_employee.push(item.count_rank);
|
| 181 |
+
});
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
var data = {
|
| 185 |
+
labels: ranks,
|
| 186 |
+
datasets: [{
|
| 187 |
+
data: cnt_rank_employee,
|
| 188 |
+
backgroundColor: ['rgba(63,103,126,1)', 'rgba(163,103,126,1)', 'rgba(63,203,226,1)', 'rgba(90,34,21,1)', 'rgba(200,150,50,1)', 'rgba(235,91,56,1)', 'rgba(137,196,244,1)', 'rgba(245,203,83,1)', 'rgba(142,69,173,1)', 'rgba(76,175,80,1)'],
|
| 189 |
+
hoverBackgroundColor: ['rgba(50,90,100,1)', 'rgba(140,85,100,1)', 'rgba(46,185,235,1)', 'rgba(45,21,231,1)', 'rgba(190,120,40,1)', 'rgba(205,80,47,1)', 'rgba(101,154,204,1)', 'rgba(221,183,60,1)', 'rgba(110,49,147,1)', 'rgba(60,136,63,1)']
|
| 190 |
+
}]
|
| 191 |
+
};
|
| 192 |
+
|
| 193 |
+
new Chart(document.getElementById('doughnutChart'), {
|
| 194 |
+
type: 'doughnut',
|
| 195 |
+
data: data,
|
| 196 |
+
options: {
|
| 197 |
+
plugins: {
|
| 198 |
+
legend: {
|
| 199 |
+
display: true,
|
| 200 |
+
position: 'bottom',
|
| 201 |
+
align: 'center',
|
| 202 |
+
}
|
| 203 |
+
},
|
| 204 |
+
tooltips: {
|
| 205 |
+
callbacks: {
|
| 206 |
+
label: function (context) {
|
| 207 |
+
var label = context.label || '';
|
| 208 |
+
var value = context.formattedValue;
|
| 209 |
+
return label + ': ' + value;
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
});
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
// Badges | Doughnut chart script for pillar distribution
|
| 218 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 219 |
+
var pillar = [];
|
| 220 |
+
var pct_gui = [];
|
| 221 |
+
json_pillar_data.forEach(function(item) {
|
| 222 |
+
pillar.push(item.Pillar);
|
| 223 |
+
pct_gui.push(item.pct_gui);
|
| 224 |
+
});
|
| 225 |
+
|
| 226 |
+
var data = {
|
| 227 |
+
labels: pillar,
|
| 228 |
+
datasets: [{
|
| 229 |
+
data: pct_gui,
|
| 230 |
+
backgroundColor: ['rgba(63,103,126,1)', 'rgba(163,103,126,1)', 'rgba(63,203,226,1)', 'rgba(90,34,21,1)', 'rgba(200,150,50,1)'],
|
| 231 |
+
hoverBackgroundColor: ['rgba(50,90,100,1)', 'rgba(140,85,100,1)', 'rgba(46,185,235,1)', 'rgba(45,21,231,1)', 'rgba(190,120,40,1)']
|
| 232 |
+
}]
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
new Chart(document.getElementById('doughnutChart2'), {
|
| 236 |
+
type: 'doughnut',
|
| 237 |
+
data: data,
|
| 238 |
+
options: {
|
| 239 |
+
plugins: {
|
| 240 |
+
legend: {
|
| 241 |
+
display: true,
|
| 242 |
+
position: 'bottom',
|
| 243 |
+
align: 'center',
|
| 244 |
+
}
|
| 245 |
+
},
|
| 246 |
+
tooltips: {
|
| 247 |
+
callbacks: {
|
| 248 |
+
label: function (context) {
|
| 249 |
+
var label = context.label || '';
|
| 250 |
+
var value = context.formattedValue;
|
| 251 |
+
return label + ': ' + value;
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
});
|
| 257 |
+
});
|
| 258 |
+
|
| 259 |
+
// Badges | Bar chart for badge earned per month
|
| 260 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 261 |
+
var month = [];
|
| 262 |
+
var cnt_gui_badgeinitiated = [];
|
| 263 |
+
var cnt_gui_badgeawarded = [];
|
| 264 |
+
|
| 265 |
+
json_badgecompletion_data.forEach(function(item) {
|
| 266 |
+
month.push(item.Month);
|
| 267 |
+
cnt_gui_badgeinitiated.push(item.cnt_gui_badgeinitiated);
|
| 268 |
+
cnt_gui_badgeawarded.push(item.cnt_gui_badgeawarded);
|
| 269 |
+
});
|
| 270 |
+
|
| 271 |
+
new Chart(document.getElementById('barchart_badgecompletionpermonth'), {
|
| 272 |
+
type: 'line',
|
| 273 |
+
data: {
|
| 274 |
+
labels: month,
|
| 275 |
+
datasets: [{
|
| 276 |
+
label: 'BadgeInitiated',
|
| 277 |
+
data: cnt_gui_badgeinitiated,
|
| 278 |
+
borderColor: 'rgba(154, 59, 59, 0.55)',
|
| 279 |
+
backgroundColor: 'rgba(154, 59, 59, 0.2)',
|
| 280 |
+
borderWidth: 7,
|
| 281 |
+
pointRadius: 4,
|
| 282 |
+
pointHoverRadius: 7,
|
| 283 |
+
fill:true,
|
| 284 |
+
|
| 285 |
+
},{
|
| 286 |
+
label: 'BadgeAwarded',
|
| 287 |
+
data: cnt_gui_badgeawarded,
|
| 288 |
+
borderColor: 'rgba(38,87,124, 0.55)',
|
| 289 |
+
backgroundColor: 'rgba(38,87,124,0.2)',
|
| 290 |
+
borderWidth: 7,
|
| 291 |
+
pointRadius: 4,
|
| 292 |
+
pointHoverRadius: 7,
|
| 293 |
+
fill:true,
|
| 294 |
+
},
|
| 295 |
+
]
|
| 296 |
+
},
|
| 297 |
+
options: {
|
| 298 |
+
scales: {
|
| 299 |
+
y: {
|
| 300 |
+
beginAtZero: true
|
| 301 |
+
}
|
| 302 |
+
},
|
| 303 |
+
},
|
| 304 |
+
|
| 305 |
+
});
|
| 306 |
+
});
|
| 307 |
+
|
| 308 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 309 |
+
new Chart(document.getElementById('doughnutChart4'), {
|
| 310 |
+
type: 'doughnut',
|
| 311 |
+
data: data,
|
| 312 |
+
options: {
|
| 313 |
+
plugins: {
|
| 314 |
+
legend: {
|
| 315 |
+
display: true,
|
| 316 |
+
position: 'top',
|
| 317 |
+
align: 'right',
|
| 318 |
+
}
|
| 319 |
+
},
|
| 320 |
+
tooltips: {
|
| 321 |
+
callbacks: {
|
| 322 |
+
label: function (context) {
|
| 323 |
+
var label = context.label || '';
|
| 324 |
+
var value = context.formattedValue;
|
| 325 |
+
return label + ': ' + value;
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
});
|
| 331 |
+
});
|
| 332 |
+
|
| 333 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 334 |
+
// Chart js | populating the line chart across each month with their rank
|
| 335 |
+
// Get the canvas element and context for the line chart
|
| 336 |
+
var labels = [];
|
| 337 |
+
var dist_staff = [];
|
| 338 |
+
var dist_senior = [];
|
| 339 |
+
var dist_manager = [];
|
| 340 |
+
var dist_seniormanager = [];
|
| 341 |
+
var dist_director = [];
|
| 342 |
+
var dist_partner = [];
|
| 343 |
+
|
| 344 |
+
// Extract data from JSON
|
| 345 |
+
jsonEmpDist.forEach(function(item) {
|
| 346 |
+
labels.push(item.Month);
|
| 347 |
+
dist_staff.push(item.Staff);
|
| 348 |
+
dist_senior.push(item.Senior);
|
| 349 |
+
dist_manager.push(item.Manager);
|
| 350 |
+
dist_seniormanager.push(item.SeniorManager);
|
| 351 |
+
dist_director.push(item.Director);
|
| 352 |
+
dist_partner.push(item.Partner);
|
| 353 |
+
});
|
| 354 |
+
|
| 355 |
+
var canvas = document.getElementById('line_rankdistribution');
|
| 356 |
+
var ctx = canvas.getContext('2d');
|
| 357 |
+
// Data for the multiple line charts
|
| 358 |
+
var data = {
|
| 359 |
+
labels: labels,
|
| 360 |
+
datasets: [
|
| 361 |
+
{
|
| 362 |
+
label: 'Staff',
|
| 363 |
+
data: dist_staff,
|
| 364 |
+
borderColor: 'rgba(0, 102, 153, 0.5)',
|
| 365 |
+
backgroundColor: 'rgba(0, 102, 153, 0.2)',
|
| 366 |
+
borderWidth: 7,
|
| 367 |
+
pointRadius: 7,
|
| 368 |
+
pointHoverRadius: 8,
|
| 369 |
+
// fill:true,
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
label: 'Senior',
|
| 373 |
+
data: dist_senior,
|
| 374 |
+
borderColor: 'rgba(0, 204, 204, 0.5)',
|
| 375 |
+
backgroundColor: 'rgba(0, 204, 204,0.2)',
|
| 376 |
+
borderWidth: 7,
|
| 377 |
+
pointRadius: 7,
|
| 378 |
+
pointHoverRadius: 8,
|
| 379 |
+
// fill: true,
|
| 380 |
+
},
|
| 381 |
+
// {
|
| 382 |
+
// label: 'Manager',
|
| 383 |
+
// data: dist_manager,
|
| 384 |
+
// borderColor: 'rgba(204, 102, 0, 0.5)',
|
| 385 |
+
// // backgroundColor: 'rgba(77, 255, 255,0.2)',
|
| 386 |
+
// borderWidth: 5,
|
| 387 |
+
// pointRadius: 5,
|
| 388 |
+
// // pointHoverRadius: 6,
|
| 389 |
+
// },
|
| 390 |
+
{
|
| 391 |
+
label: 'Senior Manager',
|
| 392 |
+
data: dist_seniormanager,
|
| 393 |
+
borderColor: 'rgba(255, 204, 102, 0.5)',
|
| 394 |
+
backgroundColor: 'rgba(255, 204, 102,0.2)',
|
| 395 |
+
borderWidth: 7,
|
| 396 |
+
pointRadius: 7,
|
| 397 |
+
pointHoverRadius: 8,
|
| 398 |
+
// fill:true,
|
| 399 |
+
},
|
| 400 |
+
{
|
| 401 |
+
label: 'Total Count',
|
| 402 |
+
data: [55, 60, 65, 50, 60, 61, 50],
|
| 403 |
+
backgroundColor: 'rgba(63,103,126,0.8)',
|
| 404 |
+
borderWidth: 1,
|
| 405 |
+
barPercentage: 0.6,
|
| 406 |
+
categoryPercentage: 0.8,
|
| 407 |
+
type: 'bar'
|
| 408 |
+
},
|
| 409 |
+
]
|
| 410 |
+
};
|
| 411 |
+
|
| 412 |
+
// Create the line chart
|
| 413 |
+
var lineChart = new Chart(ctx, {
|
| 414 |
+
type: 'line',
|
| 415 |
+
data: data,
|
| 416 |
+
options: {
|
| 417 |
+
elements: {
|
| 418 |
+
line: {
|
| 419 |
+
tension: 0.4, // Adjust the tension for smooth curves
|
| 420 |
+
},
|
| 421 |
+
},
|
| 422 |
+
scales: {
|
| 423 |
+
x: {
|
| 424 |
+
display: true,
|
| 425 |
+
title: {
|
| 426 |
+
display: true,
|
| 427 |
+
},
|
| 428 |
+
},
|
| 429 |
+
y: {
|
| 430 |
+
beginAtZero: true, // Begin y-axis at zero
|
| 431 |
+
display: true,
|
| 432 |
+
title: {
|
| 433 |
+
display: true,
|
| 434 |
+
text: 'Employee Count',
|
| 435 |
+
},
|
| 436 |
+
},
|
| 437 |
+
},
|
| 438 |
+
}
|
| 439 |
+
});
|
| 440 |
+
});
|
| 441 |
+
|
| 442 |
+
// Calculate cumulative percentage
|
| 443 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 444 |
+
var data = {
|
| 445 |
+
labels: ['Bengaluru', 'Mumbai', 'Kolkata', 'Hyderabad', 'Gurgaon', 'Noida', 'Pune'],
|
| 446 |
+
datasets: [
|
| 447 |
+
{
|
| 448 |
+
label: 'Employee Count',
|
| 449 |
+
data: [2541, 1965, 1809, 1592, 1294, 762, 147],
|
| 450 |
+
backgroundColor: 'rgba(0, 68, 102, 0.7)',
|
| 451 |
+
yAxisID: 'primary',
|
| 452 |
+
barPercentage: 0.6,
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
label: 'Cumulative Percentage',
|
| 456 |
+
data: [25,44,62, 78, 91, 99, 100],
|
| 457 |
+
borderColor: 'rgba(163,103,126,0.7)',
|
| 458 |
+
backgroundColor: 'transparent',
|
| 459 |
+
borderWidth: 4,
|
| 460 |
+
pointRadius: 5,
|
| 461 |
+
yAxisID: 'secondary',
|
| 462 |
+
type: 'line',
|
| 463 |
+
},
|
| 464 |
+
],
|
| 465 |
+
};
|
| 466 |
+
|
| 467 |
+
// Get the canvas context
|
| 468 |
+
var ctx = document.getElementById('pareto_citydistribution').getContext('2d');
|
| 469 |
+
|
| 470 |
+
// Create the multi-axis Pareto diagram with options
|
| 471 |
+
var pareto_citydistribution = new Chart(ctx, {
|
| 472 |
+
type: 'bar',
|
| 473 |
+
data: data,
|
| 474 |
+
options: {
|
| 475 |
+
scales: {
|
| 476 |
+
x: {
|
| 477 |
+
display: true,
|
| 478 |
+
title: {
|
| 479 |
+
display: true,
|
| 480 |
+
text: 'City',
|
| 481 |
+
},
|
| 482 |
+
},
|
| 483 |
+
primary: {
|
| 484 |
+
type: 'linear',
|
| 485 |
+
position: 'left',
|
| 486 |
+
beginAtZero: true,
|
| 487 |
+
display: true,
|
| 488 |
+
title: {
|
| 489 |
+
display: true,
|
| 490 |
+
text: 'Employee Count',
|
| 491 |
+
},
|
| 492 |
+
},
|
| 493 |
+
secondary: {
|
| 494 |
+
type: 'linear',
|
| 495 |
+
position: 'right',
|
| 496 |
+
beginAtZero: true,
|
| 497 |
+
display: true,
|
| 498 |
+
title: {
|
| 499 |
+
display: true,
|
| 500 |
+
text: 'Cumulative Percentage',
|
| 501 |
+
},
|
| 502 |
+
},
|
| 503 |
+
},
|
| 504 |
+
plugins: {
|
| 505 |
+
legend: {
|
| 506 |
+
display: true,
|
| 507 |
+
},
|
| 508 |
+
},
|
| 509 |
+
},
|
| 510 |
+
});
|
| 511 |
+
});
|
| 512 |
+
|
| 513 |
+
// chat function which loads user message and gets bot response by invoking the URI
|
| 514 |
+
document.addEventListener("DOMContentLoaded", function () {
|
| 515 |
+
const msgerForm = document.querySelector(".msger-inputarea");
|
| 516 |
+
const msgerInput = document.querySelector("#textInput");
|
| 517 |
+
const msgerChat = document.querySelector(".chat-container");
|
| 518 |
+
|
| 519 |
+
msgerForm.addEventListener("submit", function (event) {
|
| 520 |
+
event.preventDefault();
|
| 521 |
+
const msgText = msgerInput.value;
|
| 522 |
+
if (!msgText) return;
|
| 523 |
+
|
| 524 |
+
appendMessage(msgText);
|
| 525 |
+
msgerInput.value = "";
|
| 526 |
+
botResponse(msgText);
|
| 527 |
+
});
|
| 528 |
+
|
| 529 |
+
function appendMessage(text) {
|
| 530 |
+
const msgHTML = `
|
| 531 |
+
<div class="user-message">
|
| 532 |
+
<div class="user-icon"></div>
|
| 533 |
+
<div class="user-message-bubble">
|
| 534 |
+
${text}
|
| 535 |
+
</div>
|
| 536 |
+
</div>
|
| 537 |
+
`;
|
| 538 |
+
|
| 539 |
+
msgerChat.insertAdjacentHTML("beforeend", msgHTML);
|
| 540 |
+
msgerChat.scrollTop += 500;
|
| 541 |
+
|
| 542 |
+
setTimeout(function() {
|
| 543 |
+
const loadHTML = `
|
| 544 |
+
<div id="loading-div">
|
| 545 |
+
<div class="spinner-grow spinner-grow-sm text-light" role="status" style="margin-left:40px">
|
| 546 |
+
<span class="visually-hidden">Loading...</span>
|
| 547 |
+
</div>
|
| 548 |
+
<div class="spinner-border spinner-border-sm text-light" role="status">
|
| 549 |
+
<span class="visually-hidden">Loading...</span>
|
| 550 |
+
</div>
|
| 551 |
+
</div>
|
| 552 |
+
`;
|
| 553 |
+
msgerChat.insertAdjacentHTML("beforeend", loadHTML);
|
| 554 |
+
msgerChat.scrollTop += 500;
|
| 555 |
+
}, 1000);
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
function botResponse(rawText) {
|
| 559 |
+
|
| 560 |
+
// const table_selected = document.getElementById("table-dropdown").value;
|
| 561 |
+
const url = window.location.href;
|
| 562 |
+
const parts = url.split('/');
|
| 563 |
+
const lastPart = parts[parts.length - 1];
|
| 564 |
+
// Remove any query parameters (e.g., '?foo=bar') by splitting at '?'
|
| 565 |
+
const withoutQuery = lastPart.split('?')[0];
|
| 566 |
+
// Assign the substring to table_selected
|
| 567 |
+
table_selected = withoutQuery.replace('validate_', '');;
|
| 568 |
+
|
| 569 |
+
$.get("/get_val_llmresponse", { msg: rawText, table_selected: table_selected }).done(function (data) {
|
| 570 |
+
// Create a new Date object to represent the current date and time
|
| 571 |
+
const currentDate = new Date();
|
| 572 |
+
// Get various components of the current date and time
|
| 573 |
+
const year = currentDate.getFullYear(); // Get the current year (e.g., 2023)
|
| 574 |
+
const month = currentDate.getMonth() + 1; // Get the current month (0-11, add 1 for January to December)
|
| 575 |
+
const day = currentDate.getDate(); // Get the current day of the month (1-31)
|
| 576 |
+
const hours = currentDate.getHours(); // Get the current hour (0-23)
|
| 577 |
+
const minutes = currentDate.getMinutes(); // Get the current minute (0-59)
|
| 578 |
+
const seconds = currentDate.getSeconds(); // Get the current second (0-59)
|
| 579 |
+
const milliseconds = currentDate.getMilliseconds(); // Get the current millisecond (0-999)
|
| 580 |
+
const timestamp_now = `${year}${month}${day}-${hours}${minutes}${seconds}${milliseconds}`
|
| 581 |
+
const canvasid = "canvasid_" + timestamp_now
|
| 582 |
+
|
| 583 |
+
var responseData = JSON.parse(data);
|
| 584 |
+
|
| 585 |
+
var issuccess = responseData.success;
|
| 586 |
+
var chart_type = responseData.chart_type;
|
| 587 |
+
var chart_label = responseData.chart_label;
|
| 588 |
+
var text_to_display = responseData.text_to_display;
|
| 589 |
+
|
| 590 |
+
if (chart_type === 'text') {
|
| 591 |
+
if (text_to_display === null || text_to_display === '') {
|
| 592 |
+
text_to_display = '<span class="badge badge-danger">Error</span> Please try modifying the prompt with more details.';
|
| 593 |
+
}
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
var chart_data = JSON.parse(responseData.chart_json_data);
|
| 597 |
+
|
| 598 |
+
// clear the loading icon
|
| 599 |
+
// Get the element by its ID
|
| 600 |
+
var element = document.getElementById("loading-div");
|
| 601 |
+
// Check if the element exists before attempting to remove it
|
| 602 |
+
if (element) {
|
| 603 |
+
element.remove(); // Remove the element
|
| 604 |
+
} else {
|
| 605 |
+
console.log("Loading div not found");
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
const msgHTML = `
|
| 609 |
+
<div class="bot-message">
|
| 610 |
+
<div class="bot-icon"></div>
|
| 611 |
+
<div class="bot-message-bubble">
|
| 612 |
+
${chart_type !=='text' ? `<canvas id="${canvasid}" height="235"></canvas>` : text_to_display}
|
| 613 |
+
</div>
|
| 614 |
+
</div>
|
| 615 |
+
`;
|
| 616 |
+
msgerChat.insertAdjacentHTML("beforeend", msgHTML);
|
| 617 |
+
msgerChat.scrollTop += 500;
|
| 618 |
+
|
| 619 |
+
// Create the chart for this message
|
| 620 |
+
new Chart(document.getElementById(canvasid), {
|
| 621 |
+
// type: 'line',
|
| 622 |
+
data: chart_data,
|
| 623 |
+
options: {
|
| 624 |
+
scales: {
|
| 625 |
+
y: {
|
| 626 |
+
beginAtZero: true
|
| 627 |
+
}
|
| 628 |
+
},
|
| 629 |
+
plugins: {
|
| 630 |
+
legend: {
|
| 631 |
+
display: true,
|
| 632 |
+
position: 'bottom',
|
| 633 |
+
align: 'center',
|
| 634 |
+
},
|
| 635 |
+
},
|
| 636 |
+
}
|
| 637 |
+
});
|
| 638 |
+
});
|
| 639 |
+
}
|
| 640 |
+
});
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
// Miscellanous | Bar chart count of GUI matching with
|
| 644 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 645 |
+
var tableinconsideration = ['Workforce', 'GTE', 'TR', 'Badges', 'Learning', 'LAT', 'WorkExperience'];
|
| 646 |
+
var pct_commongui = [100, 98, 73, 89, 75, 70, 78];
|
| 647 |
+
|
| 648 |
+
// json_badgecompletion_data.forEach(function(item) {
|
| 649 |
+
// month.push(item.Month);
|
| 650 |
+
// cnt_gui_badgeinitiated.push(item.cnt_gui_badgeinitiated);
|
| 651 |
+
// cnt_gui_badgeawarded.push(item.cnt_gui_badgeawarded);
|
| 652 |
+
// });
|
| 653 |
+
|
| 654 |
+
new Chart(document.getElementById('alltable_matchbar'), {
|
| 655 |
+
type: 'bar',
|
| 656 |
+
data: {
|
| 657 |
+
labels: tableinconsideration,
|
| 658 |
+
datasets: [{
|
| 659 |
+
label: 'Percentage of GUIs matching with other tables',
|
| 660 |
+
data: pct_commongui,
|
| 661 |
+
borderColor: 'rgba(0, 68, 102, 0.8)',
|
| 662 |
+
backgroundColor: pct_commongui.map(value => value < 75 ? '#EE9322' : 'rgba(0, 68, 102, 0.6)'),
|
| 663 |
+
barPercentage: 0.65
|
| 664 |
+
}]
|
| 665 |
+
},
|
| 666 |
+
options: {
|
| 667 |
+
indexAxis: 'y',
|
| 668 |
+
scales: {
|
| 669 |
+
x: {
|
| 670 |
+
beginAtZero: true
|
| 671 |
+
}
|
| 672 |
+
},
|
| 673 |
+
plugins: {
|
| 674 |
+
verticalLine: {
|
| 675 |
+
x: 75, // The x-coordinate where you want to draw the line
|
| 676 |
+
borderColor: '#FF9B50', // Line color
|
| 677 |
+
borderWidth: 4, // Line width
|
| 678 |
+
label: {
|
| 679 |
+
text: '75%', // Label text
|
| 680 |
+
position: 'top', // Label position
|
| 681 |
+
backgroundColor: 'white', // Label background color
|
| 682 |
+
},
|
| 683 |
+
}
|
| 684 |
+
},
|
| 685 |
+
},
|
| 686 |
+
|
| 687 |
+
plugins: [{
|
| 688 |
+
beforeDraw: (chart) => {
|
| 689 |
+
const line = chart.options.plugins.verticalLine;
|
| 690 |
+
if (line) {
|
| 691 |
+
const ctx = chart.ctx;
|
| 692 |
+
const x = chart.scales.x.getPixelForValue(line.x);
|
| 693 |
+
// Set the line to be dotted
|
| 694 |
+
ctx.setLineDash([10, 5]); // Adjust the numbers to change the dash pattern
|
| 695 |
+
|
| 696 |
+
// Draw the vertical line
|
| 697 |
+
ctx.save();
|
| 698 |
+
ctx.beginPath();
|
| 699 |
+
ctx.strokeStyle = line.borderColor;
|
| 700 |
+
ctx.lineWidth = line.borderWidth;
|
| 701 |
+
ctx.moveTo(x, chart.chartArea.top);
|
| 702 |
+
ctx.lineTo(x, chart.chartArea.bottom);
|
| 703 |
+
ctx.stroke();
|
| 704 |
+
ctx.restore();
|
| 705 |
+
|
| 706 |
+
// Draw the label
|
| 707 |
+
if (line.label) {
|
| 708 |
+
const labelX = x + 5; // Adjust the label's x-coordinate for proper positioning
|
| 709 |
+
const labelY = chart.chartArea.top + 145; // Adjust the label's y-coordinate for proper positioning
|
| 710 |
+
|
| 711 |
+
ctx.fillStyle = line.label.backgroundColor;
|
| 712 |
+
ctx.fillRect(labelX, labelY, 25, 15);
|
| 713 |
+
|
| 714 |
+
ctx.textAlign = 'left';
|
| 715 |
+
ctx.font = '12px Arial';
|
| 716 |
+
ctx.fillStyle = 'black';
|
| 717 |
+
ctx.fillText(line.label.text, labelX + 5, labelY + 12);
|
| 718 |
+
}
|
| 719 |
+
}
|
| 720 |
+
}
|
| 721 |
+
}],
|
| 722 |
+
});
|
| 723 |
+
})
|
templates/chatfile8.html
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/chat_style.css') }}">
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 9 |
+
<title>Collapsible Chat Panel</title>
|
| 10 |
+
</head>
|
| 11 |
+
|
| 12 |
+
<body>
|
| 13 |
+
<button class="btn btn-primary toggle-button" type="button" id="toggleButton">
|
| 14 |
+
<i class="fas fa-arrow-left"></i>
|
| 15 |
+
</button>
|
| 16 |
+
<div class="container">
|
| 17 |
+
<div class="sidechatpanel" id="sidechatpanel">
|
| 18 |
+
<div class="msger-header">
|
| 19 |
+
<span class="">LaborEconomicsBot</span>
|
| 20 |
+
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()"
|
| 21 |
+
style="float: right; margin-right: 15px;">
|
| 22 |
+
<i class="fas fa-times"></i>
|
| 23 |
+
</a>
|
| 24 |
+
</div>
|
| 25 |
+
<div class="chat-container">
|
| 26 |
+
<div class="bot-message">
|
| 27 |
+
<div class="bot-icon"></div>
|
| 28 |
+
<div class="bot-message-bubble">
|
| 29 |
+
Ask any question related to labor ecomomics Data!
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<form class="msger-inputarea" method="POST">
|
| 35 |
+
<div class="msger-input">
|
| 36 |
+
<input type="text" id="textInput" autocomplete="off" placeholder="Enter your message...">
|
| 37 |
+
<!-- Hidden field to capture any other value from the web page -->
|
| 38 |
+
<input type="hidden" name="hiddenField" id="hiddenField">
|
| 39 |
+
<button type="submit" class="msger-send-btn"></button>
|
| 40 |
+
</div>
|
| 41 |
+
</form>
|
| 42 |
+
</div>
|
| 43 |
+
<!-- </div> -->
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
<script src='https://use.fontawesome.com/releases/v5.0.13/js/all.js'></script>
|
| 47 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 48 |
+
<script>
|
| 49 |
+
const toggleButton = document.getElementById('toggleButton');
|
| 50 |
+
const sidechatpanel = document.getElementById('sidechatpanel');
|
| 51 |
+
|
| 52 |
+
toggleButton.addEventListener('click', () => {
|
| 53 |
+
sidechatpanel.classList.toggle('show');
|
| 54 |
+
});
|
| 55 |
+
</script>
|
| 56 |
+
<script>
|
| 57 |
+
function closeNav() {
|
| 58 |
+
document.getElementById("toggleButton").click();
|
| 59 |
+
}
|
| 60 |
+
</script>
|
| 61 |
+
</body>
|
| 62 |
+
|
| 63 |
+
</html>
|
templates/data.html
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'lay_side.html' %}
|
| 2 |
+
|
| 3 |
+
{% block css %}
|
| 4 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/data_style.css') }}">
|
| 5 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap5.min.css">
|
| 6 |
+
|
| 7 |
+
{% endblock %}
|
| 8 |
+
|
| 9 |
+
{% block content %}
|
| 10 |
+
<div class="container" style="margin-bottom: 75px;">
|
| 11 |
+
|
| 12 |
+
<!-- First Row: Label, Dropdown, and Download Button -->
|
| 13 |
+
<div class="row" style="background-color:rgb(135, 167, 167); padding-top: 10px; padding-bottom: 10px; margin-left: 0px; margin-right: 0px;">
|
| 14 |
+
<div class="col-md-2" style="margin-left: 15px;">
|
| 15 |
+
<!-- Label for the dropdown -->
|
| 16 |
+
<label for="table-dropdown" style="margin-top: 5px; font-weight: 600;">Table Name : </label>
|
| 17 |
+
</div>
|
| 18 |
+
<div class="col-md-6">
|
| 19 |
+
<!-- Dropdown for table selection -->
|
| 20 |
+
<select id="table-dropdown" class="form-control" style="margin-left: -85px; width:200px;">
|
| 21 |
+
{% for tbl_name, _ in table_htmls.items() %}
|
| 22 |
+
<option value="{{ loop.index }}">{{ tbl_name | upper }}</option>
|
| 23 |
+
{% endfor %}
|
| 24 |
+
</select>
|
| 25 |
+
</div>
|
| 26 |
+
<div class="col-md-3 d-flex justify-content-end align-items-center" style="margin-left: 70px;">
|
| 27 |
+
<!-- Download Button -->
|
| 28 |
+
<button class="btn btn-light" onclick="downloadTableData()">
|
| 29 |
+
<i class="fas fa-download mr-2"></i> Download All
|
| 30 |
+
</button>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<!-- Second Row: Table Contents -->
|
| 35 |
+
<div class="tab" id="tablestab" style="padding: 10px 10px 10px;">
|
| 36 |
+
{% for _, table_html in table_htmls.items() %}
|
| 37 |
+
<div class="tabcontent" id="content{{ loop.index }}">
|
| 38 |
+
{{ table_html | safe }} <!-- The "safe" filter is used to render the HTML content as-is -->
|
| 39 |
+
</div>
|
| 40 |
+
{% endfor %}
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
<div class="fixed-button">
|
| 45 |
+
<!-- <div class="col-md-3 d-flex justify-content-end align-items-center" style="margin-left: 70px;"> -->
|
| 46 |
+
<div class="container d-flex justify-content-end align-items-center" style="margin-left: 50px;">
|
| 47 |
+
<button class="btn btn-warning" onclick="redirecttovalidation()">Proceed for validation <i class="fas fa-arrow-right"></i></button>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
<div id="content">
|
| 51 |
+
{% include 'chatfile8.html' %}
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
{% endblock %}
|
| 55 |
+
|
| 56 |
+
{% block javascript %}
|
| 57 |
+
<!-- Add any additional JavaScript specific to data.html here -->
|
| 58 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 59 |
+
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
| 60 |
+
<script src="https://cdn.datatables.net/1.13.5/js/dataTables.bootstrap5.min.js"></script>
|
| 61 |
+
<script src="{{ url_for('static', filename='js/data_script.js') }}"></script>
|
| 62 |
+
|
| 63 |
+
<script>
|
| 64 |
+
$(document).ready(function () {
|
| 65 |
+
console.log("Print hello")
|
| 66 |
+
{% for tbl_name, _ in table_htmls.items() %}
|
| 67 |
+
$('#dtable_{{ tbl_name }}').DataTable({
|
| 68 |
+
scrollX: true
|
| 69 |
+
});
|
| 70 |
+
{% endfor %}
|
| 71 |
+
// document.getElementById("tab1").click();
|
| 72 |
+
});
|
| 73 |
+
</script>
|
| 74 |
+
<script>
|
| 75 |
+
// JavaScript code to handle the dropdown change event and show the corresponding content div
|
| 76 |
+
$(document).ready(function () {
|
| 77 |
+
// Show the initial selected table content on page load
|
| 78 |
+
showSelectedTableContent();
|
| 79 |
+
|
| 80 |
+
// Handle dropdown change event
|
| 81 |
+
$('#table-dropdown').on('change', function () {
|
| 82 |
+
showSelectedTableContent();
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
// Function to show the selected table content
|
| 86 |
+
function showSelectedTableContent() {
|
| 87 |
+
const selectedTableIndex = $('#table-dropdown').val();
|
| 88 |
+
$('.tabcontent').hide();
|
| 89 |
+
$('#content' + selectedTableIndex).show();
|
| 90 |
+
}
|
| 91 |
+
});
|
| 92 |
+
|
| 93 |
+
// Function to handle the table data download
|
| 94 |
+
function downloadTableData() {
|
| 95 |
+
// Implement your download logic here
|
| 96 |
+
console.log('Downloading table data...');
|
| 97 |
+
}
|
| 98 |
+
</script>
|
| 99 |
+
<script>
|
| 100 |
+
var req_tables = {{ req_tables | safe }};
|
| 101 |
+
</script>
|
| 102 |
+
<script>
|
| 103 |
+
document.addEventListener("DOMContentLoaded", function() {
|
| 104 |
+
console.log("Entered")
|
| 105 |
+
var dropdown = document.getElementById("table-dropdown");
|
| 106 |
+
console.log("The value is , ", dropdown.value)
|
| 107 |
+
var hiddenField = document.getElementById("hiddenField");
|
| 108 |
+
|
| 109 |
+
dropdown.addEventListener("change", function() {
|
| 110 |
+
hiddenField.value = dropdown.value;
|
| 111 |
+
});
|
| 112 |
+
});
|
| 113 |
+
</script>
|
| 114 |
+
{% endblock %}
|
templates/home.html
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'lay_side.html' %}
|
| 2 |
+
|
| 3 |
+
{% block css %}
|
| 4 |
+
<!-- Add any additional CSS specific to home.html here -->
|
| 5 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/home_style.css') }}">
|
| 6 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
| 7 |
+
{% endblock %}
|
| 8 |
+
|
| 9 |
+
{% block content %}
|
| 10 |
+
<!-- Add the content specific to home.html here -->
|
| 11 |
+
<div class="container">
|
| 12 |
+
<div class="row">
|
| 13 |
+
<div class="col-md-6 left-column" style="background-image: url('{{ url_for('static', filename='images/labormarket.jpeg') }}'); background-size: cover; background-position: center; background-repeat: no-repeat; padding-right: 20px;background-color:rgba(0,0,0,0.2);">
|
| 14 |
+
</div>
|
| 15 |
+
<div class="col-md-6 right-column">
|
| 16 |
+
<h2 style="font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif">User Input Page</h2>
|
| 17 |
+
<p>Please select below filters. Please note that GPNs extracted from workforce data would be used to get other datasets.</p>
|
| 18 |
+
<form method="POST">
|
| 19 |
+
<div class="form-group">
|
| 20 |
+
<label for="date_range">Date Range</label>
|
| 21 |
+
<div id="reportrange" class="form-control" name="date_range" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
| 22 |
+
<i class="fa fa-calendar"></i>
|
| 23 |
+
<input type="hidden" name="calendar_value">
|
| 24 |
+
<span></span>
|
| 25 |
+
<i class="fa fa-caret-down" style="float:right; margin-right:0; top:50%; position:relative; transform: translateY(-50%);"></i>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div class="form-group">
|
| 30 |
+
<label for="sl_subsl">SL/SSL</label>
|
| 31 |
+
<select class="form-control" id = "slssl" name="sl_subsl" required>
|
| 32 |
+
<option value="">Select Option</option>
|
| 33 |
+
<option value="consulting_dna">Consulting DnA</option>
|
| 34 |
+
<option value="consulting_det">Consulting DET</option>
|
| 35 |
+
<option value="assurance_dna">Assurance DnA</option>
|
| 36 |
+
<option value="assurance_audit">Assurance Audit</option>
|
| 37 |
+
<option value="tax_gcr_emeia">TAX GCR EMEIA</option>
|
| 38 |
+
<option value="eyk_content_delivery">EYK Content Delivery</option>
|
| 39 |
+
<option value="es_rms_iass">ES RMS IASS</option>
|
| 40 |
+
</select>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
<div class="form-group">
|
| 44 |
+
<label for="tbl_selected">Table(s)</label>
|
| 45 |
+
<select class="form-control" id="multiple-checkboxes" multiple="multiple" name="tbl_selected" required>
|
| 46 |
+
<option value="workforce">Workforce</option>
|
| 47 |
+
<option value="badges">Badges</option>
|
| 48 |
+
<option value="learning">Learning</option>
|
| 49 |
+
<option value="lat">LAT</option>
|
| 50 |
+
<option value="tr">TR</option>
|
| 51 |
+
<option value="mct">MCT</option>
|
| 52 |
+
<option value="profqual">Profqual</option>
|
| 53 |
+
</select>
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<button type="submit" class="btn btn-primary">Submit</button>
|
| 57 |
+
</form>
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
{% endblock %}
|
| 62 |
+
|
| 63 |
+
{% block javascript %}
|
| 64 |
+
<!-- Add any additional JavaScript specific to home.html here -->
|
| 65 |
+
<script src="{{url_for('static', filename='js/home_script.js')}}"></script>
|
| 66 |
+
<!-- Bootstrap Datepicker -->
|
| 67 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
| 68 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
| 69 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
| 70 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
|
| 71 |
+
<script src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
| 72 |
+
{% endblock %}
|
templates/index.html
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
|
| 5 |
+
<title>Laboreconomics_allinone</title>
|
| 6 |
+
<!-- Add Bootstrap CSS -->
|
| 7 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
|
| 8 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
|
| 9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css">
|
| 10 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
| 11 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
|
| 12 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
| 13 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
| 14 |
+
</head>
|
| 15 |
+
<body>
|
| 16 |
+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
| 17 |
+
<div class="container">
|
| 18 |
+
<a class="navbar-brand" href="#">LE_AllinOne</a>
|
| 19 |
+
</div>
|
| 20 |
+
</nav>
|
| 21 |
+
|
| 22 |
+
<div class="container mt-4">
|
| 23 |
+
<form method="POST">
|
| 24 |
+
<div class="row mb-3">
|
| 25 |
+
<div class="col">
|
| 26 |
+
<select class="form-select" name="Environment" enabled>
|
| 27 |
+
<option value="option1">DEV</option>
|
| 28 |
+
<option value="option2">UAT</option>
|
| 29 |
+
<option value="option3">PROD</option>
|
| 30 |
+
</select>
|
| 31 |
+
</div>
|
| 32 |
+
<div class="col">
|
| 33 |
+
<select class="form-select" name="dbtable" enabled>
|
| 34 |
+
<option value="workforce">Workforce</option>
|
| 35 |
+
<option value="badges">Badges</option>
|
| 36 |
+
<option value="learning">Learning</option>
|
| 37 |
+
<option value="lat">LAT</option>
|
| 38 |
+
<option value="tr">TR</option>
|
| 39 |
+
<option value="mct">MCT</option>
|
| 40 |
+
<option value="profqual">Profqual</option>
|
| 41 |
+
</select>
|
| 42 |
+
</div>
|
| 43 |
+
<div class="col">
|
| 44 |
+
<select class="form-select" name="sl_ssl" enabled>
|
| 45 |
+
<option value="option7">Consulting DnA</option>
|
| 46 |
+
<option value="option8">Consulting DET</option>
|
| 47 |
+
<option value="option9">Assurance DnA</option>
|
| 48 |
+
<option value="option9">Assurance Audit</option>
|
| 49 |
+
<option value="option9">TAX GCR EMEIA</option>
|
| 50 |
+
<option value="option9">EYK Content Delivery</option>
|
| 51 |
+
<option value="option9">ES RMS IASS</option>
|
| 52 |
+
</select>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<div class="col form-select" id="reportrange">
|
| 56 |
+
<i class="fa fa-calendar" name="daterange_report"></i>
|
| 57 |
+
<input type="hidden" name="calendar_value">
|
| 58 |
+
<span></span>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
<div class="form-check form-switch mb-3">
|
| 63 |
+
<input class="form-check-input" type="checkbox" id="toggleSwitch" onchange="toggleFormElements()">
|
| 64 |
+
<label class="form-check-label" for="toggleSwitch">use query</label>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<div class="row mb-3">
|
| 68 |
+
<div class="col">
|
| 69 |
+
<textarea class="form-control" name="querybox" rows="1" placeholder="Enter query" disabled></textarea>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div class="row">
|
| 74 |
+
<div class="col">
|
| 75 |
+
<button type="submit" class="btn btn-primary" enabled>Submit</button>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</form>
|
| 79 |
+
|
| 80 |
+
<br>
|
| 81 |
+
{% if show_table %}
|
| 82 |
+
<div class="tab" id="tablestab">
|
| 83 |
+
<button class="tablinks" onclick="openTab(event, 'content1')" id="tab1">Workforce</button>
|
| 84 |
+
<button class="tablinks" onclick="openTab(event, 'content2')">GTE</button>
|
| 85 |
+
<button class="tablinks" onclick="openTab(event, 'content3')">Badges</button>
|
| 86 |
+
<button class="tablinks" onclick="downloadTableData()" style="position: absolute; top: 0; right: 20px;">
|
| 87 |
+
<i class="fas fa-download mr-2"></i> Download All
|
| 88 |
+
</button>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<!-- Content Area -->
|
| 92 |
+
<div id="content1" class="content" style="margin-bottom:110px">
|
| 93 |
+
<!-- <h2>Content 1</h2>-->
|
| 94 |
+
<!-- <p>This is the content for Tab 1.</p>-->
|
| 95 |
+
<div class="container" >
|
| 96 |
+
<div class="row">
|
| 97 |
+
<div class="col-9" style="overflow-x: auto; overflow-y:auto; height:342px; white-space: nowrap;border-top: 3px red">
|
| 98 |
+
<div style="border-top: 4px red;">
|
| 99 |
+
{{ form_data | safe}}
|
| 100 |
+
<!-- Your table content here -->
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
<div class="col-3">
|
| 104 |
+
<div class="card bg-light">
|
| 105 |
+
<div class="card-body" style="white-space: nowrap;background-color:#c5e0e0;">
|
| 106 |
+
<h5 class="card-title">Stats</h5>
|
| 107 |
+
<p class="card-text">Table Name: <strong>Table 1</strong></p>
|
| 108 |
+
<p class="card-text">Number of Records: <strong>100</strong></p>
|
| 109 |
+
<p class="card-text">No of Columns: <strong>24</strong></p>
|
| 110 |
+
<p class="card-text">DataTypes: <strong>String</strong></p>
|
| 111 |
+
<p class="card-text">Table values: <strong>99</strong></p>
|
| 112 |
+
<p class="card-text">Possible: <strong>Yes</strong></p>
|
| 113 |
+
<p class="card-text">DataVolume: <strong>Yes</strong></p>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<div id="content2" class="content">
|
| 123 |
+
<div class="container" style="overflow-x: auto; white-space: nowrap; margin-top: 20px; ">
|
| 124 |
+
{{ form_data | safe }}
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<div id="content3" class="content">
|
| 129 |
+
<div class="container" style="overflow-x: auto; white-space: nowrap; margin-top: 20px; ">
|
| 130 |
+
{{ form_data | safe }}
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<div class="fixed-button">
|
| 135 |
+
<div class="container d-flex justify-content-end">
|
| 136 |
+
<button class="btn btn-info btn-lg" onclick="redirecttovalidation()">Proceed for validation ></button>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
{% endif %}
|
| 140 |
+
|
| 141 |
+
<!-- {% if plot_div %}-->
|
| 142 |
+
<!-- <div class="container mt-4">-->
|
| 143 |
+
<!-- <h4>Bar Chart:</h4>-->
|
| 144 |
+
<!-- {{ plot_div | safe }}-->
|
| 145 |
+
<!-- </div>-->
|
| 146 |
+
<!-- {% endif %}-->
|
| 147 |
+
|
| 148 |
+
</div>
|
| 149 |
+
|
| 150 |
+
<!-- Add Bootstrap JS -->
|
| 151 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 152 |
+
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 153 |
+
<!-- <script>-->
|
| 154 |
+
<!-- $(document).ready(function() {-->
|
| 155 |
+
<!-- $('#dtable').DataTable();-->
|
| 156 |
+
<!-- });-->
|
| 157 |
+
<!-- </script>-->
|
| 158 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
|
| 159 |
+
<!-- jQuery -->
|
| 160 |
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
| 161 |
+
<!-- Bootstrap JS -->
|
| 162 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
| 163 |
+
<!-- Bootstrap Datepicker JS -->
|
| 164 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
|
| 165 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
| 166 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
| 167 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
| 168 |
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
|
| 169 |
+
|
| 170 |
+
<!-- DataTables JavaScript -->
|
| 171 |
+
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
| 172 |
+
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap5.min.js"></script>
|
| 173 |
+
|
| 174 |
+
<script src="{{url_for('static', filename='js/mytest.js')}}"></script>
|
| 175 |
+
<!-- <script>
|
| 176 |
+
document.getElementById("tab1").click();
|
| 177 |
+
</script> -->
|
| 178 |
+
</body>
|
| 179 |
+
</html>
|
templates/lay_side.html
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>{% block title %}LE_Web{% endblock %}</title>
|
| 7 |
+
<!-- Bootstrap CSS -->
|
| 8 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
| 9 |
+
<!-- Font Awesome CSS -->
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 11 |
+
<!-- Custom CSS -->
|
| 12 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/layout_style.css') }}">
|
| 13 |
+
<!-- Add your additional CSS files here -->
|
| 14 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css">
|
| 15 |
+
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
|
| 16 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" /> -->
|
| 17 |
+
{% block css %}
|
| 18 |
+
{% endblock %}
|
| 19 |
+
</head>
|
| 20 |
+
<body>
|
| 21 |
+
<header>
|
| 22 |
+
<!-- Your common header code here -->
|
| 23 |
+
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgb(17, 67, 86);z-index: 2;position: fixed; top: 0; width: 100%;">
|
| 24 |
+
<div class="container-fluid">
|
| 25 |
+
<a class="navbar-brand" href="index.html" style="padding-left: 70px;">Labor Economics</a>
|
| 26 |
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
| 27 |
+
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
| 28 |
+
<span class="navbar-toggler-icon"></span>
|
| 29 |
+
</button>
|
| 30 |
+
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
| 31 |
+
<ul class="navbar-nav">
|
| 32 |
+
<li class="nav-item">
|
| 33 |
+
<a class="nav-link" href="home.html"><i class="bi bi-house-fill"></i> Home</a>
|
| 34 |
+
</li>
|
| 35 |
+
<li class="nav-item">
|
| 36 |
+
<a class="nav-link" href="data.html"><i class="bi bi-graph-up"></i> Data</a>
|
| 37 |
+
</li>
|
| 38 |
+
<li class="nav-item">
|
| 39 |
+
<a class="nav-link" href="stats.html"><i class="bi bi-bar-chart-fill"></i> Stats & Validation</a>
|
| 40 |
+
</li>
|
| 41 |
+
<li class="nav-item">
|
| 42 |
+
<a class="nav-link" href="dashboard.html"><i class="bi bi-speedometer2"></i> Performance Dashboard</a>
|
| 43 |
+
</li>
|
| 44 |
+
</ul>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
</nav>
|
| 48 |
+
</header>
|
| 49 |
+
|
| 50 |
+
<div class="container-fluid" style="margin-top: 55px;">
|
| 51 |
+
<div class="row">
|
| 52 |
+
{% if show_sidebar %}
|
| 53 |
+
<!-- Sidebar content goes here -->
|
| 54 |
+
<div class="col-md-1">
|
| 55 |
+
<div class="left_tblsidebar">
|
| 56 |
+
<!-- Sidebar content here -->
|
| 57 |
+
<!-- Sidebar content for dashboard page goes here -->
|
| 58 |
+
<ul class="nav flex-column" style="z-index: 0;">
|
| 59 |
+
<!-- Icon and tooltip for Workforce -->
|
| 60 |
+
<li class="nav-item {% if 'workforce' not in req_tables|map('lower') %} disabled {% endif %}">
|
| 61 |
+
<a class="val_leftsidebarcls" href="/validate_workforce" data-section="workforce">
|
| 62 |
+
<i class="fas fa-users"></i>
|
| 63 |
+
<span>Workforce</span>
|
| 64 |
+
</a>
|
| 65 |
+
</li>
|
| 66 |
+
<!-- Icon and tooltip for Badges -->
|
| 67 |
+
<li class="nav-item {% if 'badges' not in req_tables|map('lower') %} disabled {% endif %}">
|
| 68 |
+
<a class="val_leftsidebarcls" href="/validate_badges" data-section="badges">
|
| 69 |
+
<i class="fas fa-ribbon"></i>
|
| 70 |
+
<span style="text-align: center;">Badges</span>
|
| 71 |
+
</a>
|
| 72 |
+
</li>
|
| 73 |
+
|
| 74 |
+
<!-- Icon and tooltip for Learning -->
|
| 75 |
+
<li class="nav-item {% if 'learning' not in req_tables|map('lower') %} disabled {% endif %}">
|
| 76 |
+
<a class="val_leftsidebarcls" href="/validate_learning" data-section="learning">
|
| 77 |
+
<i class="fas fa-graduation-cap"></i>
|
| 78 |
+
<span>Learning</span>
|
| 79 |
+
</a>
|
| 80 |
+
</li>
|
| 81 |
+
|
| 82 |
+
<!-- Icon and tooltip for Timecard -->
|
| 83 |
+
<li class="nav-item {% if 'gte' not in req_tables|map('lower') %} disabled {% endif %}">
|
| 84 |
+
<a class="val_leftsidebarcls" href="#" data-section="timecard">
|
| 85 |
+
<i class="fas fa-clock"></i>
|
| 86 |
+
<span>Timecard</span>
|
| 87 |
+
</a>
|
| 88 |
+
</li>
|
| 89 |
+
|
| 90 |
+
<!-- Icon and tooltip for Qualification Details -->
|
| 91 |
+
<li class="nav-item {% if 'lat' not in req_tables|map('lower') %} disabled {% endif %}">
|
| 92 |
+
<a class="val_leftsidebarcls" href="#" data-toggle="tooltip" data-placement="right" title="Qualification Details">
|
| 93 |
+
<i class="fas fa-user-graduate"></i>
|
| 94 |
+
<span>Qualification</span>
|
| 95 |
+
</a>
|
| 96 |
+
</li>
|
| 97 |
+
|
| 98 |
+
<!-- Icon and tooltip for Misc Details -->
|
| 99 |
+
<li class="nav-item">
|
| 100 |
+
<a class="val_leftsidebarcls" href="/validate_miscellaneous" data-toggle="tooltip" data-placement="right" title="Misc Details">
|
| 101 |
+
<i class="fa-solid fa-layer-group"></i>
|
| 102 |
+
<span>Misc</span>
|
| 103 |
+
</a>
|
| 104 |
+
</li>
|
| 105 |
+
</ul>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
{% endif %}
|
| 109 |
+
|
| 110 |
+
<!-- Main content goes here -->
|
| 111 |
+
<div class="{% if show_sidebar %}col-md-10{% else %}col-md-12{% endif %}">
|
| 112 |
+
{% block content %}
|
| 113 |
+
<!-- Your main content goes here -->
|
| 114 |
+
{% endblock %}
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<!-- Bootstrap JS (Make sure to include this before your custom JS, if any) -->
|
| 121 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script>
|
| 122 |
+
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js"></script>
|
| 123 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.10.2/umd/popper.min.js"></script>
|
| 124 |
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
| 125 |
+
|
| 126 |
+
<!-- Add your additional JavaScript files here -->
|
| 127 |
+
{% block javascript %}
|
| 128 |
+
{% endblock %}
|
| 129 |
+
</body>
|
| 130 |
+
</html>
|
templates/survey_display.html
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 5 |
+
<!-- Font Awesome Library -->
|
| 6 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<div class="container">
|
| 10 |
+
<canvas id="paretoChart"></canvas>
|
| 11 |
+
</div>
|
| 12 |
+
</body>
|
| 13 |
+
<script>
|
| 14 |
+
// Sample data for the Pareto diagram
|
| 15 |
+
var data = {
|
| 16 |
+
labels: ['Category A', 'Category B', 'Category C', 'Category D', 'Category E'],
|
| 17 |
+
datasets: [
|
| 18 |
+
{
|
| 19 |
+
label: 'Frequency',
|
| 20 |
+
data: [15, 10, 25, 5, 30],
|
| 21 |
+
backgroundColor: 'rgba(75, 192, 192, 0.7)',
|
| 22 |
+
yAxisID: 'primary',
|
| 23 |
+
},
|
| 24 |
+
],
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
// Calculate cumulative percentage
|
| 28 |
+
var cumulativePercentage = [0];
|
| 29 |
+
var total = data.datasets[0].data.reduce((acc, value) => acc + value, 0);
|
| 30 |
+
data.datasets[0].data.forEach(value => {
|
| 31 |
+
cumulativePercentage.push((cumulativePercentage[cumulativePercentage.length - 1] + value) / total * 100);
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
// Create the secondary dataset for the cumulative percentage line
|
| 35 |
+
data.datasets.push({
|
| 36 |
+
label: 'Cumulative Percentage',
|
| 37 |
+
data: cumulativePercentage,
|
| 38 |
+
borderColor: 'rgba(255, 99, 132, 1)',
|
| 39 |
+
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
| 40 |
+
yAxisID: 'secondary',
|
| 41 |
+
type: 'line',
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
// Get the canvas context
|
| 45 |
+
var ctx = document.getElementById('paretoChart').getContext('2d');
|
| 46 |
+
|
| 47 |
+
// Create the multi-axis Pareto diagram with options
|
| 48 |
+
var paretoChart = new Chart(ctx, {
|
| 49 |
+
type: 'bar',
|
| 50 |
+
data: data,
|
| 51 |
+
options: {
|
| 52 |
+
scales: {
|
| 53 |
+
x: {
|
| 54 |
+
display: true,
|
| 55 |
+
title: {
|
| 56 |
+
display: true,
|
| 57 |
+
text: 'Categories',
|
| 58 |
+
},
|
| 59 |
+
},
|
| 60 |
+
primary: {
|
| 61 |
+
type: 'linear',
|
| 62 |
+
position: 'left',
|
| 63 |
+
beginAtZero: true,
|
| 64 |
+
display: true,
|
| 65 |
+
title: {
|
| 66 |
+
display: true,
|
| 67 |
+
text: 'Frequency',
|
| 68 |
+
},
|
| 69 |
+
},
|
| 70 |
+
secondary: {
|
| 71 |
+
type: 'linear',
|
| 72 |
+
position: 'right',
|
| 73 |
+
beginAtZero: true,
|
| 74 |
+
display: true,
|
| 75 |
+
title: {
|
| 76 |
+
display: true,
|
| 77 |
+
text: 'Cumulative Percentage (%)',
|
| 78 |
+
},
|
| 79 |
+
grid: {
|
| 80 |
+
drawOnChartArea: false, // Hide grid lines for the secondary axis
|
| 81 |
+
},
|
| 82 |
+
},
|
| 83 |
+
},
|
| 84 |
+
plugins: {
|
| 85 |
+
legend: {
|
| 86 |
+
display: true,
|
| 87 |
+
},
|
| 88 |
+
},
|
| 89 |
+
},
|
| 90 |
+
});
|
| 91 |
+
</script>
|
| 92 |
+
|
| 93 |
+
</html>
|
templates/validate_badges.html
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'lay_side.html' %}
|
| 2 |
+
|
| 3 |
+
{% block css %}
|
| 4 |
+
<!-- style="pointer-events: none;color: #ccc;cursor: not-allowed;" -->
|
| 5 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/validate_style.css') }}">
|
| 6 |
+
{% endblock %}
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
{% block content %}
|
| 10 |
+
<br>
|
| 11 |
+
<!-- Dashboard Content -->
|
| 12 |
+
<div class="dashboard-content">
|
| 13 |
+
<div class="container">
|
| 14 |
+
<div class="row">
|
| 15 |
+
<div class="col-md-3">
|
| 16 |
+
<div class="card headstats">
|
| 17 |
+
<div class="card-body">
|
| 18 |
+
<h5 class="card-title">Employee Count</h5>
|
| 19 |
+
<p class="card-text">{{ table_info['unique_gui'] }}</p>
|
| 20 |
+
</div>
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
<div class="col-md-3">
|
| 24 |
+
<div class="card headstats">
|
| 25 |
+
<div class="card-body">
|
| 26 |
+
<h5 class="card-title">Record Count</h5>
|
| 27 |
+
<p class="card-text">{{ table_info['n_rows'] }}</p>
|
| 28 |
+
</div>
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<div class="col-md-3">
|
| 33 |
+
<div class="card headstats">
|
| 34 |
+
<div class="card-body">
|
| 35 |
+
<h5 class="card-title"> # Features</h5>
|
| 36 |
+
<p class="card-text">{{ table_info['n_cols'] }}</p>
|
| 37 |
+
</div>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
<div class="col-md-3">
|
| 42 |
+
<div class="card headstats">
|
| 43 |
+
<div class="card-body">
|
| 44 |
+
<h5 class="card-title">Placeholder</h5>
|
| 45 |
+
<p class="card-text">Yes</p>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
<br>
|
| 54 |
+
<div class="container">
|
| 55 |
+
<div class="row">
|
| 56 |
+
<div class="col-md-12">
|
| 57 |
+
<h3 class="h3" style="font-weight: bolder;">Data Validation for badges</h3>
|
| 58 |
+
<p>All entries have undergone thorough validation and have been meticulously categorized into specific groups.
|
| 59 |
+
The Y-axis of the input data table lists the columns against which validation checks were conducted. These
|
| 60 |
+
validations have culminated in a visually informative bar chart, offering a clear representation of the
|
| 61 |
+
percentage distribution across each validated category.
|
| 62 |
+
</p>
|
| 63 |
+
<canvas id="validationbar"></canvas>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
<br>
|
| 68 |
+
<br>
|
| 69 |
+
<div class="container mt-4">
|
| 70 |
+
<div class="row">
|
| 71 |
+
<div class="col-md-8">
|
| 72 |
+
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
| 73 |
+
<div class="card-body">
|
| 74 |
+
<h5 class="card-title"><span class="badge badge-primary">Badge Earned month over month</span></h5>
|
| 75 |
+
<p>The data shows a monthly trend in badge initiation and awarding,
|
| 76 |
+
with the highest initiation count in February (56) and the highest award count in January (38).
|
| 77 |
+
Overall, badge activity remains consistent, with variations in each month.</p>
|
| 78 |
+
<canvas id="barchart_badgecompletionpermonth"></canvas>
|
| 79 |
+
<!-- <p class="card-text">The organization's workforce composition is characterized by a <i class="fa-solid fa-arrow-trend-up"></i> <span style="font-size: 24px; font-weight: bolder;color: #0d3460;">13</span>% higher representation of men compared to women, resulting in a diverse and varied cultural mix within the company.</p> -->
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
<div class="col-md-4">
|
| 84 |
+
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
| 85 |
+
<div class="card-body">
|
| 86 |
+
<h5 class="card-title"><span class="badge badge-info">Pillar distribution across badges</span></h5>
|
| 87 |
+
<p>The chart below shows the distribution of pillars across badges</p>
|
| 88 |
+
<canvas id="doughnutChart2"></canvas>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
<br>
|
| 95 |
+
<div class="container mt-4">
|
| 96 |
+
<div class="row">
|
| 97 |
+
<div class="col-md-4">
|
| 98 |
+
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
| 99 |
+
<div class="card-body">
|
| 100 |
+
<h5 class="card-title"><span class="badge badge-primary">Structured vs Unstructured</span></h5>
|
| 101 |
+
<!-- <p>The following chart shows the distribution of Badge Type</p> -->
|
| 102 |
+
<canvas id="doughnutchart_strvsunstr"></canvas>
|
| 103 |
+
<!-- <p class="card-text">The organization's workforce composition is characterized by a <i class="fa-solid fa-arrow-trend-up"></i> <span style="font-size: 24px; font-weight: bolder;color: #0d3460;">13</span>% higher representation of men compared to women, resulting in a diverse and varied cultural mix within the company.</p> -->
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="col-md-8">
|
| 108 |
+
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
| 109 |
+
<div class="card-body">
|
| 110 |
+
<h5 class="card-title"><span class="badge badge-info">Badge Title Distribution</span></h5>
|
| 111 |
+
<p class="card-text">
|
| 112 |
+
{% for item in lst_topfive_badgetitle %}
|
| 113 |
+
<span class="badge badge-secondary"> {{ item }} </span>
|
| 114 |
+
{% endfor %}
|
| 115 |
+
</p>
|
| 116 |
+
<p>The most interest lies in Agile Learning and Data Integration, with a strong focus on skill
|
| 117 |
+
develop ment. Data Visualization and Cloud Learning are also popular, reflecting a growing interest
|
| 118 |
+
in data presentation and cloud technologies. Robotic Process Automation badges signify a commitment
|
| 119 |
+
to automation skills, while Data Science Learning badges show an emerging interest in data science.
|
| 120 |
+
These badges offer valuable opportunities for personal and professional growth.</p>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
<br>
|
| 127 |
+
|
| 128 |
+
<div id="content">
|
| 129 |
+
{% include 'chatfile8.html' %}
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
{% endblock %}
|
| 133 |
+
|
| 134 |
+
{% block javascript %}
|
| 135 |
+
|
| 136 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 137 |
+
<script src="{{ url_for('static', filename='js/validate_script.js') }}"></script>
|
| 138 |
+
<!-- Add any additional JavaScript specific to data.html here -->
|
| 139 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.5.1/plotly.min.js"></script>
|
| 140 |
+
<!-- Bootstrap JS (Make sure to include this before your custom JS, if any) -->
|
| 141 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script>
|
| 142 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 143 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.10.2/umd/popper.min.js"></script>
|
| 144 |
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
| 145 |
+
|
| 146 |
+
<script>
|
| 147 |
+
var jsonData = {{ json_data | safe }};
|
| 148 |
+
var json_pillar_data = {{ json_pillar_data | safe }};
|
| 149 |
+
var json_badgecompletion_data = {{ json_badgecompletion_data | safe }};
|
| 150 |
+
</script>
|
| 151 |
+
{% endblock %}
|
| 152 |
+
|
| 153 |
+
<!-- var labels = {{ labels | tojson }};
|
| 154 |
+
var pattern_issue = {{ pattern_issue | tojson }};
|
| 155 |
+
var null_issue = {{ null_issue | tojson }};
|
| 156 |
+
var good_data = {{ good_data | tojson }}; -->
|