Commit 646a534f authored by aakash.bedi's avatar aakash.bedi

tags configure in mongo

parent cc9339fd
Pipeline #59444 failed with stage
import pandas as pd
if __name__ == "__main__":
from dotenv import load_dotenv
load_dotenv(dotenv_path='config.env')
......@@ -5,13 +7,13 @@ import warnings
import numpy as np
from loguru import logger
from scripts.core.engine.mppt_data import GetData
from scripts.utils.reading_tags import GetTags
from scripts.core.engine.tags_data import get_tags_data
from scripts.utils.start_end_date import KairosStartEndDate
from scripts.utils.preprocessing import DataPreprocessing
from scripts.core.engine.inv_and_mppt_level import TrainingInference
from scripts.core.engine.final_tags import GetFinalDf
from scripts.core.data_puller_push.kafka_push import CalculatedDataPush
from scripts.core.engine.model_training_inference import ai_modelling
from scripts.core.engine.raw_predicted_tags import get_raw_predicted_tags
warnings.filterwarnings("ignore")
......@@ -21,12 +23,9 @@ start_date, end_date, start_timestamp, end_timestamp = KairosStartEndDate().star
def get_tag_details():
try:
get_tags = GetTags(base_path=base_path)
get_final_df = GetFinalDf()
tags_excel = get_tags.read_tag_excel()
df_final_tags = get_final_df.get_predicted_current_tags(tags_excel=tags_excel)
mppt_tags = get_tags.get_mppt_tags(df=tags_excel, substrings='MPPT')
df = get_tags_data(mppt_tags=mppt_tags,
df_raw_tags, df_predicted_tags = get_raw_predicted_tags()
df = get_tags_data(mppt_tags=df_raw_tags,
start_timestamp=start_timestamp,
end_timestamp=end_timestamp)
......@@ -36,34 +35,13 @@ def get_tag_details():
df_mppt = mppt_data.current_voltage_mppt_data(df=df)
data_preprocessing = DataPreprocessing()
df_mppt = data_preprocessing.remove_outliers(df=df_mppt, param_list=['tilt_irradiance', 'voltage_mppt',
'current_mppt'])
df_mppt, df_train, df_test = data_preprocessing.train_test_split(df=df_mppt)
unique_inv_id = list(df_train.inv_id.unique())
unique_mppt_id = list(df_train.mppt_id.unique())
get_training_inference = TrainingInference(df=df_mppt, df_train=df_train, df_test=df_test)
for inv_id in unique_inv_id:
for mppt_id in unique_mppt_id:
try:
model, scaler_x, scaler_y = get_training_inference.data_training(inv_id=inv_id, mppt_id=mppt_id)
x_test, y_test, predictions = get_training_inference.data_inference(scaler_x=scaler_x,
scaler_y=scaler_y,
model=model,
inv_id=inv_id,
mppt_id=mppt_id)
df_result = get_final_df.get_final_data(x_test=x_test,
y_test=y_test,
predictions=predictions)
final_dict = get_final_df.get_final_predicted_tags(df_predicted_current_tags=df_final_tags,
inv_id=inv_id, mppt_id=mppt_id)
df_result["timestamp"] = df_result["datetime"].values.astype(np.int64) / 10 ** 9
df_result["timestamp"] = df_result["timestamp"].astype('int')
CalculatedDataPush(df_result=df_result, final_tags_dict=final_dict).kafka_data_push()
# function to push the data to kairos
logger.info(f'{final_dict}')
except Exception as e:
logger.exception(f'Exception - {e}')
ai_modelling(df_train=df_train, get_training_inference=get_training_inference,
df_predicted_tags=df_predicted_tags)
except Exception as e:
logger.exception(f'Exception - {e}')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
iter RMSE
0 0.252648957
1 0.2421789369
2 0.2320061772
3 0.2222630613
4 0.2130678784
5 0.2044236959
6 0.1961344435
7 0.1888777062
8 0.181950943
9 0.1748871531
10 0.1685501907
11 0.1628686194
12 0.157326155
13 0.1521998837
14 0.1471368176
15 0.1425767808
16 0.1382665655
17 0.134179339
18 0.1304038773
19 0.1268538558
20 0.1235813635
21 0.1204593889
22 0.1175363572
23 0.1150111747
24 0.1125939488
25 0.1103436472
26 0.1082570724
27 0.1063063057
28 0.1044952449
29 0.1029832579
30 0.1015498954
31 0.1001404331
32 0.09878088515
33 0.09748507998
34 0.09632696319
35 0.0952354289
36 0.09428346558
37 0.09344170585
38 0.0925400701
39 0.09178929876
40 0.09109795137
41 0.09051927069
42 0.08986837776
43 0.08933390598
44 0.08885739433
45 0.08839839282
46 0.08801532107
47 0.08760195416
48 0.08726041296
49 0.0869377522
50 0.08666720549
51 0.08635058291
52 0.08599885619
53 0.08569343059
54 0.08538645424
55 0.08509046355
56 0.08487754518
57 0.08464447401
58 0.08445279498
59 0.08426527131
60 0.08398405071
61 0.08370692388
62 0.08346160515
63 0.08333064811
64 0.08319604768
65 0.08309198044
66 0.08285467166
67 0.08274160405
68 0.0825886989
69 0.08249033839
70 0.08233486605
71 0.08213217094
72 0.08197015928
73 0.08180206187
74 0.08168486467
75 0.08156746673
76 0.0815013622
77 0.08141598491
78 0.0813408888
79 0.08127639087
80 0.08113164297
81 0.08099059784
82 0.08087627006
83 0.08075661641
84 0.08069929175
85 0.08057972171
86 0.08048008669
87 0.08036281743
88 0.08024562069
89 0.08016512885
90 0.08007673399
91 0.0800286202
92 0.07987654099
93 0.07979305258
94 0.07974462719
95 0.07964014891
96 0.07956395711
97 0.0795288619
98 0.07942930273
99 0.07932947902
100 0.07927241425
101 0.07920289802
102 0.0791487122
103 0.07907156993
104 0.07897886632
105 0.07892077503
106 0.07886927058
107 0.07874606498
108 0.07864715802
109 0.07855198177
110 0.07847276709
111 0.07833559096
112 0.07828136535
113 0.07823908959
114 0.07811597408
115 0.07810393829
116 0.07799897567
117 0.07789204856
118 0.07782162889
119 0.07771067085
120 0.07763544233
121 0.07760521643
122 0.07752694371
123 0.07746975887
124 0.07733528432
125 0.07723795593
126 0.07715021139
127 0.07708754202
128 0.07698865621
129 0.07693243807
130 0.07684175325
131 0.07674736659
132 0.07672957964
133 0.0766569002
134 0.07659621845
135 0.07650263077
136 0.0764020329
137 0.07636715119
138 0.07629120425
139 0.07619619004
140 0.07615462438
141 0.0760845799
142 0.07597308631
143 0.07593040104
144 0.07587846364
145 0.07580272342
146 0.07577459334
147 0.07572829347
148 0.0756618626
149 0.07558069805
150 0.0755020145
151 0.07540987917
152 0.07537497687
153 0.07528706356
154 0.07521524304
155 0.07513330612
156 0.07505420114
157 0.07499456863
158 0.07489999944
159 0.07484967168
160 0.07480819763
161 0.07475926491
162 0.07469734179
163 0.07464369918
164 0.07462040544
165 0.07450137063
166 0.07448174626
167 0.07441138853
168 0.07435959629
169 0.07427189866
170 0.07419710045
171 0.07411839126
172 0.07409398497
173 0.0740785215
174 0.07402792507
175 0.07396108755
176 0.07390578951
177 0.07380462362
178 0.07373081894
179 0.0736588369
180 0.07356566861
181 0.07346381249
182 0.07340040207
183 0.07332633517
184 0.07329392197
185 0.07326242515
186 0.07322153887
187 0.07315114262
188 0.07307059018
189 0.07297851042
190 0.07293169089
191 0.0728374809
192 0.07278024335
193 0.07271033301
194 0.07262741202
195 0.07255553448
196 0.07251399581
197 0.07239780003
198 0.07234818482
199 0.07224186228
200 0.07219371833
201 0.07214574042
202 0.07206345912
203 0.07198887185
204 0.071943849
205 0.07189431519
206 0.0718191816
207 0.07173140513
208 0.07170177514
209 0.07167814891
210 0.07161633595
211 0.07154755686
212 0.0715130084
213 0.07146770159
214 0.07140413032
215 0.07133820214
216 0.07128415189
217 0.07124678707
218 0.07121125767
219 0.07117224814
220 0.07111635814
221 0.07105572413
222 0.07100043854
223 0.07097469139
224 0.07089595331
225 0.07080111424
226 0.07075326648
227 0.07069060252
228 0.07060833575
229 0.07053306871
230 0.07044004628
231 0.07037895048
232 0.07030790291
233 0.07022961959
234 0.07018610691
235 0.07015544604
236 0.07009759019
237 0.07002310557
238 0.07000879806
239 0.06993752527
240 0.069863797
241 0.06980671149
242 0.06976479544
243 0.06968975813
244 0.06966225849
245 0.06964788227
246 0.06957129924
247 0.06953711293
248 0.06947791343
249 0.0694214808
250 0.06936031487
251 0.06932934773
252 0.0692792011
253 0.06922508309
254 0.06920501353
255 0.06917682521
256 0.06914415188
257 0.06909728035
258 0.06907519752
259 0.06902876999
260 0.06899785129
261 0.06897151069
262 0.06891613553
263 0.06888013473
264 0.06882596009
265 0.06879808364
266 0.06876353608
267 0.0687183412
268 0.0686714486
269 0.0686175628
270 0.06860462157
271 0.06858581711
272 0.06854470767
273 0.06849211971
274 0.06842902999
275 0.06838617538
276 0.0683671429
277 0.06832680264
278 0.06828927444
279 0.06822384303
280 0.06820271239
281 0.06817203402
282 0.06810496321
283 0.06806459757
284 0.06805284487
285 0.06800161568
286 0.0679519143
287 0.06791119229
288 0.06786264823
289 0.06782448344
290 0.06779981264
291 0.06773677254
292 0.06770845015
293 0.06765899272
294 0.06761138033
295 0.06753208188
296 0.06747954888
297 0.06745326887
298 0.06741004628
299 0.06738121255
300 0.06735477708
301 0.06730643847
302 0.06728080111
303 0.06722277937
304 0.06718211985
305 0.06713229431
306 0.06710197061
307 0.06706681515
308 0.06703360582
309 0.06700867398
310 0.06695771964
311 0.0669136606
312 0.06687038211
313 0.06684662161
314 0.06681435576
315 0.06679182821
316 0.0667597598
317 0.06674376854
318 0.06667144792
319 0.06664764427
320 0.0665919053
321 0.06656307236
322 0.06649554271
323 0.06642835472
324 0.06639806778
325 0.0663774875
326 0.06631119406
327 0.06626463157
328 0.06622366729
329 0.06619394844
330 0.06617156966
331 0.06614472186
332 0.06610902015
333 0.06605814255
334 0.06602756623
335 0.06600144652
336 0.06598239433
337 0.06593047873
338 0.0658773282
339 0.06586201052
340 0.06582729173
341 0.06580518284
342 0.06577744285
343 0.06576262364
344 0.06572882673
345 0.06570024794
346 0.06566207665
347 0.06563209515
348 0.06561447467
349 0.065574145
350 0.06550492537
351 0.06545559342
352 0.06544123623
353 0.06538302913
354 0.06535181256
355 0.06531317938
356 0.06526974624
357 0.0652415885
358 0.06519436117
359 0.06512076883
360 0.06508682932
361 0.06501937404
362 0.06500445611
363 0.06496985761
364 0.0649253546
365 0.06491111131
366 0.06489100832
367 0.06486261205
368 0.06482922665
369 0.06479456842
370 0.0647810957
371 0.06475374409
372 0.06474615236
373 0.06471697228
374 0.06469328698
375 0.06464879154
376 0.06463298978
377 0.06457205909
378 0.06454829409
379 0.06452657117
380 0.06446499396
381 0.06443840392
382 0.06438306752
383 0.06435137494
384 0.06430737532
385 0.06428100441
386 0.0642521913
387 0.06423726564
388 0.06418945624
389 0.06414695869
390 0.06409826132
391 0.06406878868
392 0.06403791517
393 0.06398260554
394 0.06393270215
395 0.06390829826
396 0.06387900589
397 0.06387342924
398 0.06382190615
399 0.06379526094
400 0.06375621117
401 0.06370039892
402 0.06364061933
403 0.06362829041
404 0.06353161708
405 0.06347240473
406 0.06344708372
407 0.06341016155
408 0.06339822769
409 0.0633452459
410 0.0633251406
411 0.06329061272
412 0.06327110161
413 0.0632404322
414 0.06322370027
415 0.06320473966
416 0.06317190553
417 0.06315350098
418 0.06312740485
419 0.06311381539
420 0.06306166104
421 0.06303093446
422 0.06298011475
423 0.06295362267
424 0.06292751374
425 0.06288005747
426 0.06287335235
427 0.06284435349
428 0.06281161684
429 0.06276822683
430 0.06274309715
431 0.06268722944
432 0.06262965598
433 0.06259290264
434 0.06254513432
435 0.06251090548
436 0.06248606709
437 0.06245782452
438 0.06242021155
439 0.06240425635
440 0.06236175726
441 0.06233394042
442 0.06231220088
443 0.06228505204
444 0.06226407793
445 0.06222425922
446 0.06219976578
447 0.06215549888
448 0.06213166898
449 0.06211280556
450 0.0620715098
451 0.06202110265
452 0.06200324714
453 0.06198200706
454 0.06196592888
455 0.06194346354
456 0.06192605037
457 0.06189318356
458 0.06187583613
459 0.06184378685
460 0.06183760272
461 0.06180194328
462 0.06178375396
463 0.06176382523
464 0.06174746155
465 0.06173158583
466 0.0617045683
467 0.06166882041
468 0.06163610165
469 0.06160849805
470 0.06158637375
471 0.06155231828
472 0.06153739942
473 0.06151037653
474 0.06147714396
475 0.06145494538
476 0.06140355491
477 0.06138195929
478 0.06136640703
479 0.0613338295
480 0.0613058079
481 0.06129151878
482 0.06128003178
483 0.06125641168
484 0.06120818472
485 0.06118784721
486 0.06116181802
487 0.06113695118
488 0.06111777367
489 0.06108592665
490 0.06105378027
491 0.06102859558
492 0.06100426739
493 0.06097178996
494 0.06092592209
495 0.06091249223
496 0.06090740461
497 0.0608845507
498 0.06084748846
499 0.06082604545
500 0.06080120024
501 0.06075754968
502 0.06073800424
503 0.06072401642
504 0.06069345638
505 0.06066667686
506 0.06063823864
507 0.0606119005
508 0.06059352494
509 0.06055907744
510 0.06046993241
511 0.06045746892
512 0.06044050871
513 0.06041961324
514 0.06038994347
515 0.06035939825
516 0.06033975025
517 0.06028864939
518 0.06025761998
519 0.06023582106
520 0.06022103595
521 0.060176077
522 0.06015803043
523 0.06014097225
524 0.06012326115
525 0.06009301533
526 0.06006714027
527 0.06003841986
528 0.05998656609
529 0.05995742765
530 0.0598956572
531 0.05987596626
532 0.05983535162
533 0.05981844633
534 0.05980117021
535 0.05978442252
536 0.05976532446
537 0.0597276666
538 0.05967698133
539 0.05965334788
540 0.05962419644
541 0.0596116631
542 0.05959511906
543 0.05957250623
544 0.05953261133
545 0.05951096503
546 0.059467385
547 0.05945339396
548 0.05944023967
549 0.05942752556
550 0.0593778859
551 0.05935182061
552 0.05932434043
553 0.0592787296
554 0.05925228819
555 0.05922141053
556 0.05919463663
557 0.05918242595
558 0.05915414143
559 0.05910980399
560 0.05909286073
561 0.05905957805
562 0.05903923138
563 0.05901789252
564 0.05899634131
565 0.05895246342
566 0.05892672023
567 0.05889508593
568 0.05881186164
569 0.05879515342
570 0.05875525311
571 0.05874041276
572 0.0587199686
573 0.05869560487
574 0.05867152276
575 0.05864661592
576 0.05862851264
577 0.05860761571
578 0.05856912395
579 0.05855050626
580 0.05853076338
581 0.05847745336
582 0.05846473512
583 0.05842339095
584 0.05840757707
585 0.05838855678
586 0.0583730204
587 0.05834667787
588 0.05833230761
589 0.05830857525
590 0.05828551117
591 0.05825577455
592 0.05824726646
593 0.05820756486
594 0.05819556881
595 0.05818499334
596 0.05816225121
597 0.05815173068
598 0.05814709181
599 0.05813894802
600 0.05811329531
601 0.05810183278
602 0.05806534166
603 0.05802539562
604 0.05799091796
605 0.05792143939
606 0.0578831569
607 0.05786765884
608 0.05784679011
609 0.05782388674
610 0.05778762974
611 0.05777346148
612 0.05775862853
613 0.05773740048
614 0.05772083777
615 0.05769404276
616 0.05762098943
617 0.05760588868
618 0.05758058483
619 0.05754642744
620 0.05752663546
621 0.05750352162
622 0.05746386783
623 0.05743747866
624 0.05741249523
625 0.05737516381
626 0.0573381789
627 0.05727692362
628 0.05725469847
629 0.05721619703
630 0.05718768398
631 0.05716753314
632 0.0571504057
633 0.05713341153
634 0.05711820254
635 0.05705052009
636 0.0570132681
637 0.05700071612
638 0.05698098102
639 0.05694908438
640 0.05691322112
641 0.05690084823
642 0.05688992161
643 0.05685888995
644 0.05683130445
645 0.05680984616
646 0.0567968464
647 0.05678147081
648 0.05676582199
649 0.05675086591
650 0.05673648617
651 0.05672150126
652 0.05671271004
653 0.05669309017
654 0.0566748066
655 0.05665476607
656 0.05663935192
657 0.05662580991
658 0.05659282071
659 0.05656484528
660 0.05653394226
661 0.05650879091
662 0.0564973064
663 0.05644724186
664 0.05640494778
665 0.05634163669
666 0.05632043519
667 0.05630267044
668 0.05627297668
669 0.05623733816
670 0.05622296318
671 0.0561950798
672 0.05617322294
673 0.05613294481
674 0.05611566002
675 0.05608800061
676 0.05606538399
677 0.05603131978
678 0.05601518748
679 0.05599689029
680 0.05596677125
681 0.05592740043
682 0.05590645058
683 0.05589396377
684 0.05586583433
685 0.05583849017
686 0.0558204156
687 0.05580359154
688 0.05576954813
689 0.05576038667
690 0.05573557606
691 0.05571831118
692 0.05570176651
693 0.05567972015
694 0.05567539954
695 0.05565191904
696 0.05559892863
697 0.05558826099
698 0.05554942181
699 0.05553311208
700 0.05551507711
701 0.05550259867
702 0.05548582194
703 0.05547795368
704 0.05547163912
705 0.05546554222
706 0.05544744259
707 0.05542446148
708 0.05537601504
709 0.05534893833
710 0.05532063919
711 0.05530213174
712 0.05528252917
713 0.05525703865
714 0.05521141779
715 0.05519381025
716 0.05518655649
717 0.05516496689
718 0.05514295962
719 0.05512173125
720 0.0551047411
721 0.05507831781
722 0.05505226019
723 0.05502714505
724 0.05500521749
725 0.05498133461
726 0.05496638074
727 0.0549542268
728 0.05491276636
729 0.05488802347
730 0.05485469806
731 0.05484331813
732 0.0548252011
733 0.05480257532
734 0.05477970405
735 0.05475859612
736 0.05473815594
737 0.05471674551
738 0.05467463428
739 0.05463588878
740 0.05459820969
741 0.05459006555
742 0.05455534354
743 0.05454749532
744 0.0545144822
745 0.05450369252
746 0.05446705903
747 0.05444104955
748 0.05441635549
749 0.05440016686
750 0.05438971927
751 0.05437270943
752 0.05436212258
753 0.05434147025
754 0.05432428282
755 0.05430832855
756 0.05428994739
757 0.05426772922
758 0.05423482594
759 0.05420986354
760 0.05418851795
761 0.05415744539
762 0.05414355352
763 0.0541281288
764 0.0541135194
765 0.05410536502
766 0.05407819056
767 0.05404933545
768 0.05400648583
769 0.05397311507
770 0.05394526371
771 0.05392765211
772 0.05392390176
773 0.05391006821
774 0.05389227433
775 0.05387384369
776 0.05385572427
777 0.05383546259
778 0.05381642728
779 0.05376762801
780 0.05374753029
781 0.05372138949
782 0.05370346219
783 0.05369183314
784 0.05367629562
785 0.05366194955
786 0.05364246623
787 0.05363503607
788 0.05360718848
789 0.05359590449
790 0.05358677448
791 0.05356985353
792 0.05354256977
793 0.0535138874
794 0.05347630855
795 0.05345131509
796 0.05343329987
797 0.05342029451
798 0.05338573876
799 0.05338208875
800 0.05334866514
801 0.0533386752
802 0.05330707815
803 0.05329073918
804 0.05327856568
805 0.05327119591
806 0.05326138696
807 0.05324425589
808 0.05322033226
809 0.0532092082
810 0.0531867883
811 0.05317696845
812 0.05315722861
813 0.05315391184
814 0.05314090953
815 0.05312550417
816 0.05307697665
817 0.05306039344
818 0.05304998421
819 0.05302119672
820 0.05299835438
821 0.0529708812
822 0.05293768228
823 0.05291965575
824 0.05290100865
825 0.05288051157
826 0.05285537596
827 0.05282299759
828 0.05279594817
829 0.05278532969
830 0.05276994715
831 0.05275708063
832 0.05273716511
833 0.05272577296
834 0.05269956526
835 0.05268467134
836 0.05266463868
837 0.05264952815
838 0.05263460801
839 0.05261920374
840 0.05257439714
841 0.05256114336
842 0.0525468638
843 0.05252109133
844 0.05249043058
845 0.05248164473
846 0.0524716851
847 0.05245490511
848 0.05242928518
849 0.05241577828
850 0.0523934813
851 0.05236447967
852 0.05232586812
853 0.052309292
854 0.05229394918
855 0.05227829328
856 0.05224532051
857 0.05221724333
858 0.05220239389
859 0.05218794504
860 0.05216142213
861 0.05214960206
862 0.05213971135
863 0.05211348895
864 0.0520997049
865 0.05205202969
866 0.05203699236
867 0.05201703357
868 0.05199462119
869 0.05198202401
870 0.05196996861
871 0.05195065984
872 0.05192929619
873 0.05191660095
874 0.05189117533
875 0.05187959965
876 0.051868514
877 0.0518440003
878 0.05181390515
879 0.05180437335
880 0.05179078187
881 0.05178083839
882 0.05177591784
883 0.05175279151
884 0.05173465619
885 0.05171568689
886 0.05170242637
887 0.05168914451
888 0.05167469268
889 0.05166246234
890 0.05164046363
891 0.05160845522
892 0.05159562888
893 0.05156707955
894 0.05155352135
895 0.05153171615
896 0.0515068529
897 0.05148946369
898 0.05147375913
899 0.0514627782
900 0.05144806073
901 0.05143649498
902 0.0514206172
903 0.05139345594
904 0.05137006722
905 0.05135003574
906 0.05133703362
907 0.05132794669
908 0.05130193665
909 0.05127707084
910 0.0512450204
911 0.05123260848
912 0.05121017692
913 0.05119533254
914 0.05117243719
915 0.05116437336
916 0.05113367815
917 0.05111562905
918 0.05109771594
919 0.0510809242
920 0.05106914598
921 0.05105001513
922 0.05103906401
923 0.05101740442
924 0.05100711155
925 0.0509971472
926 0.05097380287
927 0.05096364674
928 0.05095436833
929 0.05094299736
930 0.05090113542
931 0.05087967734
932 0.05086814672
933 0.05085920876
934 0.05085021513
935 0.05083206663
936 0.0508168572
937 0.05080022308
938 0.0507917535
939 0.0507767932
940 0.05075259285
941 0.05073360009
942 0.05071345535
943 0.05069361323
944 0.0506708425
945 0.05066266792
946 0.05064115762
947 0.05062869197
948 0.05061281533
949 0.05060530967
950 0.05059411059
951 0.05057808205
952 0.05056068995
953 0.05055054646
954 0.05054376558
955 0.05053520068
956 0.0505286816
957 0.05052344912
958 0.05051724511
959 0.05050545293
960 0.05047202724
961 0.0504569078
962 0.05044412061
963 0.05043861576
964 0.05042432422
965 0.05041945224
966 0.05040767332
967 0.05039756758
968 0.05038734298
969 0.05037148123
970 0.05035720187
971 0.05033870185
972 0.05033289932
973 0.05030403567
974 0.05028499155
975 0.05026191435
976 0.05025053815
977 0.05023471442
978 0.05021303088
979 0.0501990438
980 0.05018690257
981 0.05017308015
982 0.05015268447
983 0.05013442538
984 0.05011020492
985 0.05008937224
986 0.05007838255
987 0.05005229721
988 0.05003608483
989 0.05001450939
990 0.05000901885
991 0.05000520489
992 0.04999524073
993 0.04997237946
994 0.04995481823
995 0.04994525495
996 0.04994129583
997 0.04992387509
998 0.04991179772
999 0.04990110236
03828489
0 0.2564637099
1 0.2452986855
2 0.2347352757
3 0.2247418379
4 0.2152861838
5 0.2064455645
6 0.1981261727
7 0.190239704
8 0.1830554212
9 0.1762352252
10 0.1696022308
11 0.1634056009
12 0.1575844551
13 0.1522670778
14 0.1471785274
15 0.1426206424
16 0.1382496635
17 0.1341253319
18 0.1301770699
19 0.126676502
20 0.1234497077
21 0.1204423538
22 0.1176245535
23 0.1149619435
24 0.1124233084
25 0.1102309191
26 0.1080246933
27 0.1059238449
28 0.1039973633
29 0.1022539503
30 0.1007431375
31 0.09918339958
32 0.09783971588
33 0.09659973432
34 0.09558895542
35 0.09440461345
36 0.09350882717
37 0.09261889224
38 0.09166620487
39 0.09087260261
40 0.09012514378
41 0.08938393436
42 0.08873897352
43 0.08819450957
44 0.08758719551
45 0.08706965074
46 0.08652054816
47 0.08607896732
48 0.0857236993
49 0.08531364285
50 0.08500192674
51 0.08465351675
52 0.08437771358
53 0.08413321719
54 0.08384687407
55 0.08355550223
56 0.08329215166
57 0.0830096721
58 0.08281516011
59 0.08261800066
60 0.08242420586
61 0.08229614782
62 0.08212012195
63 0.08199081005
64 0.08182879522
65 0.08164175575
66 0.08149111181
67 0.08132511476
68 0.08122733724
69 0.08110485133
70 0.08096823573
71 0.08090528192
72 0.08083762189
73 0.08075172498
74 0.08066042539
75 0.08055337604
76 0.08044310227
77 0.08028527044
78 0.08015259272
79 0.08004480074
80 0.07997259642
81 0.07989052807
82 0.0797796664
83 0.07967353074
84 0.07950976647
85 0.07941148172
86 0.07927176912
87 0.07920854108
88 0.07909967369
89 0.07899793216
90 0.07893469583
91 0.07883437593
92 0.07870124857
93 0.07860063305
94 0.07851330737
95 0.07841702462
96 0.07828684267
97 0.07817099236
98 0.07805445502
99 0.07793505518
100 0.0778099338
101 0.07773153241
102 0.07766707254
103 0.07759820448
104 0.07746256703
105 0.07741425197
106 0.07732725987
107 0.07728502453
108 0.07723473527
109 0.0771554947
110 0.07707072023
111 0.07702379321
112 0.07695373436
113 0.07684387682
114 0.07676531208
115 0.07669680806
116 0.07659122595
117 0.07645863833
118 0.07638009317
119 0.07626169398
120 0.0761908292
121 0.07611514923
122 0.07605608209
123 0.07599660369
124 0.07590377446
125 0.07582469587
126 0.07576635419
127 0.07569350041
128 0.07563936605
129 0.07555784144
130 0.07548070106
131 0.07541597381
132 0.07536740684
133 0.07528012368
134 0.07522015982
135 0.07517096963
136 0.07508799033
137 0.07503938151
138 0.07495492595
139 0.07490985753
140 0.07483318536
141 0.07478314264
142 0.07470373103
143 0.07463737335
144 0.07455648991
145 0.07449803581
146 0.07439257881
147 0.07432248642
148 0.07420550851
149 0.07411485597
150 0.07405992223
151 0.07399503972
152 0.0739099539
153 0.0738261893
154 0.07381584621
155 0.07376984259
156 0.07368712621
157 0.07358159296
158 0.07349223609
159 0.07342852762
160 0.07337284628
161 0.07333978882
162 0.07324227345
163 0.073199799
164 0.07310607721
165 0.07305036054
166 0.07298177136
167 0.07288575865
168 0.07281012888
169 0.07277664696
170 0.07272087731
171 0.07267438835
172 0.07260283834
173 0.07252056415
174 0.07243115344
175 0.07233881993
176 0.07231050863
177 0.07226651925
178 0.07219939279
179 0.07214460737
180 0.07204624615
181 0.07195487644
182 0.07190764221
183 0.07182346759
184 0.07177072156
185 0.0716832163
186 0.07159419047
187 0.07154826
188 0.07147486367
189 0.07142497754
190 0.07134990201
191 0.07123012837
192 0.0711831045
193 0.07111565892
194 0.07104002728
195 0.07096313264
196 0.07092557329
197 0.07083344199
198 0.07077644993
199 0.07069799475
200 0.07063509211
201 0.07059451139
202 0.07048594046
203 0.07041688082
204 0.07034663584
205 0.07028164163
206 0.07023859799
207 0.07018040837
208 0.07012043085
209 0.07002197369
210 0.0699408498
211 0.06989182674
212 0.06984131399
213 0.06979369884
214 0.06975520238
215 0.06970978529
216 0.06964153574
217 0.06958152996
218 0.06953977057
219 0.06950005641
220 0.06946260127
221 0.06939802982
222 0.06936262064
223 0.0693138812
224 0.06925035593
225 0.06918448234
226 0.06912257096
227 0.06908883112
228 0.06903081018
229 0.06899883344
230 0.06895564151
231 0.06891248311
232 0.06885960761
233 0.06880995241
234 0.06875055292
235 0.06872046322
236 0.06867473092
237 0.06857392485
238 0.06851911026
239 0.06846350896
240 0.06842398229
241 0.06833495399
242 0.06829012693
243 0.06826144412
244 0.06823662308
245 0.06818834953
246 0.06812431909
247 0.06810521476
248 0.06806859053
249 0.06802431934
250 0.06799822672
251 0.06792804372
252 0.06788063023
253 0.06783310755
254 0.06777952271
255 0.06773431537
256 0.06768596543
257 0.06761264966
258 0.06755156958
259 0.06752832891
260 0.06748283827
261 0.06743032987
262 0.06739671917
263 0.06732224875
264 0.06728969092
265 0.06725516931
266 0.06723300356
267 0.06720887295
268 0.06718586325
269 0.06714616988
270 0.06710827646
271 0.0670731178
272 0.06704169236
273 0.06699485454
274 0.06690772622
275 0.06688667598
276 0.06685713884
277 0.06682745586
278 0.06676248038
279 0.06672611731
280 0.06668865626
281 0.06666719068
282 0.06661724682
283 0.06655618112
284 0.06650605897
285 0.06647273345
286 0.06645618873
287 0.06640487797
288 0.06637404626
289 0.06633844125
290 0.06630860942
291 0.06626677386
292 0.06620145629
293 0.06613504904
294 0.06604521192
295 0.06595477418
296 0.06588712921
297 0.06582504113
298 0.06579542657
299 0.06576715644
300 0.06572663817
301 0.06566262651
302 0.06562564449
303 0.06559859369
304 0.06558406394
305 0.06554745475
306 0.06550011801
307 0.06542661042
308 0.06539822525
309 0.06532794566
310 0.06528984667
311 0.06526273588
312 0.06517352858
313 0.06513700383
314 0.0650663878
315 0.06501049196
316 0.06498051493
317 0.06495227448
318 0.06494714083
319 0.06488116773
320 0.06481500881
321 0.06479020971
322 0.06475126259
323 0.06470341329
324 0.06464397911
325 0.06460661312
326 0.06456952566
327 0.06452710556
328 0.06446800797
329 0.06442676522
330 0.06436842375
331 0.06428725709
332 0.06427121669
333 0.06420961889
334 0.06417597643
335 0.06414433453
336 0.06410928364
337 0.06404520872
338 0.06399242091
339 0.06394186339
340 0.06387800869
341 0.06384634403
342 0.06380115375
343 0.06375961736
344 0.06372953291
345 0.06371485391
346 0.06369417562
347 0.06364461773
348 0.063603238
349 0.06353552081
350 0.06350700106
351 0.06344085046
352 0.06339297584
353 0.06334372421
354 0.06330727135
355 0.06327400821
356 0.06320762166
357 0.06315508852
358 0.06310591213
359 0.06306853186
360 0.06303562341
361 0.06299764081
362 0.06295532581
363 0.06292863192
364 0.06289769881
365 0.06281713395
366 0.06279628511
367 0.06275927738
368 0.06273539348
369 0.06271611737
370 0.06266384426
371 0.062608929
372 0.06255246437
373 0.06249934479
374 0.06242105108
375 0.06239144108
376 0.06236355074
377 0.06231986181
378 0.06226054079
379 0.06221714484
380 0.06216793217
381 0.06212736192
382 0.06210084338
383 0.0620755381
384 0.06203982527
385 0.0619992177
386 0.0619738053
387 0.06190238672
388 0.06188269862
389 0.06184367939
390 0.06180150934
391 0.06176380997
392 0.06171384851
393 0.06168389745
394 0.06164815543
395 0.06159437901
396 0.06155125181
397 0.06151733503
398 0.06148340121
399 0.06144372347
400 0.06138377611
401 0.06136367194
402 0.0613366596
403 0.06129473494
404 0.06126366408
405 0.06123461948
406 0.06120293815
407 0.06117235051
408 0.06113512473
409 0.06109665393
410 0.06107111457
411 0.06104359362
412 0.06103446385
413 0.06100486437
414 0.0609796214
415 0.06093745638
416 0.06090722809
417 0.06087102708
418 0.0608248306
419 0.06078930399
420 0.06076113343
421 0.06074582998
422 0.0607273368
423 0.06070257637
424 0.06065322229
425 0.06063870197
426 0.06059277081
427 0.06055913301
428 0.06050367492
429 0.06047605762
430 0.06045306298
431 0.06040763795
432 0.06038106045
433 0.06035537891
434 0.06032132603
435 0.0602969703
436 0.06026180946
437 0.06023183194
438 0.06018876329
439 0.06013349461
440 0.06010662805
441 0.0600807249
442 0.06005916478
443 0.06000464278
444 0.05998212374
445 0.05995491895
446 0.05992273466
447 0.05989235453
448 0.05986151406
449 0.05981272229
450 0.0597830826
451 0.05974186132
452 0.05968905234
453 0.05964365095
454 0.05961880289
455 0.05959483857
456 0.05956341806
457 0.05952500396
458 0.05950180459
459 0.05947023602
460 0.05946089132
461 0.05943922225
462 0.05939166043
463 0.05936901928
464 0.05935066006
465 0.05932094489
466 0.05930666734
467 0.05928514643
468 0.05926864741
469 0.05924771896
470 0.05920464505
471 0.05917766697
472 0.05912873234
473 0.05908828615
474 0.0590516855
475 0.05900514911
476 0.05899227452
477 0.05898854709
478 0.05895627514
479 0.0589150352
480 0.05886960235
481 0.05885643808
482 0.05883624417
483 0.0587932631
484 0.0587721923
485 0.05872298888
486 0.0587080584
487 0.05867204169
488 0.05865804016
489 0.05862780707
490 0.05859705955
491 0.05858549634
492 0.05856944779
493 0.05856601945
494 0.05854731988
495 0.05852679115
496 0.0584900875
497 0.0584391937
498 0.05839378702
499 0.05837648889
500 0.0583380073
501 0.05831550605
502 0.05827498251
503 0.05824728632
504 0.05821996574
505 0.05819349616
506 0.05816999645
507 0.0581281465
508 0.05810907164
509 0.05808312763
510 0.05803959125
511 0.05801379161
512 0.05799672488
513 0.05798297006
514 0.05795384313
515 0.05794509916
516 0.05789980611
517 0.05787842574
518 0.05786122753
519 0.05783621053
520 0.05778371993
521 0.0577664882
522 0.05773912204
523 0.0577208637
524 0.05769549963
525 0.05767534805
526 0.05762609047
527 0.05760616968
528 0.05755219961
529 0.05753587066
530 0.05748974294
531 0.05747545637
532 0.05742986288
533 0.05740215413
534 0.05738666492
535 0.05733530526
536 0.05731970432
537 0.05727822784
538 0.05725954409
539 0.05724492328
540 0.05721098923
541 0.05719684037
542 0.05717307872
543 0.05715976163
544 0.05714005812
545 0.05708022952
546 0.057024425
547 0.05697708387
548 0.05694675934
549 0.05693060089
550 0.05690793072
551 0.05688395165
552 0.05685202819
553 0.05680600406
554 0.05675448262
555 0.05673578346
556 0.05668399305
557 0.05664283433
558 0.05663370501
559 0.05659057352
560 0.05657368969
561 0.05656501947
562 0.05653104857
563 0.05652052126
564 0.05650059686
565 0.05647926978
566 0.056465833
567 0.05645067746
568 0.05642200194
569 0.05639972013
570 0.05638466223
571 0.05633574091
572 0.05629061992
573 0.05627610676
574 0.05625819249
575 0.05621542893
576 0.05618939271
577 0.05617533174
578 0.05615773365
579 0.05611729172
580 0.05609840646
581 0.05606050381
582 0.05603303108
583 0.05601483514
584 0.0560072109
585 0.05596098033
586 0.05591659805
587 0.05589632737
588 0.05585598783
589 0.05581570511
590 0.05580260108
591 0.05576364351
592 0.05571903913
593 0.05567929337
594 0.05566017868
595 0.05564324068
596 0.0555965235
597 0.05558534302
598 0.05556904502
599 0.05556609126
600 0.05552085058
601 0.0555075775
602 0.05546698327
603 0.05543937922
604 0.05542205541
605 0.05538163712
606 0.05534871701
607 0.05531139667
608 0.0552945202
609 0.05527963775
610 0.05523650958
611 0.05522009004
612 0.05519391814
613 0.05514659519
614 0.05511004234
615 0.05507418249
616 0.05505010507
617 0.05500882246
618 0.05499280194
619 0.05497017105
620 0.05492974439
621 0.05489957153
622 0.05486604484
623 0.0548504195
624 0.05483977291
625 0.05481818762
626 0.05480302379
627 0.05477664642
628 0.05473873335
629 0.05471540592
630 0.05470509603
631 0.05469534354
632 0.05466849291
633 0.05464173254
634 0.05461943548
635 0.05460983611
636 0.05459496292
637 0.05456446132
638 0.05455349085
639 0.05450649527
640 0.05449631104
641 0.05448765949
642 0.05447792029
643 0.05445300369
644 0.05442977378
645 0.05440526842
646 0.05436616989
647 0.05435670006
648 0.05433232982
649 0.05428553321
650 0.05426046133
651 0.05425278899
652 0.0542273628
653 0.05421275505
654 0.05417918458
655 0.05414731064
656 0.05414452155
657 0.05412037061
658 0.05407761156
659 0.05406380438
660 0.05403643515
661 0.05400300517
662 0.05398205542
663 0.05395913741
664 0.05395028987
665 0.0539326103
666 0.05391855665
667 0.05388735162
668 0.05387510035
669 0.0538611439
670 0.05385299397
671 0.05384445216
672 0.05382767769
673 0.05380900653
674 0.05377150263
675 0.0537504293
676 0.05372662879
677 0.05368367552
678 0.05366663487
679 0.0536243798
680 0.05358923848
681 0.05357773659
682 0.05355344445
683 0.0535340571
684 0.05351778914
685 0.05348658855
686 0.05346323521
687 0.05342549406
688 0.05338516802
689 0.05334706317
690 0.05332960519
691 0.05329767397
692 0.05328997783
693 0.05325274386
694 0.05322926027
695 0.05319103754
696 0.05316326287
697 0.05313151912
698 0.05310359945
699 0.05308261369
700 0.05305812542
701 0.05302296455
702 0.0530000221
703 0.05297659886
704 0.05293602629
705 0.05290866311
706 0.05288905319
707 0.05287382796
708 0.05285885343
709 0.05283878686
710 0.05281278323
711 0.05279407157
712 0.05277551467
713 0.05275560502
714 0.05273878527
715 0.0526985448
716 0.05267659084
717 0.05264935386
718 0.05263142046
719 0.05260694717
720 0.05258324499
721 0.05255707776
722 0.05252109537
723 0.05249961599
724 0.05248241304
725 0.0524529898
726 0.05242829341
727 0.05241520055
728 0.05239601296
729 0.05237282833
730 0.05235431039
731 0.05233803114
732 0.05232848867
733 0.05230036211
734 0.05229112447
735 0.05226333
736 0.05225258796
737 0.05224087679
738 0.05222718373
739 0.052209845
740 0.05219675054
741 0.05216762275
742 0.05213633376
743 0.05211175465
744 0.052093788
745 0.05207770372
746 0.05206812093
747 0.05205755284
748 0.05202879244
749 0.05201306498
750 0.05200127045
751 0.05197999037
752 0.05196310351
753 0.05193176677
754 0.05191044363
755 0.05189358603
756 0.05187295618
757 0.05185272673
758 0.05182819275
759 0.05181402689
760 0.0517939837
761 0.051772403
762 0.05174119565
763 0.05171403368
764 0.05169884256
765 0.05168008609
766 0.05166095345
767 0.05164675986
768 0.05162847906
769 0.05160584088
770 0.05158727032
771 0.05157036821
772 0.05155434202
773 0.05153705249
774 0.0515344874
775 0.05152130678
776 0.05150319671
777 0.05147201088
778 0.05146323252
779 0.05144142187
780 0.0514251041
781 0.05140702089
782 0.05139047339
783 0.05137682002
784 0.05134583902
785 0.05131439078
786 0.05128821904
787 0.05126919369
788 0.05125075224
789 0.0512328739
790 0.05121553886
791 0.05119139102
792 0.05116559237
793 0.05115062337
794 0.05112743426
795 0.05109691284
796 0.05107022176
797 0.05105403851
798 0.05103391756
799 0.05102293215
800 0.05100969822
801 0.05099397213
802 0.05097870549
803 0.05095661576
804 0.05094178369
805 0.050927384
806 0.05090983889
807 0.05088903398
808 0.0508526688
809 0.05084399814
810 0.05082651773
811 0.05081811934
812 0.05080201318
813 0.05079096026
814 0.05078377959
815 0.05077082008
816 0.05076045416
817 0.05075381741
818 0.05074946269
819 0.05070992185
820 0.05070232137
821 0.0506816004
822 0.05066212701
823 0.05065409239
824 0.05063485213
825 0.05062666061
826 0.05061251025
827 0.05060478402
828 0.05058794341
829 0.05057051628
830 0.05054611086
831 0.05053289924
832 0.05051877722
833 0.0505043759
834 0.05049191433
835 0.05046888851
836 0.05044120703
837 0.05042701788
838 0.05041099321
839 0.05040010666
840 0.05038616697
841 0.05036342871
842 0.05035618149
843 0.05033930729
844 0.05033196566
845 0.05030694268
846 0.0502836333
847 0.05026772698
848 0.05025238715
849 0.05023079534
850 0.05021197258
851 0.05018441543
852 0.05016156485
853 0.05013557517
854 0.05011150008
855 0.05010162974
856 0.05008771875
857 0.05008534565
858 0.05006007488
859 0.05003623789
860 0.05001281879
861 0.04998424242
862 0.04996914715
863 0.04996234015
864 0.04994034091
865 0.04991180017
866 0.04988848753
867 0.04985821913
868 0.04984531684
869 0.04983050852
870 0.04980182982
871 0.04978309159
872 0.04977170444
873 0.04974964405
874 0.04972405023
875 0.04970388653
876 0.04969237591
877 0.04966837593
878 0.04966014128
879 0.04964391542
880 0.04963418903
881 0.04960457919
882 0.04958631864
883 0.04955013938
884 0.04952676704
885 0.04951422334
886 0.04950194466
887 0.04948640474
888 0.04946079018
889 0.04944566436
890 0.04940128604
891 0.04938700939
892 0.04938496319
893 0.04936503816
894 0.0493397069
895 0.04930559236
896 0.0492909345
897 0.04927554904
898 0.04924521755
899 0.04923385542
900 0.04922006676
901 0.04921456985
902 0.04920106238
903 0.04918817398
904 0.04917526552
905 0.04915037306
906 0.04912862134
907 0.04911660276
908 0.04909250859
909 0.04906462508
910 0.0490412708
911 0.04902327587
912 0.04899678576
913 0.04897895124
914 0.04895404707
915 0.0489255016
916 0.04891423675
917 0.04888820492
918 0.04887360068
919 0.04884990043
920 0.04882523039
921 0.04880646352
922 0.04878231187
923 0.04875872742
924 0.04873506036
925 0.04872328088
926 0.04870424863
927 0.0486732031
928 0.04866436654
929 0.04865449454
930 0.04863150091
931 0.04861356339
932 0.04859173672
933 0.04857774001
934 0.04857173717
935 0.04855659055
936 0.04853583058
937 0.04851996191
938 0.04849616784
939 0.04846901804
940 0.04845328857
941 0.04844211409
942 0.048430801
943 0.04841579505
944 0.04839902752
945 0.04837602543
946 0.04834045631
947 0.0483236697
948 0.04829893957
949 0.04828249577
950 0.04827421882
951 0.04826647504
952 0.04824307838
953 0.04822086369
954 0.04819583364
955 0.04816633803
956 0.04815717794
957 0.04812880966
958 0.04811630323
959 0.04810557805
960 0.04809606971
961 0.04806933495
962 0.04805404146
963 0.04804222867
964 0.04802093067
965 0.04800619778
966 0.04798091747
967 0.04796394031
968 0.04795376252
969 0.04793087196
970 0.04791039612
971 0.0478883379
972 0.04786222217
973 0.0478412503
974 0.04782191286
975 0.0478037294
976 0.04778990797
977 0.04777431577
978 0.04776367868
979 0.0477396886
980 0.04772326032
981 0.04770609531
982 0.04768714217
983 0.0476690391
984 0.04765173928
985 0.04763519897
986 0.04761556024
987 0.04759074739
988 0.04756797442
989 0.04754646736
990 0.04753456303
991 0.04751585939
992 0.04749739859
993 0.04747675266
994 0.04746575348
995 0.04744657533
996 0.04743312051
997 0.04741463392
998 0.04739438905
999 0.04738376077
4659588612
......@@ -30,6 +30,8 @@ email_sender=$SENDER_EMAIL
[MONGO]
mongo_uri=$MONGO_URI
project_id=$PROJECT_ID
query_filter=$QUERY_FILTER
[TIMEZONE]
required_tz=$REQUIRED_TZ
......
......@@ -11,6 +11,10 @@ START_RELATIVE=90
END_RELATIVE=0
REQUIRED_TZ="Asia/Kolkata"
MONGO_URI=mongodb://admin:iLensDevMongo783@192.168.0.220:2717/
PROJECT_ID=project_101
QUERY_FILTER=dalmia_string_level_tags
MLFLOW_TRACKING_URI=https://qa.unifytwin.com/mlflow/
MLFLOW_TRACKING_USERNAME=mlflow
MLFLOW_TRACKING_PASSWORD=MlFlOwQA#4321
......
......@@ -35,10 +35,6 @@ except Exception as e:
sys.exit()
class Mongo:
mongo_uri = config["MONGO"]["mongo_uri"]
class KairosDb:
uri = config["KAIROS_DB"]["uri"]
metric_name = config['KAIROS_DB']['metric_name']
......@@ -84,6 +80,12 @@ class PycaretParams:
hyperparameter_tuning_method= config['PYCARET']['hyperparameter_tuning_method']
class Mongo:
mongo_uri = config["MONGO"]["mongo_uri"]
project_id = config["MONGO"]["project_id"]
query_filter = config["MONGO"]["query_filter"]
......
json_file_path = "scripts/utils/"
class DBConstants:
class MongoConstants:
# DB
db_metadata = "ilens_configuration"
db = "ilens_ai"
# collections
collection_rule_targets = "rule_targets"
collection = "dalmiaStringTags"
yield_sheet_name = "yield_reports_3cp"
\ No newline at end of file
import numpy as np
from loguru import logger
from scripts.core.engine.final_tags import GetFinalDf
from scripts.core.data_puller_push.kafka_push import CalculatedDataPush
def ai_modelling(df_train, get_training_inference, df_predicted_tags):
try:
get_final_df = GetFinalDf()
for inv_id in list(df_train.inv_id.unique()):
for mppt_id in list(df_train.mppt_id.unique()):
try:
model, scaler_x, scaler_y = get_training_inference.data_training(inv_id=inv_id, mppt_id=mppt_id)
x_test, y_test, predictions = get_training_inference.data_inference(scaler_x=scaler_x,
scaler_y=scaler_y,
model=model,
inv_id=inv_id,
mppt_id=mppt_id)
df_result = get_final_df.get_final_data(x_test=x_test,
y_test=y_test,
predictions=predictions)
final_dict = get_final_df.get_final_predicted_tags(df_predicted_current_tags=df_predicted_tags,
inv_id=inv_id, mppt_id=mppt_id)
df_result["timestamp"] = df_result["datetime"].values.astype(np.int64) / 10 ** 9
df_result["timestamp"] = df_result["timestamp"].astype('int')
CalculatedDataPush(df_result=df_result, final_tags_dict=final_dict).kafka_data_push()
logger.info(f'{final_dict}')
except Exception as e:
logger.exception(f'Exception - {e}')
except Exception as e:
logger.exception(f'Exception - {e}')
import pandas as pd
from loguru import logger
import warnings
from scripts.utils.mongo_utils import MongoConnect
from scripts.constants.app_configuration import Mongo
from scripts.constants.app_constants import MongoConstants
warnings.filterwarnings('ignore')
def get_raw_predicted_tags():
try:
mongo_conn = MongoConnect(uri=Mongo.mongo_uri, database=MongoConstants.db,
collection=MongoConstants.collection)
raw_tags_dict = mongo_conn.find_one({"$and": [{"id": "dalmia_string_level_tags"}, {"city": "ariyalur"},
{"tags_property": "raw"}]})
req_tags = raw_tags_dict['input_data']
df_raw_tags = pd.DataFrame.from_dict(req_tags, orient='index')
predicted_tags_dict = mongo_conn.find_one({"$and": [{"id": "dalmia_string_level_tags"}, {"city": "ariyalur"},
{"tags_property": "predicted"}]})
predicted_tags = predicted_tags_dict['input_data']
df_predicted_tags = pd.DataFrame.from_dict(predicted_tags, orient='index')
df_raw_tags.reset_index(inplace=True)
df_raw_tags.rename(columns={'index': 'tag_name'}, inplace=True)
df_predicted_tags.reset_index(inplace=True)
df_predicted_tags.rename(columns={'index': 'tag_name'}, inplace=True)
return df_raw_tags, df_predicted_tags
except Exception as e:
logger.exception(f'Exception - {e}')
......@@ -28,7 +28,6 @@ def get_tags_data(mppt_tags, start_timestamp, end_timestamp):
df_merged['hour'] = df_merged['datetime'].dt.hour
logger.info(f'Final shape of merged dataframe = {df_merged.shape}')
df_merged.reset_index(drop=True, inplace=True)
# df_merged.to_csv(f'{base_path}/df_merged.csv', index=False)
return df_merged
except Exception as e:
logger.exception(f'Exception - {e}')
......
from typing import Dict
from loguru import logger
from pymongo import MongoClient
from scripts.constants.app_configuration import Mongo
class MongoConnect:
def __init__(self, uri, database, collection):
try:
self.uri = uri
self.client = MongoClient(self.uri, connect=False)
self.database = database
self.collection = collection
except Exception as e:
logger.exception(f'Exception - {e}')
@staticmethod
def data_dict(data, city):
try:
req_dict = dict()
req_dict['project_id'] = Mongo.project_id
req_dict['id'] = Mongo.query_filter
req_dict['city'] = city
req_dict['input_data'] = data
return req_dict
except Exception as e:
logger.exception(f'Exception - {e}')
def insert_one(self, data, city):
try:
db = self.client[self.database]
collection = db[self.collection]
req_dict = self.data_dict(data=data, city=city)
response = collection.insert_one(req_dict)
return response.inserted_id
except Exception as e:
logger.exception(f'Exception - {e}')
def find_one(self, query, filter_dict=None):
try:
if filter_dict is None:
filter_dict = {"_id": 0}
db = self.client[self.database]
collection = db[self.collection]
response = collection.find_one(query, filter_dict)
return response
except Exception as e:
logger.exception(f'Exception - {e}')
......@@ -10,15 +10,15 @@ class DataPreprocessing:
@staticmethod
def remove_outliers(df, param_list):
try:
for col in param_list:
lb = df[col].mean() - 3 * df[col].std()
ub = df[col].mean() + 3 * df[col].std()
logger.debug(f"Min values of {col} = {df[col].min()} \nLower Bracket of {col} = {lb}")
logger.debug(f"Max values of {col} = {df[col].max()} \nUpper Bracket of {col} = {ub}")
logger.debug(f'Shape of df before outlier removal = {df.shape}')
df = (df[(df[col] > lb) & (df[col] < ub)])
logger.debug(f'Shape of df after outlier removal = {df.shape}')
logger.debug(f'Shape final df before outlier removal = {df.shape}')
# for col in param_list:
# lb = df[col].mean() - 3 * df[col].std()
# ub = df[col].mean() + 3 * df[col].std()
# logger.debug(f"Min values of {col} = {df[col].min()} \nLower Bracket of {col} = {lb}")
# logger.debug(f"Max values of {col} = {df[col].max()} \nUpper Bracket of {col} = {ub}")
# logger.debug(f'Shape of df before outlier removal = {df.shape}')
# df = (df[(df[col] > lb) & (df[col] < ub)])
# logger.debug(f'Shape of df after outlier removal = {df.shape}')
# logger.debug(f'Shape final df before outlier removal = {df.shape}')
return df
except Exception as e:
logger.exception(f'Exception - {e}')
......
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