Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sterlite_custom_reports
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
sterlite_custom_reports
Commits
660c0641
Commit
660c0641
authored
Oct 11, 2023
by
suryakant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sterlite Custom Report Updates
parent
1ebecec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
8 deletions
+62
-8
scripts/core/db/postgres/custom_report_query.py
scripts/core/db/postgres/custom_report_query.py
+38
-0
scripts/template/sterlite_report_template.py
scripts/template/sterlite_report_template.py
+24
-8
No files found.
scripts/core/db/postgres/custom_report_query.py
View file @
660c0641
...
@@ -2653,3 +2653,41 @@ class SterliteRefineryQuery:
...
@@ -2653,3 +2653,41 @@ class SterliteRefineryQuery:
WHERE DCS.DATE BETWEEN '{day_start_date}' AND '{day_end_date}'
WHERE DCS.DATE BETWEEN '{day_start_date}' AND '{day_end_date}'
GROUP BY 1;
GROUP BY 1;
"""
"""
class
StrippingTime
:
""" STRIPPING TIME | CSM Plate Rejection """
QUERY_1
=
"""
SELECT
'Stripping Time/Changeover (Till Date)' AS stripping_time,
'hr' AS uom,
ROUND(AVG(CASE WHEN LOWER(TRIM(CROP)) = '1st crop'
THEN REFINARY_PRODUCTION_STRIPPING_TIME::double precision
END)::NUMERIC, 2) AS "1st_crop",
ROUND(AVG(CASE WHEN LOWER(TRIM(CROP)) = '2nd crop'
THEN REFINARY_PRODUCTION_STRIPPING_TIME::double precision
END)::NUMERIC, 2) AS "2nd_crop",
ROUND(AVG(CASE WHEN LOWER(TRIM(CROP)) = '3rd crop'
THEN REFINARY_PRODUCTION_STRIPPING_TIME::double precision
END)::NUMERIC, 2) AS "3rd_crop"
FROM SEMANTIC_PROD.BANKWISE_REFINERY_PRODUCTION
WHERE LOWER(TRIM(CROP)) in ('1st crop', '2nd crop', '3rd crop')
AND DATE BETWEEN '{day_start_date}' AND '{day_end_date}'
GROUP BY 1,2;
"""
class
CsmPlateRejection
:
""" CSM Plate Rejection """
QUERY_1
=
"""
SELECT
KPI as csm_plate_rejection,
'
%
' AS uom,
ROUND(((SUM(METRICS_NUMERATOR) /
NULLIF(SUM(METRICS_DENOMINATOR), 0)) * 100)
::NUMERIC, 2) AS METRIC_VALUE
FROM SEMANTIC_PROD.CSM_PLATE_REJECTION_VIEW CPRV
WHERE LOWER(KPI) = 'csm_plate_rejection'
AND DATE BETWEEN '{day_start_date}' AND '{day_end_date}'
GROUP BY 1;
"""
scripts/template/sterlite_report_template.py
View file @
660c0641
...
@@ -317,20 +317,36 @@ class SterliteRefineryTemplate:
...
@@ -317,20 +317,36 @@ class SterliteRefineryTemplate:
"columns"
:
[
"columns"
:
[
"STRIPPING TIME"
,
"STRIPPING TIME"
,
"UOM"
,
"UOM"
,
"1st CROP - St
t
ripping time"
,
"1st CROP - Stripping time"
,
"2nd CROP - Change over time"
,
"2nd CROP - Change over time"
,
"3rd CROP"
,
"3rd CROP"
,
"CSM Plate Rejection"
"CSM Plate Rejection"
],
],
"query"
:
{},
"query"
:
{
"StrippingTime"
:
[
SterliteRefineryQuery
.
StrippingTime
.
QUERY_1
]
},
"data"
:
[],
"data"
:
[],
"data_column"
:
[
"data_column"
:
[
"stripping_time"
,
"stripping_time"
,
"uom"
,
"1st_crop"
,
"uom"
,
"2nd_crop"
,
"3rd_crop"
,
"csm_plate_rejection"
"1st_crop"
,
],
"2nd_crop"
,
},
"3rd_crop"
,
"CSM PLATE REJECTION"
:
{
"csm_plate_rejection"
"columns"
:
[
"CSM Plate Rejection"
,
"UOM"
,
"ON DATE"
],
"query"
:
{
"StrippingTime"
:
[
SterliteRefineryQuery
.
CsmPlateRejection
.
QUERY_1
]
},
"data"
:
[],
"data_column"
:
[
"csm_plate_rejection"
,
"uom"
,
"on_date"
],
],
}
}
},
},
...
...
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