Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trends_dashboard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
suryakant
trends_dashboard
Commits
edfe1e7a
Commit
edfe1e7a
authored
Feb 27, 2024
by
suryakant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trends Dashboard
parent
afe24ad1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
19 deletions
+32
-19
scripts/core/db/postgres/__init__.py
scripts/core/db/postgres/__init__.py
+3
-3
scripts/core/handler/trends_handler.py
scripts/core/handler/trends_handler.py
+2
-2
scripts/core/schemas/postgres/postgres_tables.py
scripts/core/schemas/postgres/postgres_tables.py
+27
-14
No files found.
scripts/core/db/postgres/__init__.py
View file @
edfe1e7a
...
...
@@ -4,7 +4,7 @@ from sqlalchemy.pool import NullPool
from
scripts.configurations
import
postgres_details
from
scripts.core.logging.application_logging
import
logger
from
sqlalchemy_utils
import
create_database
,
database_exists
from
scripts.core.schemas.postgres.postgres_tables
import
Trends
Async
Table
from
scripts.core.schemas.postgres.postgres_tables
import
Trends
Master
Table
from
scripts.core.exception.app_exceptions
import
ErrorMessages
,
GeneralException
...
...
@@ -22,10 +22,10 @@ def database_init():
if
not
database_exists
(
engine
.
url
):
create_database
(
engine
.
url
)
Trends
Async
Table
.
__table__
.
create
(
bind
=
engine
,
checkfirst
=
True
)
Trends
Master
Table
.
__table__
.
create
(
bind
=
engine
,
checkfirst
=
True
)
logger
.
info
(
"Tables initiation successful"
)
Trends
Async
Table
.
index_name
.
create
(
bind
=
engine
,
checkfirst
=
True
)
Trends
Master
Table
.
index_name
.
create
(
bind
=
engine
,
checkfirst
=
True
)
# Creating database object for CRUD operation
database_obj
=
session_local
()
...
...
scripts/core/handler/trends_handler.py
View file @
edfe1e7a
...
...
@@ -6,7 +6,7 @@ from scripts.core.schemas.postgres import TableObject
from
scripts.core.logging.application_logging
import
logger
from
scripts.core.exception.app_exceptions
import
GeneralException
from
scripts.core.schemas.postgres.postgres_tables
import
\
Trends
Async
Table
Trends
Master
Table
class
TrendsDashboardHandler
:
...
...
@@ -26,7 +26,7 @@ class TrendsDashboardHandler:
max_score_json
=
{}
max_score_obj
=
TableObject
(
db
=
db_init
,
table_name
=
Trends
Async
Table
db
=
db_init
,
table_name
=
Trends
Master
Table
)
# max_score_query = fetch_max_score_downday_query(
# table=max_score_obj.table,
...
...
scripts/core/schemas/postgres/postgres_tables.py
View file @
edfe1e7a
from
sqlalchemy
import
VARCHAR
,
Column
,
Integer
,
Index
,
FLOAT
from
sqlalchemy
import
VARCHAR
,
Column
,
Integer
,
Index
,
FLOAT
,
BOOLEAN
from
datetime
import
datetime
from
sqlalchemy.ext.declarative
import
declarative_base
Base
=
declarative_base
()
class
Trends
Async
Table
(
Base
):
__tablename__
=
"trends_
dashboard
_tbl"
class
Trends
Master
Table
(
Base
):
__tablename__
=
"trends_
master
_tbl"
id
=
Column
(
Integer
,
primary_key
=
True
)
id
=
Column
(
Integer
,
primary_key
=
True
,
autoincrement
=
True
)
mapping_id
=
Column
(
VARCHAR
,
nullable
=
True
)
department
=
Column
(
VARCHAR
,
nullable
=
True
)
sub_menu
=
Column
(
VARCHAR
,
nullable
=
True
)
form
=
Column
(
VARCHAR
,
nullable
=
True
)
filter
=
Column
(
VARCHAR
,
nullable
=
True
)
sub_filter
=
Column
(
VARCHAR
,
nullable
=
True
)
parameter_name
=
Column
(
VARCHAR
,
nullable
=
True
)
lower_limit
=
Column
(
FLOAT
,
nullable
=
True
)
upper_limit
=
Column
(
FLOAT
,
nullable
=
True
)
form_id
=
Column
(
VARCHAR
,
nullable
=
True
)
line_id
=
Column
(
VARCHAR
,
nullable
=
True
)
equipment_id
=
Column
(
VARCHAR
,
nullable
=
True
)
parameter
=
Column
(
VARCHAR
,
nullable
=
True
)
trend_captured
=
Column
(
BOOLEAN
,
nullable
=
True
)
min
=
Column
(
FLOAT
,
nullable
=
True
)
max
=
Column
(
FLOAT
,
nullable
=
True
)
actual_value
=
Column
(
FLOAT
,
nullable
=
True
)
recheck_value
=
Column
(
FLOAT
,
nullable
=
True
)
index_name
=
Index
(
'trends_async_index'
,
id
,
department
,
sub_menu
,
form
,
filter
,
sub_filter
,
parameter_name
)
index_name
=
Index
(
'trends_master_indx'
,
mapping_id
,
department
,
sub_menu
,
form_id
,
line_id
,
equipment_id
,
parameter
)
class
TrendsFormTable
(
Base
):
__tablename__
=
"trends_form_tbl"
id
=
Column
(
Integer
,
primary_key
=
True
,
autoincrement
=
True
)
mapping_id
=
Column
(
VARCHAR
,
nullable
=
True
)
value
=
Column
(
VARCHAR
,
nullable
=
True
)
time
=
Column
(
datetime
,
nullable
=
True
)
index_name
=
Index
(
'trends_form_indx'
,
mapping_id
,
time
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment