Commit cc9339fd authored by aakash.bedi's avatar aakash.bedi

added data push function

parent 4c5662f8
Pipeline #58260 failed with stage
......@@ -2,6 +2,7 @@ if __name__ == "__main__":
from dotenv import load_dotenv
load_dotenv(dotenv_path='config.env')
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
......@@ -9,6 +10,8 @@ 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
warnings.filterwarnings("ignore")
......@@ -19,7 +22,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,
start_timestamp=start_timestamp,
......@@ -31,7 +36,8 @@ 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 = 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())
......@@ -45,9 +51,17 @@ def get_tag_details():
model=model,
inv_id=inv_id,
mppt_id=mppt_id)
df_result = mppt_data.get_final_data(x_test=x_test, y_test=y_test, predictions=predictions)
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'{df_result.shape}')
logger.info(f'{final_dict}')
except Exception as e:
logger.exception(f'Exception - {e}')
except Exception as e:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
iter RMSE
0 0.2692964719
1 0.258083442
2 0.247760476
3 0.2377924956
4 0.2283793129
5 0.2193944633
6 0.2107527152
7 0.202718083
8 0.1949315754
9 0.1875224358
10 0.180765735
11 0.1739757876
12 0.1678233509
13 0.1618256524
14 0.1564252946
15 0.1510555759
16 0.1460218679
17 0.1413732764
18 0.1369137946
19 0.1327311224
20 0.1287778564
21 0.1250815938
22 0.1215790172
23 0.1181865932
24 0.1150963943
25 0.1122115368
26 0.1094371903
27 0.1068700428
28 0.1044623821
29 0.1021321695
30 0.1000464985
31 0.09811471224
32 0.09612252361
33 0.09436634107
34 0.09274936637
35 0.09126349055
36 0.08981925819
37 0.08846160512
38 0.08734000998
39 0.08619072748
40 0.08518615391
41 0.08422040918
42 0.08335523784
43 0.08254045364
44 0.08170258325
45 0.08091613729
46 0.0802211608
47 0.07965115419
48 0.07906794752
49 0.07854155973
50 0.07794838214
51 0.07732478653
52 0.07670870773
53 0.07626100396
54 0.07586207033
55 0.07538025826
56 0.07496071844
57 0.07465781428
58 0.07430872528
59 0.07390490575
60 0.07356052373
61 0.07313008753
62 0.0728172485
63 0.07245824784
64 0.0722506465
65 0.07196196116
66 0.0716904739
67 0.07155453914
68 0.07136746712
69 0.07111351285
70 0.07100226647
71 0.07090214053
72 0.07062867395
73 0.07054428335
74 0.07039160928
75 0.07019474993
76 0.07005779542
77 0.06982322111
78 0.06975321718
79 0.06958447161
80 0.06938419825
81 0.06920802589
82 0.06908513439
83 0.06893034621
84 0.06885057309
85 0.06876959006
86 0.06865037018
87 0.0684872619
88 0.0683665145
89 0.06819063826
90 0.06812118257
91 0.06805316375
92 0.06800638099
93 0.06790128694
94 0.06781983602
95 0.06771089333
96 0.06765821741
97 0.06758945707
98 0.06753715569
99 0.06749735779
100 0.0674161878
101 0.06733545589
102 0.0672015421
103 0.06714708338
104 0.06703376326
105 0.06691199285
106 0.06683089238
107 0.06676273987
108 0.06665915313
109 0.06656994911
110 0.06645016246
111 0.06636219408
112 0.06626214303
113 0.06616507483
114 0.06609787556
115 0.06594174888
116 0.06589023978
117 0.06581725931
118 0.0657280351
119 0.06564852024
120 0.06562323013
121 0.06556184376
122 0.06552106402
123 0.0654490618
124 0.06538941975
125 0.06532342289
126 0.06519434438
127 0.06512998599
128 0.06503128615
129 0.06496585539
130 0.06490523496
131 0.06483697669
132 0.06477170054
133 0.06473138173
134 0.06464924381
135 0.06454291112
136 0.06441986018
137 0.06437335476
138 0.0643173042
139 0.06423286243
140 0.06419310728
141 0.0641468083
142 0.06410944248
143 0.0640755453
144 0.06396388101
145 0.06390396909
146 0.06382018092
147 0.06370744452
148 0.06363921619
149 0.06354586648
150 0.06347780467
151 0.06343010348
152 0.06335464222
153 0.06330869588
154 0.06326124443
155 0.06318237299
156 0.06310103486
157 0.0630706422
158 0.06301156972
159 0.06295827355
160 0.06288707207
161 0.06276202733
162 0.06272338677
163 0.06266365766
164 0.06256207496
165 0.06249731688
166 0.06242140524
167 0.06236803145
168 0.06227940219
169 0.06221363866
170 0.06214387826
171 0.06208320758
172 0.06202834751
173 0.0619859167
174 0.0619551617
175 0.06186386801
176 0.06177553947
177 0.06170070696
178 0.06164782678
179 0.06159436314
180 0.06156799303
181 0.06149920393
182 0.06145668174
183 0.06142822595
184 0.06135476531
185 0.06129551719
186 0.06127042832
187 0.06121784724
188 0.06119834152
189 0.06112207124
190 0.06106556091
191 0.06100846346
192 0.06095460054
193 0.06088849596
194 0.06081467248
195 0.06078881643
196 0.06070236494
197 0.06066082143
198 0.06063408267
199 0.06057457193
200 0.06054894228
201 0.06051102577
202 0.06046093445
203 0.06039968779
204 0.06037458341
205 0.06032085263
206 0.06028359121
207 0.0602515349
208 0.0602211697
209 0.06019929101
210 0.06012608626
211 0.06007396062
212 0.06004126831
213 0.06002033221
214 0.05995199154
215 0.05987599484
216 0.05985448494
217 0.05977865957
218 0.05969975646
219 0.05967749356
220 0.05965094149
221 0.05960973195
222 0.05958454571
223 0.05951451604
224 0.05946138231
225 0.05943529003
226 0.05941706232
227 0.05939308912
228 0.0593277332
229 0.05928890178
230 0.05926861808
231 0.0592322133
232 0.05920458275
233 0.05915707306
234 0.05914271301
235 0.05910845803
236 0.05905222454
237 0.05902188745
238 0.05896284552
239 0.05890516688
240 0.0588882094
241 0.05883352813
242 0.05878810874
243 0.05875385748
244 0.05871614763
245 0.05866574123
246 0.05861131447
247 0.05855267695
248 0.05850602813
249 0.05847568328
250 0.05843619256
251 0.05842042263
252 0.0583798086
253 0.05832398027
254 0.05827511291
255 0.05822798415
256 0.05817421825
257 0.05810409676
258 0.05807496455
259 0.05805997884
260 0.05797441288
261 0.0579358936
262 0.05792111902
263 0.05787948138
264 0.05782857388
265 0.05778111154
266 0.05771170564
267 0.05766655715
268 0.05763884325
269 0.05759460044
270 0.05754262132
271 0.05750392549
272 0.05749002645
273 0.05747657826
274 0.05743978422
275 0.05735977631
276 0.0573061557
277 0.05727469951
278 0.05724817004
279 0.05722185571
280 0.05719187601
281 0.05716782538
282 0.05715865406
283 0.05714977347
284 0.05707261351
285 0.05701167077
286 0.05698297577
287 0.05690688167
288 0.05687058862
289 0.05683805444
290 0.05678878647
291 0.05676334665
292 0.05673932829
293 0.05672697244
294 0.05668855491
295 0.0566531198
296 0.05657371236
297 0.05653613509
298 0.05650022085
299 0.05648781019
300 0.05646300295
301 0.05639154254
302 0.05632021997
303 0.05625248648
304 0.05622408468
305 0.05619983349
306 0.05616095078
307 0.05608780895
308 0.05602435964
309 0.05600580765
310 0.05599420373
311 0.05597054216
312 0.05591059091
313 0.05584363592
314 0.05581009802
315 0.05575603465
316 0.05568828634
317 0.05565402175
318 0.05563121947
319 0.05561371306
320 0.05559054853
321 0.05554392891
322 0.0555018101
323 0.05548013867
324 0.05541639526
325 0.05539039966
326 0.05537922216
327 0.05535445647
328 0.05531832954
329 0.05527566103
330 0.0552535205
331 0.05518993564
332 0.0551349651
333 0.05510331803
334 0.05505443318
335 0.055043341
336 0.05502869436
337 0.05500706521
338 0.05499681107
339 0.05494002138
340 0.05491891893
341 0.05487923229
342 0.05485863939
343 0.05478606901
344 0.05476205748
345 0.054751047
346 0.05469958967
347 0.05462718805
348 0.05460320392
349 0.05453061096
350 0.05450741336
351 0.05449370426
352 0.05446492616
353 0.05443328167
354 0.05442262936
355 0.05440970884
356 0.05436025721
357 0.05431246075
358 0.05429024574
359 0.05427652893
360 0.05423427021
361 0.05419285136
362 0.05415283931
363 0.05411392449
364 0.05407900702
365 0.05402916113
366 0.05396766225
367 0.05394287835
368 0.05391535561
369 0.05388991502
370 0.0538244021
371 0.0538013315
372 0.05377978732
373 0.05375887034
374 0.05374601229
375 0.05370886729
376 0.05366226743
377 0.05362680264
378 0.0536064239
379 0.05355051182
380 0.05350487449
381 0.05347018582
382 0.0534260984
383 0.05336388712
384 0.05334522687
385 0.05332580155
386 0.05329354699
387 0.05328135002
388 0.05326245662
389 0.05322867181
390 0.05317607421
391 0.05314529502
392 0.05309575697
393 0.05305716627
394 0.05300029772
395 0.05295380544
396 0.05292758751
397 0.05287383689
398 0.05283749376
399 0.05279257954
400 0.05273370061
401 0.05271596804
402 0.05269875636
403 0.0526884356
404 0.05267387753
405 0.05264076539
406 0.05261132362
407 0.05256963939
408 0.05253087555
409 0.052463696
410 0.05244674507
411 0.05243030708
412 0.05241387956
413 0.05235193239
414 0.05230890101
415 0.05225400399
416 0.05223319989
417 0.05221713347
418 0.05219759458
419 0.05216620262
420 0.05211525608
421 0.05210558879
422 0.05207356155
423 0.05203045591
424 0.05195258476
425 0.05193664234
426 0.05192123425
427 0.05190621781
428 0.0518880162
429 0.05187869716
430 0.05183093144
431 0.05179965606
432 0.05173811944
433 0.05169000791
434 0.05167529225
435 0.05162982296
436 0.05158249009
437 0.05153793008
438 0.05149596507
439 0.05146386068
440 0.0514213214
441 0.05139430215
442 0.05136737594
443 0.0513294482
444 0.05129007719
445 0.0512609694
446 0.05123506785
447 0.05121031047
448 0.05117956739
449 0.05114959017
450 0.0511203573
451 0.05110760331
452 0.05107907573
453 0.05105125293
454 0.05102125369
455 0.05099408989
456 0.05094998876
457 0.05092343576
458 0.05089753754
459 0.05087227625
460 0.05084763466
461 0.05082359611
462 0.05080014455
463 0.05077080839
464 0.05076186156
465 0.05075322899
466 0.05074043707
467 0.05071823486
468 0.05071009393
469 0.05068842955
470 0.05068057083
471 0.05067298602
472 0.0506435854
473 0.05062242089
474 0.05060177005
475 0.05059443889
476 0.05058736133
477 0.05056720507
478 0.05056036852
479 0.05054069675
480 0.05053409192
481 0.05051489209
482 0.05050851015
483 0.05050234613
484 0.05047769256
485 0.05047178117
486 0.05046607048
487 0.0504244286
488 0.05041889659
489 0.05039561374
490 0.05039068081
491 0.05038407197
492 0.05037771222
493 0.05035080716
494 0.05034466003
495 0.05032312692
496 0.0503046719
497 0.05028776304
498 0.05027394144
499 0.05025773037
500 0.05024223375
501 0.05023233093
502 0.0502174985
503 0.05020431254
504 0.05017268075
505 0.05016132659
506 0.05012733266
507 0.05011310675
508 0.0501078267
509 0.05010268804
510 0.05009587177
511 0.050079715
512 0.05007195316
513 0.05006695399
514 0.05006210521
515 0.05005468215
516 0.05004445093
517 0.05003339745
518 0.05002605014
519 0.0500073694
520 0.05000009316
521 0.04999301494
522 0.04998901923
523 0.04996513504
524 0.04990349824
525 0.049893258
526 0.04985778804
527 0.049805713
528 0.04980200943
529 0.04979555377
530 0.04977349556
531 0.04972517415
532 0.04967712313
533 0.04966540524
534 0.04964347404
535 0.04960040785
536 0.04957827454
537 0.04955558647
538 0.0495108989
539 0.04946376209
540 0.04941724052
541 0.04937341804
542 0.04933545533
543 0.04931779235
544 0.04929734635
545 0.04927786062
546 0.04927176694
547 0.04924676215
548 0.04923251127
549 0.04920693253
550 0.04918252795
551 0.0491585783
552 0.04910790167
553 0.049063985
554 0.04905829887
555 0.04905275924
556 0.0490473619
557 0.04904148359
558 0.0490130584
559 0.04897936695
560 0.04896586075
561 0.04894295188
562 0.04892977421
563 0.0489244903
564 0.04888844479
565 0.04886981425
566 0.04884929973
567 0.0488364175
568 0.04881178951
569 0.0487944174
570 0.04878181113
571 0.04877662075
572 0.04875504273
573 0.04870972469
574 0.048690909
575 0.04864716848
576 0.04863179819
577 0.04861223589
578 0.04857812021
579 0.04853870479
580 0.04851464402
581 0.0484746316
582 0.04846230309
583 0.04844103385
584 0.04842900489
585 0.04839792227
586 0.04838617401
587 0.04834228938
588 0.04832071985
589 0.04830924026
590 0.04828837972
591 0.04824600134
592 0.04820568412
593 0.04819162715
594 0.04817165972
595 0.04814468008
596 0.04810415064
597 0.04809736192
598 0.04806317374
599 0.04803424214
600 0.04802298258
601 0.04799102509
602 0.04796245386
603 0.04793782799
604 0.04791526095
605 0.04790149313
606 0.04786624392
607 0.04784447477
608 0.04780659536
609 0.04778321296
610 0.04776048813
611 0.04773842728
612 0.04771117915
613 0.04768117161
614 0.04765421609
615 0.04764319993
616 0.04761109044
617 0.04758268851
618 0.04757192257
619 0.04753880294
620 0.04751947171
621 0.0474884588
622 0.04745791389
623 0.04742831418
624 0.04740934285
625 0.0473802376
626 0.04735241871
627 0.04734122975
628 0.04733058275
629 0.04730302995
630 0.04727638788
631 0.04726254827
632 0.04722525035
633 0.04721507006
634 0.04718499966
635 0.04715902834
636 0.04714077801
637 0.04709757428
638 0.04707637048
639 0.04706534316
640 0.04705482043
641 0.04703709439
642 0.04701170585
643 0.04700141927
644 0.04698730462
645 0.04697705063
646 0.04696172835
647 0.04693085794
648 0.04690211942
649 0.04686776141
650 0.04685049344
651 0.04682339341
652 0.04681333555
653 0.04680056389
654 0.04676915807
655 0.04673238657
656 0.04669977278
657 0.04666991638
658 0.04663831504
659 0.04661599633
660 0.04660261437
661 0.04659276462
662 0.04657744727
663 0.04653582232
664 0.04652619685
665 0.04650225063
666 0.04649289114
667 0.04648397669
668 0.04647548166
669 0.04645813208
670 0.04641971585
671 0.0463797821
672 0.04634676445
673 0.04632929781
674 0.04632116477
675 0.04628273073
676 0.04626835819
677 0.04625892288
678 0.04624433641
679 0.04623130664
680 0.04621735102
681 0.046196856
682 0.04617627514
683 0.04616416931
684 0.04613640492
685 0.04610026161
686 0.04608574991
687 0.04604856505
688 0.04602914469
689 0.04600354876
690 0.04597485282
691 0.04595783374
692 0.04594115357
693 0.04592493775
694 0.04589720711
695 0.04588141786
696 0.04586606268
697 0.04583861189
698 0.04580115157
699 0.04577481369
700 0.04575897944
701 0.04573710702
702 0.04571368245
703 0.04568719624
704 0.04566215501
705 0.04565282649
706 0.04562731832
707 0.04559367779
708 0.04558456198
709 0.04556256413
710 0.04554138011
711 0.04551924609
712 0.04550160961
713 0.04547842616
714 0.04545724112
715 0.04543677924
716 0.04541567017
717 0.04539071584
718 0.045368646
719 0.04535008506
720 0.04532447086
721 0.04530990195
722 0.04528241436
723 0.04525472024
724 0.04522583505
725 0.04521768873
726 0.04520976548
727 0.04517421209
728 0.04515734477
729 0.04512997998
730 0.04509177966
731 0.04507226766
732 0.04504450763
733 0.04502786102
734 0.04499297615
735 0.04498164058
736 0.04495569723
737 0.04493877155
738 0.04491986605
739 0.04488516554
740 0.0448708904
741 0.04486191583
742 0.04485181865
743 0.04484425403
744 0.04482564433
745 0.04481812563
746 0.04479632161
747 0.04478755224
748 0.04477827105
749 0.04474011798
750 0.04470601653
751 0.04468818237
752 0.0446559914
753 0.04464199688
754 0.04463305794
755 0.04460318445
756 0.04456945868
757 0.04454232504
758 0.04452862202
759 0.04451528919
760 0.04450231436
761 0.04449554629
762 0.04447352474
763 0.04446276025
764 0.04445243488
765 0.04443629003
766 0.04441731959
767 0.04439841245
768 0.04437347852
769 0.0443550366
770 0.0443370548
771 0.04431965319
772 0.04430249527
773 0.04428300377
774 0.04426597175
775 0.0442493747
776 0.04422565459
777 0.04420941042
778 0.04419046837
779 0.0441669859
780 0.04414763538
781 0.04412494915
782 0.04409895769
783 0.0440750074
784 0.04406650825
785 0.04405191138
786 0.04404285969
787 0.0440347511
788 0.04401960875
789 0.04399606578
790 0.04397322476
791 0.0439471647
792 0.04392732526
793 0.04390555918
794 0.04388112356
795 0.04385812981
796 0.04384136947
797 0.04381369036
798 0.04379902877
799 0.04378991529
800 0.04376611067
801 0.04373381234
802 0.04370234049
803 0.0436848083
804 0.04366919832
805 0.04363813217
806 0.04362413997
807 0.043610703
808 0.04359030053
809 0.04357734469
810 0.04356180426
811 0.04354248371
812 0.04353098658
813 0.04351992915
814 0.04348904124
815 0.04347175586
816 0.04345189742
817 0.04341981633
818 0.04339921762
819 0.04338153223
820 0.04335414566
821 0.04333360751
822 0.04330051189
823 0.04326965645
824 0.04321911646
825 0.04319192421
826 0.04316485217
827 0.04315871265
828 0.04312928376
829 0.04308335515
830 0.04307107352
831 0.04305039373
832 0.04302447639
833 0.04299800145
834 0.04297295643
835 0.04295308809
836 0.04294123665
837 0.04291726818
838 0.04288655173
839 0.04286626953
840 0.04285782271
841 0.04283956357
842 0.04281342987
843 0.04280518997
844 0.0427939272
845 0.04278590098
846 0.04275962303
847 0.04271638593
848 0.04270006511
849 0.04268944417
850 0.04267298944
851 0.04265928501
852 0.04263495692
853 0.04262710484
854 0.04260470678
855 0.04259705055
856 0.04258874184
857 0.04257170764
858 0.04254344788
859 0.0425359773
860 0.04252622831
861 0.04251012999
862 0.04248023531
863 0.04246257523
864 0.04242677418
865 0.04242222234
866 0.04238036207
867 0.04237162685
868 0.04232971816
869 0.04230541791
870 0.04228751244
871 0.04225652519
872 0.0422394253
873 0.04220868158
874 0.04217884346
875 0.04214850951
876 0.0421255614
877 0.04210342107
878 0.04207820064
879 0.04203982209
880 0.04203259997
881 0.04199676226
882 0.04198971416
883 0.04196994459
884 0.04193848378
885 0.04190961025
886 0.04188055959
887 0.04186859919
888 0.04184165996
889 0.04182006975
890 0.04179986027
891 0.0417783606
892 0.04176265393
893 0.04173673919
894 0.04171676941
895 0.04170985162
896 0.04169942831
897 0.04168004236
898 0.04167330346
899 0.04163668338
900 0.04160890539
901 0.04160130997
902 0.04159391646
903 0.04157182989
904 0.04155624065
905 0.04153292274
906 0.04151946467
907 0.0415125877
908 0.04149516074
909 0.04146490169
910 0.04144859052
911 0.04141991988
912 0.04140011384
913 0.04137770633
914 0.04136495878
915 0.04135019667
916 0.04134347504
917 0.04133690813
918 0.04131180612
919 0.04129682407
920 0.04126957023
921 0.04124430739
922 0.04122866237
923 0.0412035693
924 0.04117746876
925 0.0411597003
926 0.04113798228
927 0.04112113613
928 0.04110302094
929 0.04108821989
930 0.04107291623
931 0.04105716387
932 0.04103198644
933 0.04099958899
934 0.04098004996
935 0.04096219912
936 0.04094785878
937 0.04092707665
938 0.04091427343
939 0.04088685624
940 0.04087179116
941 0.04086067715
942 0.04084226437
943 0.04083625269
944 0.04082542173
945 0.04081955401
946 0.04080609437
947 0.04078306494
948 0.04075871272
949 0.04073994069
950 0.04072185652
951 0.04070407897
952 0.04069137435
953 0.04067062306
954 0.04064580865
955 0.0406373999
956 0.04060554708
957 0.04058397403
958 0.04056106315
959 0.04053907103
960 0.040518731
961 0.04050554786
962 0.04049990858
963 0.04047656687
964 0.04047106634
965 0.04044448168
966 0.04042069463
967 0.04039804264
968 0.04039267078
969 0.04037983788
970 0.04035365961
971 0.04032902095
972 0.04031507244
973 0.04029767036
974 0.04027233754
975 0.04025034434
976 0.04023390121
977 0.04020670223
978 0.04018543838
979 0.04016681389
980 0.04014551725
981 0.04013510677
982 0.04011477393
983 0.04009220232
984 0.04007495497
985 0.04005738232
986 0.04003690561
987 0.0400193475
988 0.04000712877
989 0.03999526381
990 0.03998691452
991 0.03997319037
992 0.03995536171
993 0.03993098485
994 0.03991120083
995 0.03988989539
996 0.03987555844
997 0.03985932115
998 0.03984358399
999 0.0398203998
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
......@@ -2,7 +2,7 @@ APP_NAME=dalmia-solar-degradation
KAIROS_URI=https://iLens:iLensDAL$456@dalmia.ilens.io/kairos/
KAIROS_METRIC=ilens.live_data.raw
AGGREGATOR=max
AGGREGATOR_VALUE=30
AGGREGATOR_VALUE=15
AGGREGATOR_UNIT=minutes
KAFKA_HOST=192.168.0.220
KAFKA_PORT=9092
......
from loguru import logger
from scripts.core.data_puller_push.push_data import insert_values_3cp
class CalculatedDataPush:
def __init__(self, df_calculated, all_cal_tags_dict):
self.df_calculated = df_calculated
self.all_cal_tags_dict = all_cal_tags_dict
def kafka_data_push(self, df_calculated):
try:
logger.info(f"Calculated dict length = {len(self.all_cal_tags_dict)}")
logger.info(f"Calculated df shape with Date and Timestamp column = {df_calculated.shape}")
df_calculated_tags_dict = {col: self.all_cal_tags_dict[col] for col in df_calculated.columns
if col not in ('Date', 'timestamp')}
for i, j in df_calculated.iterrows():
my_dict = {v: j[k] for k, v in df_calculated_tags_dict.items()}
logger.info(f"{j['timestamp'], j['Date'], my_dict}")
insert_values_3cp(j['timestamp'], my_dict)
except Exception as e:
logger.exception(f'Exception - {e}')
......@@ -34,7 +34,9 @@ class KairosQuery:
"sampling": {
"value": KairosDb.aggregator_value,
"unit": KairosDb.aggregator_unit
}
},
"align_sampling": True,
"align_end_time": True
}
]
}
......
from loguru import logger
from scripts.core.data_puller_push.push_data import insert_values_dalmia
class CalculatedDataPush:
def __init__(self, df_result, final_tags_dict):
self.df_result = df_result
self.final_tags_dict = final_tags_dict
def kafka_data_push(self):
try:
logger.info(f"final_tags_dict = {self.final_tags_dict}")
logger.info(f"df result shape = {self.df_result.shape}")
for i, j in self.df_result.iterrows():
my_dict = {v: j[k] for k, v in self.final_tags_dict.items()}
logger.info(f"{j['timestamp'], j['datetime'], my_dict}")
insert_values_dalmia(j['timestamp'], my_dict)
except Exception as e:
logger.exception(f'Exception - {e}')
from json import dumps
from kafka import KafkaProducer
from loguru import logger
from scripts.constants.app_configuration import Kafka
def insert_values_3cp(ts, my_dict):
def insert_values_dalmia(ts, my_dict):
kairos_writer = KairosWriter()
kairos_writer.write_data(
{
......@@ -46,7 +44,7 @@ class KafkaProducerUtil:
class KairosWriter(KafkaProducerUtil):
def write_data(self, data_json, topic):
site_id = "site_116"
site_id = "site_107"
logger.debug(f"Data being pushed to kafka topic: {topic}")
msg_counter = 0
for k, v in data_json.items():
......
import pandas as pd
from loguru import logger
class GetFinalDf:
@staticmethod
def get_final_data(x_test, y_test, predictions):
try:
df_result = pd.DataFrame(index=[i for i in range(len(y_test))])
df_result['datetime'] = x_test['datetime']
df_result['actual_current_mppt'] = y_test
df_result['predicted_current_mppt'] = predictions
df_result.drop(['actual_current_mppt'], axis=1, inplace=True)
df_result = df_result.round(2)
df_result.reset_index(drop=True, inplace=True)
logger.info(f'{df_result.shape}')
return df_result
except Exception as e:
logger.exception(f'Exception - {e}')
@staticmethod
def get_predicted_current_tags(tags_excel):
try:
df = tags_excel.copy()
df['parameter_name'] = df['parameter_name'].str.replace('Potential Current MPPT ',
'potential_current_mppt_')
df['inv_id'] = df['inv_id'].str.replace('INV ', 'inv_')
df['mppt_id'] = df['parameter_name'].copy()
df['mppt_id'] = df['mppt_id'].str.replace('potential_current_', '')
req_substrings = 'mppt_'
data_with_substring = [data for data in df['mppt_id'] if req_substrings in data]
df = df.loc[df['mppt_id'].isin(data_with_substring)]
df = df.sort_values(['inv_id', 'mppt_id'])
df.reset_index(drop=True, inplace=True)
return df
except Exception as e:
logger.exception(f'Exception - {e}')
@staticmethod
def get_final_predicted_tags(df_predicted_current_tags, inv_id, mppt_id):
try:
df = df_predicted_current_tags[df_predicted_current_tags['inv_id'] == inv_id]
df = df[df['mppt_id'] == mppt_id]
df.reset_index(drop=True, inplace=True)
final_dict = {}
for index in range(df.shape[0]):
tag_id = df.iloc[index, df.columns.get_loc('tag_id')]
parameter_name = df.iloc[index, df.columns.get_loc('parameter_name')]
final_dict['predicted_current_mppt'] = tag_id
return final_dict
except Exception as e:
logger.exception(f'Exception - {e}')
\ No newline at end of file
......@@ -30,29 +30,5 @@ class GetData:
except Exception as e:
logger.exception(f'Exception - {e}')
@staticmethod
def get_final_data(x_test, y_test, predictions):
try:
df_result = pd.DataFrame(index=[i for i in range(len(y_test))])
df_result['datetime'] = x_test['datetime']
df_result['actual_current_mppt'] = y_test
df_result['predicted_current_mppt'] = predictions
df_result['potential_current_mppt_loss'] = df_result['predicted_current_mppt'] - \
df_result['actual_current_mppt']
df_result.loc[df_result['potential_current_mppt_loss'] < 0, 'potential_current_mppt_loss'] = 0
df_result['hour'] = df_result['datetime'].dt.hour
df_result.loc[df_result['hour'].between(left=18, right=23, inclusive='both'),
'potential_current_mppt_loss'] = 0
df_result.loc[df_result['hour'].between(left=0, right=6, inclusive='both'),
'potential_current_mppt_loss'] = 0
df_result.drop(['hour'], axis=1, inplace=True)
df_result['total_potential_current_mppt_loss'] = df_result['potential_current_mppt_loss']. \
rolling(min_periods=1, window=len(df_result)).sum()
df_result.drop(['actual_current_mppt', 'predicted_current_mppt'], axis=1, inplace=True)
df_result = df_result.round(2)
df_result.reset_index(drop=True, inplace=True)
logger.info(f'{df_result.shape}')
return df_result
except Exception as e:
logger.exception(f'Exception - {e}')
......@@ -9,7 +9,9 @@ class GetTags:
def read_tag_excel(self):
try:
df = pd.read_excel(f'{self.base_path}/tags_download.xlsx')
df.drop(['Site', 'Plant', 'Line', 'Tag'], axis=1, inplace=True)
df.drop(['Site', 'Plant', 'Line', 'Tag', 'Unit', 'Tag Register', 'System Rules', 'Target',
'Target limits', 'Deviation', 'Indicator', 'Lower Limit', 'Upper Limit'],
axis=1, inplace=True)
df.rename(columns={'Tag ID': 'tag_id', 'Tag Name': 'tag_name',
'Equipment': 'inv_id', 'Parameter Name': 'parameter_name'}, inplace=True)
return df
......
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