Commit ec94d16c authored by suryakant's avatar suryakant

Query Update

parent 4ad7037b
...@@ -53,6 +53,7 @@ class CommonConstants: ...@@ -53,6 +53,7 @@ class CommonConstants:
FREQUENCY = 'D' FREQUENCY = 'D'
START_COLUMN = 0 START_COLUMN = 0
START_ROW = 2 START_ROW = 2
OVERALL_COLUMN_WIDTH = 25
class ReportType: class ReportType:
......
...@@ -146,6 +146,8 @@ class CustomReportHandler: ...@@ -146,6 +146,8 @@ class CustomReportHandler:
logger.info("Iterating through each block to create a dataframe") logger.info("Iterating through each block to create a dataframe")
# Iterate through the categories and concatenate their data # Iterate through the categories and concatenate their data
print(input_json)
for category, category_data in input_json.items(): for category, category_data in input_json.items():
data = category_data.get('data', []) data = category_data.get('data', [])
data_frame = pd.DataFrame(data) data_frame = pd.DataFrame(data)
...@@ -249,6 +251,11 @@ class CustomReportHandler: ...@@ -249,6 +251,11 @@ class CustomReportHandler:
worksheet.merge_range(1, 1, 0, total_column - 1, worksheet.merge_range(1, 1, 0, total_column - 1,
ReportType.REFINERY_WORKSHEET_NAME, ReportType.REFINERY_WORKSHEET_NAME,
main_header_format) main_header_format)
# Setting width to the column
worksheet.set_column(0, total_column,
CommonConstants.OVERALL_COLUMN_WIDTH)
worksheet.set_text_wrap()
logger.info(f"Report completed for: {each_date_range}") logger.info(f"Report completed for: {each_date_range}")
except GeneralException as err: except GeneralException as err:
......
...@@ -9,6 +9,7 @@ class SterliteRefineryTemplate: ...@@ -9,6 +9,7 @@ class SterliteRefineryTemplate:
"fg_color": "#e6e7eb", "fg_color": "#e6e7eb",
"font_color": "#1b314f", "font_color": "#1b314f",
"border": 1, "border": 1,
'font_size': '20',
} }
COLUMN_HEADER_FORMAT = { COLUMN_HEADER_FORMAT = {
"bold": True, "bold": True,
...@@ -19,6 +20,37 @@ class SterliteRefineryTemplate: ...@@ -19,6 +20,37 @@ class SterliteRefineryTemplate:
"border": 1, "border": 1,
} }
REPORT_TEMPLATE = [ REPORT_TEMPLATE = [
{
"CATHODE PRODUCTION REVISED": {
"columns": [
"CATHODE PRODUCTION REVISED",
"UOM"
],
"query": {
"Cathode Production Revised": [
SterliteRefineryQuery.CathodeProductionRevised.QUERY_1,
]
},
"data": [],
"data_column": [
"cathode_production_revised", "uom"
],
},
"DEPOSIT REVISED": {
"columns": [
"DEPOSIT REVISED"
],
"query": {
"Deposit Revised": [
SterliteRefineryQuery.DepositRevised.QUERY_1,
]
},
"data": [],
"data_column": [
"deposit_revised"
],
},
},
{ {
"ANODE AVAILABILITY": { "ANODE AVAILABILITY": {
"columns": [ "columns": [
...@@ -391,7 +423,35 @@ class SterliteRefineryTemplate: ...@@ -391,7 +423,35 @@ class SterliteRefineryTemplate:
"data_column": [ "data_column": [
"filter_availability", "uom", "norms", "on_date", "mtd", "ytd" "filter_availability", "uom", "norms", "on_date", "mtd", "ytd"
], ],
} },
"FILTERED VOLUME": {
"columns": [
"FILTERED VOLUME"
],
"query": {
"FilterAvailability": [
SterliteRefineryQuery.FilteredVolume.QUERY_1
]
},
"data": [],
"data_column": [
"filter_availability"
],
},
"TOTAL VOLUME REFINERY": {
"columns": [
"TOTAL VOLUME REFINERY"
],
"query": {
"TotalVolumeRefinery": [
SterliteRefineryQuery.TotalVolumeRefinery.QUERY_1
]
},
"data": [],
"data_column": [
"total_volume_refinery"
],
},
}, },
{ {
"SPECIFIC ENERGY CONSUMPTION": { "SPECIFIC ENERGY CONSUMPTION": {
...@@ -539,11 +599,31 @@ class SterliteRefineryTemplate: ...@@ -539,11 +599,31 @@ class SterliteRefineryTemplate:
"cir_2", "cir_2",
], ],
}, },
"SUSPENDED SOLIDS": { "SUSPENDED SOLIDS 1": {
"columns": ["SUSPENDED SOLIDS"], "columns": [
"query": [], "Cir-1: I/L",
"Cir-1: VALUES",
],
"query": {
"SuspendedSolidsCir1": [
SterliteRefineryQuery.SuspendedSolidsCir1.QUERY_1,
]
},
"data": [],
"data_column": ["cir_1", "cir_1_values"],
},
"SUSPENDED SOLIDS 2": {
"columns": [
"Cir-2: I/L",
"Cir-2: Values",
],
"query": {
"SuspendedSolidsCir2": [
SterliteRefineryQuery.SuspendedSolidsCir2.QUERY_1,
]
},
"data": [], "data": [],
"data_column": ["suspended_solids"], "data_column": ["cir_2", "cir_2_values"],
}, },
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment