Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
batch-analytics
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
aakash.bedi
batch-analytics
Commits
a4ad1f05
Commit
a4ad1f05
authored
Jan 20, 2023
by
aakash.bedi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batch_master_qty logic added
parent
c08d46d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
6 deletions
+23
-6
app.py
app.py
+23
-6
data/P2E Golden batch 05-01-2023.xlsx
data/P2E Golden batch 05-01-2023.xlsx
+0
-0
data/batch_master.xlsx
data/batch_master.xlsx
+0
-0
data/batch_material.xlsx
data/batch_material.xlsx
+0
-0
data/master_batch_material.xlsx
data/master_batch_material.xlsx
+0
-0
No files found.
app.py
View file @
a4ad1f05
...
...
@@ -42,40 +42,57 @@ class BatchMaster:
if
process_stage_name
==
"Stage-01"
:
df_stage
[
'batch_no'
]
=
df
[
'batch_no'
]
df_stage
[
'input_qty'
]
=
df
[
'Input Qty. (kg) F00056-BULK-001'
]
df_stage
[
'input_qty_uom'
]
=
'kg'
df_stage
[
'formaldehyde_content'
]
=
df
[
'F00041-BULK-001 content nil'
]
df_stage
[
'unreactive_alpha_picoline'
]
=
df
[
'un reacted F00056-BULK-001 ( for infor.)'
]
df_stage
[
'moisture_content'
]
=
df
[
'Moisture content
\n
(for infor)'
]
df_stage
[
'output_qty'
]
=
df
[
'Output Qty. (kg)'
]
df_stage
[
'output_qty_uom'
]
=
'kg'
elif
process_stage_name
==
"Stage-02"
:
df_stage
[
'batch_no'
]
=
df
[
'batch_no'
]
df_stage
[
'input_qty'
]
=
df
[
'Input Qty.
\n
(kg) Stage-I'
]
df_stage
[
'input_qty_uom'
]
=
'kg'
df_stage
[
'formaldehyde_content'
]
=
None
df_stage
[
'unreactive_alpha_picoline'
]
=
df
[
'F00056-BULK-001
\n
(NLT 50
%
)'
]
df_stage
[
'moisture_content'
]
=
df
[
'Moisture content
\n
(for Information).1'
]
df_stage
[
'output_qty'
]
=
df
[
'Output
\n
Qty. (kg)'
]
df_stage
[
'output_qty_uom'
]
=
'kg'
elif
process_stage_name
==
"Stage-03"
:
df_stage
[
'batch_no'
]
=
df
[
'batch_no'
]
df_stage
[
'input_qty'
]
=
df
[
'Input Qty. (kg) Stage-I'
]
df_stage
[
'input_qty_uom'
]
=
'kg'
df_stage
[
'formaldehyde_content'
]
=
None
df_stage
[
'unreactive_alpha_picoline'
]
=
None
df_stage
[
'moisture_content'
]
=
df
[
'M/C for infor'
]
df_stage
[
'output_qty'
]
=
df
[
'Output Qty. (kg)'
]
df_stage
[
'output_qty_uom'
]
=
'kg'
elif
process_stage_name
==
"Stage-04"
:
df_stage
[
'batch_no'
]
=
df
[
'batch_no'
]
df_stage
[
'input_qty'
]
=
None
df_stage
[
'input_qty_uom'
]
=
'kg'
df_stage
[
'formaldehyde_content'
]
=
None
df_stage
[
'unreactive_alpha_picoline'
]
=
None
df_stage
[
'moisture_content'
]
=
df
[
'NMT 0.5
%
'
]
df_stage
[
'output_qty'
]
=
None
df_stage
[
'output_qty_uom'
]
=
'kg'
elif
process_stage_name
==
"Stage-05"
:
df_stage
[
'batch_no'
]
=
df
[
'batch_no'
]
df_stage
[
'input_qty'
]
=
None
df_stage
[
'input_qty_uom'
]
=
'kg'
df_stage
[
'formaldehyde_content'
]
=
None
df_stage
[
'unreactive_alpha_picoline'
]
=
None
df_stage
[
'moisture_content'
]
=
df
[
' NMT 1.0
%
'
]
df_stage
[
'output_qty'
]
=
None
df_stage
[
'output_qty_uom'
]
=
'kg'
df_stage
.
reset_index
(
drop
=
True
,
inplace
=
True
)
df_stage
=
df_stage
[[
'batch_no'
,
'input_qty'
,
'formaldehyde_content'
,
'unreactive_alpha_picoline'
,
'moisture_content'
]]
df_stage
=
df_stage
[[
'batch_no'
,
'input_qty'
,
'input_qty_uom'
,
'formaldehyde_content'
,
'unreactive_alpha_picoline'
,
'moisture_content'
,
'output_qty'
,
'output_qty_uom'
]]
return
df_stage
except
Exception
as
e
:
...
...
@@ -206,9 +223,9 @@ class BatchMaster:
df
=
pd
.
merge
(
left
=
df_master
,
right
=
df_other
,
how
=
'left'
,
on
=
'batch_no'
)
df
[
'bct_input_qty_ratio'
]
=
df
[
'batch_cycle_time_minutes'
]
/
df
[
'input_qty'
]
df
.
reset_index
(
drop
=
True
,
inplace
=
True
)
df
.
to_excel
(
f
"{base_path}/master_
proto
.xlsx"
,
index
=
False
)
df
.
to_excel
(
f
"{base_path}/master_
batch_material
.xlsx"
,
index
=
False
)
logger
.
info
(
f
'Pushing master_join to postgres'
)
df
.
set_index
(
'batch_no'
)
.
to_sql
(
"master_
proto
"
,
"postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai"
,
if_exists
=
'replace'
)
df
.
set_index
(
'batch_no'
)
.
to_sql
(
"master_
batch_material
"
,
"postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai"
,
if_exists
=
'replace'
)
logger
.
debug
(
f
'Pushed master_join to postgres'
)
except
Exception
as
e
:
logger
.
exception
(
f
"Exception - {e}"
)
...
...
@@ -224,9 +241,9 @@ class BatchMaster:
df
=
pd
.
concat
([
df_stage_1
,
df_stage_2
,
df_stage_3
,
df_stage_4
,
df_stage_5
],
axis
=
0
)
df
.
reset_index
(
drop
=
True
,
inplace
=
True
)
df
.
to_excel
(
f
"{base_path}/batch_ma
ster_quantity
.xlsx"
,
index
=
False
)
df
.
to_excel
(
f
"{base_path}/batch_ma
terial
.xlsx"
,
index
=
False
)
logger
.
info
(
f
'Pushing batch_master to postgres'
)
df
.
set_index
(
'batch_no'
)
.
to_sql
(
"batch_ma
ster_quantity
"
,
df
.
set_index
(
'batch_no'
)
.
to_sql
(
"batch_ma
terial
"
,
"postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai"
,
if_exists
=
"replace"
)
logger
.
debug
(
f
'Pushed batch_master to postgres'
)
...
...
data/P2E Golden batch 05-01-2023.xlsx
View file @
a4ad1f05
No preview for this file type
data/batch_master.xlsx
View file @
a4ad1f05
No preview for this file type
data/batch_material.xlsx
0 → 100644
View file @
a4ad1f05
File added
data/master_batch_material.xlsx
0 → 100644
View file @
a4ad1f05
File added
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